Changeset 1630
- Timestamp:
- Nov 14, 2013, 5:40:26 PM (11 years ago)
- Location:
- ccr/trunk/rxnorm/trunk/routines
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/rxnorm/trunk/routines/C0CRXNAD.m
r1618 r1630 1 C0CRXNAD 2 ;;1.0;RX NORM;;Apr 25, 2012;Build 99 3 4 5 6 ADDDRUG(RXN,NDC,BARCODE) 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 EX 1 C0CRXNAD ; VEN/SMH - Add a drug to VISTA from RxNorm;2013-04-19 5:39 PM 2 ;;2.2;RXNORM FOR VISTA;;Nov 14, 2013;Build 8 3 ; (C) 2013 Sam Habiel 4 ; Proprietary Code. Don't use if license terms aren't supplied. 5 ; 6 ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File 7 ; Input: RXN - RxNorm Semantic Clinical Drug CUI by Value. Required. 8 ; Input: NDC - Drug NDC by Value. Optional. Pass in 11 digit format without dashes. 9 ; Input: BARCODE - Wand Barcode. Optional. Pass exactly as wand reads minus control characters. 10 ; Output: Internal Entry Number 11 ; 12 ; Prelim Checks 13 I '$G(RXN) S $EC=",U1," ; Required 14 I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1," 15 ; 16 N PSSZ S PSSZ=1 ; Needed for the drug file to let me in! 17 ; 18 ; If RXN refers to a brand drug, get the generic instead. 19 I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN) 20 W !,"(debug) RxNorm is "_RXN,! 21 ; 22 ; Get first VUID for this RxNorm drug 23 N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN) 24 Q:'VUID 25 W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,! 26 ; 27 ; IEN in 50.68 28 N C0XVUID ; For Searching Compound Index 29 S C0XVUID(1)=VUID 30 S C0XVUID(2)=1 31 N F5068IEN S F5068IEN=$$FIND1^DIC(50.68,"","XQ",.C0XVUID,"AMASTERVUID") 32 Q:'F5068IEN 33 W "F 50.68 IEN (debug): "_F5068IEN,! 34 ; 35 ; FDA Array 36 N C0XFDA 37 ; 38 ; Name, shortened 39 S C0XFDA(50,"+1,",.01)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,40) 40 ; 41 ; File BarCode as a Synonym for BCMA 42 I $L($G(BARCODE)) D 43 . S C0XFDA(50.1,"+2,+1,",.01)=BARCODE 44 . S C0XFDA(50.1,"+2,+1,",1)="Q" 45 ; 46 ; Brand Names 47 N BNS S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands 48 I $L(BNS) N I F I=1:1:$L(BNS,U) D 49 . N IENS S IENS=I+2 50 . S C0XFDA(50.1,"+"_IENS_",+1,",.01)=$$UP^XLFSTR($E($P(BNS,U,I),1,40)) 51 . S C0XFDA(50.1,"+"_IENS_",+1,",1)="T" 52 ; 53 ; NDC (string) 54 I $G(NDC) S C0XFDA(50,"+1,",31)=$E(NDC,1,5)_"-"_$E(NDC,6,9)_"-"_$E(NDC,10,11) 55 ; 56 ; Dispense Unit (string) 57 S C0XFDA(50,"+1,",14.5)=$$GET1^DIQ(50.68,F5068IEN,"VA DISPENSE UNIT") 58 ; 59 ; National Drug File Entry (pointer to 50.6) 60 S C0XFDA(50,"+1,",20)="`"_$$GET1^DIQ(50.68,F5068IEN,"VA GENERIC NAME","I") 61 ; 62 ; VA Product Name (string) 63 S C0XFDA(50,"+1,",21)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,70) 64 ; 65 ; PSNDF VA PRODUCT NAME ENTRY (pointer to 50.68) 66 S C0XFDA(50,"+1,",22)="`"_F5068IEN 67 ; 68 ; DEA, SPECIAL HDLG (string) 69 D ; From ^PSNMRG 70 . N CS S CS=$$GET1^DIQ(50.68,F5068IEN,"CS FEDERAL SCHEDULE","I") 71 . S CS=$S(CS?1(1"2n",1"3n"):+CS_"C",+CS=2!(+CS=3)&(CS'["C"):+CS_"A",1:CS) 72 . S C0XFDA(50,"+1,",3)=CS 73 ; 74 ; NATIONAL DRUG CLASS (pointer to 50.605) (triggers VA Classification field) 75 S C0XFDA(50,"+1,",25)="`"_$$GET1^DIQ(50.68,F5068IEN,"PRIMARY VA DRUG CLASS","I") 76 ; 77 ; Right Now, I don't file the following which ^PSNMRG does (cuz I don't need them) 78 ; - Package Size (derived from NDC/UPN file) 79 ; - Package Type (ditto) 80 ; - CMOP ID (from $$PROD2^PSNAPIS) 81 ; - National Formulary Indicator (from 50.68) 82 ; 83 ; Next Step is to kill Old OI if Dosage Form doesn't match 84 ; Won't do that here as it's assumed any drugs that's added is new. 85 ; This happens at ^PSNPSS 86 ; 87 ; Now add drug to drug file, as we need the IEN for the dosages call. 88 N C0XERR,C0XIEN 89 D UPDATE^DIE("E","C0XFDA","C0XIEN","C0XERR") 90 S:$D(C0XERR) $EC=",U1," 91 ; 92 ; Next Step: Kill off old doses and add new ones. 93 D EN2^PSSUTIL(C0XIEN(1)) 94 ; 95 ; Mark uses for the Drug; use the undocumented Silent call in PSSGIU 96 N PSIUDA,PSIUX ; Expected Input variables 97 S PSIUDA=C0XIEN(1),PSIUX="O^Outpatient Pharmacy" D ENS^PSSGIU 98 S PSIUDA=C0XIEN(1),PSIUX="U^Unit Dose" D ENS^PSSGIU 99 S PSIUDA=C0XIEN(1),PSIUX="X^Non-VA Med" D ENS^PSSGIU 100 ; 101 ; Get VA Generic text and VA Product pointer for Orderable Item creation plus dosage form information 102 N VAGENP S VAGENP=$P(^PSDRUG(C0XIEN(1),"ND"),U) ; VA Generic Pointer 103 N VAGEN S VAGEN=$$VAGN^PSNAPIS(VAGENP) ; VA Generic Full name 104 N VAPRODP S VAPRODP=$P(^PSDRUG(C0XIEN(1),"ND"),U,3) ; VA Product Pointer 105 N DOSAGE S DOSAGE=$$PSJDF^PSNAPIS(0,VAPRODP) ; IEN of dose form in 50.606 ^ Text 106 N DOSEPTR S DOSEPTR=$P(DOSAGE,U) ; ditto 107 N DOSEFORM S DOSEFORM=$P(DOSAGE,U,2) ;ditto 108 ; 109 ; Get the (possibly new) Orderable Item Text 110 N VAG40 S VAG40=$E(VAGEN,1,40) ; Max length of .01 field 111 ; 112 ; See if there is an existing orderable item already. If so, populate the Pharmacy Orderable item on drug file. 113 N OI S OI=$O(^PS(50.7,"ADF",VAG40,DOSEPTR,"")) 114 ; 115 ; Otherwise, add a new one. (See MCHAN+12^PSSPOIMN) 116 I 'OI D 117 . N C0XFDA,C0XERR 118 . S C0XFDA(50.7,"+1,",.01)=VAG40 119 . S C0XFDA(50.7,"+1,",.02)=DOSEPTR 120 . D UPDATE^DIE("",$NA(C0XFDA),$NA(OI),$NA(C0XERR)) 121 . I $D(C0XERR) S $EC=",U1," 122 . S OI=OI(1) ; For ease of use... 123 . ; Next two statements: See FIN^PSSPOIM1 and MF^PSSDEE. 124 . D EN^PSSPOIDT(OI) ; Update Indexes; activations, etc. 125 . D EN2^PSSHL1(OI,"MUP") ; Send HL7 message to CPRS 126 ; 127 ; Finally, add the orderable Item to the drug file. 128 N C0XFDA,C0XERR S C0XFDA(50,C0XIEN(1)_",",2.1)=OI ; Orderable Item 129 D FILE^DIE("",$NA(C0XFDA),$NA(C0XERR)) 130 S:$D(C0XERR) $EC=",U1," 131 ; 132 EX QUIT C0XIEN(1) -
ccr/trunk/rxnorm/trunk/routines/C0CRXNLK.m
r1617 r1630 1 C0CRXNLK ; VEN/SMH - RxNorm Lookup Utilities ;2013- 04-10 7:01PM2 ;; 1.0;RX NORM;;Apr 25, 2012;Build 991 C0CRXNLK ; VEN/SMH - RxNorm Lookup Utilities ;2013-11-14 2:43 PM 2 ;;2.2;RXNORM FOR VISTA;;Nov 14, 2013;Build 8 3 3 ;(c) Sam Habiel 2013 4 4 ; See accompanying license. Don't use otherwise. … … 10 10 QUIT 11 11 ; 12 EXIST(RXN) 12 EXIST(RXN) ; $$ Public - Does this RxNorm CUI exist? 13 13 ; Input: RxNorm CUI by value 14 14 ; Output: Extrinsic … … 22 22 Q ^(IEN) 23 23 ; 24 GCN2RXNT ; @TEST - Test Get RxNorm CUI using GCN 24 GCN2RXNT ; @TEST - Test Get RxNorm CUI using GCN 25 Q:'$D(^C0CRXN(176.001,"STC","NDDF")) 25 26 N L F L=1:1 N LN S LN=$T(GCN2RXND+L) Q:LN["<<END>>" Q:LN="" D 26 27 . N GCN S GCN=$P(LN,";",3) … … 29 30 QUIT 30 31 ; 31 GCN2RXND 32 GCN2RXND ; @DATA - Data for Tests ;;GCN;EXPECTED RXNCUI 32 33 ;;16033;991632 33 34 ;;8208;310429 … … 35 36 ;;18;197604 36 37 ;;346;884173 38 ;;<<END>> 39 ; 40 ; 41 ; 42 RXN2GCN(RXNCUI) ; $$ Public - Get GCN(s) given an RxNorm Number 43 ; Input: RXNCUI by Value 44 ; Output: Caret delimited Extrinsic 45 N GCNS S GCNS="" 46 N I S I="" 47 F S I=$O(^C0CRXN(176.001,"STX","NDDF","CDC",RXNCUI,I)) Q:I="" S GCNS=GCNS_+^(I)_U ; + b/c we want the GCN w/o leading zeros 48 S GCNS=$E(GCNS,1,$L(GCNS)-1) ; remove trailing ^ 49 Q GCNS 50 ; 51 RXN2GCNT ; @TEST - Test Get GCN from RXNCUI 52 Q:'$D(^C0CRXN(176.001,"STX","NDDF")) 53 N L F L=1:1 N LN S LN=$T(RXN2GCND+L) Q:LN["<<END>>" Q:LN="" D 54 . N RXN S RXN=$P(LN,";",3) 55 . N GCN S GCN=$P(LN,";",4) 56 . D CHKEQ^XTMUNIT($$RXN2GCN(RXN),GCN,"Translation from RXCUI to GCN failed") 57 QUIT 58 ; 59 ; 60 RXN2GCND ; @DATA - Data for Tests ;;RXNORM CUI;Expected GCN; Human Readable Drug name for dear reader 61 ;;998689;5145;Acetabulol 200mg tab 62 ;;745679;5037;Albuterol Inhaler 63 ;;197320;2536;Allopurinol 300mg tab 64 ;;993691;3948^46236;Bupropion 75mg tab 65 ;;197591;3768;Diazepam 5mg tab 37 66 ;;<<END>> 38 67 ; … … 50 79 Q C0PVUID 51 80 ; 52 RXN2VUIT 81 RXN2VUIT ; @TEST - Get VUIDs given RxNorm values 53 82 N L F L=1:1 N LN S LN=$T(RXN2VUID+L) Q:LN["<<END>>" Q:LN="" D 54 83 . N RXN S RXN=$P(LN,";",3) … … 57 86 QUIT 58 87 ; 59 RXN2VUID 88 RXN2VUID ; @DATA - Data items for previous test 60 89 ;;991632;4006455 61 90 ;;310429;4002369^4013941 … … 76 105 Q O 77 106 ; 78 VUI2VAPT 107 VUI2VAPT ; @TEST - Get VA Product IEN from VUID 79 108 N L F L=1:1 N LN S LN=$T(VUI2VAPD+L) Q:LN["<<END>>" Q:LN="" D 80 109 . N VUID S VUID=$P(LN,";",3) … … 83 112 QUIT 84 113 ; 85 VUI2VAPD 114 VUI2VAPD ; @DATA - Data for above test 86 115 ;;4006455;5932 87 116 ;;4002369;1784 … … 112 141 ; 113 142 ; 114 RXN2MEDS(RXNCUI) 143 RXN2MEDS(RXNCUI) ; $$ Public - Convert RxNorm value to currently existing drugs in File 50. 115 144 ; Input: SCD RXNCUI 116 145 ; Output; Caret delimited extrinsic … … 123 152 . N VUID S VUID=$P(VUIDS,U,I) 124 153 . N VAPRODS S VAPRODS=$$VUI2VAP(VUID) ; Get VA Product from VUID (multiple products per VUID) 125 . I '$L(VAPRODS) S ^SAM(RXNCUI)="TELL SAM",DONE=1 QUIT; MUST EXIST. Every VUID must have a product to go with it.154 . I '$L(VAPRODS) S $ECODE=",U-NO-VA-PRODUCT-CORRUPT-NDF," ; MUST EXIST. Every VUID must have a product to go with it. 126 155 . N J F J=1:1:$L(VAPRODS,U) D Q:DONE 127 156 . . N VAPROD S VAPROD=$P(VAPRODS,U,J) … … 138 167 ; 139 168 FDI2RXNT ; @TEST - Test Get RxNorm CUI for FDB Ingredient/Base 169 Q:'$D(^C0CRXN(176.001,"STC","NDDF")) 140 170 D CHKEQ^XTMUNIT($$FDI2RXN(14739),1362160,"$$FDI2RXN failed") 141 171 QUIT … … 162 192 Q C0PIEN_"^"_C0P01 163 193 ; 164 VIN2VAGT 194 VIN2VAGT ; @TEST - Test Get VA Generic for VUID Ingredient 165 195 D CHKEQ^XTMUNIT(+$$VIN2VAG(4023636),2832,"$$VIN2VAG failed") 166 196 QUIT … … 202 232 QUIT RXNS 203 233 ; 204 MED2RXN(DA) ; $$ Public - Get RxNorm CUI for Drug 234 VUI2GCN(VUID) ; $$ Public - Get GCNs for a given VUID (any VUID type) 235 ; Input: VUID by Value 236 ; Output: GCNs delimited by ^ 237 ; TODO: Unit Test 238 N RXNS S RXNS=$$VUI2RXN(VUID) 239 N GCNS S GCNS="" 240 N I F I=1:1:$L(RXNS,U) S GCNS=GCNS_$$RXN2GCN($P(RXNS,U,I))_U 241 S GCNS=$E(GCNS,1,$L(GCNS)-1) 242 QUIT GCNS 243 ; 244 MED2RXN(DA) ; $$ Public - Get RxNorm CUI for Drug 205 245 ; Input: DA - Medication IEN 206 246 ; Output: RXNCUIs delimited by ^ … … 212 252 Q $$VUI2RXN(VUID) 213 253 ; 214 MED2SCDN(DA) 254 MED2SCDN(DA) ; $$ Public - Medication to Semantic Clinical Drug Name 215 255 ; Input: DA - Medication IEN 216 256 ; Output: The Canonical Semantic Clinical Drug name … … 239 279 ; --- 240 280 ; 241 NDC2RXN(NDC) 281 NDC2RXN(NDC) ; $$ Public - Get RxCUI given the NDC 242 282 ; NB: Will only work if passed NDC is in 5-4-2 format. 243 283 ; Input: NDC By Value in 5-4-2 Format … … 246 286 N IEN S IEN=$O(^C0CRXN(176.002,"ASAA","RXNORM","NDC",NDC,"")) Q ^(IEN) 247 287 ; 248 NDC2RXNT 288 NDC2RXNT ; @TEST - Test Get RxCUI given the NDC 249 289 D CHKEQ^XTMUNIT($$NDC2RXN("30142-0917-71"),198439,"$$NDC2RXN failed") 250 290 QUIT … … 252 292 ; --- 253 293 ; 254 ISBRAND(RXN) 294 ISBRAND(RXN) ; $$ Public - Is this RxCUI for a brand drug? 255 295 ; Input: RxCUI 256 296 ; Output: 0 or 1 257 297 Q ''$D(^C0CRXN(176.001,"STC","RXNORM","SBD",RXN)) 258 ISBRANDT 298 ISBRANDT ; @TEST - Test Is this RxCUI for a brand drug? 259 299 D CHKEQ^XTMUNIT($$ISBRAND(205535),1,"$$ISBRAND failed") ; Brand Prozac 260 300 D CHKEQ^XTMUNIT($$ISBRAND(310384),0,"$$ISBRAND failed") ; Generic Fluoxetine … … 263 303 ; --- 264 304 ; 265 BR2GEN(RXN) 305 BR2GEN(RXN) ; $$ Public - Convert Brand RxCUI to Generic RxCUI (many to 1) 266 306 ; Input: RxCUI of Brand 267 307 ; Output: RxCUI of Generic 268 308 Q $O(^C0CRXN(176.005,"B",RXN,"has_tradename","")) 269 BR2GENT 309 BR2GENT ; @TEST - Test Convert Brand RxCUI to Generic RxCUI (many to 1) 270 310 D CHKEQ^XTMUNIT($$BR2GEN(205535),310384,"$$BR2GEN failed") 271 311 QUIT … … 273 313 ; --- 274 314 ; 275 GEN2BR(RXN) 315 GEN2BR(RXN) ; $$ Public - Convert Generic RxCUI to Brand RxCUIs (1 to many). 276 316 N RTN S RTN="" ; Return 277 317 N I S I="" F S I=$O(^C0CRXN(176.005,"B",RXN,"tradename_of",I)) Q:'I S RTN=RTN_I_U … … 279 319 Q RTN 280 320 ; 281 GEN2BRT 321 GEN2BRT ; @TEST - Test Convert Generic RxCUI to Brand RxCUIs (1 to many). 282 322 D CHKTF^XTMUNIT($$GEN2BR(310384)[205535,"$$GEN2BR failed") 283 323 QUIT … … 285 325 ; --- 286 326 ; 287 RXN2BNS(RXN) 327 RXN2BNS(RXN) ; $$ Public - Get all Brand Names associated with an RXN 288 328 N BNS S BNS="" 289 329 I $$ISBRAND(RXN) S RXN=$$BR2GEN(RXN) … … 297 337 . S BNS=BNS_$P(^C0CRXN(176.001,BNIEN,0),U,15)_U 298 338 QUIT $E(BNS,1,$L(BNS)-1) 299 RXN2BNST 339 RXN2BNST ; @TEST - Test Get all Brand Names associated with an RXN 300 340 D CHKTF^XTMUNIT($$RXN2BNS(205535)["Prozac","$$RXN2BNS failed") 301 341 QUIT 342 ; 343 ; --- 344 ; 345 RXN2NDC(RXN) ; Get NDC codes for RxNorm code 346 N NDCS S NDCS="" 347 N I F I=0:0 S I=$O(^C0CRXN(176.002,"ASAR","RXNORM","NDC",RXN,I)) Q:'I S NDCS=NDCS_^(I)_"^" 348 S $E(NDCS,$L(NDCS))="" 349 QUIT NDCS 350 RXN2NDCT ; @TEST - Test Get NDC codes for RxNorm code 351 D CHKTF^XTMUNIT($$RXN2NDC(197379)["^"_16714003309,"$$RXN2NDC failed") 352 QUIT -
ccr/trunk/rxnorm/trunk/routines/C0CRXNRD.m
r1615 r1630 1 C0CRXNRD ; VEN/SMH - RxNorm Utilities: Routine to Read RxNorm files;2013- 03-06 4:32PM2 ;;2. 0;RX NORM;;May 11, 2012;Build 501 C0CRXNRD ; VEN/SMH - RxNorm Utilities: Routine to Read RxNorm files;2013-11-14 1:23 PM 2 ;;2.2;RXNORM FOR VISTA;;Nov 14, 2013;Build 8 3 3 ; (C) Sam Habiel 2013 4 4 ; See license for terms of use. 5 5 ; 6 6 W "No entry from top" Q 7 IMPORT(PATH ); PUBLIC ENTRY POINT. Rest are private7 IMPORT(PATH,RESTRICTED) ; PUBLIC ENTRY POINT. Rest are private 8 8 I PATH="" QUIT 9 S RESTRICTED=$G(RESTRICTED,0) 9 10 S U="^" 10 11 N STARTTIME S STARTTIME=$P($H,",")*24*60*60+$P($H,",",2) 11 D SAB(PATH),CONSO(PATH),SAT(PATH),STY(PATH),REL(PATH),DOC(PATH) 12 N SABS 13 D SAB(PATH,.SABS) ; Load restriction values into SAB. ; 176.006 14 D CONSO(PATH,.SABS,RESTRICTED),SAT(PATH,.SABS,RESTRICTED) ; 176.001,176.002 15 D STY(PATH),REL(PATH),DOC(PATH) ; 176.003-5 12 16 N ENDTIME S ENDTIME=$P($H,",")*24*60*60+$P($H,",",2) 13 17 W !,(ENDTIME-STARTTIME)/60_" minutes elapsed" … … 25 29 QUIT 26 30 GETLINES(PATH,FILENAME) ; Get number of lines in a file 31 N POP 27 32 D OPEN^%ZISH("FILE",PATH,FILENAME,"R") 33 Q:POP 28 34 U IO 29 35 N I,LINE … … 31 37 D CLOSE^%ZISH("FILE") 32 38 Q I-1 33 CONSO(PATH, INCRES) ; Open and read concepts file: RXNCONSO.RRF39 CONSO(PATH,SABS,RESTRICTED) ; Open and read concepts file: RXNCONSO.RRF 34 40 ; PATH ByVal, path of RxNorm files 35 ; INCRES ByVal, include restricted sources. 1 for yes, 0 for no 41 ; SABS ByRef, arrays of SABS(SAB)=restriction level 42 ; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no 36 43 I PATH="" QUIT 37 S INCRES=+$G(INCRES) ; if not passed, becomes zero.38 44 N FILENAME S FILENAME="RXNCONSO.RRF" 39 45 D DELFILED(176.001) ; delete data … … 48 54 . IF $$STATUS^%ZISH QUIT 49 55 . I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000 56 . ; 57 . ; Deal with restriction level 58 . N SAB S SAB=$P(LINE,"|",12) 59 . I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit 60 . ; 61 . ; Save data 50 62 . S ^C0CRXN(176.001,C0CCOUNT,0)=$TR(LINE,"|^","^|") 51 . ; TODO Implement Filtering:52 . ; If the source is a restricted source, decide what to do based on what's asked.53 . ; N SRCIEN S SRCIEN=$$FIND1^DIC(176.003,"","QX",SAB,"B") ; SrcIEN in RXNORM SOURCES file54 . ; N RESTRIC S RESTRIC=$$GET1^DIQ(176.003,SRCIEN,14,"I") ; 14 is restriction field; values 0-455 . ; If RESTRIC is zero, then it's unrestricted. Everything else is restricted.56 . ; If user didn't ask to include restricted sources, and the source is restricted, then quit57 . ; I 'INCRES,RESTRIC QUIT58 63 EX D CLOSE^%ZISH("FILE") 59 64 N DIK S DIK="^C0CRXN(176.001," D IXALL^DIK … … 61 66 ; 62 67 ; 63 SAT(PATH) ; Open and read Concept and Atom attributes: RXNSAT.RRF 68 SAT(PATH,SABS,RESTRICTED) ; Open and read Concept and Atom attributes: RXNSAT.RRF 69 ; PATH ByVal, path of RxNorm files 70 ; SABS ByRef, arrays of SABS(SAB)=restriction level 71 ; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no 64 72 I PATH="" QUIT 65 73 N FILENAME S FILENAME="RXNSAT.RRF" … … 82 90 . S $P(LINE,"|",9)=RXCUI1 83 91 . ; 92 . ; Deal with restricted sources 93 . N SAB S SAB=$P(LINE,"|",10) 94 . I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit 95 . ; 84 96 . ; Save off 85 97 . S ^C0CRXN(176.002,C0CCOUNT,0)=$TR(LINE,"|^","^|") … … 89 101 ; 90 102 ; 91 SAB(PATH ) ; Open the read RxNorm Sources file: RXNSAB.RRF103 SAB(PATH,SABS) ; Open the read RxNorm Sources file: RXNSAB.RRF 92 104 I PATH="" QUIT 93 105 N FILENAME S FILENAME="RXNSAB.RRF" … … 109 121 EX3 D CLOSE^%ZISH("FILE") 110 122 N DIK S DIK="^C0CRXN(176.003," D IXALL^DIK 123 N C0CI F C0CI=0:0 S C0CI=$O(^C0CRXN(176.003,C0CI)) Q:'C0CI D 124 . S SABS($$GET1^DIQ(176.003,C0CI,.01))=$$GET1^DIQ(176.003,C0CI,"SRL") 111 125 QUIT 112 126 STY(PATH) ; Open and read RxNorm Semantic types file: RXNSTY.RRF
Note:
See TracChangeset
for help on using the changeset viewer.