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

AICDZMDC.m

Go to the documentation of this file.
AICDZMDC ;IHS/OIT/FBD - CLEAN UP MDC PTRS IN ICD FILES
 ;;4.0;AICD;;DEC 03, 2014;Build 7
 ;
 ;UTILITY TO CLEAN UP MALFORMED 'MAJOR DIAGNOSTIC CATEGORY' POINTER FIELD
 ;VALUES IN THE ICD DIAGNOSIS (#80) AND ICD OPERATION/PROCEDURE (#80.1)
 ;FILES.
 ;
 D INIT
 D MAIN
 D CLEANUP
 Q
 ;
INIT ;PRIMARY MODULE INITIALIZATION
 S U="^"
 K ^AICDZMDC  ;TEMP COPY OF CLEANED ENTRIES
 Q
 ;
MAIN ;PRIMARY MODULE EXECUTION
 D ICDDX
 D ICDPX
 W:'$D(ZTSK) !,"# OF ENTRIES CLEANED - FILE 80:   ",^AICDZMDC("ICD9")
 W:'$D(ZTSK) !,"# OF ENTRIES CLEANED - FILE 80.1: ",^AICDZMDC("ICD0")
 Q
 ;
ICDDX ;CLEAN UP FILE 80 (ICD DIAGNOSIS)
 S (AICDIEN,AICDCNT)=0
 F  S AICDIEN=$O(^ICD9(AICDIEN)) Q:AICDIEN'=+AICDIEN  D  ;
 . S AICDMDC=$P(^ICD9(AICDIEN,0),U,5)  ;EXTRACT MDC PTR
 . Q:AICDMDC=""  ;SKIP IF NULL,
 . Q:AICDMDC=+AICDMDC  ;SKIP IF A TRUE NUMBER,
 . S AICDCNT=AICDCNT+1,^AICDZMDC("ICD9",AICDIEN)=AICDMDC  ;ELSE COUNT & RECORD THE ERROR,
 . S $P(^ICD9(AICDIEN,0),U,5)=+AICDMDC  ;THEN CLEAN UP THE ENTRY
 S ^AICDZMDC("ICD9")=AICDCNT  ;COUNT OF CLEANED ENTRIES
 Q
 ;
ICDPX ;CLEAN UP FILE 80.1 (ICD OPERATION/PROCEDURE)
 S (AICDIEN,AICDCNT)=0
 F  S AICDIEN=$O(^ICD0(AICDIEN)) Q:AICDIEN'=+AICDIEN  D  ;
 . S AICDMLT=0  ;IEN WITHIN 'MDC' MULTIPLE
 . F  S AICDMLT=$O(^ICD0(AICDIEN,"MDC",AICDMLT)) Q:AICDMLT'=+AICDMLT  D  ;
 .. S AICDMDC=$P(^ICD0(AICDIEN,"MDC",AICDMLT,0),U,1)  ;EXTRACT MDC PTR
 .. Q:AICDMDC=""  ;SKIP IF NULL,
 .. Q:AICDMDC=+AICDMDC  ;SKIP IF A TRUE NUMBER,
 .. S AICDCNT=AICDCNT+1,^AICDZMDC("ICD0",AICDIEN,AICDMLT)=AICDMDC  ;ELSE COUNT & RECORD THE ERROR,
 .. S $P(^ICD0(AICDIEN,"MDC",AICDMLT,0),U,1)=+AICDMDC  ;THEN CLEAN UP THE ENTRY
 S ^AICDZMDC("ICD0")=AICDCNT  ;COUNT OF CLEANED ENTRIES
 Q
 ;
CLEANUP ;PRIMARY MODULE CLEANUP
 Q