- EDPLEX ;ALB/DRP - EDIS API'S ;8/28/2012
- ;;2.0;EMERGENCY DEPARTMENT;**2**;Feb 24, 2012;Build 23
- ;
- ; API's used for ICD10 implementation created for patch EDP*2.0*2
- ; $$IMPDATE^LEXU ICR 5679
- ; $$FREQ^LEXU ICR 5679
- ; $$MAX^LEXU ICR 5679
- ; $$ICDOP^ICDEX ICR 5747
- ; $$ICDDX^ICDEX ICR 5747
- ;
- VER(EDPCSYS) ; CODING SYSTEM is passed in
- ;Input: Coding System Identifier (ICD,10D)
- ;Output: Returns the Nomenclature string used by GUI displays.
- N IMPDT,EDPCSTR S EDPCSTR=-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")
- S:EDPCSYS="10D" EDPCSTR=$S($D(^LEX(757.03,30,0))#10:$P(^LEX(757.03,30,0),U,2),1:"ICD-10-CM")
- Q EDPCSTR
- ;
- CSYS(EDPEDDT) ; Select proper Coding system based on Implementation date
- ; input Date of Interest
- ; output...coding system active for date.
- ;
- Q:$G(EDPEDDT)="" "-1^"_$ZN_" Date In, Parameter not optional."
- N EDPLIMPDT,EDPLCSYS
- S EDPLCSYS="10D"
- S EDPLIMPDT=$$IMPDATE^LEXU(EDPLCSYS)
- S:EDPEDDT<EDPLIMPDT EDPLCSYS="ICD"
- Q EDPLCSYS
- ;
- IMPDATE(EDPCSYS) ; Returns Implementation date of the ICD code set
- ;Input CSYS = System abbreviation for the coding system
- ;Output Implementation Date
- ;
- Q $$IMPDATE^LEXU(EDPCSYS)
- ;
- TOOHI(X,EDPCSYS,EDPLMT) ; CHECK TERM FOR FREQUENCY AGAINST MAX ALLOWED - RETURN WARNING IF TOO LARGE
- ; Input Search string (X)
- ; Coding system (CSYS)
- ; Honor Threshold Flag (EDPLMT)
- ; Output Threshold exceeded Message flag (with Message if failed)
- ;
- N EDPLCOUNT,EDPLALLOWED,EDPLRTN
- S EDPLCOUNT=$$FREQ^LEXU(X),EDPLALLOWED=$$MAX^LEXU(EDPCSYS),EDPLRTN=0
- I EDPLMT,EDPLCOUNT>EDPLALLOWED D
- .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?"
- .Q
- Q EDPLRTN
- ;
- ICDDATA(EDPCSYS,EDPCODE,EDPDATE,EDPFRMT) ; ICD data for code
- ;Moved here from ICDXCODE, as that API will be retired
- ;
- ; Input:
- ;
- ; EDPCSYS Coding system Required
- ; EDPCODE Code/IEN/variable pointer Required
- ; EDPDATE Code Set Date (default = TODAY)
- ; EDPFRMT Code format "I" internal (IEN - DEFAULT)
- ; "E" external (CODE)
- ;
- ; Output:
- ;
- ; Diagnosis returns an 20 piece string delimited by "^"
- ;
- ; 1 IEN of code in file 80
- ; 2 ICD Dx Code (#.01)
- ; 3 Identifier (#1.2)
- ; 4 Versioned Dx (67 multiple)
- ; 5 Unacceptable as Principal Dx (#1.3)
- ; 6 Major Dx Cat (72 multiple)
- ; 7 MDC13 (#1.4)
- ; 8 Compl/Comorb (103 multiple)
- ; 9 ICD Expanded (#1.7)
- ; 10 Status (66 multiple)
- ; 11 Sex (10 multiple)
- ; 12 Inactive Date (66 multiple)
- ; 13 MDC24 (#1.5)
- ; 14 MDC25 (#1.6)
- ; 15 Age Low (11 multiple)
- ; 16 Age High (12 multiple)
- ; 17 Activation Date (66 multiple)
- ; 18 Message
- ; 19 Complication/Comorbidity (103 multiple)
- ; 20 Coding System (#1.1)
- ;
- ; Procedures returns A 14 piece string delimited by "^"
- ;
- ; 1 IEN of code in file 80.1
- ; 2 ICD procedure code (#.01)
- ; 3 Identifier (#1.2)
- ; 4 MDC24 (#1.5)
- ; 5 Versioned Oper/Proc (67 multiple)
- ; 6 <null>
- ; 7 <null>
- ; 8 <null>
- ; 9 ICD Expanded (#1.7)
- ; 10 Status (66 multiple)
- ; 11 Use with Sex (10 multiple)
- ; 12 Inactive Date (66 multiple)
- ; 13 Activation Date (66 multiple)
- ; 14 Message
- ; 15 Coding System (#1.1)
- ;
- ; or
- ;
- ; -1^Error Description
- ;
- N ROOT,SYS
- S EDPDATE=$P($G(EDPDATE),".",1),SYS=$$SYS^ICDEX($G(EDPCSYS),$G(EDPDATE)) S:+SYS'>0 SYS=$$SYS^ICDEX($G(EDPCODE))
- Q:+SYS'>0 "-1^Invalid coding system specified"
- S ROOT=$$ROOT^ICDEX(SYS) Q:'$L(ROOT) "-1^Invalid Global Root"
- Q:ROOT["ICD9" $$ICDDX^ICDEX($G(EDPCODE),$G(EDPDATE),$G(SYS),$G(EDPFRMT,"I"))
- Q:ROOT["ICD0" $$ICDOP^ICDEX($G(EDPCODE),$G(EDPDATE),$G(SYS),$G(EDPFRMT,"I"))
- Q "-1^Not found"
- ;
- ICDDX(EDPCODE,EDPCDT,EDPDFN,EDPSRC) ; Return ICD Dx Code Info
- ;Moved here from ICDXCODE, as that API will be retired
- ; Input:
- ;
- ; CODE Code/IEN (required)
- ; CDT Date (default = TODAY)
- ; DFN Not in use
- ; SRC Source
- ; 0 = exclude local codes
- ; 1 = include local codes
- ;
- ; Output:
- ;
- ; Returns an 19 piece string delimited by ^
- ;
- ; 1 IEN of code in file 80
- ; 2 ICD-9 Dx Code (#.01)
- ; 3 Id (#2)
- ; 4 Versioned Dx (67 multiple)
- ; 5 Unacceptable as Principal Dx (#101)
- ; 6 Major Dx Cat (#5)
- ; 7 MDC13 (5.5)
- ; 8 Compl/Comorb (#70)
- ; 9 ICD Expanded (#8) 1:Yes 0:No
- ; 10 Status (66 multiple)
- ; 11 Sex (#9.5)
- ; 12 Inactive Date (66 multiple)
- ; 13 MDC24 (#5.7)
- ; 14 MDC25 (#5.9)
- ; 15 Age Low (#14)
- ; 16 Age High (#15)
- ; 17 Activation Date (.01 of 66 multiple)
- ; 18 Message
- ; 19 Versioned Complication/Comorbidity (#103)
- ;
- ; or
- ;
- ; -1^Error Description
- ;
- Q $$ICDDX^ICDEX($G(EDPCODE),$G(EDPCDT),1,$G(EDPSRC,"I"))
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEDPLEX 5821 printed Feb 18, 2025@23:18:23 Page 2
- EDPLEX ;ALB/DRP - EDIS API'S ;8/28/2012
- +1 ;;2.0;EMERGENCY DEPARTMENT;**2**;Feb 24, 2012;Build 23
- +2 ;
- +3 ; API's used for ICD10 implementation created for patch EDP*2.0*2
- +4 ; $$IMPDATE^LEXU ICR 5679
- +5 ; $$FREQ^LEXU ICR 5679
- +6 ; $$MAX^LEXU ICR 5679
- +7 ; $$ICDOP^ICDEX ICR 5747
- +8 ; $$ICDDX^ICDEX ICR 5747
- +9 ;
- VER(EDPCSYS) ; CODING SYSTEM is passed in
- +1 ;Input: Coding System Identifier (ICD,10D)
- +2 ;Output: Returns the Nomenclature string used by GUI displays.
- +3 NEW IMPDT,EDPCSTR
- SET EDPCSTR=-1
- +4 if EDPCSYS="ICD"
- SET EDPCSTR=$SELECT($DATA(^LEX(757.03,1,0))#10:$PIECE($GET(^LEX(757.03,1,0)),U,2),1:"ICD-9-CM")
- +5 if EDPCSYS="10D"
- SET EDPCSTR=$SELECT($DATA(^LEX(757.03,30,0))#10:$PIECE(^LEX(757.03,30,0),U,2),1:"ICD-10-CM")
- +6 QUIT EDPCSTR
- +7 ;
- CSYS(EDPEDDT) ; Select proper Coding system based on Implementation date
- +1 ; input Date of Interest
- +2 ; output...coding system active for date.
- +3 ;
- +4 if $GET(EDPEDDT)=""
- QUIT "-1^"_$ZN_" Date In, Parameter not optional."
- +5 NEW EDPLIMPDT,EDPLCSYS
- +6 SET EDPLCSYS="10D"
- +7 SET EDPLIMPDT=$$IMPDATE^LEXU(EDPLCSYS)
- +8 if EDPEDDT<EDPLIMPDT
- SET EDPLCSYS="ICD"
- +9 QUIT EDPLCSYS
- +10 ;
- IMPDATE(EDPCSYS) ; Returns Implementation date of the ICD code set
- +1 ;Input CSYS = System abbreviation for the coding system
- +2 ;Output Implementation Date
- +3 ;
- +4 QUIT $$IMPDATE^LEXU(EDPCSYS)
- +5 ;
- TOOHI(X,EDPCSYS,EDPLMT) ; CHECK TERM FOR FREQUENCY AGAINST MAX ALLOWED - RETURN WARNING IF TOO LARGE
- +1 ; Input Search string (X)
- +2 ; Coding system (CSYS)
- +3 ; Honor Threshold Flag (EDPLMT)
- +4 ; Output Threshold exceeded Message flag (with Message if failed)
- +5 ;
- +6 NEW EDPLCOUNT,EDPLALLOWED,EDPLRTN
- +7 SET EDPLCOUNT=$$FREQ^LEXU(X)
- SET EDPLALLOWED=$$MAX^LEXU(EDPCSYS)
- SET EDPLRTN=0
- +8 IF EDPLMT
- IF EDPLCOUNT>EDPLALLOWED
- Begin DoDot:1
- +9 SET 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 c
- ontinue?"
- +10 QUIT
- End DoDot:1
- +11 QUIT EDPLRTN
- +12 ;
- ICDDATA(EDPCSYS,EDPCODE,EDPDATE,EDPFRMT) ; ICD data for code
- +1 ;Moved here from ICDXCODE, as that API will be retired
- +2 ;
- +3 ; Input:
- +4 ;
- +5 ; EDPCSYS Coding system Required
- +6 ; EDPCODE Code/IEN/variable pointer Required
- +7 ; EDPDATE Code Set Date (default = TODAY)
- +8 ; EDPFRMT Code format "I" internal (IEN - DEFAULT)
- +9 ; "E" external (CODE)
- +10 ;
- +11 ; Output:
- +12 ;
- +13 ; Diagnosis returns an 20 piece string delimited by "^"
- +14 ;
- +15 ; 1 IEN of code in file 80
- +16 ; 2 ICD Dx Code (#.01)
- +17 ; 3 Identifier (#1.2)
- +18 ; 4 Versioned Dx (67 multiple)
- +19 ; 5 Unacceptable as Principal Dx (#1.3)
- +20 ; 6 Major Dx Cat (72 multiple)
- +21 ; 7 MDC13 (#1.4)
- +22 ; 8 Compl/Comorb (103 multiple)
- +23 ; 9 ICD Expanded (#1.7)
- +24 ; 10 Status (66 multiple)
- +25 ; 11 Sex (10 multiple)
- +26 ; 12 Inactive Date (66 multiple)
- +27 ; 13 MDC24 (#1.5)
- +28 ; 14 MDC25 (#1.6)
- +29 ; 15 Age Low (11 multiple)
- +30 ; 16 Age High (12 multiple)
- +31 ; 17 Activation Date (66 multiple)
- +32 ; 18 Message
- +33 ; 19 Complication/Comorbidity (103 multiple)
- +34 ; 20 Coding System (#1.1)
- +35 ;
- +36 ; Procedures returns A 14 piece string delimited by "^"
- +37 ;
- +38 ; 1 IEN of code in file 80.1
- +39 ; 2 ICD procedure code (#.01)
- +40 ; 3 Identifier (#1.2)
- +41 ; 4 MDC24 (#1.5)
- +42 ; 5 Versioned Oper/Proc (67 multiple)
- +43 ; 6 <null>
- +44 ; 7 <null>
- +45 ; 8 <null>
- +46 ; 9 ICD Expanded (#1.7)
- +47 ; 10 Status (66 multiple)
- +48 ; 11 Use with Sex (10 multiple)
- +49 ; 12 Inactive Date (66 multiple)
- +50 ; 13 Activation Date (66 multiple)
- +51 ; 14 Message
- +52 ; 15 Coding System (#1.1)
- +53 ;
- +54 ; or
- +55 ;
- +56 ; -1^Error Description
- +57 ;
- +58 NEW ROOT,SYS
- +59 SET EDPDATE=$PIECE($GET(EDPDATE),".",1)
- SET SYS=$$SYS^ICDEX($GET(EDPCSYS),$GET(EDPDATE))
- if +SYS'>0
- SET SYS=$$SYS^ICDEX($GET(EDPCODE))
- +60 if +SYS'>0
- QUIT "-1^Invalid coding system specified"
- +61 SET ROOT=$$ROOT^ICDEX(SYS)
- if '$LENGTH(ROOT)
- QUIT "-1^Invalid Global Root"
- +62 if ROOT["ICD9"
- QUIT $$ICDDX^ICDEX($GET(EDPCODE),$GET(EDPDATE),$GET(SYS),$GET(EDPFRMT,"I"))
- +63 if ROOT["ICD0"
- QUIT $$ICDOP^ICDEX($GET(EDPCODE),$GET(EDPDATE),$GET(SYS),$GET(EDPFRMT,"I"))
- +64 QUIT "-1^Not found"
- +65 ;
- ICDDX(EDPCODE,EDPCDT,EDPDFN,EDPSRC) ; Return ICD Dx Code Info
- +1 ;Moved here from ICDXCODE, as that API will be retired
- +2 ; Input:
- +3 ;
- +4 ; CODE Code/IEN (required)
- +5 ; CDT Date (default = TODAY)
- +6 ; DFN Not in use
- +7 ; SRC Source
- +8 ; 0 = exclude local codes
- +9 ; 1 = include local codes
- +10 ;
- +11 ; Output:
- +12 ;
- +13 ; Returns an 19 piece string delimited by ^
- +14 ;
- +15 ; 1 IEN of code in file 80
- +16 ; 2 ICD-9 Dx Code (#.01)
- +17 ; 3 Id (#2)
- +18 ; 4 Versioned Dx (67 multiple)
- +19 ; 5 Unacceptable as Principal Dx (#101)
- +20 ; 6 Major Dx Cat (#5)
- +21 ; 7 MDC13 (5.5)
- +22 ; 8 Compl/Comorb (#70)
- +23 ; 9 ICD Expanded (#8) 1:Yes 0:No
- +24 ; 10 Status (66 multiple)
- +25 ; 11 Sex (#9.5)
- +26 ; 12 Inactive Date (66 multiple)
- +27 ; 13 MDC24 (#5.7)
- +28 ; 14 MDC25 (#5.9)
- +29 ; 15 Age Low (#14)
- +30 ; 16 Age High (#15)
- +31 ; 17 Activation Date (.01 of 66 multiple)
- +32 ; 18 Message
- +33 ; 19 Versioned Complication/Comorbidity (#103)
- +34 ;
- +35 ; or
- +36 ;
- +37 ; -1^Error Description
- +38 ;
- +39 QUIT $$ICDDX^ICDEX($GET(EDPCODE),$GET(EDPCDT),1,$GET(EDPSRC,"I"))