[1544] | 1 | C0CRXN ; CCDCCR/GPL - CCR RXN utilities; 12/6/08
|
---|
[1586] | 2 | ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
|
---|
| 3 | ;Copyright 2009 George Lilly.
|
---|
[1544] | 4 | ;
|
---|
[1586] | 5 | ; This program is free software: you can redistribute it and/or modify
|
---|
| 6 | ; it under the terms of the GNU Affero General Public License as
|
---|
| 7 | ; published by the Free Software Foundation, either version 3 of the
|
---|
| 8 | ; License, or (at your option) any later version.
|
---|
[1544] | 9 | ;
|
---|
[1586] | 10 | ; This program is distributed in the hope that it will be useful,
|
---|
| 11 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | ; GNU Affero General Public License for more details.
|
---|
[1544] | 14 | ;
|
---|
[1586] | 15 | ; You should have received a copy of the GNU Affero General Public License
|
---|
| 16 | ; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
[1544] | 17 | ;
|
---|
| 18 | W "This is the CCR RXNORM Utility Library ",!
|
---|
| 19 | W !
|
---|
| 20 | Q
|
---|
| 21 | ;
|
---|
| 22 | EXPAND ; MAIN ROUTINE TO CREATE THE C0C RXNORM VUID EXPANSION FILE (176.112)
|
---|
| 23 | ; READ EACH RECORD FROM 176.111 AND USE THE VUID TO LOOK UP THE RXNORM
|
---|
| 24 | ; CODE FROM 176.001 (RXNORM CONCEPTS)
|
---|
| 25 | ; POPULATE ALL FIELDS IN 176.112 AND SET "NEW" TO "Y" IF 176.111 DOES NOT
|
---|
| 26 | ; ALREADY HAVE AN RXNORM CODE.
|
---|
| 27 | ; ADD THE RXNORM TEXT FIELD TO EVERY RECORD (NOT PRESENT IN 176.111)
|
---|
| 28 | ; AND COMPARE THE RXNORM TEXT FIELD WITH THE VUID TEXT FIELD, SETTING THE
|
---|
| 29 | ; "DIFFERENT TEXT" FIELD TO "Y" IF THERE ARE DIFFERENCES
|
---|
| 30 | ; USES SUPPORT ROUTINES FROM C0CRNF.m
|
---|
| 31 | N C0CFDA,C0CA,C0CB,C0CC,C0CZX ;FDA WORK ARRAY, RNF ARRAYS, AND IEN ITERATOR
|
---|
| 32 | N C0CFVA,C0CFRXN ; CLOSED ROOTS FOR SOURCE FILES
|
---|
| 33 | N C0CF ; CLOSED ROOT FOR DESTINATION FILE
|
---|
| 34 | S C0CVA=$$FILEREF^C0CRNF(176.111) ; C0C PHARMACY VA RXNORM MAPPING FILE
|
---|
| 35 | S C0CFRXN=$$FILEREF^C0CRNF(176.001) ; CLOSED ROOT FOR RXNORM CONCEPT FILE
|
---|
| 36 | S C0CF=$$FILEREF^C0CRNF(176.112) ; C0C RXNORM VUID MAPPING EXPANSION FILE
|
---|
| 37 | W C0CVA,C0CFRXN,C0CF,!
|
---|
| 38 | S C0CZX=0
|
---|
| 39 | S (HASRXN,NORXN,NOVUID,RXFOUND,RXMATCH,TXTMATCH)=0 ; INITIALIZE COUNTERS
|
---|
| 40 | F S C0CZX=$O(^C0CCODES(176.111,C0CZX)) Q:+C0CZX=0 D ; FOR EVERY RECORD
|
---|
| 41 | . K C0CA,C0CB,C0CC ; CLEAR ARRAYS
|
---|
| 42 | . D FIELDS^C0CRNF("C0CC",176.112) ;GET FIELD NAMES FOR OUTPUT FILE
|
---|
| 43 | . D GETN1^C0CRNF("C0CA",176.111,C0CZX,"","ALL") ;GET THE FIELDS
|
---|
| 44 | . I $$ZVALUE("MEDIATION CODE")="" D
|
---|
| 45 | . . S NORXN=NORXN+1 ;
|
---|
| 46 | . E D ; PROCESS MEDIATION CODE
|
---|
| 47 | . . S HASRXN=HASRXN+1
|
---|
| 48 | . . D SETFDA("MEDIATION CODE",$$ZVALUE("MEDIATION CODE")) ;
|
---|
| 49 | . I $$ZVALUE("VUID")="" D ; BAD RECORD
|
---|
| 50 | . . S NOVUID=NOVUID+1
|
---|
| 51 | . . ;D SETFDA("VUID",$$ZVALUE("VUID"))
|
---|
| 52 | . E D SETFDA("VUID TEXT",$$ZVALUE("VUID TEXT"))
|
---|
[1586] | 53 | . ;ZWR C0CA
|
---|
[1544] | 54 | . D GETN1^C0CRNF("C0CB",176.001,$$ZVALUE("VUID"),"VUID","ALL")
|
---|
| 55 | . I $$ZVALUE("RXCUI","C0CB")'="" D ; RXNORM FOUND
|
---|
| 56 | . . S RXFOUND=RXFOUND+1
|
---|
| 57 | . . I $$ZVALUE("MEDIATION CODE")="" D ; THIS IS A NEW CODE
|
---|
| 58 | . . . D SETFDA("MEDIATION CODE",$$ZVALUE("RXCUI","C0CB"))
|
---|
| 59 | . . . D SETFDA("NEW","Y") ;FLAG RECORD HAS HAVING NEW RXNORM
|
---|
| 60 | . . W "RXNORM=",$$ZVALUE("RXCUI","C0CB")," ",$$ZVALUE("STR","C0CB"),!
|
---|
| 61 | . . W "VUID TEXT: ",$$ZVALUE("VUID TEXT"),!
|
---|
| 62 | . . I $$ZVALUE("VUID TEXT")=$$ZVALUE("STR","C0CB") S TXTMATCH=TXTMATCH+1
|
---|
| 63 | . . E D ;
|
---|
| 64 | . . . S ZZ=$$ZVALUE("VUID TEXT")_"^"_$$ZVALUE("STR","C0CB")
|
---|
| 65 | . . . D PUSH^GPLXPATH("NOMATCH",ZZ)
|
---|
| 66 | . . . D SETFDA("RXNORM TEXT",$$ZVALUE("STR","C0CB")) ;
|
---|
| 67 | . . . D SETFDA("DIFFERENT TEXT","Y") ;FLAG RECORD FOR DIFFERENT TEXT
|
---|
| 68 | . I $$ZVALUE("MEDIATION CODE")=$$ZVALUE("RXCUI","C0CB") D ;
|
---|
| 69 | . . S RXMATCH=RXMATCH+1
|
---|
| 70 | . . W "VUID=",$$ZVALUE("VUID")," MATCH RXNORM=",$$ZVALUE("MEDIATION CODE"),!
|
---|
| 71 | . D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP
|
---|
| 72 | . S C0CFDA(176.112,"+"_C0CZX_",",.01)=$$ZVALUE("VUID") ; NEW VUID RECORD
|
---|
| 73 | . D UPDATE^DIE("","C0CFDA")
|
---|
[1586] | 74 | . I $D(^TMP("DIERR",$J)) S $EC=",U1,"
|
---|
[1544] | 75 | W "HAS RXN=",HASRXN,!
|
---|
| 76 | W "NO RXN=",NORXN,!
|
---|
| 77 | W "NO VUID=",NOVUID,!
|
---|
| 78 | W "RXNORM FOUND=",RXFOUND,!
|
---|
| 79 | W "RXNORM MATCHES:",RXMATCH,!
|
---|
| 80 | W "TEXT MATCHES:",TXTMATCH,!
|
---|
| 81 | Q
|
---|
| 82 | ;
|
---|
| 83 | EXP2 ; ROUTINE TO CREATE 176.113 C0C RXNORM VUID MAPPING DISCREPANCIES FILE
|
---|
| 84 | ; CROSS CHECKS THE NATIONAL DRUG FILE AND THE VA MAPPING FILE AGAINST
|
---|
| 85 | ; THE UMLS RXNORM DATABASE
|
---|
| 86 | ; THIS ROUTINE HAS BEEN ENHANCED TO ALSO CHECK THE 50.416 DRUG INGREDIENT
|
---|
| 87 | ; FILE AND TREAT VUIDS FOUND THERE LIKE THE ONES BEING FOUND IN THE NDF
|
---|
| 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 NDF, IT IS CHECKED IN THE DRUG INGREDIENT
|
---|
| 93 | ; FILE, AND IF FOUND, THE FLAG IS NOT SET. IN THIS CASE THE TEXT FROM THE
|
---|
| 94 | ; DRUG INGREDIENT FILE IS USED FOR COMPARISONS)
|
---|
| 95 | ; IF THE VUID IS MISSING FROM THE VA MAPPING FILE VAMAP=N
|
---|
| 96 | ; IF THE VUID IS PRESENT IN THE VA MAPPING FILE, BUT THE RXNORM
|
---|
| 97 | ; CODE IS MISSING IN THAT FILE, VARXN=N
|
---|
| 98 | ; IF THE TEXT STRINGS DO NOT MATCH EXACTLY, TXTM=N AND ALL THREE STRINGS
|
---|
| 99 | ; ARE SHOWN; NDF TEXT=NDF TEXT STRING, VA MAP TEXT=VA MAPPING TEXT STRING
|
---|
| 100 | ; RXNORM TEXT=RXNORM TEXT STRING
|
---|
| 101 | ; THE FILE IS KEYED ON VUID AND WOULD USUALLY BE SORTED BY VUID
|
---|
| 102 | ; THE OBJECTIVE IS TO SEE IF NDF (50.68) AND VA MAPPING (176.111) HAVE
|
---|
| 103 | ; ALL THE VUID CODES THAT ARE IN THE UMLS RXNORM DATABASE
|
---|
| 104 | N C0CFDA,C0CA,C0CB,C0CC,C0CZX ;FDA WORK ARRAY, RNF ARRAYS, AND IEN ITERATOR
|
---|
| 105 | N C0CFVA,C0CFRXN ; CLOSED ROOTS FOR SOURCE FILES
|
---|
| 106 | N C0CF ; CLOSED ROOT FOR DESTINATION FILE
|
---|
| 107 | S C0CVA=$$FILEREF^C0CRNF(176.111) ; C0C PHARMACY VA RXNORM MAPPING FILE
|
---|
| 108 | S C0CFRXN=$$FILEREF^C0CRNF(176.001) ; CLOSED ROOT FOR RXNORM CONCEPT FILE
|
---|
| 109 | ;S C0CF=$$FILEREF^C0CRNF(176.113) ; C0C RXNORM VUID MAPPING ADDITIONAL FILE
|
---|
| 110 | W C0CVA,C0CFRXN,! ;C0CF,!
|
---|
| 111 | S C0CZX=0
|
---|
| 112 | S (NDFVCNT,NDFTCNT,NDFNO)=0 ; COUNTERS FOR NDF TESTS
|
---|
| 113 | S (VAVCNT,VATCNT,VARCNT,VANO)=0 ; COUNTERS FOR VA MAPPING FILE TESTS
|
---|
| 114 | F S C0CZX=$O(^C0CRXN(176.001,"VUID",C0CZX)) Q:+C0CZX=0 D ; FOR EVERY VUID
|
---|
| 115 | . K C0CA,C0CB,C0CC,C0CD ; CLEAR ARRAYS
|
---|
| 116 | . D FIELDS^C0CRNF("C0CC",176.113) ;GET FIELD NAMES FOR OUTPUT FILE
|
---|
| 117 | . D GETN1^C0CRNF("C0CA",176.001,C0CZX,"VUID","ALL") ;GET FROM RXNORM FILE
|
---|
| 118 | . D GETN1^C0CRNF("C0CB",176.111,C0CZX,"B","ALL") ;GET FROM VA MAPPING FILE
|
---|
| 119 | . D GETN1^C0CRNF("C0CD",50.68,C0CZX,"AVUID","ALL") ;GET FROM NDF
|
---|
| 120 | . D GETN1^C0CRNF("C0CE",50.416,C0CZX,"AVUID","ALL") ;GET FROM DRUG INGREDIENTS
|
---|
| 121 | . ;D SETFDA("VUID",$$ZVALUE("CODE")) ;SET THE VUID CODE
|
---|
| 122 | . D SETFDA("RXNORM",$$ZVALUE("RXCUI")) ;SET THE RXNORM CODE
|
---|
| 123 | . D SETFDA("RXNORM TEXT",$$ZVALUE("STR")) ;SET THE RXNORM TEXT
|
---|
| 124 | . ;VA MAPPING FILE TESTS
|
---|
| 125 | . I $$ZVALUE("VUID","C0CB")=C0CZX D ; VUID FOUND
|
---|
| 126 | . . S VAVCNT=VAVCNT+1 ;INCREMENT COUNT
|
---|
| 127 | . . I $$ZVALUE("STR")'=$$ZVALUE("VUID TEXT","C0CB") D ;TEXT MISMATCH
|
---|
| 128 | . . . S VATCNT=VATCNT+1 ; INCREMENT VA TEXT MISMATCH COUNT
|
---|
| 129 | . . . D SETFDA("TXTM","N") ;MARK THAT TEXT DOESN'T MATCH
|
---|
| 130 | . . . D SETFDA("VA MAP TEXT",$$ZVALUE("VUID TEXT","C0CB")) ; SET VA MAP TEXT
|
---|
| 131 | . E D ; VUID NOT FOUND
|
---|
| 132 | . . S VANO=VANO+1
|
---|
| 133 | . . D SETFDA("VAMAP","N") ;MARK AS MISSING FROM VA MAPPING FILE
|
---|
| 134 | . ; NATIONAL DRUG FILE TESTS
|
---|
| 135 | . I ($$ZVALUE("VUID","C0CD")=C0CZX)!($$ZVALUE("VUID","C0CE")=C0CZX) D ;
|
---|
| 136 | . . ;FOUND IN NATIONAL DRUG FILE OR DRUG INGREDIENT FILE
|
---|
| 137 | . . S NDFVCNT=NDFVCNT+1 ;INCREMENT VUID FOUND COUNT
|
---|
| 138 | . . I $$ZVALUE("NAME","C0CD")'=$$ZVALUE("STR") D ;NDF TEXT DOESN'T MATCH
|
---|
| 139 | . . . I $$ZVALUE("NAME","C0CE")'=$$ZVALUE("STR") D ;DRUG ING FILE ALSO
|
---|
| 140 | . . . . S NDFTCNT=NDFTCNT+1 ; INCREMENT MISMATCHED NDF TEXT COUNT
|
---|
| 141 | . . . . D SETFDA("TXTM","N") ; SET TEXT MATCH FLAG TO N
|
---|
| 142 | . . . . D SETFDA("NDF TEXT",$$ZVALUE("NAME","C0CD")) ;POST THE TEXT
|
---|
| 143 | . . . . D SETFDA("NAT DRUG TEXT",$$ZVALUE("NAME","C0CE")) ;POST TEXT
|
---|
| 144 | . E D ;
|
---|
| 145 | . . D SETFDA("NDF","N") ;MARK AS MISSING
|
---|
| 146 | . . S NDFNO=NDFNO+1 ;INCREMENT MISSING COUNT
|
---|
| 147 | . D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP
|
---|
| 148 | . S C0CFDA(176.113,"+"_C0CZX_",",.01)=C0CZX ; NEW VUID RECORD
|
---|
| 149 | . D UPDATE^DIE("","C0CFDA")
|
---|
[1586] | 150 | . I $D(^TMP("DIERR",$J)) S $EC=",U1,"
|
---|
[1544] | 151 | W "VA MAPPING VUID COUNT: ",VAVCNT,!
|
---|
| 152 | W "VA MAPPING MISSING: ",VANO,!
|
---|
| 153 | W "VA MAPPING TEXT MISMATCH: ",VATCNT,!
|
---|
| 154 | W "NDF VUID COUNT: ",NDFVCNT,!
|
---|
| 155 | W "NDF MISSING: ",NDFNO,!
|
---|
| 156 | W "NDF TEXT MISMATCH: ",NDFTCNT,!
|
---|
| 157 | Q
|
---|
| 158 | CHKNDF ; ROUTINE TO CHECK THE NATIONAL DRUG FILE WITH THE UMLS RXNORM DB
|
---|
| 159 | ; USING THE AVUID INDEX, READS ALL VUID CODES IN ^PSNDF(50.68),
|
---|
| 160 | ; CHECKS TO SEE IF THE CODE IS IN 176.001, AND CREATES A RECORD
|
---|
| 161 | ; IN 176.114
|
---|
| 162 | ; THE OBJECTIVE IS TO SEE IF ^PSNDF(50.68) HAS ALL THE VUID CODES IN THE
|
---|
| 163 | ; UMLS RXNORM DATABASE AND IF THE TEXT FIELDS MATCH
|
---|
| 164 | ; ALSO CAPTURES THE RXNORM CODE MAPPING
|
---|
| 165 | ; CHKNDF2 WILL CHECK THE OTHER DIRECTION, STARTING WITH THE 176.001 VUID INDEX
|
---|
| 166 | ; THIS ROUTINE ALSO CHECKS IF THE VUID CODE IS IN 176.111 AND IF NOT
|
---|
| 167 | ; SETS NOTMAPPED=Y
|
---|
| 168 | N C0CFDA,C0CA,C0CB,C0CC,C0CZX ;FDA WORK ARRAY, RNF ARRAYS, AND IEN ITERATOR
|
---|
| 169 | N C0CFVA,C0CFRXN,C0CPSNDF ; CLOSED ROOTS FOR SOURCE FILES
|
---|
| 170 | N C0CF ; CLOSED ROOT FOR DESTINATION FILE
|
---|
| 171 | S C0CPSNDF=$$FILEREF^C0CRNF(50.68) ; NDF CLOSED ROOT REFERENCE
|
---|
| 172 | S C0CVA=$$FILEREF^C0CRNF(176.111) ; C0C PHARMACY VA RXNORM MAPPING FILE
|
---|
| 173 | S C0CFRXN=$$FILEREF^C0CRNF(176.001) ; CLOSED ROOT FOR RXNORM CONCEPT FILE
|
---|
| 174 | ;S C0CF=$$FILEREF^C0CRNF(176.113) ; C0C RXNORM VUID MAPPING ADDITIONAL FILE
|
---|
| 175 | W C0CVA,C0CFRXN,! ;C0CF,!
|
---|
| 176 | S C0CZX=0
|
---|
| 177 | S (FOUND,MISSING)=0
|
---|
| 178 | S (NOVUID,VMATCH,NOMATCH,MISSING,FOUND,TXTMATCH,NOTM,NVAM)=0 ; COUNTERS
|
---|
| 179 | F S C0CZX=$O(^PSNDF(50.68,"AVUID",C0CZX)) Q:+C0CZX=0 D ; FOR EVERY VUID
|
---|
| 180 | . K C0CA,C0CB,C0CC,C0CD ; CLEAR ARRAYS
|
---|
| 181 | . ;D FIELDS^C0CRNF("C0CC",176.113) ;GET FIELD NAMES FOR OUTPUT FILE
|
---|
| 182 | . D GETN1^C0CRNF("C0CA",50.68,C0CZX,"AVUID","ALL") ;GET THE FIELDS
|
---|
| 183 | . I $$ZVALUE("VUID")="" D ; ERROR, SHOULD NOT HAPPEN
|
---|
| 184 | . . S NOVUID=NOVUID+1 ; FLAG THE ERROR
|
---|
| 185 | . . D PUSH^GPLXPATH("NOVUID",C0CZX) ; RECORD THE VUID
|
---|
| 186 | . D GETN1^C0CRNF("C0CD",176.001,C0CZX,"VUID","ALL") ;TRY RXNORM DB
|
---|
| 187 | . I $$ZVALUE("CODE","C0CD")=C0CZX D ; FOUND IN RXNORM
|
---|
| 188 | . . S VMATCH=VMATCH+1 ; COUNT OF PSNDF VUIDS FOUND IN RXNORM
|
---|
| 189 | . . I $$ZVALUE("NAME")=$$ZVALUE("STR","C0CD") D ;TEXT MATCHES
|
---|
| 190 | . . . S TXTMATCH=TXTMATCH+1 ; COUNT IT
|
---|
| 191 | . . E D ; TEXT DOESN'T MATCH
|
---|
| 192 | . . . S NOTM=NOTM+1 ;NO TEXT MATCH COUNTER
|
---|
| 193 | . . . S ZV=$$ZVALUE("NAME")_"^"_$$ZVALUE("STR","C0CD")
|
---|
| 194 | . . . W ZV,!
|
---|
| 195 | . . . D PUSH^GPLXPATH("TXTNM",ZV) ; RECORD THE TXT MISMATCH
|
---|
| 196 | . E S NOMATCH=NOMATCH+1 ; NOT FOUND IN RXNORM
|
---|
| 197 | . D GETN1^C0CRNF("C0CB",176.111,C0CZX,"B","ALL") ;TRY TO GET FROM 176.111
|
---|
| 198 | . I $$ZVALUE("VUID","C0CB")="" D ; VUID NOT FOUND
|
---|
| 199 | . . ;W "NOT FOUND: ",C0CZX," ",$$ZVALUE("STR")," ",$$ZVALUE("RXCUI"),!
|
---|
| 200 | . . S MISSING=MISSING+1
|
---|
| 201 | . . D PUSH^GPLXPATH("MISSING",C0CZX) ;MISSING FROM MAPPING FILE
|
---|
| 202 | . E D ; FOUND IN VA MAPPING FILE
|
---|
| 203 | . . S FOUND=FOUND+1
|
---|
| 204 | . . I $$ZVALUE("VUID TEXT","C0CB")'=$$ZVALUE("NAME") D ; TEXT DOESN'T MATCH
|
---|
| 205 | . . . S NVAM=NVAM+1 ; MAPPING FILE TEXT IS DIFFERENT THAN NDF
|
---|
| 206 | . . . S ZY=$$ZVALUE("VUID TEXT","C0CB")_"^"_$$ZVALUE("NAME") ;BOTH STRINGS
|
---|
| 207 | . . . W "VA: ",ZY,!
|
---|
| 208 | . . . D PUSH^GPLXPATH("NVAM",ZY) ;SAVE IT
|
---|
| 209 | W "MISSING IN MAPPING FILE: ",MISSING,!
|
---|
| 210 | W "FOUND IN MAPPING FILE: ",FOUND,!
|
---|
| 211 | W "FOUND IN RXNORM: ",VMATCH,!
|
---|
| 212 | W "NOT FOUND IN RXNORM: ",NOMATCH,!
|
---|
| 213 | W "ERRORS: ",NOVUID,!
|
---|
| 214 | Q
|
---|
| 215 | ;
|
---|
[1586] | 216 | D
|
---|
[1544] | 217 | . I $$ZVALUE("MEDIATION CODE")="" D
|
---|
| 218 | . . S NORXN=NORXN+1 ;
|
---|
| 219 | . E D ; PROCESS MEDIATION CODE
|
---|
| 220 | . . S HASRXN=HASRXN+1
|
---|
| 221 | . . D SETFDA("MEDIATION CODE",$$ZVALUE("MEDIATION CODE")) ;
|
---|
| 222 | . I $$ZVALUE("VUID")="" D ; BAD RECORD
|
---|
| 223 | . . S NOVUID=NOVUID+1
|
---|
| 224 | . . ;D SETFDA("VUID",$$ZVALUE("VUID"))
|
---|
| 225 | . E D SETFDA("VUID TEXT",$$ZVALUE("VUID TEXT"))
|
---|
[1586] | 226 | . ;ZWR C0CA
|
---|
[1544] | 227 | . D GETN1^C0CRNF("C0CB",176.001,$$ZVALUE("VUID"),"VUID","ALL")
|
---|
| 228 | . I $$ZVALUE("RXCUI","C0CB")'="" D ; RXNORM FOUND
|
---|
| 229 | . . S RXFOUND=RXFOUND+1
|
---|
| 230 | . . I $$ZVALUE("MEDIATION CODE")="" D ; THIS IS A NEW CODE
|
---|
| 231 | . . . D SETFDA("MEDIATION CODE",$$ZVALUE("RXCUI","C0CB"))
|
---|
| 232 | . . . D SETFDA("NEW","Y") ;FLAG RECORD HAS HAVING NEW RXNORM
|
---|
| 233 | . . W "RXNORM=",$$ZVALUE("RXCUI","C0CB")," ",$$ZVALUE("STR","C0CB"),!
|
---|
| 234 | . . W "VUID TEXT: ",$$ZVALUE("VUID TEXT"),!
|
---|
| 235 | . . I $$ZVALUE("VUID TEXT")=$$ZVALUE("STR","C0CB") S TXTMATCH=TXTMATCH+1
|
---|
| 236 | . . E D ;
|
---|
| 237 | . . . D PUSH^GPLXPATH("NOMATCH",$$ZVALUE("VUID TEXT")_"^"_$$ZVALUE("STR","C0CB"))
|
---|
| 238 | . . . D SETFDA("RXNORM TEXT",$$ZVALUE("STR","C0CB")) ;
|
---|
| 239 | . . . D SETFDA("DIFFERENT TEXT","Y") ;FLAG RECORD FOR DIFFERENT TEXT
|
---|
| 240 | . I $$ZVALUE("MEDIATION CODE")=$$ZVALUE("RXCUI","C0CB") D ;
|
---|
| 241 | . . S RXMATCH=RXMATCH+1
|
---|
| 242 | . . W "VUID=",$$ZVALUE("VUID")," MATCH RXNORM=",$$ZVALUE("MEDIATION CODE"),!
|
---|
| 243 | . D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP
|
---|
| 244 | . S C0CFDA(176.112,"+"_C0CZX_",",.01)=$$ZVALUE("VUID") ; NEW VUID RECORD
|
---|
| 245 | . D UPDATE^DIE("","C0CFDA")
|
---|
[1586] | 246 | . I $D(^TMP("DIERR",$J)) S $EC=",U1,"
|
---|
[1544] | 247 | W "HAS RXN=",HASRXN,!
|
---|
| 248 | W "NO RXN=",NORXN,!
|
---|
| 249 | W "NO VUID=",NOVUID,!
|
---|
| 250 | W "RXNORM FOUND=",RXFOUND,!
|
---|
| 251 | W "RXNORM MATCHES:",RXMATCH,!
|
---|
| 252 | W "TEXT MATCHES:",TXTMATCH,!
|
---|
| 253 | Q
|
---|
| 254 | SETFDA(C0CSN,C0CSV) ; INTERNAL ROUTINE TO MAKE AN FDA ENTRY FOR FIELD C0CSN
|
---|
| 255 | ; TO SET TO VALUE C0CSV.
|
---|
| 256 | ; C0CFDA,C0CA,C0CZX ARE ASSUMED FROM THE CALLING ROUTINE
|
---|
| 257 | ; C0CSN,C0CSV ARE PASSED BY VALUE
|
---|
| 258 | ;
|
---|
| 259 | N C0CSI,C0CSJ
|
---|
| 260 | S C0CSI=$$ZFILE(C0CSN,"C0CC") ; FILE NUMBER
|
---|
| 261 | S C0CSJ=$$ZFIELD(C0CSN,"C0CC") ; FIELD NUMBER
|
---|
| 262 | S C0CFDA(C0CSI,"+"_C0CZX_",",C0CSJ)=C0CSV
|
---|
| 263 | Q
|
---|
| 264 | ZFILE(ZFN,ZTAB) ; EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
|
---|
| 265 | ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 1 OF C0CA(ZFN)
|
---|
| 266 | ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
---|
| 267 | I '$D(ZTAB) S ZTAB="C0CA"
|
---|
| 268 | N ZR
|
---|
| 269 | I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",1)
|
---|
| 270 | E S ZR=""
|
---|
| 271 | Q ZR
|
---|
| 272 | ZFIELD(ZFN,ZTAB) ;EXTRINSIC TO RETURN FIELD NUMBER FOR FIELD NAME PASSED
|
---|
| 273 | ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 2 OF C0CA(ZFN)
|
---|
| 274 | ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
---|
| 275 | I '$D(ZTAB) S ZTAB="C0CA"
|
---|
| 276 | N ZR
|
---|
| 277 | I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",2)
|
---|
| 278 | E S ZR=""
|
---|
| 279 | Q ZR
|
---|
| 280 | ;
|
---|
| 281 | ZVALUE(ZFN,ZTAB) ;EXTRINSIC TO RETURN VALUE FOR FIELD NAME PASSED
|
---|
| 282 | ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 3 OF C0CA(ZFN)
|
---|
| 283 | ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
---|
| 284 | I '$D(ZTAB) S ZTAB="C0CA"
|
---|
| 285 | N ZR
|
---|
| 286 | I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",3)
|
---|
| 287 | E S ZR=""
|
---|
| 288 | Q ZR
|
---|
| 289 | ;
|
---|