Changeset 306
- Timestamp:
- Dec 11, 2008, 7:42:01 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/p/C0CRXN.m
r304 r306 31 31 ; "DIFFERENT TEXT" FIELD TO "Y" IF THERE ARE DIFFERENCES 32 32 ; USES SUPPORT ROUTINES FROM C0CRNF.m 33 ;N C0CFDA,C0CA,C0CB,C0CC,C0CZX ;FDA WORK ARRAY, RNF ARRAYS, AND IEN ITERATOR34 ;N C0CFVA,C0CFRXN ; CLOSED ROOTS FOR SOURCE FILES35 ;N C0CF ; CLOSED ROOT FOR DESTINATION FILE33 N C0CFDA,C0CA,C0CB,C0CC,C0CZX ;FDA WORK ARRAY, RNF ARRAYS, AND IEN ITERATOR 34 N C0CFVA,C0CFRXN ; CLOSED ROOTS FOR SOURCE FILES 35 N C0CF ; CLOSED ROOT FOR DESTINATION FILE 36 36 S C0CVA=$$FILEREF^C0CRNF(176.111) ; C0C PHARMACY VA RXNORM MAPPING FILE 37 37 S C0CFRXN=$$FILEREF^C0CRNF(176.001) ; CLOSED ROOT FOR RXNORM CONCEPT FILE … … 44 44 . D FIELDS^C0CRNF("C0CC",176.112) ;GET FIELD NAMES FOR OUTPUT FILE 45 45 . D GETN2^C0CRNF("C0CA",176.111,C0CZX,"","ALL") ;GET THE FIELDS 46 . I $$ZVALUE("MEDIATION CODE")="" D 47 . . S NORXN=NORXN+1 ; 48 . E D ; PROCESS MEDIATION CODE 49 . . S HASRXN=HASRXN+1 50 . . D SETFDA("MEDIATION CODE",$$ZVALUE("MEDIATION CODE")) ; 51 . I $$ZVALUE("VUID")="" D ; BAD RECORD 52 . . S NOVUID=NOVUID+1 53 . . ;D SETFDA("VUID",$$ZVALUE("VUID")) 54 . E D SETFDA("VUID TEXT",$$ZVALUE("VUID TEXT")) 55 . . ;ZWR C0CA 56 . D GETN2^C0CRNF("C0CB",176.001,$$ZVALUE("VUID"),"VUID","ALL") 57 . I $$ZVALUE("RXCUI","C0CB")'="" D ; RXNORM FOUND 58 . . S RXFOUND=RXFOUND+1 59 . . I $$ZVALUE("MEDIATION CODE")="" D ; THIS IS A NEW CODE 60 . . . D SETFDA("MEDIATION CODE",$$ZVALUE("RXCUI","C0CB")) 61 . . . D SETFDA("NEW","Y") ;FLAG RECORD HAS HAVING NEW RXNORM 62 . . W "RXNORM=",$$ZVALUE("RXCUI","C0CB")," ",$$ZVALUE("STR","C0CB"),! 63 . . W "VUID TEXT: ",$$ZVALUE("VUID TEXT"),! 64 . . I $$ZVALUE("VUID TEXT")=$$ZVALUE("STR","C0CB") S TXTMATCH=TXTMATCH+1 65 . . E D ; 66 . . . S ZZ=$$ZVALUE("VUID TEXT")_"^"_$$ZVALUE("STR","C0CB") 67 . . . D PUSH^GPLXPATH("NOMATCH",ZZ) 68 . . . D SETFDA("RXNORM TEXT",$$ZVALUE("STR","C0CB")) ; 69 . . . D SETFDA("DIFFERENT TEXT","Y") ;FLAG RECORD FOR DIFFERENT TEXT 70 . I $$ZVALUE("MEDIATION CODE")=$$ZVALUE("RXCUI","C0CB") D ; 71 . . S RXMATCH=RXMATCH+1 72 . . W "VUID=",$$ZVALUE("VUID")," MATCH RXNORM=",$$ZVALUE("MEDIATION CODE"),! 73 . D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP 74 . S C0CFDA(176.112,"+"_C0CZX_",",.01)=$$ZVALUE("VUID") ; NEW VUID RECORD 75 . D UPDATE^DIE("","C0CFDA") 76 . I $D(^TMP("DIERR",$J)) U $P BREAK 77 W "HAS RXN=",HASRXN,! 78 W "NO RXN=",NORXN,! 79 W "NO VUID=",NOVUID,! 80 W "RXNORM FOUND=",RXFOUND,! 81 W "RXNORM MATCHES:",RXMATCH,! 82 W "TEXT MATCHES:",TXTMATCH,! 83 Q 84 ; 85 EXP2 ; ROUTINE TO CREATE 176.113 C0C RXNORM VUID MAPPING DISCREPANCIES FILE 86 ; CROSS CHECKS THE NATIONAL DRUG FILE AND THE VA MAPPING FILE AGAINST 87 ; THE UMLS RXNORM DATABASE 88 ; IF THE VUID EXISISTS IN ALL THREE FILES, THE RXNORM CODE MATCHES IN 89 ; THE VA MAPPING FILE AND THE TEXT STRINGS ARE THE SAME, THE VUID IS INCLUDED 90 ; IN THE FILE BUT NO FLAGS ARE SET 91 ; IF THE VUID IS MISSING FROM THE NATIONAL DRUG FILE NDF=N 92 ; IF THE VUID IS MISSING FROM THE VA MAPPING FILE VAMAP=N 93 ; IF THE VUID IS PRESENT IN THE VA MAPPING FILE, BUT THE RXNORM 94 ; CODE IS MISSING IN THAT FILE, VARXN=N 95 ; IF THE TEXT STRINGS DO NOT MATCH EXACTLY, TXTM=N AND ALL THREE STRINGS 96 ; ARE SHOWN; NDF TEXT=NDF TEXT STRING, VA MAP TEXT=VA MAPPING TEXT STRING 97 ; RXNORM TEXT=RXNORM TEXT STRING 98 ; THE FILE IS KEYED ON VUID AND WOULD USUALLY BE SORTED BY VUID 99 ; THE OBJECTIVE IS TO SEE IF NDF (50.68) AND VA MAPPING (176.111) HAVE 100 ; ALL THE VUID CODES THAT ARE IN THE UMLS RXNORM DATABASE 101 N C0CFDA,C0CA,C0CB,C0CC,C0CZX ;FDA WORK ARRAY, RNF ARRAYS, AND IEN ITERATOR 102 N C0CFVA,C0CFRXN ; CLOSED ROOTS FOR SOURCE FILES 103 N C0CF ; CLOSED ROOT FOR DESTINATION FILE 104 S C0CVA=$$FILEREF^C0CRNF(176.111) ; C0C PHARMACY VA RXNORM MAPPING FILE 105 S C0CFRXN=$$FILEREF^C0CRNF(176.001) ; CLOSED ROOT FOR RXNORM CONCEPT FILE 106 ;S C0CF=$$FILEREF^C0CRNF(176.113) ; C0C RXNORM VUID MAPPING ADDITIONAL FILE 107 W C0CVA,C0CFRXN,! ;C0CF,! 108 S C0CZX=0 109 S (NDFVCNT,NDFTCNT,NDFNO)=0 ; COUNTERS FOR NDF TESTS 110 S (VAVCNT,VATCNT,VARCNT,VANO)=0 ; COUNTERS FOR VA MAPPING FILE TESTS 111 F S C0CZX=$O(^C0CRXN(176.001,"VUID",C0CZX)) Q:+C0CZX=0 D ; FOR EVERY VUID 112 . K C0CA,C0CB,C0CC,C0CD ; CLEAR ARRAYS 113 . D FIELDS^C0CRNF("C0CC",176.113) ;GET FIELD NAMES FOR OUTPUT FILE 114 . D GETN2^C0CRNF("C0CA",176.001,C0CZX,"VUID","ALL") ;GET FROM RXNORM FILE 115 . D GETN2^C0CRNF("C0CB",176.111,C0CZX,"B","ALL") ;GET FROM VA MAPPING FILE 116 . D GETN2^C0CRNF("C0CD",50.68,C0CZX,"AVUID","ALL") ;GET FROM NDF 117 . ;D SETFDA("VUID",$$ZVALUE("CODE")) ;SET THE VUID CODE 118 . D SETFDA("RXNORM",$$ZVALUE("RXCUI")) ;SET THE RXNORM CODE 119 . D SETFDA("RXNORM TEXT",$$ZVALUE("STR")) ;SET THE RXNORM TEXT 120 . ;VA MAPPING FILE TESTS 121 . I $$ZVALUE("VUID","C0CB")=C0CZX D ; VUID FOUND 122 . . S VAVCNT=VAVCNT+1 ;INCREMENT COUNT 123 . . I $$ZVALUE("STR")'=$$ZVALUE("VUID TEXT","C0CB") D ;TEXT MISMATCH 124 . . . S VATCNT=VATCNT+1 ; INCREMENT VA TEXT MISMATCH COUNT 125 . . . D SETFDA("TXTM","N") ;MARK THAT TEXT DOESN'T MATCH 126 . . . D SETFDA("VA MAP TEXT",$$ZVALUE("VUID TEXT","C0CB")) ; SET VA MAP TEXT 127 . E D ; VUID NOT FOUND 128 . . S VANO=VANO+1 129 . . D SETFDA("VAMAP","N") ;MARK AS MISSING FROM VA MAPPING FILE 130 . ; NATIONAL DRUG FILE TESTS 131 . I $$ZVALUE("VUID","C0CD")=C0CZX D ; FOUND IN NATIONAL DRUG FILE 132 . . S NDFVCNT=NDFVCNT+1 ;INCREMENT VUID FOUND COUNT 133 . . I $$ZVALUE("NAME","C0CD")'=$$ZVALUE("STR") D ;NDF TEXT DOESN'T MATCH 134 . . . S NDFTCNT=NDFTCNT+1 ; INCREMENT MISMATCHED NDF TEXT COUNT 135 . . . D SETFDA("TXTM","N") ; SET TEXT MATCH FLAG TO N 136 . . . D SETFDA("NDF TEXT",$$ZVALUE("NAME","C0CD")) ;POST THE TEXT 137 . E D ; 138 . . D SETFDA("NDF","N") ;MARK AS MISSING 139 . . S NDFNO=NDFNO+1 ;INCREMENT MISSING COUNT 140 . D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP 141 . S C0CFDA(176.113,"+"_C0CZX_",",.01)=C0CZX ; NEW VUID RECORD 142 . D UPDATE^DIE("","C0CFDA") 143 . I $D(^TMP("DIERR",$J)) U $P BREAK 144 W "VA MAPPING VUID COUNT: ",VAVCNT,! 145 W "VA MAPPING MISSING: ",VANO,! 146 W "VA MAPPING TEXT MISMATCH: ",VATCNT,! 147 W "NDF VUID COUNT: ",NDFVCNT,! 148 W "NDF MISSING: ",NDFNO,! 149 W "NDF TEXT MISMATCH: ",NDFTCNT,! 150 Q 151 CHKNDF ; ROUTINE TO CHECK THE NATIONAL DRUG FILE WITH THE UMLS RXNORM DB 152 ; USING THE AVUID INDEX, READS ALL VUID CODES IN ^PSNDF(50.68), 153 ; CHECKS TO SEE IF THE CODE IS IN 176.001, AND CREATES A RECORD 154 ; IN 176.114 155 ; THE OBJECTIVE IS TO SEE IF ^PSNDF(50.68) HAS ALL THE VUID CODES IN THE 156 ; UMLS RXNORM DATABASE AND IF THE TEXT FIELDS MATCH 157 ; ALSO CAPTURES THE RXNORM CODE MAPPING 158 ; CHKNDF2 WILL CHECK THE OTHER DIRECTION, STARTING WITH THE 176.001 VUID INDEX 159 ; THIS ROUTINE ALSO CHECKS IF THE VUID CODE IS IN 176.111 AND IF NOT 160 ; SETS NOTMAPPED=Y 161 N C0CFDA,C0CA,C0CB,C0CC,C0CZX ;FDA WORK ARRAY, RNF ARRAYS, AND IEN ITERATOR 162 N C0CFVA,C0CFRXN,C0CPSNDF ; CLOSED ROOTS FOR SOURCE FILES 163 N C0CF ; CLOSED ROOT FOR DESTINATION FILE 164 S C0CPSNDF=$$FILEREF^C0CRNF(50.68) ; NDF CLOSED ROOT REFERENCE 165 S C0CVA=$$FILEREF^C0CRNF(176.111) ; C0C PHARMACY VA RXNORM MAPPING FILE 166 S C0CFRXN=$$FILEREF^C0CRNF(176.001) ; CLOSED ROOT FOR RXNORM CONCEPT FILE 167 ;S C0CF=$$FILEREF^C0CRNF(176.113) ; C0C RXNORM VUID MAPPING ADDITIONAL FILE 168 W C0CVA,C0CFRXN,! ;C0CF,! 169 S C0CZX=0 170 S (FOUND,MISSING)=0 171 S (NOVUID,VMATCH,NOMATCH,MISSING,FOUND,TXTMATCH,NOTM,NVAM)=0 ; COUNTERS 172 F S C0CZX=$O(^PSNDF(50.68,"AVUID",C0CZX)) Q:+C0CZX=0 D ; FOR EVERY VUID 173 . K C0CA,C0CB,C0CC,C0CD ; CLEAR ARRAYS 174 . ;D FIELDS^C0CRNF("C0CC",176.113) ;GET FIELD NAMES FOR OUTPUT FILE 175 . D GETN2^C0CRNF("C0CA",50.68,C0CZX,"AVUID","ALL") ;GET THE FIELDS 176 . I $$ZVALUE("VUID")="" D ; ERROR, SHOULD NOT HAPPEN 177 . . S NOVUID=NOVUID+1 ; FLAG THE ERROR 178 . . D PUSH^GPLXPATH("NOVUID",C0CZX) ; RECORD THE VUID 179 . D GETN2^C0CRNF("C0CD",176.001,C0CZX,"VUID","ALL") ;TRY RXNORM DB 180 . I $$ZVALUE("CODE","C0CD")=C0CZX D ; FOUND IN RXNORM 181 . . S VMATCH=VMATCH+1 ; COUNT OF PSNDF VUIDS FOUND IN RXNORM 182 . . I $$ZVALUE("NAME")=$$ZVALUE("STR","C0CD") D ;TEXT MATCHES 183 . . . S TXTMATCH=TXTMATCH+1 ; COUNT IT 184 . . E D ; TEXT DOESN'T MATCH 185 . . . S NOTM=NOTM+1 ;NO TEXT MATCH COUNTER 186 . . . S ZV=$$ZVALUE("NAME")_"^"_$$ZVALUE("STR","C0CD") 187 . . . W ZV,! 188 . . . D PUSH^GPLXPATH("TXTNM",ZV) ; RECORD THE TXT MISMATCH 189 . E S NOMATCH=NOMATCH+1 ; NOT FOUND IN RXNORM 190 . D GETN2^C0CRNF("C0CB",176.111,C0CZX,"B","ALL") ;TRY TO GET FROM 176.111 191 . I $$ZVALUE("VUID","C0CB")="" D ; VUID NOT FOUND 192 . . ;W "NOT FOUND: ",C0CZX," ",$$ZVALUE("STR")," ",$$ZVALUE("RXCUI"),! 193 . . S MISSING=MISSING+1 194 . . D PUSH^GPLXPATH("MISSING",C0CZX) ;MISSING FROM MAPPING FILE 195 . E D ; FOUND IN VA MAPPING FILE 196 . . S FOUND=FOUND+1 197 . . I $$ZVALUE("VUID TEXT","C0CB")'=$$ZVALUE("NAME") D ; TEXT DOESN'T MATCH 198 . . . S NVAM=NVAM+1 ; MAPPING FILE TEXT IS DIFFERENT THAN NDF 199 . . . S ZY=$$ZVALUE("VUID TEXT","C0CB")_"^"_$$ZVALUE("NAME") ;BOTH STRINGS 200 . . . W "VA: ",ZY,! 201 . . . D PUSH^GPLXPATH("NVAM",ZY) ;SAVE IT 202 W "MISSING IN MAPPING FILE: ",MISSING,! 203 W "FOUND IN MAPPING FILE: ",FOUND,! 204 W "FOUND IN RXNORM: ",VMATCH,! 205 W "NOT FOUND IN RXNORM: ",NOMATCH,! 206 W "ERRORS: ",NOVUID,! 207 Q 208 ; 46 209 . I $$ZVALUE("MEDIATION CODE")="" D 47 210 . . S NORXN=NORXN+1 ; … … 81 244 W "TEXT MATCHES:",TXTMATCH,! 82 245 Q 83 ;84 246 SETFDA(C0CSN,C0CSV) ; INTERNAL ROUTINE TO MAKE AN FDA ENTRY FOR FIELD C0CSN 85 247 ; TO SET TO VALUE C0CSV.
Note:
See TracChangeset
for help on using the changeset viewer.