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

ICDCODE.m

Go to the documentation of this file.
  1. ICDCODE ;DLS/DEK/KER/FJF - ICD CODE APIS ;04/21/2014
  1. ;;18.0;DRG Grouper;**6,12,14,29,57**;Oct 20, 2000;Build 1
  1. ;
  1. ; Global Variables
  1. ; ^TMP("ICDD") SACC 2.3.2.5.1
  1. ;
  1. ; External References
  1. ; $$DT^XLFDT ICR 10103
  1. ;
  1. EN ; Main Entry Point
  1. HELP ; Developer Help for an API
  1. D HLP^ICDEXH("LEG") Q
  1. ;
  1. ICDDX(CODE,CDT,DFN,SRC) ; Return ICD Dx Code Info
  1. ;
  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. N X S X=$$ICDDX^ICDEX($S($G(CODE)?1N.N:$$CODEC^ICDEX(80,$G(CODE)),1:$G(CODE)),$G(CDT),1,,$G(SRC))
  1. S $P(X,"^",3)=$TR($P(X,"^",3),";","")
  1. Q X
  1. ICDOP(CODE,CDT,DFN,SRC) ; Return ICD Operation/Procedure Code Info
  1. ;
  1. ; Input:
  1. ;
  1. ; CODE ICD code or IEN format, (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 14 piece string delimited by ^
  1. ;
  1. ; 1 IEN of code in file 80.1
  1. ; 2 ICD-9 code (#.01)
  1. ; 3 Id (#2)
  1. ; 4 MDC24 (#5)
  1. ; 5 Versioned Oper/Proc (67 multiple)
  1. ; 6 <null>
  1. ; 7 <null>
  1. ; 8 <null>
  1. ; 9 ICD Expanded (#8) 1:Yes 0:No
  1. ; 10 Status (66 multiple)
  1. ; 11 Use with Sex (#9.5)
  1. ; 12 Inactive Date (66 multiple)
  1. ; 13 Activation Date (66 multiple)
  1. ; 14 Message
  1. ;
  1. ; or
  1. ;
  1. ; -1^Error Description
  1. ;
  1. N X S X=$$ICDOP^ICDEX($S($G(CODE)?1N.N:$$CODEC^ICDEX(80.1,$G(CODE)),1:$G(CODE)),$G(CDT),2,,$G(SRC))
  1. S $P(X,"^",3)=$TR($P(X,"^",3),";","")
  1. Q X
  1. ICDD(CODE,OUTARR,CDT) ; returns ICD description in array
  1. ;
  1. ; Input:
  1. ;
  1. ; CODE ICD Code (required)
  1. ; ARY Array Name for description
  1. ; e.g. "ABC" or "ABC("TEST")"
  1. ; Default = ^TMP("ICDD",$J)
  1. ; CDT Date (default = TODAY)
  1. ;
  1. ; Output:
  1. ;
  1. ; # Number of lines in array
  1. ;
  1. ; @ARY(1:n) - Versioned Description (68 multiple)
  1. ; @ARY(n+1) - blank
  1. ; @ARY(n+1) - message: CODE TEXT MAY BE INACCURATE
  1. ;
  1. ; or
  1. ;
  1. ; -1^Error Description
  1. ;
  1. ; ** NOTE - USER MUST INITIALIZE ^TMP("ICDD",$J), IF USED **
  1. ;
  1. N ICDDXOUT,ICDDXARY,END,ICDDXI,ICDDXC
  1. S ICDDXOUT=$$ICDD^ICDEX($G(CODE),.ICDDXARY,$G(CDT))
  1. Q:ICDDXOUT["-1^Invalid" "-1^Invalid code"
  1. Q:ICDDXOUT["-1^" ICDDXOUT
  1. I $G(OUTARR)="" S OUTARR="^TMP(""ICDD"",$J,"
  1. I OUTARR'["(" S OUTARR=OUTARR_"("
  1. I OUTARR[")" S OUTARR=$P(OUTARR,")")
  1. S END=$E(OUTARR,$L(OUTARR)) I END'="("&(END'=",") S OUTARR=OUTARR_","
  1. I OUTARR="^TMP(""ICDD"",$J," K ^TMP("ICDD",$J)
  1. S (ICDDXI,ICDDXC)=0 F S ICDDXI=$O(ICDDXARY(ICDDXI)) Q:+ICDDXI'>0 D
  1. . N ARR S ARR=OUTARR_ICDDXI_")",@ARR=$G(ICDDXARY(ICDDXI)),ICDDXC=ICDDXC+1
  1. Q ICDDXC
  1. CODEN(CODE,FILE) ; return ien of ICD code
  1. ;
  1. ; Input:
  1. ;
  1. ; CODE ICD code (required)
  1. ; FILE File Number to search for code
  1. ; 80 = ICD Dx file
  1. ; 80.1 = ICD Oper/Proc file
  1. ;
  1. ; Output:
  1. ;
  1. ; IEN~global root
  1. ; or
  1. ; -1~error message
  1. ;
  1. N X S X=$$CODEN^ICDEX($G(CODE),$G(FILE))
  1. Q:X["-1~Invalid" "-1~Invalid code"
  1. Q X
  1. CODEC(IEN,FILE) ;return the ICD code of an ien
  1. ;Input:
  1. ; IEN IEN of ICD code REQUIRED
  1. ; FILE File Number to search for code
  1. ; 80 = ICD Dx file
  1. ; 80.1 = ICD Oper/Proc file
  1. ;
  1. ;Output: ICD code, -1 if not found
  1. ;
  1. S:+($G(FILE))'>0 FILE=80
  1. Q $$CODEC^ICDEX($G(FILE),$G(IEN))
  1. CODEZ(CODE,ROOT,FLG) ; Based on IEN/root:
  1. N Y,ICDL ; if 'FLG return code existence, else zero node - piece 1
  1. S Y=$P($G(@(ROOT_CODE_",0)")),U),ICDL=$L(Y) I ICDL,'$G(FLG) Q CODE
  1. Q $S('ICDL:-1,1:Y)
  1. CODEBA(CODE,ROOT) ; Return IEN based on code/root
  1. ;
  1. ; Input:
  1. ;
  1. ; CODE ICD Code, either ICD-9 or ICD-10 (required)
  1. ; ROOT File Root or Number (required)
  1. ;
  1. ; Output:
  1. ;
  1. ; IEN IEN for CODE in ROOT or -1 if not found
  1. ;
  1. Q $$CODEBA^ICDEX($G(CODE),$G(ROOT))
  1. COMCOM(IEN,VDT) ; Return versioned complication/comorbidity
  1. Q $$VCC^ICDEX($G(IEN),$G(CDT))
  1. VST(IEN,VDT,FILE) ; Versioned Short Text
  1. Q $$VST^ICDEX($G(FILE),$G(IEN),$G(CDT))
  1. VSTD(IEN,VDT) ; Versioned Short Text (Dx)
  1. Q $$VSTD^ICDEX($G(IEN),$G(CDT))
  1. VSTP(IEN,VDT) ; Versioned Short Text (Proc)
  1. Q $$VSTP^ICDEX($G(IEN),$G(CDT))
  1. VLT(IEN,VDT,FILE) ; Version Description - Long Text
  1. Q $$VLT^ICDEX($G(FILE),$G(IEN),$G(CDT))
  1. VLTD(IEN,VDT) ; Versioned Description - Long Text (Dx)
  1. Q $$VLTD^ICDEX($G(IEN),$G(CDT))
  1. VLTP(IEN,VDT) ; Versioned Description - Long Text (Proc)
  1. Q $$VLTP^ICDEX($G(IEN),$G(CDT))