- ICDSUPT ;DLS/DEK - ICD SUPPORT FOR APIS ;04/21/2014
- ;;18.0;DRG Grouper;**6,57**;Oct 20, 2000;Build 1
- ;
- ; Global Variables
- ; None
- ;
- ; External References
- ; $$DT^XLFDT ICR 10103
- ;
- EN ; Main Entry Point
- HELP ; Developer Help for an API
- D HLP^ICDEXH("LEG") Q
- ;
- EFF(FILE,IEN,CDT) ; returns effective date and status for code/modifier
- ;
- ; Input:
- ;
- ; FILE File number (required)
- ; 80 = ICD DX
- ; 80.1 = ICD O/P
- ; IEN ICD IEN (required)
- ; CDT Date to check (FileMan format) (required)
- ;
- ; Output:
- ;
- ; A 3 piece "^" delimited string
- ;
- ; 1 Status
- ; 1 - Active
- ; 0 - Inactive
- ; 2 Inactivation Date
- ; 3 Activation Date
- ; -or-
- ; -1^error message
- ;
- ;
- ; 3 piece "^" delimited string
- ;
- ; 1 Status
- ; 2 Activation Date
- ; 3 Inactivation Date
- ;
- N ICDD,ICDF,ICDI,ICDR,ICDX,ICDY
- I $G(IEN)="" Q "-1^No Code Selected"
- S ICDF=$$FILE^ICDEX($G(FILE)) Q:+($G(ICDF))'>0 "-1^Invalid File Selected"
- S ICDR=$$ROOT^ICDEX($G(ICDF)) Q:'$L(ICDR) "-1^Invalid File Selected"
- S ICDI=+($G(IEN)) Q:+ICDI'>0 "-1^IEN Invalid"
- S ICDY=$P($G(@(ICDR_+ICDI_",1)")),"^",1) Q:+ICDY'>0 "-1^Invalid Coding System"
- S ICDD=$S($G(CDT)="":$$DT^XLFDT,1:$$DTBR^ICDEX($G(CDT),,ICDY))
- S ICDX=$P($$SAI^ICDEX($G(ICDF),$G(ICDI),$G(ICDD)),"^",1,3)
- Q $S($L(ICDX,"^")=3:($P(ICDX,"^",1)_"^"_$P(ICDX,"^",3)_"^"_$P(ICDX,"^",2)),1:"-1^Not found")
- LA(IEN,FILE,CDT) ; Last Current Activation Date
- ;
- ; Input:
- ;
- ; IEN Internal Entry Number (Required)
- ; FILE Global Root/File Number (Required)
- ; CDT Date (default = TODAY) (Optional)
- ;
- ; Output:
- ;
- ; $$LA Last Current Activation Date OR -1 ^ Error Message
- ;
- Q $$LA^ICDEX($G(FILE),$G(IEN),$G(CDT))
- LI(IEN,FILE,CDT) ; Last Current Inactivation Date
- ;
- ; Input:
- ;
- ; IEN Internal Entry Number (Required)
- ; FILE Global Root/File Number (Required)
- ; CDT Date (default = TODAY) (Optional)
- ;
- ; Output:
- ;
- ; $$LI Last Current Inactivation Date OR -1 ^ Error Message
- ;
- Q $$LI^ICDEX($G(FILE),$G(IEN),$G(CDT))
- NUM(CODE) ; Convert Code to a Numeric Value (opposite of $$COD)
- ;
- ; Input:
- ;
- ; CODE ICD CODE (required)
- ;
- ; Output:
- ;
- ; NUM Numerical representation of CODE
- ;
- ; or
- ;
- ; -1 on error
- ;
- Q $$NUM^ICDEX($G(CODE))
- COD(NUM) ; Convert Numeric Value to a Code (opposite of $$NUM)
- ;
- ; Input:
- ;
- ; NUM Numerical representation of an ICD Code (required)
- ;
- ; Output:
- ;
- ; CODE ICD Code
- ;
- ; or
- ;
- ; null on error
- ;
- Q $$COD^ICDEX($G(NUM))
- FILE(X) ; File Number
- ;
- ; Input:
- ;
- ; X File/Identifier/Coding System/Code (required)
- ;
- ; Output:
- ;
- ; FILE File Number or -1 on error
- ;
- Q $$FILE^ICDEX($G(X))
- ROOT(X) ; Global Root
- ;
- ; Input:
- ;
- ; X File Number, File Name, Root, Identifier
- ; or Coding System (required)
- ;
- ; Output:
- ;
- ; ROOT Global Root for File or null
- ;
- Q $$ROOT^ICDEX($G(X))
- SNAM(X) ; System Name
- ;
- ; Input:
- ;
- ; X Numeric System Identifier (field 1.1)
- ;
- ; Output:
- ;
- ; X Character System Identifier
- ;
- Q $$SNAM^ICDEX($G(X))
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HICDSUPT 3478 printed Mar 13, 2025@20:55:43 Page 2
- ICDSUPT ;DLS/DEK - ICD SUPPORT FOR APIS ;04/21/2014
- +1 ;;18.0;DRG Grouper;**6,57**;Oct 20, 2000;Build 1
- +2 ;
- +3 ; Global Variables
- +4 ; None
- +5 ;
- +6 ; External References
- +7 ; $$DT^XLFDT ICR 10103
- +8 ;
- EN ; Main Entry Point
- HELP ; Developer Help for an API
- +1 DO HLP^ICDEXH("LEG")
- QUIT
- +2 ;
- EFF(FILE,IEN,CDT) ; returns effective date and status for code/modifier
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; FILE File number (required)
- +5 ; 80 = ICD DX
- +6 ; 80.1 = ICD O/P
- +7 ; IEN ICD IEN (required)
- +8 ; CDT Date to check (FileMan format) (required)
- +9 ;
- +10 ; Output:
- +11 ;
- +12 ; A 3 piece "^" delimited string
- +13 ;
- +14 ; 1 Status
- +15 ; 1 - Active
- +16 ; 0 - Inactive
- +17 ; 2 Inactivation Date
- +18 ; 3 Activation Date
- +19 ; -or-
- +20 ; -1^error message
- +21 ;
- +22 ;
- +23 ; 3 piece "^" delimited string
- +24 ;
- +25 ; 1 Status
- +26 ; 2 Activation Date
- +27 ; 3 Inactivation Date
- +28 ;
- +29 NEW ICDD,ICDF,ICDI,ICDR,ICDX,ICDY
- +30 IF $GET(IEN)=""
- QUIT "-1^No Code Selected"
- +31 SET ICDF=$$FILE^ICDEX($GET(FILE))
- if +($GET(ICDF))'>0
- QUIT "-1^Invalid File Selected"
- +32 SET ICDR=$$ROOT^ICDEX($GET(ICDF))
- if '$LENGTH(ICDR)
- QUIT "-1^Invalid File Selected"
- +33 SET ICDI=+($GET(IEN))
- if +ICDI'>0
- QUIT "-1^IEN Invalid"
- +34 SET ICDY=$PIECE($GET(@(ICDR_+ICDI_",1)")),"^",1)
- if +ICDY'>0
- QUIT "-1^Invalid Coding System"
- +35 SET ICDD=$SELECT($GET(CDT)="":$$DT^XLFDT,1:$$DTBR^ICDEX($GET(CDT),,ICDY))
- +36 SET ICDX=$PIECE($$SAI^ICDEX($GET(ICDF),$GET(ICDI),$GET(ICDD)),"^",1,3)
- +37 QUIT $SELECT($LENGTH(ICDX,"^")=3:($PIECE(ICDX,"^",1)_"^"_$PIECE(ICDX,"^",3)_"^"_$PIECE(ICDX,"^",2)),1:"-1^Not found")
- LA(IEN,FILE,CDT) ; Last Current Activation Date
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; IEN Internal Entry Number (Required)
- +5 ; FILE Global Root/File Number (Required)
- +6 ; CDT Date (default = TODAY) (Optional)
- +7 ;
- +8 ; Output:
- +9 ;
- +10 ; $$LA Last Current Activation Date OR -1 ^ Error Message
- +11 ;
- +12 QUIT $$LA^ICDEX($GET(FILE),$GET(IEN),$GET(CDT))
- LI(IEN,FILE,CDT) ; Last Current Inactivation Date
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; IEN Internal Entry Number (Required)
- +5 ; FILE Global Root/File Number (Required)
- +6 ; CDT Date (default = TODAY) (Optional)
- +7 ;
- +8 ; Output:
- +9 ;
- +10 ; $$LI Last Current Inactivation Date OR -1 ^ Error Message
- +11 ;
- +12 QUIT $$LI^ICDEX($GET(FILE),$GET(IEN),$GET(CDT))
- NUM(CODE) ; Convert Code to a Numeric Value (opposite of $$COD)
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; CODE ICD CODE (required)
- +5 ;
- +6 ; Output:
- +7 ;
- +8 ; NUM Numerical representation of CODE
- +9 ;
- +10 ; or
- +11 ;
- +12 ; -1 on error
- +13 ;
- +14 QUIT $$NUM^ICDEX($GET(CODE))
- COD(NUM) ; Convert Numeric Value to a Code (opposite of $$NUM)
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; NUM Numerical representation of an ICD Code (required)
- +5 ;
- +6 ; Output:
- +7 ;
- +8 ; CODE ICD Code
- +9 ;
- +10 ; or
- +11 ;
- +12 ; null on error
- +13 ;
- +14 QUIT $$COD^ICDEX($GET(NUM))
- FILE(X) ; File Number
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; X File/Identifier/Coding System/Code (required)
- +5 ;
- +6 ; Output:
- +7 ;
- +8 ; FILE File Number or -1 on error
- +9 ;
- +10 QUIT $$FILE^ICDEX($GET(X))
- ROOT(X) ; Global Root
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; X File Number, File Name, Root, Identifier
- +5 ; or Coding System (required)
- +6 ;
- +7 ; Output:
- +8 ;
- +9 ; ROOT Global Root for File or null
- +10 ;
- +11 QUIT $$ROOT^ICDEX($GET(X))
- SNAM(X) ; System Name
- +1 ;
- +2 ; Input:
- +3 ;
- +4 ; X Numeric System Identifier (field 1.1)
- +5 ;
- +6 ; Output:
- +7 ;
- +8 ; X Character System Identifier
- +9 ;
- +10 QUIT $$SNAM^ICDEX($GET(X))