Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: EDPLEX

EDPLEX.m

Go to the documentation of this file.
  1. EDPLEX ;ALB/DRP - EDIS API'S ;8/28/2012
  1. ;;2.0;EMERGENCY DEPARTMENT;**2**;Feb 24, 2012;Build 23
  1. ;
  1. ; API's used for ICD10 implementation created for patch EDP*2.0*2
  1. ; $$IMPDATE^LEXU ICR 5679
  1. ; $$FREQ^LEXU ICR 5679
  1. ; $$MAX^LEXU ICR 5679
  1. ; $$ICDOP^ICDEX ICR 5747
  1. ; $$ICDDX^ICDEX ICR 5747
  1. ;
  1. VER(EDPCSYS) ; CODING SYSTEM is passed in
  1. ;Input: Coding System Identifier (ICD,10D)
  1. ;Output: Returns the Nomenclature string used by GUI displays.
  1. N IMPDT,EDPCSTR S EDPCSTR=-1
  1. S:EDPCSYS="ICD" EDPCSTR=$S($D(^LEX(757.03,1,0))#10:$P($G(^LEX(757.03,1,0)),U,2),1:"ICD-9-CM")
  1. S:EDPCSYS="10D" EDPCSTR=$S($D(^LEX(757.03,30,0))#10:$P(^LEX(757.03,30,0),U,2),1:"ICD-10-CM")
  1. Q EDPCSTR
  1. ;
  1. CSYS(EDPEDDT) ; Select proper Coding system based on Implementation date
  1. ; input Date of Interest
  1. ; output...coding system active for date.
  1. ;
  1. Q:$G(EDPEDDT)="" "-1^"_$ZN_" Date In, Parameter not optional."
  1. N EDPLIMPDT,EDPLCSYS
  1. S EDPLCSYS="10D"
  1. S EDPLIMPDT=$$IMPDATE^LEXU(EDPLCSYS)
  1. S:EDPEDDT<EDPLIMPDT EDPLCSYS="ICD"
  1. Q EDPLCSYS
  1. ;
  1. IMPDATE(EDPCSYS) ; Returns Implementation date of the ICD code set
  1. ;Input CSYS = System abbreviation for the coding system
  1. ;Output Implementation Date
  1. ;
  1. Q $$IMPDATE^LEXU(EDPCSYS)
  1. ;
  1. TOOHI(X,EDPCSYS,EDPLMT) ; CHECK TERM FOR FREQUENCY AGAINST MAX ALLOWED - RETURN WARNING IF TOO LARGE
  1. ; Input Search string (X)
  1. ; Coding system (CSYS)
  1. ; Honor Threshold Flag (EDPLMT)
  1. ; Output Threshold exceeded Message flag (with Message if failed)
  1. ;
  1. N EDPLCOUNT,EDPLALLOWED,EDPLRTN
  1. S EDPLCOUNT=$$FREQ^LEXU(X),EDPLALLOWED=$$MAX^LEXU(EDPCSYS),EDPLRTN=0
  1. I EDPLMT,EDPLCOUNT>EDPLALLOWED D
  1. .S EDPLRTN="1^Searching for "_X_" requires inspecting "_EDPLCOUNT_" records to determine if they match the search criteria. This could take quite some time. Suggest refining the search by further specifying "_X_". Do you wish to continue?"
  1. .Q
  1. Q EDPLRTN
  1. ;
  1. ICDDATA(EDPCSYS,EDPCODE,EDPDATE,EDPFRMT) ; ICD data for code
  1. ;Moved here from ICDXCODE, as that API will be retired
  1. ;
  1. ; Input:
  1. ;
  1. ; EDPCSYS Coding system Required
  1. ; EDPCODE Code/IEN/variable pointer Required
  1. ; EDPDATE Code Set Date (default = TODAY)
  1. ; EDPFRMT Code format "I" internal (IEN - DEFAULT)
  1. ; "E" external (CODE)
  1. ;
  1. ; Output:
  1. ;
  1. ; Diagnosis returns an 20 piece string delimited by "^"
  1. ;
  1. ; 1 IEN of code in file 80
  1. ; 2 ICD Dx Code (#.01)
  1. ; 3 Identifier (#1.2)
  1. ; 4 Versioned Dx (67 multiple)
  1. ; 5 Unacceptable as Principal Dx (#1.3)
  1. ; 6 Major Dx Cat (72 multiple)
  1. ; 7 MDC13 (#1.4)
  1. ; 8 Compl/Comorb (103 multiple)
  1. ; 9 ICD Expanded (#1.7)
  1. ; 10 Status (66 multiple)
  1. ; 11 Sex (10 multiple)
  1. ; 12 Inactive Date (66 multiple)
  1. ; 13 MDC24 (#1.5)
  1. ; 14 MDC25 (#1.6)
  1. ; 15 Age Low (11 multiple)
  1. ; 16 Age High (12 multiple)
  1. ; 17 Activation Date (66 multiple)
  1. ; 18 Message
  1. ; 19 Complication/Comorbidity (103 multiple)
  1. ; 20 Coding System (#1.1)
  1. ;
  1. ; Procedures returns A 14 piece string delimited by "^"
  1. ;
  1. ; 1 IEN of code in file 80.1
  1. ; 2 ICD procedure code (#.01)
  1. ; 3 Identifier (#1.2)
  1. ; 4 MDC24 (#1.5)
  1. ; 5 Versioned Oper/Proc (67 multiple)
  1. ; 6 <null>
  1. ; 7 <null>
  1. ; 8 <null>
  1. ; 9 ICD Expanded (#1.7)
  1. ; 10 Status (66 multiple)
  1. ; 11 Use with Sex (10 multiple)
  1. ; 12 Inactive Date (66 multiple)
  1. ; 13 Activation Date (66 multiple)
  1. ; 14 Message
  1. ; 15 Coding System (#1.1)
  1. ;
  1. ; or
  1. ;
  1. ; -1^Error Description
  1. ;
  1. N ROOT,SYS
  1. S EDPDATE=$P($G(EDPDATE),".",1),SYS=$$SYS^ICDEX($G(EDPCSYS),$G(EDPDATE)) S:+SYS'>0 SYS=$$SYS^ICDEX($G(EDPCODE))
  1. Q:+SYS'>0 "-1^Invalid coding system specified"
  1. S ROOT=$$ROOT^ICDEX(SYS) Q:'$L(ROOT) "-1^Invalid Global Root"
  1. Q:ROOT["ICD9" $$ICDDX^ICDEX($G(EDPCODE),$G(EDPDATE),$G(SYS),$G(EDPFRMT,"I"))
  1. Q:ROOT["ICD0" $$ICDOP^ICDEX($G(EDPCODE),$G(EDPDATE),$G(SYS),$G(EDPFRMT,"I"))
  1. Q "-1^Not found"
  1. ;
  1. ICDDX(EDPCODE,EDPCDT,EDPDFN,EDPSRC) ; Return ICD Dx Code Info
  1. ;Moved here from ICDXCODE, as that API will be retired
  1. ; Input:
  1. ;
  1. ; CODE Code/IEN (required)
  1. ; CDT Date (default = TODAY)
  1. ; DFN Not in use
  1. ; SRC Source
  1. ; 0 = exclude local codes
  1. ; 1 = include local codes
  1. ;
  1. ; Output:
  1. ;
  1. ; Returns an 19 piece string delimited by ^
  1. ;
  1. ; 1 IEN of code in file 80
  1. ; 2 ICD-9 Dx Code (#.01)
  1. ; 3 Id (#2)
  1. ; 4 Versioned Dx (67 multiple)
  1. ; 5 Unacceptable as Principal Dx (#101)
  1. ; 6 Major Dx Cat (#5)
  1. ; 7 MDC13 (5.5)
  1. ; 8 Compl/Comorb (#70)
  1. ; 9 ICD Expanded (#8) 1:Yes 0:No
  1. ; 10 Status (66 multiple)
  1. ; 11 Sex (#9.5)
  1. ; 12 Inactive Date (66 multiple)
  1. ; 13 MDC24 (#5.7)
  1. ; 14 MDC25 (#5.9)
  1. ; 15 Age Low (#14)
  1. ; 16 Age High (#15)
  1. ; 17 Activation Date (.01 of 66 multiple)
  1. ; 18 Message
  1. ; 19 Versioned Complication/Comorbidity (#103)
  1. ;
  1. ; or
  1. ;
  1. ; -1^Error Description
  1. ;
  1. Q $$ICDDX^ICDEX($G(EDPCODE),$G(EDPCDT),1,$G(EDPSRC,"I"))