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

BLRICDO.m

Go to the documentation of this file.
  1. BLRICDO ; IHS/OIT/MKK - ICDO Global Utilities ; 17-Oct-2014 09:22 ; MKK
  1. ;;5.2;IHS LABORATORY;**1034**;NOV 01, 1997;Build 88
  1. ;
  1. ; This routine creates the ^BLRICDO global for the Input Transform for Field .07 file 61.
  1. ;
  1. ; ICD-10 Codes retrieved from http://seer.cancer.gov/tools/conversion/
  1. ;
  1. EEP ; Ersatz EP
  1. D EEP^BLRGMENU
  1. Q
  1. ;
  1. ;
  1. CLEANSET ; EP
  1. ; This subroutine is called during the post-install phase of LR*5.2*1034.
  1. ; It first creates the ^BLRICDO (see SETUP below).
  1. ; It then purges all non-valid ICD codes from ^BLRICDO (see SILPURGE below).
  1. ;
  1. D SETUP
  1. D SILPURGE
  1. Q
  1. ;
  1. ;
  1. SETUP ; EP
  1. ; This subroutine creates the ^BLRICDO global with the necessary ICDO codes
  1. ; so that the input transform subroutine (see ICDO below) can use it instead
  1. ; of having to create an array every time it is accessed.
  1. ;
  1. NEW CODE,GLOBAL,I,SUB,X
  1. ;
  1. S GLOBAL="^BLRICDO"
  1. K @GLOBAL
  1. ;
  1. ; The following are ICD-9 codes.
  1. ; They were determined by the original Input Transform.
  1. F CODE=140:1:199 F SUB=1:1:99 S X=CODE_"."_SUB I X?3N1"."1N D STUFFIT(CODE_".",SUB)
  1. ;
  1. ; The following are ICD-10 codes from seer.cancer.gov
  1. ; are equivalent to the ICD-9 codes above.
  1. F I=0,1,2,3,4,5,6,8,9 D STUFFIT("C00.",I)
  1. D STUFFIT("C01.",9)
  1. F I=0,1,2,3,4,8,9 D STUFFIT("C02.",I)
  1. F I=0,1,9 D STUFFIT("C03.",I)
  1. F I=0,1,8,9 D STUFFIT("C04.",I)
  1. F I=0,1,2,8,9 D STUFFIT("C05.",I)
  1. F I=0,1,2,8,9 D STUFFIT("C06.",I)
  1. D STUFFIT("C07.",9)
  1. F I=0,1,8,9 D STUFFIT("C08.",I)
  1. F I=0,1,8,9 D STUFFIT("C09.",I)
  1. F I=4,8,9 D STUFFIT("C10.",I)
  1. F I=0,1,2,3,8,9 D STUFFIT("C11.",I)
  1. D STUFFIT("C12.",9)
  1. F I=0,1,2,8,9 D STUFFIT("C13.",I)
  1. F I=0,2,8 D STUFFIT("C14.",I)
  1. F I=0,1,2,3,4,5,8,9 D STUFFIT("C15.",I)
  1. F I=0,1,2,3,4,5,6,8,9 D STUFFIT("C16.",I)
  1. F I=0,1,2,3,8,9 D STUFFIT("C17.",I)
  1. F I=0:1:9 D STUFFIT("C18.",I)
  1. D STUFFIT("C19.",9)
  1. D STUFFIT("C20.")
  1. F I=0,1,8 D STUFFIT("C21.",I)
  1. F I=0,1 D STUFFIT("C22.",I)
  1. D STUFFIT("C23.",9)
  1. F I=0,1,8,9 D STUFFIT("C24.",I)
  1. F I=0,1,2,3,4,5,7,8,9 D STUFFIT("C25.",I)
  1. F I=0,1,9 D STUFFIT("C26.",I)
  1. Q
  1. ;
  1. ;
  1. STUFFIT(CODE,SUB) ; EP - Create and "stuff" resulting code into ^BLRICDO
  1. S ^BLRICDO(CODE_$G(SUB))=""
  1. Q
  1. ;
  1. ;
  1. ICHEKALL ; EP - Interactively CHEcK ALL the codes in ^BLRICDO
  1. ; This is to ensure that the codes are in the ICD DIAGNOSIS (#80) dictionary.
  1. ; If the code is in ^BLRICDO but not in File 80, delete it from ^BLRICDO
  1. ;
  1. NEW CNT,GLOBAL,HEADER,ICD,KILLER,PURGED
  1. ;
  1. S GLOBAL="^BLRICDO"
  1. ;
  1. S HEADER(1)="ICDO Codes"
  1. S HEADER(2)="Data File Analysis"
  1. D HEADERDT^BLRGMENU
  1. S ICD=""
  1. S (CNT,PURGED)=0
  1. ;
  1. W ?4,"Analysis "
  1. F S ICD=$O(^BLRICDO(ICD)) Q:ICD="" D
  1. . S CNT=CNT+1
  1. . W:(CNT#10)=0 "." W:$X>74 !,?4
  1. . ;
  1. . Q:+$$ICDDX^ICDEX(ICD)>0 ; Valid code
  1. . ;
  1. . S PURGED(ICD)=""
  1. . S PURGED=PURGED+1
  1. ;
  1. W !!,?4,CNT," Codes Analyzed.",!!
  1. I PURGED=0 W ?9,"No Codes Purged.",!
  1. E D
  1. . W ?9,"The following ",PURGED," codes will be purged from the ^BLRICDO global.",!!,?14
  1. . S ICD=""
  1. . F S ICD=$O(PURGED(ICD)) Q:ICD="" D
  1. .. W $$LJ^XLFSTR(ICD,7)
  1. .. W:$X>64 !,?14
  1. .. S ICDSTR=ICD
  1. .. S:$E(ICD)?1A!($P(ICD,".",2)="0") ICDSTR=$C(34)_ICD_$C(34)
  1. .. S KILLER=GLOBAL_"("_ICDSTR_")"
  1. .. K @KILLER
  1. ;
  1. D PRESSKEY^BLRGMENU(4)
  1. Q
  1. ;
  1. SILPURGE ; EP - SILent Purge of BLRICDO dictionary
  1. ; This is to ensure that the codes are in the ICD DIAGNOSIS (#80) dictionary.
  1. ; If the code is in ^BLRICDO but not in File 80, delete it from ^BLRICDO
  1. ;
  1. NEW CNT,GLOBAL,ICD,KILLER,PURGED
  1. ;
  1. S GLOBAL="^BLRICDO"
  1. ;
  1. S ICD=""
  1. S (CNT,PURGED)=0
  1. ;
  1. F S ICD=$O(^BLRICDO(ICD)) Q:ICD="" D
  1. . S CNT=CNT+1
  1. . ;
  1. . Q:+$$ICDDX^ICDEX(ICD)>0 ; Valid code
  1. . ;
  1. . S PURGED(ICD)=""
  1. . S PURGED=PURGED+1
  1. ;
  1. I PURGED D
  1. . S ICD=""
  1. . F S ICD=$O(PURGED(ICD)) Q:ICD="" D
  1. .. S ICDSTR=ICD
  1. .. S:$E(ICD)?1A!($P(ICD,".",2)="0") ICDSTR=$C(34)_ICD_$C(34)
  1. .. S KILLER=GLOBAL_"("_ICDSTR_")"
  1. .. K @KILLER
  1. Q
  1. ;
  1. ;
  1. ICDO(X) ; EP - Input Transform for field .07 file 61
  1. ;X is the value entered by the user, this subroutine checks to make
  1. ;sure that the value matches a valid code. This function evaluates
  1. ;to true if X is okay, false if X is not valid.
  1. Q $D(^BLRICDO(X))