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

ICDGTDRG.m

Go to the documentation of this file.
  1. ICDGTDRG ;ALB/ADL - COLLECTION OF DRG APIS ;07/19/2012
  1. ;;18.0;DRG Grouper;**7,12,14,17,57,64**;Oct 20, 2000;Build 103
  1. ; Collection of API's for accessing new "DRG" level
  1. ; of files #80, #80.1, and #80.2. These new levels
  1. ; were added for the Code Set Versioning Project
  1. ;
  1. ; Global Variables
  1. ; None
  1. ;
  1. ; External References
  1. ; ^ICDDRG0 ICR N/A
  1. ; $$CODEN^ICDEX ICR N/A
  1. ; $$DRG^ICDEX ICR N/A
  1. ; $$DRGD^ICDEX ICR N/A
  1. ; $$DRGDES^ICDEX ICR N/A
  1. ; $$DRGN^ICDEX ICR N/A
  1. ; $$GETDATE^ICDEX ICR N/A
  1. ; $$GETDRG^ICDEX ICR N/A
  1. ; $$ISVALID^ICDEX ICR N/A
  1. ;
  1. ; Local Variables NEWed or KILLed Elsewhere
  1. ; EFFD,ICDMDC
  1. ;
  1. GETDRG(CODE,DGNDT,FILE) ; Get DRG or DRG string associated with a Code
  1. ;
  1. ; Input:
  1. ; CODE - IEN number
  1. ; DRGDT - Effective date of the Code
  1. ; FILE - File to check : 9 - ICD9 (file #80)
  1. ; 0 - ICD0 (file 80.1)
  1. ; Output:
  1. ; DRGS - DRG or string of DRG's (delimited
  1. ; by "^") or -1 if not defined
  1. ;
  1. ; Effective date or error message;
  1. ; status flag (1=Active;0=Inactive)
  1. ; Delimited by ";" because DRG's can be
  1. ; multiple and are already delimited by "^"
  1. ;
  1. ; NOTE: For ICD Procedures, it uses the additional variable ICDMDC
  1. ;
  1. Q $$GETDRG^ICDEX($G(FILE),$G(CODE),$P($G(DGNDT),".",1),$G(ICDMDC))
  1. DRG(CODE,EDT) ; Returns a string of information from the DRG file (#80.2)
  1. ; Input: CODE DRG code, internal or external format (Required)
  1. ; CDT Date to check status for, FileMan format (default = TODAY)
  1. ; If CDT < 10/1/1978, use 10/1/1978
  1. ; If CDT > DT, validate with In/Activation Dates
  1. ; If CDT is year only, use first of the year
  1. ; If CDT is year and month, use first of the month
  1. ;
  1. ; Output: Returns an 22 piece string delimited by the up-arrow (^), where the
  1. ; pieces are:
  1. ; 1 DRG name (field #.01)
  1. ; 2 Weight (field #2)
  1. ; 3 Low Trim (days) (field #3)
  1. ; 4 High Trim (days) (field #4)
  1. ; 5 MDC (field #5)
  1. ; 6 Surgery Flag (field #.06)
  1. ; 7 <null>
  1. ; 8 Avg Length of Stay (days) (field 10)
  1. ; 9 Local Low Trim Days (field #11)
  1. ; 10 Local High Trim Days (field #12)
  1. ; 11 <null>
  1. ; 12 Local Breakeven (field #13)
  1. ; 13 Activation Date (.01 field of the 66 multiple)
  1. ; 14 Status (.03 field of the 66 multiple)
  1. ; 15 Inactivation Date (.01 field of the 66 multiple)
  1. ; 16 Effective date (.01 field of the 66 multiple)
  1. ; 17 Internal Entry Number (IEN)
  1. ; 18 Effective date of CSV (.01 field of the 66 multiple)
  1. ; 19 Reference (field #900)
  1. ; 20 Weight (Non Affil) (field #7)
  1. ; 21 Weight (Int Affil) (field #7.5)
  1. ; 22 Message
  1. ;
  1. ; or
  1. ;
  1. ; -1^Error Description
  1. ;
  1. Q $$DRG^ICDEX($G(CODE),$G(EDT))
  1. CODEI(CODE) ; Returns the IEN of an ICD code
  1. Q +($$CODEN^ICDEX($G(CODE),80))
  1. GETDATE(PATNUM) ; Find the correct "EFFECTIVE DATE" for locating the DRG/ICD/CPT codes
  1. ;
  1. ; Input: PATNUM - PTF Record Number
  1. ; Output: "effective date" to use
  1. ;
  1. Q $$GETDATE^ICDEX($G(PATNUM))
  1. ISVALID(CODE,EDATE,FILE) ; Is an ICD/CPT code Valid
  1. ; This is a function call to be used in DIC("S") FileMan
  1. ; calls to check the validation of a ICD/CPT code
  1. ; Input:
  1. ; CODE - ICD/CPT code (ien)
  1. ; EDATE - Effective date to be used
  1. ; FILE - File to use: 0 - ICD0; 9 - ICD9
  1. ;
  1. ; Output:
  1. ; OUT - 1 if valid; 0 if not
  1. ;
  1. Q $$ISVALID^ICDEX($G(FILE),$G(CODE),$G(EDATE))
  1. DRGD(CODE,OUTARR,DFN,CDT) ; returns DRG description in array
  1. ; Input: CODE ICD Code, Internal or External Format (required)
  1. ; ARY Output Array Name for description
  1. ; e.g. "ABC" or "ABC("TEST")"
  1. ; Default = ^TMP("DRGD",$J)
  1. ; DFN Not in use but included in anticipation of future need
  1. ; CDT Date to screen against (default = TODAY)
  1. ; If CDT < 10/1/1978, use 10/1/1978
  1. ; If CDT > DT, use DT
  1. ; If CDT is year only, use first of the year
  1. ; If CDT is year and month only, use first of the month
  1. ;
  1. ; Output: # Number of lines in description output array
  1. ; @ARY(1:n) - Versioned Description (lines 1-n) (from the 68 multiple)
  1. ; @ARY(n+1) - Blank
  1. ; @ARY(n+1) - A message stating: CODE TEXT MAY BE INACCURATE
  1. ;
  1. ; or
  1. ;
  1. ; -1^Error Description
  1. ;
  1. ; ** NOTE - USER MUST INITIALIZE ^TMP("DRGD",$J), IF USED **
  1. Q $$DRGD^ICDEX($G(CODE),$G(OUTARR),$G(CDT))
  1. VLTDR(IEN,VDATE,ARY) ; Versioned Description - Long Text
  1. ; Input:
  1. ; IEN - Internal Entry Number file 80.2
  1. ; VDATE - Effective/Versioning date to be used
  1. ; .ARY - Array for output, passed by reference
  1. ;
  1. ; Output:
  1. ; ARY() - Local array containing versioned description
  1. ;
  1. Q $$DRGDES^ICDEX($G(IEN),$G(VDATE),.ARY)
  1. CODEN(CODE) ; Return the IEN of DRG
  1. ;
  1. ; Input: DRG code
  1. ; Output: IEN of code
  1. ;
  1. Q $$DRGN^ICDEX($G(CODE))