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

ICDEXD3.m

Go to the documentation of this file.
  1. ICDEXD3 ;SLC/KER - ICD Extractor - DRG APIs (cont) ;04/21/2014
  1. ;;18.0;DRG Grouper;**57**;Oct 20, 2000;Build 1
  1. ;
  1. ;
  1. ; Global Variables
  1. ; ^ICDCCEX( N/A
  1. ; ^TMP(SUB,$J SACC 2.3.2.5.1
  1. ;
  1. ; External References
  1. ; None
  1. ;
  1. Q
  1. NOT(IEN,SUB,FMT) ; Codes not Used With
  1. ;
  1. ; Input:
  1. ;
  1. ; IEN Internal Entry Number in file 80
  1. ; SUB TMP global array subscript name.
  1. ; If not provided, the subscript
  1. ; "ICDNOT" will be used.
  1. ; FMT Format of Output
  1. ; 0 - Total number only (default)
  1. ; 1 - Total number with global array
  1. ;
  1. ; Output:
  1. ;
  1. ; $$NOT The number of ICD codes that can not
  1. ; be used with the ICD code identified
  1. ; by IEN (FMT=0 or 1)
  1. ;
  1. ; TMP global array as follows (FMT=1):
  1. ;
  1. ; ^TMP("SUB",$J,IEN)=CODE
  1. ; ^TMP("SUB",$J,"B",(CODE_" "),IEN)=""
  1. ;
  1. S IEN=+($G(IEN)) Q:$O(^ICD9(IEN,"N",0))'>0 0
  1. S SUB=$$TM($G(SUB)) S:'$L(SUB) SUB="ICDNOT" S FMT=+($G(FMT)) K ^TMP(SUB,$J)
  1. N NIEN,NCNT S (NIEN,NCNT)=0 F S NIEN=$O(^ICD9(IEN,"N",NIEN)) Q:+NIEN'>0 D
  1. . N CODE,NOT,TIEN S TIEN=$G(^ICD9(IEN,"N",NIEN,0)) Q:TIEN'>0
  1. . S CODE=$P($G(^ICD9(TIEN,0)),"^",1) Q:'$L(CODE) Q:$D(^TMP(SUB,$J,"B",(CODE_" ")))
  1. . S ^TMP(SUB,$J,TIEN)=CODE,^TMP(SUB,$J,"B",(CODE_" "),TIEN)="",NCNT=NCNT+1
  1. K:FMT'>0 ^TMP(SUB,$J)
  1. Q NCNT
  1. REQ(IEN,SUB,FMT) ; Codes Required With
  1. ;
  1. ; Input:
  1. ;
  1. ; IEN Internal Entry Number in file 80
  1. ; SUB TMP global array subscript name.
  1. ; If not provided, the subscript
  1. ; "ICDREQ" will be used.
  1. ; FMT Format of Output
  1. ; 0 - Total number only (default)
  1. ; 1 - Total number with global array
  1. ;
  1. ; Output:
  1. ;
  1. ; $$REQ The number of ICD codes requires when
  1. ; the ICD code identified by IEN is used.
  1. ; (FMT=0 or 1)
  1. ;
  1. ; TMP global array as follows (FMT=1):
  1. ;
  1. ; ^TMP("SUB",$J,IEN)=CODE
  1. ; ^TMP("SUB",$J,"B",(CODE_" "),IEN)=""
  1. ;
  1. S IEN=+($G(IEN)) Q:$O(^ICD9(IEN,"R",0))'>0 0
  1. S SUB=$$TM($G(SUB)) S:'$L(SUB) SUB="ICDREQ" S FMT=+($G(FMT)) K ^TMP(SUB,$J)
  1. N NIEN,NCNT S (NIEN,NCNT)=0 F S NIEN=$O(^ICD9(IEN,"R",NIEN)) Q:+NIEN'>0 D
  1. . N CODE,REQ,TIEN S TIEN=$G(^ICD9(IEN,"R",NIEN,0)) Q:TIEN'>0
  1. . S CODE=$P($G(^ICD9(TIEN,0)),"^",1) Q:'$L(CODE) Q:$D(^TMP(SUB,$J,"B",(CODE_" ")))
  1. . S ^TMP(SUB,$J,TIEN)=CODE,^TMP(SUB,$J,"B",(CODE_" "),TIEN)="",NCNT=NCNT+1
  1. K:FMT'>0 ^TMP(SUB,$J)
  1. Q NCNT
  1. Q
  1. NCC(IEN,SUB,FMT) ; Codes not considered CC With
  1. ;
  1. ; Input:
  1. ;
  1. ; IEN Internal Entry Number in file 80
  1. ; SUB TMP global array subscript name.
  1. ; If not provided, the subscript
  1. ; "ICDNCC" will be used.
  1. ; FMT Format of Output
  1. ; 0 - Total number only (default)
  1. ; 1 - Total number with global array
  1. ;
  1. ; Output:
  1. ;
  1. ; $$NCC The number of ICD codes not considered
  1. ; as Complication/Comorbidity with the
  1. ; ICD code identified by IEN.
  1. ; (FMT=0 or 1)
  1. ;
  1. ; TMP global array as follows (FMT=1):
  1. ;
  1. ; ^TMP("SUB",$J,IEN)=CODE
  1. ; ^TMP("SUB",$J,"B",(CODE_" "),IEN)=""
  1. ;
  1. S IEN=+($G(IEN)) Q:$O(^ICD9(IEN))'>0 0
  1. S SUB=$$TM($G(SUB)) S:'$L(SUB) SUB="ICDNCC" S FMT=+($G(FMT)) K ^TMP(SUB,$J)
  1. N NIEN,NCNT,PDXE,ICDCS S NCNT=0,ICDCS=$P($G(^ICD9(IEN,1)),"^",1)
  1. S PDXE=$$PDXE^ICDEX(IEN) I PDXE>0 D K:FMT'>0 ^TMP(SUB,$J) Q NCNT
  1. . S (NIEN,NCNT)=0 F S NIEN=$O(^ICDCCEX(+PDXE,1,NIEN)) Q:+NIEN'>0 D
  1. . . N CODE,NCC S NCC=$P($G(^ICDCCEX(+PDXE,1,+NIEN,0)),"^",1) Q:+NCC'>0
  1. . . S CODE=$P($G(^ICD9(NCC,0)),"^",1) Q:'$L(CODE) Q:$D(^TMP(SUB,$J,"B",(CODE_" ")))
  1. . . S NCNT=NCNT+1,^TMP(SUB,$J,NCNT)=CODE,^TMP(SUB,$J,"B",(CODE_" "),NCNT)=""
  1. . . S ^TMP(SUB,$J,0)=NCNT
  1. I ICDCS=1!(ICDCS=2) S (NIEN,NCNT)=0 F S NIEN=$O(^ICD9(IEN,2,NIEN)) Q:+NIEN'>0 D
  1. . N CODE,NCC S NCC=$P($G(^ICD9(IEN,2,NIEN,0)),"^",1) Q:+NCC'>0
  1. . S CODE=$P($G(^ICD9(NCC,0)),"^",1) Q:'$L(CODE)
  1. . Q:$D(^TMP(SUB,$J,"B",(CODE_" ")))
  1. . S NCNT=NCNT+1,^TMP(SUB,$J,NCNT)=CODE,^TMP(SUB,$J,"B",(CODE_" "),NCNT)=""
  1. . S ^TMP(SUB,$J,0)=NCNT
  1. K:FMT'>0 ^TMP(SUB,$J)
  1. Q NCNT
  1. Q
  1. PDXE(IEN) ; Primary DX Exclusion Code
  1. ;
  1. ; Input
  1. ;
  1. ; IEN Internal Entry Number (IEN) for file #80
  1. ;
  1. ; Output
  1. ;
  1. ; $$PDXE Pointer to DRG CC Exclusions file #82.13
  1. ; or <null> if not found
  1. Q $P($G(^ICD9(+($G(IEN)),1)),"^",11)
  1. TM(X,Y) ; Trim Character
  1. ;
  1. ; Input:
  1. ;
  1. ; X Input String
  1. ; Y Character to Trim (default " ")
  1. ;
  1. ; Output:
  1. ;
  1. ; X String without Leading/Trailing character Y
  1. ;
  1. S X=$G(X) Q:X="" X S Y=$G(Y) S:'$L(Y) Y=" "
  1. F Q:$E(X,1)'=Y S X=$E(X,2,$L(X))
  1. F Q:$E(X,$L(X))'=Y S X=$E(X,1,($L(X)-1))
  1. Q X