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

ICDXCODE.m

Go to the documentation of this file.
  1. ICDXCODE ;ISL/KER - ICD basic data API's ;04/21/2014
  1. ;;18.0;DRG Grouper;**57**;Oct 20, 2000;Build 7
  1. ;
  1. ; ICD wrapper APIs
  1. ;
  1. EN ; Main Entry Point
  1. HELP ; Developer Help for an API
  1. D HLP^ICDEXH("SDD") Q
  1. ;
  1. ICDDATA(CSYS,CODE,DATE,FRMT) ; ICD data for code
  1. ;
  1. ; Input:
  1. ;
  1. ; CSYS Coding system Required
  1. ; CODE Code/IEN/variable pointer Required
  1. ; DATE Code Set Date (default = TODAY)
  1. ; FRMT Code format "E" external (default)
  1. ; "I" internal (IEN)
  1. ;
  1. ; Output:
  1. ;
  1. ; Diagnosis returns an 22 piece string delimited by "^"
  1. ;
  1. ; 1 IEN of code in file 80
  1. ; 2 ICD-9 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. ; 21 Primary CC Flag (103 multiple)
  1. ; 22 PDX Exclusion Code (#1.11)
  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 DATE=$P($G(DATE),".",1),SYS=$$SYS^ICDEX($G(CSYS),$G(DATE)) S:+SYS'>0 SYS=$$SYS^ICDEX($G(CODE))
  1. Q:+SYS'>0 "-1^Invalid coding system specified"
  1. S ROOT=$$ROOT^ICDEX(SYS) Q:'$L(ROOT) "-1^Invalid Global Root"
  1. S:CODE[";"&($P(CODE,";",2)=$TR(ROOT,"^",""))&($L($P(CODE,";",1))) FRMT="I",CODE=$P(CODE,";",1)
  1. S:'$L($G(FRMT)) FRMT=$$IE^ICDEX($G(CODE))
  1. Q:ROOT["ICD9" $$ICDDX^ICDEX($G(CODE),$G(DATE),$G(SYS),$G(FRMT))
  1. Q:ROOT["ICD0" $$ICDOP^ICDEX($G(CODE),$G(DATE),$G(SYS),$G(FRMT))
  1. Q "-1^Not found"
  1. ;
  1. ICDDESC(CSYS,CODE,DATE,OUTARR) ; ICD description
  1. ;
  1. ; Input:
  1. ;
  1. ; CSYS Coding system
  1. ; CODE ICD Code (required)
  1. ; DATE Date (default = TODAY)
  1. ; .OUTARR Array Name passed by reference
  1. ;
  1. ; Output:
  1. ;
  1. ; $$ICDDESC Number of lines in array
  1. ;
  1. ; @ARY(1) - Versioned Description (68 multiple)
  1. ; @ARY(2) - blank
  1. ; @ARY(3) - message: CODE TEXT MAY BE INACCURATE
  1. ;
  1. Q $$ICDD^ICDEX($G(CODE),.OUTARR,$G(DATE),$G(CSYS))
  1. ;
  1. STATCHK(CSYS,CODE,DATE) ; Check status for code
  1. ;
  1. ; Input:
  1. ;
  1. ; CSYS Coding system
  1. ; CODE Code (IEN not allowed)
  1. ; DATE Date (default = TODAY)
  1. ;
  1. ; Output:
  1. ;
  1. ; 2-Piece String containing the code's status
  1. ; and the IEN if the code exists, else -1.
  1. ; The following are possible outputs:
  1. ;
  1. ; 1^IEN^Effective Date Active Code
  1. ; 0^IEN^Effective Date Inactive Code
  1. ; 0^-1 Code not Found
  1. ;
  1. Q $$STATCHK^ICDEX($G(CODE),$G(DATE),$G(CSYS))
  1. ;
  1. PREV(CSYS,CODE) ; Previous ICD Code
  1. ;
  1. ; Input:
  1. ;
  1. ; CSYS Coding system Required
  1. ; CODE ICD-10 Code (IEN not allowed) Required
  1. ;
  1. ; Output:
  1. ;
  1. ; $$PREV The Previous ICD Code, Null if none
  1. ;
  1. Q $$PREV^ICDEX($G(CODE),$G(CSYS))
  1. ;
  1. NEXT(CSYS,CODE) ; Next ICD Code
  1. ;
  1. ; Input:
  1. ;
  1. ; CSYS Coding system Required
  1. ; CODE ICD-10 Code (IEN not allowed) Required
  1. ;
  1. ; Output:
  1. ;
  1. ; $$NEXT The Next ICD Code, Null if none
  1. ;
  1. Q $$NEXT^ICDEX($G(CODE),$G(CSYS))
  1. ;
  1. HIST(CSYS,CODE,ARRAY) ; Activation History
  1. ;
  1. ; Input:
  1. ;
  1. ; CSYS Coding system Required
  1. ; CODE ICD Code (IEN not allowed) Required
  1. ; .ARRAY Array, passed by Reference Required
  1. ;
  1. ; Output:
  1. ;
  1. ; $$HIST Mirrors ARRAY(0) or, -1 on error
  1. ; ARRAY(0) = Number of Activation History Entries
  1. ; ARRAY(<date>) = Status where: 1 is Active
  1. ; ARRAY("IEN") = <ien>
  1. ;
  1. Q $$HIST^ICDEX($G(CODE),.ARRAY,$G(CSYS))
  1. ;
  1. PERIOD(CSYS,CODE,ARY) ; Activation Periods
  1. ; Input:
  1. ;
  1. ; CSYS Coding system Required
  1. ; CODE ICD Code (IEN not allowed) Required
  1. ; .ARY Array, passed by Reference Required
  1. ;
  1. ; Output:
  1. ;
  1. ; ARY(0) = IEN ^ Selectable ^ Error Message
  1. ;
  1. ; Where IEN = -1 if error
  1. ; Selectable = 0 for unselectable
  1. ; Error Message if applicable
  1. ;
  1. ; ARY(Activation Date) = Inactivation Date^Short Name
  1. ;
  1. ; Where the Short Name is versioned as follows:
  1. ;
  1. ; Period is active - Text for TODAY's date
  1. ; Period is inactive - Text for inactivation date
  1. ;
  1. Q $$PERIOD^ICDEX($G(CODE),.ARY,$G(CSYS))