2.5 version of RxNorm package
This commit is contained in:
parent
6e277d3a84
commit
3a8d6017d5
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,11 @@
|
||||||
|
v 2.5
|
||||||
|
|
||||||
|
This version is a cumulative version that provides the following changes:
|
||||||
|
|
||||||
|
- Any row in the tables with a SUPPRESS value of O, Y or E is not imported.
|
||||||
|
This data has been deemed obsolete or unreliable and should not be used.
|
||||||
|
- Data loader loads the data in 2 threads.
|
||||||
|
- Unit Tests moved to the OSEHRA Unit Testing Framework
|
||||||
|
- New APIs for translating VUIDs to RxNorm values:
|
||||||
|
-- $$VUI2RXN^C0CRXNLK(VUID,TTY) -> VUID to RxNorm
|
||||||
|
-- $$LVUID^C0CRXNLK(RXN) -> RxNorm to VUID
|
|
@ -1,132 +1,132 @@
|
||||||
C0CRXNAD ; VEN/SMH - Add a drug to VISTA from RxNorm;2013-04-19 5:39 PM
|
C0CRXNAD ; VEN/SMH - Add a drug to VISTA from RxNorm;2013-04-19 5:39 PM
|
||||||
;;2.3;RXNORM FOR VISTA;;Jul 22, 2014;Build 10
|
;;2.5;RXNORM FOR VISTA;;Apr 27, 2016;Build 17
|
||||||
; (C) 2013 Sam Habiel
|
; (C) 2013 Sam Habiel
|
||||||
; Proprietary Code. Don't use if license terms aren't supplied.
|
; Proprietary Code. Don't use if license terms aren't supplied.
|
||||||
;
|
;
|
||||||
ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
|
ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
|
||||||
; Input: RXN - RxNorm Semantic Clinical Drug CUI by Value. Required.
|
; Input: RXN - RxNorm Semantic Clinical Drug CUI by Value. Required.
|
||||||
; Input: NDC - Drug NDC by Value. Optional. Pass in 11 digit format without dashes.
|
; Input: NDC - Drug NDC by Value. Optional. Pass in 11 digit format without dashes.
|
||||||
; Input: BARCODE - Wand Barcode. Optional. Pass exactly as wand reads minus control characters.
|
; Input: BARCODE - Wand Barcode. Optional. Pass exactly as wand reads minus control characters.
|
||||||
; Output: Internal Entry Number
|
; Output: Internal Entry Number
|
||||||
;
|
;
|
||||||
; Prelim Checks
|
; Prelim Checks
|
||||||
I '$G(RXN) S $EC=",U1," ; Required
|
I '$G(RXN) S $EC=",U1," ; Required
|
||||||
I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1,"
|
I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1,"
|
||||||
;
|
;
|
||||||
N PSSZ S PSSZ=1 ; Needed for the drug file to let me in!
|
N PSSZ S PSSZ=1 ; Needed for the drug file to let me in!
|
||||||
;
|
;
|
||||||
; If RXN refers to a brand drug, get the generic instead.
|
; If RXN refers to a brand drug, get the generic instead.
|
||||||
I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN)
|
I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN)
|
||||||
W !,"(debug) RxNorm is "_RXN,!
|
W !,"(debug) RxNorm is "_RXN,!
|
||||||
;
|
;
|
||||||
; Get first VUID for this RxNorm drug
|
; Get first VUID for this RxNorm drug
|
||||||
N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN)
|
N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN)
|
||||||
Q:'VUID
|
Q:'VUID
|
||||||
W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,!
|
W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,!
|
||||||
;
|
;
|
||||||
; IEN in 50.68
|
; IEN in 50.68
|
||||||
N C0XVUID ; For Searching Compound Index
|
N C0XVUID ; For Searching Compound Index
|
||||||
S C0XVUID(1)=VUID
|
S C0XVUID(1)=VUID
|
||||||
S C0XVUID(2)=1
|
S C0XVUID(2)=1
|
||||||
N F5068IEN S F5068IEN=$$FIND1^DIC(50.68,"","XQ",.C0XVUID,"AMASTERVUID")
|
N F5068IEN S F5068IEN=$$FIND1^DIC(50.68,"","XQ",.C0XVUID,"AMASTERVUID")
|
||||||
Q:'F5068IEN
|
Q:'F5068IEN
|
||||||
W "F 50.68 IEN (debug): "_F5068IEN,!
|
W "F 50.68 IEN (debug): "_F5068IEN,!
|
||||||
;
|
;
|
||||||
; FDA Array
|
; FDA Array
|
||||||
N C0XFDA
|
N C0XFDA
|
||||||
;
|
;
|
||||||
; Name, shortened
|
; Name, shortened
|
||||||
S C0XFDA(50,"+1,",.01)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,40)
|
S C0XFDA(50,"+1,",.01)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,40)
|
||||||
;
|
;
|
||||||
; File BarCode as a Synonym for BCMA
|
; File BarCode as a Synonym for BCMA
|
||||||
I $L($G(BARCODE)) D
|
I $L($G(BARCODE)) D
|
||||||
. S C0XFDA(50.1,"+2,+1,",.01)=BARCODE
|
. S C0XFDA(50.1,"+2,+1,",.01)=BARCODE
|
||||||
. S C0XFDA(50.1,"+2,+1,",1)="Q"
|
. S C0XFDA(50.1,"+2,+1,",1)="Q"
|
||||||
;
|
;
|
||||||
; Brand Names
|
; Brand Names
|
||||||
N BNS S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands
|
N BNS S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands
|
||||||
I $L(BNS) N I F I=1:1:$L(BNS,U) D
|
I $L(BNS) N I F I=1:1:$L(BNS,U) D
|
||||||
. N IENS S IENS=I+2
|
. N IENS S IENS=I+2
|
||||||
. S C0XFDA(50.1,"+"_IENS_",+1,",.01)=$$UP^XLFSTR($E($P(BNS,U,I),1,40))
|
. S C0XFDA(50.1,"+"_IENS_",+1,",.01)=$$UP^XLFSTR($E($P(BNS,U,I),1,40))
|
||||||
. S C0XFDA(50.1,"+"_IENS_",+1,",1)="T"
|
. S C0XFDA(50.1,"+"_IENS_",+1,",1)="T"
|
||||||
;
|
;
|
||||||
; NDC (string)
|
; NDC (string)
|
||||||
I $G(NDC) S C0XFDA(50,"+1,",31)=$E(NDC,1,5)_"-"_$E(NDC,6,9)_"-"_$E(NDC,10,11)
|
I $G(NDC) S C0XFDA(50,"+1,",31)=$E(NDC,1,5)_"-"_$E(NDC,6,9)_"-"_$E(NDC,10,11)
|
||||||
;
|
;
|
||||||
; Dispense Unit (string)
|
; Dispense Unit (string)
|
||||||
S C0XFDA(50,"+1,",14.5)=$$GET1^DIQ(50.68,F5068IEN,"VA DISPENSE UNIT")
|
S C0XFDA(50,"+1,",14.5)=$$GET1^DIQ(50.68,F5068IEN,"VA DISPENSE UNIT")
|
||||||
;
|
;
|
||||||
; National Drug File Entry (pointer to 50.6)
|
; National Drug File Entry (pointer to 50.6)
|
||||||
S C0XFDA(50,"+1,",20)="`"_$$GET1^DIQ(50.68,F5068IEN,"VA GENERIC NAME","I")
|
S C0XFDA(50,"+1,",20)="`"_$$GET1^DIQ(50.68,F5068IEN,"VA GENERIC NAME","I")
|
||||||
;
|
;
|
||||||
; VA Product Name (string)
|
; VA Product Name (string)
|
||||||
S C0XFDA(50,"+1,",21)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,70)
|
S C0XFDA(50,"+1,",21)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,70)
|
||||||
;
|
;
|
||||||
; PSNDF VA PRODUCT NAME ENTRY (pointer to 50.68)
|
; PSNDF VA PRODUCT NAME ENTRY (pointer to 50.68)
|
||||||
S C0XFDA(50,"+1,",22)="`"_F5068IEN
|
S C0XFDA(50,"+1,",22)="`"_F5068IEN
|
||||||
;
|
;
|
||||||
; DEA, SPECIAL HDLG (string)
|
; DEA, SPECIAL HDLG (string)
|
||||||
D ; From ^PSNMRG
|
D ; From ^PSNMRG
|
||||||
. N CS S CS=$$GET1^DIQ(50.68,F5068IEN,"CS FEDERAL SCHEDULE","I")
|
. N CS S CS=$$GET1^DIQ(50.68,F5068IEN,"CS FEDERAL SCHEDULE","I")
|
||||||
. S CS=$S(CS?1(1"2n",1"3n"):+CS_"C",+CS=2!(+CS=3)&(CS'["C"):+CS_"A",1:CS)
|
. S CS=$S(CS?1(1"2n",1"3n"):+CS_"C",+CS=2!(+CS=3)&(CS'["C"):+CS_"A",1:CS)
|
||||||
. S C0XFDA(50,"+1,",3)=CS
|
. S C0XFDA(50,"+1,",3)=CS
|
||||||
;
|
;
|
||||||
; NATIONAL DRUG CLASS (pointer to 50.605) (triggers VA Classification field)
|
; NATIONAL DRUG CLASS (pointer to 50.605) (triggers VA Classification field)
|
||||||
S C0XFDA(50,"+1,",25)="`"_$$GET1^DIQ(50.68,F5068IEN,"PRIMARY VA DRUG CLASS","I")
|
S C0XFDA(50,"+1,",25)="`"_$$GET1^DIQ(50.68,F5068IEN,"PRIMARY VA DRUG CLASS","I")
|
||||||
;
|
;
|
||||||
; Right Now, I don't file the following which ^PSNMRG does (cuz I don't need them)
|
; Right Now, I don't file the following which ^PSNMRG does (cuz I don't need them)
|
||||||
; - Package Size (derived from NDC/UPN file)
|
; - Package Size (derived from NDC/UPN file)
|
||||||
; - Package Type (ditto)
|
; - Package Type (ditto)
|
||||||
; - CMOP ID (from $$PROD2^PSNAPIS)
|
; - CMOP ID (from $$PROD2^PSNAPIS)
|
||||||
; - National Formulary Indicator (from 50.68)
|
; - National Formulary Indicator (from 50.68)
|
||||||
;
|
;
|
||||||
; Next Step is to kill Old OI if Dosage Form doesn't match
|
; Next Step is to kill Old OI if Dosage Form doesn't match
|
||||||
; Won't do that here as it's assumed any drugs that's added is new.
|
; Won't do that here as it's assumed any drugs that's added is new.
|
||||||
; This happens at ^PSNPSS
|
; This happens at ^PSNPSS
|
||||||
;
|
;
|
||||||
; Now add drug to drug file, as we need the IEN for the dosages call.
|
; Now add drug to drug file, as we need the IEN for the dosages call.
|
||||||
N C0XERR,C0XIEN
|
N C0XERR,C0XIEN
|
||||||
D UPDATE^DIE("E","C0XFDA","C0XIEN","C0XERR")
|
D UPDATE^DIE("E","C0XFDA","C0XIEN","C0XERR")
|
||||||
S:$D(C0XERR) $EC=",U1,"
|
S:$D(C0XERR) $EC=",U1,"
|
||||||
;
|
;
|
||||||
; Next Step: Kill off old doses and add new ones.
|
; Next Step: Kill off old doses and add new ones.
|
||||||
D EN2^PSSUTIL(C0XIEN(1))
|
D EN2^PSSUTIL(C0XIEN(1))
|
||||||
;
|
;
|
||||||
; Mark uses for the Drug; use the undocumented Silent call in PSSGIU
|
; Mark uses for the Drug; use the undocumented Silent call in PSSGIU
|
||||||
N PSIUDA,PSIUX ; Expected Input variables
|
N PSIUDA,PSIUX ; Expected Input variables
|
||||||
S PSIUDA=C0XIEN(1),PSIUX="O^Outpatient Pharmacy" D ENS^PSSGIU
|
S PSIUDA=C0XIEN(1),PSIUX="O^Outpatient Pharmacy" D ENS^PSSGIU
|
||||||
S PSIUDA=C0XIEN(1),PSIUX="U^Unit Dose" D ENS^PSSGIU
|
S PSIUDA=C0XIEN(1),PSIUX="U^Unit Dose" D ENS^PSSGIU
|
||||||
S PSIUDA=C0XIEN(1),PSIUX="X^Non-VA Med" D ENS^PSSGIU
|
S PSIUDA=C0XIEN(1),PSIUX="X^Non-VA Med" D ENS^PSSGIU
|
||||||
;
|
;
|
||||||
; Get VA Generic text and VA Product pointer for Orderable Item creation plus dosage form information
|
; Get VA Generic text and VA Product pointer for Orderable Item creation plus dosage form information
|
||||||
N VAGENP S VAGENP=$P(^PSDRUG(C0XIEN(1),"ND"),U) ; VA Generic Pointer
|
N VAGENP S VAGENP=$P(^PSDRUG(C0XIEN(1),"ND"),U) ; VA Generic Pointer
|
||||||
N VAGEN S VAGEN=$$VAGN^PSNAPIS(VAGENP) ; VA Generic Full name
|
N VAGEN S VAGEN=$$VAGN^PSNAPIS(VAGENP) ; VA Generic Full name
|
||||||
N VAPRODP S VAPRODP=$P(^PSDRUG(C0XIEN(1),"ND"),U,3) ; VA Product Pointer
|
N VAPRODP S VAPRODP=$P(^PSDRUG(C0XIEN(1),"ND"),U,3) ; VA Product Pointer
|
||||||
N DOSAGE S DOSAGE=$$PSJDF^PSNAPIS(0,VAPRODP) ; IEN of dose form in 50.606 ^ Text
|
N DOSAGE S DOSAGE=$$PSJDF^PSNAPIS(0,VAPRODP) ; IEN of dose form in 50.606 ^ Text
|
||||||
N DOSEPTR S DOSEPTR=$P(DOSAGE,U) ; ditto
|
N DOSEPTR S DOSEPTR=$P(DOSAGE,U) ; ditto
|
||||||
N DOSEFORM S DOSEFORM=$P(DOSAGE,U,2) ;ditto
|
N DOSEFORM S DOSEFORM=$P(DOSAGE,U,2) ;ditto
|
||||||
;
|
;
|
||||||
; Get the (possibly new) Orderable Item Text
|
; Get the (possibly new) Orderable Item Text
|
||||||
N VAG40 S VAG40=$E(VAGEN,1,40) ; Max length of .01 field
|
N VAG40 S VAG40=$E(VAGEN,1,40) ; Max length of .01 field
|
||||||
;
|
;
|
||||||
; See if there is an existing orderable item already. If so, populate the Pharmacy Orderable item on drug file.
|
; See if there is an existing orderable item already. If so, populate the Pharmacy Orderable item on drug file.
|
||||||
N OI S OI=$O(^PS(50.7,"ADF",VAG40,DOSEPTR,""))
|
N OI S OI=$O(^PS(50.7,"ADF",VAG40,DOSEPTR,""))
|
||||||
;
|
;
|
||||||
; Otherwise, add a new one. (See MCHAN+12^PSSPOIMN)
|
; Otherwise, add a new one. (See MCHAN+12^PSSPOIMN)
|
||||||
I 'OI D
|
I 'OI D
|
||||||
. N C0XFDA,C0XERR
|
. N C0XFDA,C0XERR
|
||||||
. S C0XFDA(50.7,"+1,",.01)=VAG40
|
. S C0XFDA(50.7,"+1,",.01)=VAG40
|
||||||
. S C0XFDA(50.7,"+1,",.02)=DOSEPTR
|
. S C0XFDA(50.7,"+1,",.02)=DOSEPTR
|
||||||
. D UPDATE^DIE("",$NA(C0XFDA),$NA(OI),$NA(C0XERR))
|
. D UPDATE^DIE("",$NA(C0XFDA),$NA(OI),$NA(C0XERR))
|
||||||
. I $D(C0XERR) S $EC=",U1,"
|
. I $D(C0XERR) S $EC=",U1,"
|
||||||
. S OI=OI(1) ; For ease of use...
|
. S OI=OI(1) ; For ease of use...
|
||||||
. ; Next two statements: See FIN^PSSPOIM1 and MF^PSSDEE.
|
. ; Next two statements: See FIN^PSSPOIM1 and MF^PSSDEE.
|
||||||
. D EN^PSSPOIDT(OI) ; Update Indexes; activations, etc.
|
. D EN^PSSPOIDT(OI) ; Update Indexes; activations, etc.
|
||||||
. D EN2^PSSHL1(OI,"MUP") ; Send HL7 message to CPRS
|
. D EN2^PSSHL1(OI,"MUP") ; Send HL7 message to CPRS
|
||||||
;
|
;
|
||||||
; Finally, add the orderable Item to the drug file.
|
; Finally, add the orderable Item to the drug file.
|
||||||
N C0XFDA,C0XERR S C0XFDA(50,C0XIEN(1)_",",2.1)=OI ; Orderable Item
|
N C0XFDA,C0XERR S C0XFDA(50,C0XIEN(1)_",",2.1)=OI ; Orderable Item
|
||||||
D FILE^DIE("",$NA(C0XFDA),$NA(C0XERR))
|
D FILE^DIE("",$NA(C0XFDA),$NA(C0XERR))
|
||||||
S:$D(C0XERR) $EC=",U1,"
|
S:$D(C0XERR) $EC=",U1,"
|
||||||
;
|
;
|
||||||
EX QUIT C0XIEN(1)
|
EX QUIT C0XIEN(1)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
C0CRXNLK ; VEN/SMH - RxNorm Lookup Utilities ;2014-07-22 2:27 PM
|
C0CRXNLK ; VEN/SMH - RxNorm Lookup Utilities ;2014-07-22 2:27 PM
|
||||||
;;2.3;RXNORM FOR VISTA;;Jul 22, 2014;Build 16
|
;;2.5;RXNORM FOR VISTA;;Apr 27, 2016;Build 16
|
||||||
;(c) Sam Habiel 2013
|
;(c) Sam Habiel 2016
|
||||||
; See accompanying license. Don't use otherwise.
|
; See accompanying license. Don't use otherwise.
|
||||||
;
|
;
|
||||||
S IO=$P
|
S IO=$P
|
||||||
N DIQUIET S DIQUIET=1
|
N DIQUIET S DIQUIET=1
|
||||||
D DT^DICRW
|
D DT^DICRW
|
||||||
D EN^XTMUNIT($T(+0),1)
|
D EN^%ut($T(+0),2)
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
EXIST(RXN) ; $$ Public - Does this RxNorm CUI exist?
|
EXIST(RXN) ; $$ Public - Does this RxNorm CUI exist?
|
||||||
|
@ -21,16 +21,15 @@ GCN2RXN(GCN) ; $$ Public - Get RxNorm CUI using GCN
|
||||||
N IEN S IEN=$O(^C0CRXN(176.001,"STC","NDDF","CDC",GCN,"")) ; Get Entry
|
N IEN S IEN=$O(^C0CRXN(176.001,"STC","NDDF","CDC",GCN,"")) ; Get Entry
|
||||||
Q ^(IEN)
|
Q ^(IEN)
|
||||||
;
|
;
|
||||||
GCN2RXNT ; @TEST - Test Get RxNorm CUI using GCN
|
GCN2RXNT ; @TEST Test Get RxNorm CUI using GCN
|
||||||
Q:'$D(^C0CRXN(176.001,"STC","NDDF"))
|
Q:'$D(^C0CRXN(176.001,"STC","NDDF"))
|
||||||
N L F L=1:1 N LN S LN=$T(GCN2RXND+L) Q:LN["<<END>>" Q:LN="" D
|
N L F L=1:1 N LN S LN=$T(GCN2RXND+L) Q:LN["<<END>>" Q:LN="" D
|
||||||
. N GCN S GCN=$P(LN,";",3)
|
. N GCN S GCN=$P(LN,";",3)
|
||||||
. N RXN S RXN=$P(LN,";",4)
|
. N RXN S RXN=$P(LN,";",4)
|
||||||
. D CHKEQ^XTMUNIT($$GCN2RXN(GCN),RXN,"Translation from GCN to RXCUI failed")
|
. D CHKEQ^%ut($$GCN2RXN(GCN),RXN,"Translation from GCN to RXCUI failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
GCN2RXND ; @DATA - Data for Tests ;;GCN;EXPECTED RXNCUI
|
GCN2RXND ; @DATA - Data for Tests ;;GCN;EXPECTED RXNCUI
|
||||||
;;16033;991632
|
|
||||||
;;8208;310429
|
;;8208;310429
|
||||||
;;1275;628953
|
;;1275;628953
|
||||||
;;18;197604
|
;;18;197604
|
||||||
|
@ -48,20 +47,20 @@ RXN2GCN(RXNCUI) ; $$ Public - Get GCN(s) given an RxNorm Number
|
||||||
S GCNS=$E(GCNS,1,$L(GCNS)-1) ; remove trailing ^
|
S GCNS=$E(GCNS,1,$L(GCNS)-1) ; remove trailing ^
|
||||||
Q GCNS
|
Q GCNS
|
||||||
;
|
;
|
||||||
RXN2GCNT ; @TEST - Test Get GCN from RXNCUI
|
RXN2GCNT ; @TEST Test Get GCN from RXNCUI
|
||||||
Q:'$D(^C0CRXN(176.001,"STX","NDDF"))
|
Q:'$D(^C0CRXN(176.001,"STX","NDDF"))
|
||||||
N L F L=1:1 N LN S LN=$T(RXN2GCND+L) Q:LN["<<END>>" Q:LN="" D
|
N L F L=1:1 N LN S LN=$T(RXN2GCND+L) Q:LN["<<END>>" Q:LN="" D
|
||||||
. N RXN S RXN=$P(LN,";",3)
|
. N RXN S RXN=$P(LN,";",3)
|
||||||
. N GCN S GCN=$P(LN,";",4)
|
. N GCN S GCN=$P(LN,";",4)
|
||||||
. D CHKEQ^XTMUNIT($$RXN2GCN(RXN),GCN,"Translation from RXCUI to GCN failed")
|
. D CHKEQ^%ut($$RXN2GCN(RXN),GCN,"Translation from RXCUI to GCN failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
RXN2GCND ; @DATA - Data for Tests ;;RXNORM CUI;Expected GCN; Human Readable Drug name for dear reader
|
RXN2GCND ; @DATA - Data for Tests ;;RXNORM CUI;Expected GCN; Human Readable Drug name for dear reader
|
||||||
;;998689;5145;Acetabulol 200mg tab
|
;;998689;5145;Acetabulol 200mg tab
|
||||||
;;745679;5037;Albuterol Inhaler
|
;;745679;28090;Albuterol Inhaler
|
||||||
;;197320;2536;Allopurinol 300mg tab
|
;;197320;2536;Allopurinol 300mg tab
|
||||||
;;993691;3948^46236;Bupropion 75mg tab
|
;;993691;46236;Bupropion 75mg tab
|
||||||
;;197591;3768;Diazepam 5mg tab
|
;;197591;3768;Diazepam 5mg tab
|
||||||
;;<<END>>
|
;;<<END>>
|
||||||
;
|
;
|
||||||
|
@ -78,19 +77,18 @@ RXN2VUI(RXNCUI) ; $$ Public - Get VUID(s) for given RXNCUI for Clinical Drug
|
||||||
; I $O(^C0CRXN(176.005,"RXCUIREL",RXN,"has_quantified_form","")) N QF S QF=$O(^("")) Q $O(^C0CRXN(176.001,"RXN2VUID",QF,""))
|
; I $O(^C0CRXN(176.005,"RXCUIREL",RXN,"has_quantified_form","")) N QF S QF=$O(^("")) Q $O(^C0CRXN(176.001,"RXN2VUID",QF,""))
|
||||||
Q C0PVUID
|
Q C0PVUID
|
||||||
;
|
;
|
||||||
RXN2VUIT ; @TEST - Get VUIDs given RxNorm values
|
RXN2VUIT ; @TEST Get VUIDs given RxNorm values
|
||||||
N L F L=1:1 N LN S LN=$T(RXN2VUID+L) Q:LN["<<END>>" Q:LN="" D
|
N L F L=1:1 N LN S LN=$T(RXN2VUID+L) Q:LN["<<END>>" Q:LN="" D
|
||||||
. N RXN S RXN=$P(LN,";",3)
|
. N RXN S RXN=$P(LN,";",3)
|
||||||
. N VUIDS S VUIDS=$P(LN,";",4)
|
. N VUIDS S VUIDS=$P(LN,";",4)
|
||||||
. D CHKEQ^XTMUNIT($P($$RXN2VUI(RXN),U),$P(VUIDS,U),"Translation from RXNCUI to VUID failed")
|
. D CHKEQ^%ut($P($$RXN2VUI(RXN),U),$P(VUIDS,U),"Translation from RXNCUI to VUID failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
RXN2VUID ; @DATA - Data items for previous test
|
RXN2VUID ; @DATA - Data items for previous test
|
||||||
;;991632;4006455
|
|
||||||
;;310429;4002369^4013941
|
;;310429;4002369^4013941
|
||||||
;;628953;4000874^4000856^4013966^4015798^4015799
|
;;628953;4000856^4013966^4015798^4015799
|
||||||
;;197604;4003335^4015937
|
;;197604;4003335^4015937
|
||||||
;;884173;4002469^4013919
|
;;884173;4002469^4013919^4032795
|
||||||
;;<<END>>
|
;;<<END>>
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
@ -104,11 +102,11 @@ VUI2VAP(VUID) ; $$ Public - Get VA Product IEN(s) from VUID
|
||||||
S O=$E(O,1,$L(O)-1) ; remove trailing ^
|
S O=$E(O,1,$L(O)-1) ; remove trailing ^
|
||||||
Q O
|
Q O
|
||||||
;
|
;
|
||||||
VUI2VAPT ; @TEST - Get VA Product IEN from VUID
|
VUI2VAPT ; @TEST Get VA Product IEN from VUID
|
||||||
N L F L=1:1 N LN S LN=$T(VUI2VAPD+L) Q:LN["<<END>>" Q:LN="" D
|
N L F L=1:1 N LN S LN=$T(VUI2VAPD+L) Q:LN["<<END>>" Q:LN="" D
|
||||||
. N VUID S VUID=$P(LN,";",3)
|
. N VUID S VUID=$P(LN,";",3)
|
||||||
. N VAP S VAP=$P(LN,";",4)
|
. N VAP S VAP=$P(LN,";",4)
|
||||||
. D CHKEQ^XTMUNIT($$VUI2VAP(VUID),VAP,"Translation from VUID to VA PRODUCT failed")
|
. D CHKEQ^%ut($$VUI2VAP(VUID),VAP,"Translation from VUID to VA PRODUCT failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
VUI2VAPD ; @DATA - Data for above test
|
VUI2VAPD ; @DATA - Data for above test
|
||||||
|
@ -165,9 +163,9 @@ FDI2RXN(BASE) ; $$ Public - Get RxNorm CUI for FDB Ingredient/Base
|
||||||
S BASE=$$RJ^XLFSTR(BASE,6,0) ; pad to six digits by zeros (123 becomes 000123)
|
S BASE=$$RJ^XLFSTR(BASE,6,0) ; pad to six digits by zeros (123 becomes 000123)
|
||||||
N IEN S IEN=$O(^C0CRXN(176.001,"STC","NDDF","IN",BASE,"")) Q ^(IEN)
|
N IEN S IEN=$O(^C0CRXN(176.001,"STC","NDDF","IN",BASE,"")) Q ^(IEN)
|
||||||
;
|
;
|
||||||
FDI2RXNT ; @TEST - Test Get RxNorm CUI for FDB Ingredient/Base
|
FDI2RXNT ; @TEST Test Get RxNorm CUI for FDB Ingredient/Base
|
||||||
Q:'$D(^C0CRXN(176.001,"STC","NDDF"))
|
Q:'$D(^C0CRXN(176.001,"STC","NDDF"))
|
||||||
D CHKEQ^XTMUNIT($$FDI2RXN(14739),1362160,"$$FDI2RXN failed")
|
D CHKEQ^%ut($$FDI2RXN(14739),1362160,"$$FDI2RXN failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
@ -176,10 +174,12 @@ RXN2VIN(RXNCUI) ; $$ Public - Get VUID Ingredient for RxNorm CUI
|
||||||
; ^C0CRXN(176.001,"STX","VANDF","IN",1366467,1008555)=4031768
|
; ^C0CRXN(176.001,"STX","VANDF","IN",1366467,1008555)=4031768
|
||||||
; Input: RXNCUI By Value
|
; Input: RXNCUI By Value
|
||||||
; Output: VUID
|
; Output: VUID
|
||||||
N IEN S IEN=$O(^C0CRXN(176.001,"STX","VANDF","IN",RXNCUI,"")) Q ^(IEN)
|
N IEN S IEN=$O(^C0CRXN(176.001,"STX","VANDF","IN",RXNCUI,""))
|
||||||
|
I IEN Q ^(IEN)
|
||||||
|
E Q ""
|
||||||
;
|
;
|
||||||
RXN2VINT ; @TEST - Test Get VUID Ingredient for RxNorm CUI
|
RXN2VINT ; @TEST Test Get VUID Ingredient for RxNorm CUI
|
||||||
D CHKEQ^XTMUNIT($$RXN2VIN(1366467),4031768,"$$RXN2VIN failed")
|
D CHKEQ^%ut($$RXN2VIN(1366467),4031768,"$$RXN2VIN failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
@ -191,8 +191,8 @@ VIN2VAG(VUID) ; $$ Public - Get VA Generic for VUID Ingredient
|
||||||
N C0P01 S C0P01=$$GET1^DIQ(50.6,C0PIEN,.01)
|
N C0P01 S C0P01=$$GET1^DIQ(50.6,C0PIEN,.01)
|
||||||
Q C0PIEN_"^"_C0P01
|
Q C0PIEN_"^"_C0P01
|
||||||
;
|
;
|
||||||
VIN2VAGT ; @TEST - Test Get VA Generic for VUID Ingredient
|
VIN2VAGT ; @TEST Test Get VA Generic for VUID Ingredient
|
||||||
D CHKEQ^XTMUNIT(+$$VIN2VAG(4023636),2832,"$$VIN2VAG failed")
|
D CHKEQ^%ut(+$$VIN2VAG(4023636),2832,"$$VIN2VAG failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
@ -217,25 +217,31 @@ FDI2DIN(BASE) ; $$ Public - Get Drug Ingredient for FDB Ingredient/Base
|
||||||
; Output: IEN^Drug Ingredient Name (i.e. .01 field value)
|
; Output: IEN^Drug Ingredient Name (i.e. .01 field value)
|
||||||
Q $$VIN2DIN($$RXN2VIN($$FDI2RXN(BASE)))
|
Q $$VIN2DIN($$RXN2VIN($$FDI2RXN(BASE)))
|
||||||
;
|
;
|
||||||
VUI2RXN(VUID) ; $$ Public - Get RXNCUI for VUID (any VUID type)
|
VUI2RXN(VUID,TTY) ; $$ Public Stephanie's Unified VUID searcher. Get RXNCUI given VUID
|
||||||
; Input: VUID By Value
|
;GIVEN A VUID IN ONE OF SEVERAL FILES RETURN THE ASSOCIATED RXNORM CODE IN 176.001
|
||||||
; Output: RXNCUIs delimited by ^
|
; TTY="IN", "CD", or "PT"
|
||||||
; Get all entries whose code is the VUID and are in the VA NDF which are clinical drugs
|
; IN = DRUG INGRIDENT FILE & VA GENERIC file
|
||||||
D FIND^DIC(176.001,,"@;.01","PQX",VUID,,"CODE","I $P(^(0),U,12,13)=""VANDF^CD""")
|
; CD = VA PRODUCT FILE
|
||||||
; Deserialise it into a single string
|
; PT = VA DRUG CLASS
|
||||||
; ^TMP("DILIST",4844,0)="1^*^0^"
|
;
|
||||||
; ^TMP("DILIST",4844,0,"MAP")="IEN^.01"
|
; SAB="VANDF"
|
||||||
; ^TMP("DILIST",4844,1,0)="1006351^1364462"
|
; CODE=VUID
|
||||||
N RXNS S RXNS=""
|
;
|
||||||
N I F I=0:0 S I=$O(^TMP("DILIST",$J,I)) Q:'I S RXNS=RXNS_$P(^(I,0),U,2)_U
|
I $O(^C0CRXN(176.001,"STC","VANDF",TTY,VUID,"")) Q ^($O(^("")))
|
||||||
S RXNS=$E(RXNS,1,$L(RXNS)-1)
|
Q ""
|
||||||
QUIT RXNS
|
;
|
||||||
|
VUI2RXNT ; @TEST VUID to RxNorm CUI tests
|
||||||
|
D CHKEQ^%ut($$VUI2RXN(4010151,"CD"),314231)
|
||||||
|
D CHKEQ^%ut($$VUI2RXN(4020940,"IN"),16681)
|
||||||
|
D CHKEQ^%ut($$VUI2RXN(4021568,"PT"),883)
|
||||||
|
D CHKEQ^%ut($$VUI2RXN(1234234,"CD"),"")
|
||||||
|
QUIT
|
||||||
;
|
;
|
||||||
VUI2GCN(VUID) ; $$ Public - Get GCNs for a given VUID (any VUID type)
|
VUI2GCN(VUID) ; $$ Public - Get GCNs for a given VUID (any VUID type)
|
||||||
; Input: VUID by Value
|
; Input: VUID by Value
|
||||||
; Output: GCNs delimited by ^
|
; Output: GCNs delimited by ^
|
||||||
; TODO: Unit Test
|
; TODO: Unit Test
|
||||||
N RXNS S RXNS=$$VUI2RXN(VUID)
|
N RXNS S RXNS=$$VUI2RXN(VUID,"AB")
|
||||||
Q:RXNS="" "" ; VUID not a drug or ingredient (can be food)
|
Q:RXNS="" "" ; VUID not a drug or ingredient (can be food)
|
||||||
N GCNS S GCNS=""
|
N GCNS S GCNS=""
|
||||||
N I F I=1:1:$L(RXNS,U) S GCNS=GCNS_$$RXN2GCN($P(RXNS,U,I))_U
|
N I F I=1:1:$L(RXNS,U) S GCNS=GCNS_$$RXN2GCN($P(RXNS,U,I))_U
|
||||||
|
@ -250,13 +256,16 @@ MED2RXN(DA) ; $$ Public - Get RxNorm CUI for Drug
|
||||||
Q:'VAP "" ; quit if empty
|
Q:'VAP "" ; quit if empty
|
||||||
N VUID S VUID=+^PSNDF(50.68,VAP,"VUID") ; Get VUID
|
N VUID S VUID=+^PSNDF(50.68,VAP,"VUID") ; Get VUID
|
||||||
I 'VUID S $EC=",U1," ; Must exist
|
I 'VUID S $EC=",U1," ; Must exist
|
||||||
Q $$VUI2RXN(VUID)
|
Q $$VUI2RXN(VUID,"AB")
|
||||||
;
|
;
|
||||||
MED2SCDN(DA) ; $$ Public - Medication to Semantic Clinical Drug Name
|
MED2SCDN(DA) ; $$ Public - Medication to Semantic Clinical Drug Name
|
||||||
; Input: DA - Medication IEN
|
; Input: DA - Medication IEN
|
||||||
; Output: The Canonical Semantic Clinical Drug name
|
; Output: The Canonical Semantic Clinical Drug name
|
||||||
N RXNCUI S RXNCUI=$$MED2RXN(DA)
|
N RXNCUI S RXNCUI=$$MED2RXN(DA)
|
||||||
Q:'RXNCUI ""
|
Q:'RXNCUI ""
|
||||||
|
Q $$SCDNAME(RXNCUI)
|
||||||
|
;
|
||||||
|
SCDNAME(RXNCUI) ; $$ Public - Semantic Clinical Drug Name for RxNorm CUI
|
||||||
N IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM","SCD",RXNCUI,"")) ; Let's try generic drug
|
N IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM","SCD",RXNCUI,"")) ; Let's try generic drug
|
||||||
I 'IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM","SBD",RXNCUI,"")) ; Let's try non-bioequivalent Brands then
|
I 'IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM","SBD",RXNCUI,"")) ; Let's try non-bioequivalent Brands then
|
||||||
I 'IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM","GPCK",RXNCUI,"")) ; Let's try a Generic combination package
|
I 'IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM","GPCK",RXNCUI,"")) ; Let's try a Generic combination package
|
||||||
|
@ -264,6 +273,15 @@ MED2SCDN(DA) ; $$ Public - Medication to Semantic Clinical Drug Name
|
||||||
Q:'IEN "" ; Apparently not every VUID has a corresponding RXNCUI SCD.
|
Q:'IEN "" ; Apparently not every VUID has a corresponding RXNCUI SCD.
|
||||||
Q $P(^C0CRXN(176.001,IEN,0),U,15)
|
Q $P(^C0CRXN(176.001,IEN,0),U,15)
|
||||||
;
|
;
|
||||||
|
ANYNAME(RXNCUI) ; $$ Public - Get the RxNorm name, no matter what it is
|
||||||
|
N RESULT S RESULT=""
|
||||||
|
N TTY S TTY=""
|
||||||
|
F S TTY=$O(^C0CRXN(176.001,"STC","RXNORM",TTY)) Q:TTY="" D Q:RESULT]""
|
||||||
|
. N IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM",TTY,RXNCUI,""))
|
||||||
|
. Q:'IEN
|
||||||
|
. S RESULT=$P(^C0CRXN(176.001,IEN,0),U,15)
|
||||||
|
QUIT RESULT
|
||||||
|
;
|
||||||
RXN2NDI(RXNCUI) ; $$ Public - Get NDDF Ingredient for RXNCUI
|
RXN2NDI(RXNCUI) ; $$ Public - Get NDDF Ingredient for RXNCUI
|
||||||
; Input: RXNCUI By Value
|
; Input: RXNCUI By Value
|
||||||
; Output: NDDF Base code
|
; Output: NDDF Base code
|
||||||
|
@ -275,7 +293,7 @@ VIN2NDI(VUID) ; $$ Public - Get NDDF Ingredient for VUID
|
||||||
; Input: VUID By Value
|
; Input: VUID By Value
|
||||||
; Output: NDDF Base code
|
; Output: NDDF Base code
|
||||||
; TODO:Not tested...
|
; TODO:Not tested...
|
||||||
Q $$RXN2NDI($$VUI2RXN(VUID))
|
Q $$RXN2NDI($$VUI2RXN(VUID,"IN"))
|
||||||
;
|
;
|
||||||
; ---
|
; ---
|
||||||
;
|
;
|
||||||
|
@ -286,9 +304,9 @@ NDC2RXN(NDC) ; $$ Public - Get RxCUI given the NDC
|
||||||
S NDC=$TR(NDC,"-")
|
S NDC=$TR(NDC,"-")
|
||||||
N IEN S IEN=$O(^C0CRXN(176.002,"ASAA","RXNORM","NDC",NDC,"")) Q ^(IEN)
|
N IEN S IEN=$O(^C0CRXN(176.002,"ASAA","RXNORM","NDC",NDC,"")) Q ^(IEN)
|
||||||
;
|
;
|
||||||
NDC2RXNT ; @TEST - Test Get RxCUI given the NDC & Get RxCUI given the 50.67 NDC
|
NDC2RXNT ; @TEST Test Get RxCUI given the NDC & Get RxCUI given the 50.67 NDC
|
||||||
D CHKEQ^XTMUNIT($$NDC2RXN("30142-0917-71"),198439,"$$NDC2RXN failed")
|
D CHKEQ^%ut($$NDC2RXN("30142-0917-71"),198439,"$$NDC2RXN failed")
|
||||||
D CHKEQ^XTMUNIT($$NDC2RXN2("000031868518","VANDF"),996520,"$$NDC2RXN2 failed")
|
D CHKEQ^%ut($$NDC2RXN2("000031868518","VANDF"),996520,"$$NDC2RXN2 failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
NDC2RXN2(NDC,SOURCE) ; $$ Public - Get RxCUI given the source
|
NDC2RXN2(NDC,SOURCE) ; $$ Public - Get RxCUI given the source
|
||||||
|
@ -303,9 +321,9 @@ ISBRAND(RXN) ; $$ Public - Is this RxCUI for a brand drug?
|
||||||
; Input: RxCUI
|
; Input: RxCUI
|
||||||
; Output: 0 or 1
|
; Output: 0 or 1
|
||||||
Q ''$D(^C0CRXN(176.001,"STC","RXNORM","SBD",RXN))
|
Q ''$D(^C0CRXN(176.001,"STC","RXNORM","SBD",RXN))
|
||||||
ISBRANDT ; @TEST - Test Is this RxCUI for a brand drug?
|
ISBRANDT ; @TEST Test Is this RxCUI for a brand drug?
|
||||||
D CHKEQ^XTMUNIT($$ISBRAND(205535),1,"$$ISBRAND failed") ; Brand Prozac
|
D CHKEQ^%ut($$ISBRAND(205535),1,"$$ISBRAND failed") ; Brand Prozac
|
||||||
D CHKEQ^XTMUNIT($$ISBRAND(310384),0,"$$ISBRAND failed") ; Generic Fluoxetine
|
D CHKEQ^%ut($$ISBRAND(310384),0,"$$ISBRAND failed") ; Generic Fluoxetine
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
; ---
|
; ---
|
||||||
|
@ -314,8 +332,8 @@ BR2GEN(RXN) ; $$ Public - Convert Brand RxCUI to Generic RxCUI (many to 1)
|
||||||
; Input: RxCUI of Brand
|
; Input: RxCUI of Brand
|
||||||
; Output: RxCUI of Generic
|
; Output: RxCUI of Generic
|
||||||
Q $O(^C0CRXN(176.005,"B",RXN,"has_tradename",""))
|
Q $O(^C0CRXN(176.005,"B",RXN,"has_tradename",""))
|
||||||
BR2GENT ; @TEST - Test Convert Brand RxCUI to Generic RxCUI (many to 1)
|
BR2GENT ; @TEST Test Convert Brand RxCUI to Generic RxCUI (many to 1)
|
||||||
D CHKEQ^XTMUNIT($$BR2GEN(205535),310384,"$$BR2GEN failed")
|
D CHKEQ^%ut($$BR2GEN(205535),310384,"$$BR2GEN failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
; ---
|
; ---
|
||||||
|
@ -326,8 +344,8 @@ GEN2BR(RXN) ; $$ Public - Convert Generic RxCUI to Brand RxCUIs (1 to many).
|
||||||
S RTN=$E(RTN,1,$L(RTN)-1)
|
S RTN=$E(RTN,1,$L(RTN)-1)
|
||||||
Q RTN
|
Q RTN
|
||||||
;
|
;
|
||||||
GEN2BRT ; @TEST - Test Convert Generic RxCUI to Brand RxCUIs (1 to many).
|
GEN2BRT ; @TEST Test Convert Generic RxCUI to Brand RxCUIs (1 to many).
|
||||||
D CHKTF^XTMUNIT($$GEN2BR(310384)[205535,"$$GEN2BR failed")
|
D CHKTF^%ut($$GEN2BR(310384)[205535,"$$GEN2BR failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
; ---
|
; ---
|
||||||
|
@ -344,17 +362,63 @@ RXN2BNS(RXN) ; $$ Public - Get all Brand Names associated with an RXN
|
||||||
. N BNIEN S BNIEN=$O(^C0CRXN(176.001,"B",BNRXCUI,""))
|
. N BNIEN S BNIEN=$O(^C0CRXN(176.001,"B",BNRXCUI,""))
|
||||||
. S BNS=BNS_$P(^C0CRXN(176.001,BNIEN,0),U,15)_U
|
. S BNS=BNS_$P(^C0CRXN(176.001,BNIEN,0),U,15)_U
|
||||||
QUIT $E(BNS,1,$L(BNS)-1)
|
QUIT $E(BNS,1,$L(BNS)-1)
|
||||||
RXN2BNST ; @TEST - Test Get all Brand Names associated with an RXN
|
RXN2BNST ; @TEST Test Get all Brand Names associated with an RXN
|
||||||
D CHKTF^XTMUNIT($$RXN2BNS(205535)["Prozac","$$RXN2BNS failed")
|
D CHKTF^%ut($$RXN2BNS(205535)["Prozac","$$RXN2BNS failed")
|
||||||
QUIT
|
QUIT
|
||||||
;
|
;
|
||||||
; ---
|
; ---
|
||||||
;
|
;
|
||||||
RXN2NDC(RXN) ; Get NDC codes for RxNorm code
|
RXN2NDC(RXN) ; $$ Public - Get NDC codes for RxNorm code
|
||||||
N NDCS S NDCS=""
|
N NDCS S NDCS=""
|
||||||
N I F I=0:0 S I=$O(^C0CRXN(176.002,"ASAR","RXNORM","NDC",RXN,I)) Q:'I S NDCS=NDCS_^(I)_"^"
|
N I F I=0:0 S I=$O(^C0CRXN(176.002,"ASAR","RXNORM","NDC",RXN,I)) Q:'I S NDCS=NDCS_^(I)_"^"
|
||||||
S $E(NDCS,$L(NDCS))=""
|
S $E(NDCS,$L(NDCS))=""
|
||||||
QUIT NDCS
|
QUIT NDCS
|
||||||
RXN2NDCT ; @TEST - Test Get NDC codes for RxNorm code
|
RXN2NDCT ; @TEST Test Get NDC codes for RxNorm code
|
||||||
D CHKTF^XTMUNIT($$RXN2NDC(197379)["^"_16714003309,"$$RXN2NDC failed")
|
D CHKTF^%ut($$RXN2NDC(197379)["^"_16714003309,"$$RXN2NDC failed")
|
||||||
QUIT
|
QUIT
|
||||||
|
;
|
||||||
|
LVUID(RXN) ; $$ Public - Locate VUID, given RxNorm. Iterative Search
|
||||||
|
; ^C0CRXN(176.001,"STC","RXNORM","IN",46239,IEN
|
||||||
|
N TTY S TTY=""
|
||||||
|
N intermediateRxCUI
|
||||||
|
N finalVUID
|
||||||
|
i '$$EXIST(RXN) q "0^not found in RxNorm"
|
||||||
|
;
|
||||||
|
F S TTY=$O(^C0CRXN(176.001,"STC","RXNORM",TTY)) Q:TTY="" D q:$g(intermediateRxCUI) q:$g(finalVUID)
|
||||||
|
. N IEN S IEN=$O(^C0CRXN(176.001,"STC","RXNORM",TTY,RXN,""))
|
||||||
|
. I 'IEN quit ; s err="0^not found in RxNorm" quit
|
||||||
|
. ; W ^C0CRXN(176.001,IEN,0),!
|
||||||
|
. I TTY="BN" s intermediateRxCUI=$$BR2GEN(RXN) quit ; try searching with generic
|
||||||
|
. I TTY="IN"!(TTY="MIN") s finalVUID=$$RXN2VIN(RXN) quit ; match VUID
|
||||||
|
. I TTY="PIN" s intermediateRxCUI=$$formOf(RXN) quit ; try searching with ingredient
|
||||||
|
. I TTY="SCD" d
|
||||||
|
.. s finalVUID=$$RXN2VUI(RXN)
|
||||||
|
.. i finalVUID="" s finalVUID=$$containerOf(RXN)
|
||||||
|
.. I finalVUID="" s finalVUID=$$tradeName(RXN)
|
||||||
|
. I TTY="GPCK" d
|
||||||
|
.. s finalVUID=$$tradeName(RXN)
|
||||||
|
i $get(intermediateRxCUI) q $$LVUID(intermediateRxCUI) ; recurse
|
||||||
|
i $get(finalVUID) quit finalVUID
|
||||||
|
quit "0^no mapping found in RxNorm"
|
||||||
|
;
|
||||||
|
formOf(RXN) ; RXN is form of result
|
||||||
|
q $o(^C0CRXN(176.005,"B",RXN,"has_form",""))
|
||||||
|
containerOf(RXN) ; loop through all contains and see if one hits it.
|
||||||
|
n container
|
||||||
|
n vuid s vuid=""
|
||||||
|
f container=0:0 s container=$o(^C0CRXN(176.005,"B",RXN,"contains",container)) q:'container d q:$g(vuid)
|
||||||
|
. s vuid=$$RXN2VUI(container)
|
||||||
|
quit vuid
|
||||||
|
tradeName(RXN) ; loop through all tradenames and see if there's a match
|
||||||
|
n vuid s vuid=""
|
||||||
|
n tncui f tncui=0:0 s tncui=$o(^C0CRXN(176.005,"B",RXN,"tradename_of",tncui)) q:'tncui d q:$g(vuid)
|
||||||
|
. s vuid=$$RXN2VUI(tncui)
|
||||||
|
quit vuid
|
||||||
|
;
|
||||||
|
loopVUIDs ; [Public] Paste VUIDs to get the RxNorm Numbers
|
||||||
|
; ZEXCEPT: DTIME
|
||||||
|
n rxn
|
||||||
|
f r rxn:$g(DTIME,300) q:rxn="" q:rxn=$c(4) d
|
||||||
|
. w "|"
|
||||||
|
. w $$LVUID(rxn),"|",$$ANYNAME(rxn),!
|
||||||
|
quit
|
||||||
|
|
|
@ -1,182 +1,210 @@
|
||||||
C0CRXNRD ; VEN/SMH - RxNorm Utilities: Routine to Read RxNorm files;2013-11-14 1:23 PM
|
C0CRXNRD ; VEN/SMH - RxNorm Utilities: Routine to Read RxNorm files;2013-11-14 1:23 PM
|
||||||
;;2.3;RXNORM FOR VISTA;;Jul 22, 2014;Build 10
|
;;2.5;RXNORM FOR VISTA;;Apr 27, 2016;Build 10
|
||||||
; (C) Sam Habiel 2013
|
; (C) Sam Habiel 2016
|
||||||
; See license for terms of use.
|
; See license for terms of use.
|
||||||
;
|
;
|
||||||
W "No entry from top" Q
|
W "No entry from top" Q
|
||||||
IMPORT(PATH,RESTRICTED) ; PUBLIC ENTRY POINT. Rest are private
|
IMPORT(PATH,RESTRICTED) ; PUBLIC ENTRY POINT. Rest are private
|
||||||
I PATH="" QUIT
|
I PATH="" QUIT
|
||||||
S RESTRICTED=$G(RESTRICTED,0)
|
S RESTRICTED=$G(RESTRICTED,0)
|
||||||
S U="^"
|
S U="^"
|
||||||
N STARTTIME S STARTTIME=$P($H,",")*24*60*60+$P($H,",",2)
|
N STARTTIME S STARTTIME=$P($H,",")*24*60*60+$P($H,",",2)
|
||||||
N SABS
|
D SAB(PATH) ; Load restriction values into SAB. ; 176.006
|
||||||
D SAB(PATH,.SABS) ; Load restriction values into SAB. ; 176.006
|
JOB SAT^C0CRXNRD(PATH,RESTRICTED) ; 176.002
|
||||||
D CONSO(PATH,.SABS,RESTRICTED),SAT(PATH,.SABS,RESTRICTED) ; 176.001,176.002
|
W "Jobbed off... "_$ZJOB_"."
|
||||||
D STY(PATH),REL(PATH),DOC(PATH) ; 176.003-5
|
D CONSO(PATH,RESTRICTED) ; 176.001,176.002
|
||||||
N ENDTIME S ENDTIME=$P($H,",")*24*60*60+$P($H,",",2)
|
D STY(PATH),REL(PATH),DOC(PATH) ; 176.003-5
|
||||||
W !,(ENDTIME-STARTTIME)/60_" minutes elapsed"
|
N ENDTIME S ENDTIME=$P($H,",")*24*60*60+$P($H,",",2)
|
||||||
QUIT
|
W !,(ENDTIME-STARTTIME)/60_" minutes elapsed"
|
||||||
;
|
QUIT
|
||||||
; Everything is private from down on...
|
;
|
||||||
DELFILED(FN) ; Delete file data; PEP procedure; only for RxNorm files
|
; Everything is private from down on...
|
||||||
; FN is Filenumber passed by Value
|
DELFILED(FN) ; Delete file data; PEP procedure; only for RxNorm files
|
||||||
QUIT:$E(FN,1,3)'=176 ; Quit if not RxNorm files
|
; FN is Filenumber passed by Value
|
||||||
N ROOT S ROOT=$$ROOT^DILFD(FN,"",1) ; global root
|
QUIT:$E(FN,1,3)'=176 ; Quit if not RxNorm files
|
||||||
N ZERO S ZERO=@ROOT@(0) ; Save zero node
|
N ROOT S ROOT=$$ROOT^DILFD(FN,"",1) ; global root
|
||||||
S $P(ZERO,U,3,9999)="" ; Remove entry # and last edited
|
N ZERO S ZERO=@ROOT@(0) ; Save zero node
|
||||||
K @ROOT ; Kill the file -- so sad!
|
S $P(ZERO,U,3,9999)="" ; Remove entry # and last edited
|
||||||
S @ROOT@(0)=ZERO ; It riseth again!
|
K @ROOT ; Kill the file -- so sad!
|
||||||
QUIT
|
S @ROOT@(0)=ZERO ; It riseth again!
|
||||||
GETLINES(PATH,FILENAME) ; Get number of lines in a file
|
QUIT
|
||||||
N POP
|
GETLINES(PATH,FILENAME) ; Get number of lines in a file
|
||||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
N POP
|
||||||
Q:POP
|
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||||
U IO
|
Q:POP
|
||||||
N I,LINE
|
U IO
|
||||||
F I=1:1 R LINE:0 Q:$$STATUS^%ZISH
|
N I,LINE
|
||||||
D CLOSE^%ZISH("FILE")
|
F I=1:1 R LINE:0 Q:$$STATUS^%ZISH
|
||||||
Q I-1
|
D CLOSE^%ZISH("FILE")
|
||||||
CONSO(PATH,SABS,RESTRICTED) ; Open and read concepts file: RXNCONSO.RRF
|
Q I-1
|
||||||
; PATH ByVal, path of RxNorm files
|
CONSO(PATH,RESTRICTED) ; Open and read concepts file: RXNCONSO.RRF
|
||||||
; SABS ByRef, arrays of SABS(SAB)=restriction level
|
; PATH ByVal, path of RxNorm files
|
||||||
; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no
|
; SABS ByRef, arrays of SABS(SAB)=restriction level
|
||||||
I PATH="" QUIT
|
; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no
|
||||||
N FILENAME S FILENAME="RXNCONSO.RRF"
|
N SABS D LOADSABS(.SABS)
|
||||||
D DELFILED(176.001) ; delete data
|
I PATH="" QUIT
|
||||||
N LINES S LINES=$$GETLINES(PATH,FILENAME)
|
N FILENAME S FILENAME="RXNCONSO.RRF"
|
||||||
N POP
|
D DELFILED(176.001) ; delete data
|
||||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
N LINES S LINES=$$GETLINES(PATH,FILENAME)
|
||||||
IF POP D EN^DDIOL("Error reading file..., Please check...") G EX
|
N POP
|
||||||
N C0CCOUNT
|
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||||
F C0CCOUNT=1:1 D Q:$$STATUS^%ZISH
|
IF POP D EN^DDIOL("Error reading file..., Please check...") G EX
|
||||||
. U IO
|
N C0CCOUNT
|
||||||
. N LINE R LINE:0
|
N C0CSUPP S C0CSUPP=0
|
||||||
. IF $$STATUS^%ZISH QUIT
|
F C0CCOUNT=1:1 D Q:$$STATUS^%ZISH
|
||||||
. I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000
|
. U IO
|
||||||
. ;
|
. N LINE R LINE:0
|
||||||
. ; Deal with restriction level
|
. IF $$STATUS^%ZISH QUIT
|
||||||
. N SAB S SAB=$P(LINE,"|",12)
|
. I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000
|
||||||
. I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit
|
. ;
|
||||||
. ;
|
. ; If suppressed, quit
|
||||||
. ; Save data
|
. N SUPP S SUPP=$P(LINE,"|",17)
|
||||||
. S ^C0CRXN(176.001,C0CCOUNT,0)=$TR(LINE,"|^","^|")
|
. I SUPP="O"!(SUPP="Y")!(SUPP="E") S C0CSUPP=C0CSUPP+1 QUIT
|
||||||
EX D CLOSE^%ZISH("FILE")
|
. ;
|
||||||
N DIK S DIK="^C0CRXN(176.001," D IXALL^DIK
|
. ; Deal with restriction level
|
||||||
QUIT
|
. N SAB S SAB=$P(LINE,"|",12)
|
||||||
;
|
. I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit
|
||||||
;
|
. ;
|
||||||
SAT(PATH,SABS,RESTRICTED) ; Open and read Concept and Atom attributes: RXNSAT.RRF
|
. ; Save data
|
||||||
; PATH ByVal, path of RxNorm files
|
. S ^C0CRXN(176.001,C0CCOUNT,0)=$TR(LINE,"|^","^|")
|
||||||
; SABS ByRef, arrays of SABS(SAB)=restriction level
|
EX D CLOSE^%ZISH("FILE")
|
||||||
; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no
|
N DIK S DIK="^C0CRXN(176.001," D IXALL^DIK
|
||||||
I PATH="" QUIT
|
W "Suppressed: ",C0CSUPP,!
|
||||||
N FILENAME S FILENAME="RXNSAT.RRF"
|
QUIT
|
||||||
D DELFILED(176.002) ; delete data
|
;
|
||||||
N LINES S LINES=$$GETLINES(PATH,FILENAME)
|
;
|
||||||
N POP
|
SAT(PATH,RESTRICTED) ; Open and read Concept and Atom attributes: RXNSAT.RRF
|
||||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
; PATH ByVal, path of RxNorm files
|
||||||
IF POP W "Error reading file..., Please check...",! G EX2
|
; SABS ByRef, arrays of SABS(SAB)=restriction level
|
||||||
N C0CCOUNT F C0CCOUNT=1:1 Q:$$STATUS^%ZISH D
|
; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no
|
||||||
. U IO
|
N $ET S $ET="D ^%ZTER HALT"
|
||||||
. N LINE R LINE:0
|
S U="^"
|
||||||
. IF $$STATUS^%ZISH QUIT
|
I PATH="" QUIT
|
||||||
. I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000
|
N FILENAME S FILENAME="RXNSAT.RRF"
|
||||||
. ;
|
D DELFILED(176.002) ; delete data
|
||||||
. ; We switch around the fields .01 and .09 because the .01 isn't always present; where as .09 is required
|
N LINES S LINES=$$GETLINES(PATH,FILENAME)
|
||||||
. N RXCUI1,ATN9
|
N POP
|
||||||
. S RXCUI1=$P(LINE,"|",1)
|
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||||
. S ATN9=$P(LINE,"|",9)
|
IF POP W "Error reading file..., Please check...",! G EX2
|
||||||
. S $P(LINE,"|",1)=ATN9
|
N SABS D LOADSABS(.SABS)
|
||||||
. S $P(LINE,"|",9)=RXCUI1
|
N C0CSUPP S C0CSUPP=0
|
||||||
. ;
|
N C0CCOUNT F C0CCOUNT=1:1 Q:$$STATUS^%ZISH D
|
||||||
. ; Deal with restricted sources
|
. U IO
|
||||||
. N SAB S SAB=$P(LINE,"|",10)
|
. N LINE R LINE:0
|
||||||
. I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit
|
. IF $$STATUS^%ZISH QUIT
|
||||||
. ;
|
. I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000
|
||||||
. ; Save off
|
. ;
|
||||||
. S ^C0CRXN(176.002,C0CCOUNT,0)=$TR(LINE,"|^","^|")
|
. ; If suppressed, quit
|
||||||
EX2 D CLOSE^%ZISH("FILE")
|
. N SUPP S SUPP=$P(LINE,"|",12)
|
||||||
N DIK S DIK="^C0CRXN(176.002," D IXALL^DIK
|
. I SUPP="O"!(SUPP="Y")!(SUPP="E") S C0CSUPP=C0CSUPP+1 QUIT
|
||||||
QUIT
|
. ;
|
||||||
;
|
. ; We switch around the fields .01 and .09 because the .01 isn't always present; where as .09 is required
|
||||||
;
|
. N RXCUI1,ATN9
|
||||||
SAB(PATH,SABS) ; Open the read RxNorm Sources file: RXNSAB.RRF
|
. S RXCUI1=$P(LINE,"|",1)
|
||||||
I PATH="" QUIT
|
. S ATN9=$P(LINE,"|",9)
|
||||||
N FILENAME S FILENAME="RXNSAB.RRF"
|
. S $P(LINE,"|",1)=ATN9
|
||||||
D DELFILED(176.003) ; delete data
|
. S $P(LINE,"|",9)=RXCUI1
|
||||||
N POP
|
. ;
|
||||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
. ; Deal with restricted sources
|
||||||
IF POP W "Error reading file..., Please check...",! G EX3
|
. N SAB S SAB=$P(LINE,"|",10)
|
||||||
N I F I=1:1 Q:$$STATUS^%ZISH D
|
. I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit
|
||||||
. U IO
|
. ;
|
||||||
. N LINE R LINE:0
|
. ; Save off
|
||||||
. IF $$STATUS^%ZISH QUIT
|
. S ^C0CRXN(176.002,C0CCOUNT,0)=$TR(LINE,"|^","^|")
|
||||||
. U $P W I,! U IO ; Write I to the screen, then go back to reading the file
|
EX2 D CLOSE^%ZISH("FILE")
|
||||||
. ; Switch pieces 1 and 4 because 4 is always defined. Goes into .01 field.
|
N DIK S DIK="^C0CRXN(176.002," D IXALL^DIK
|
||||||
. N VCUI S VCUI=$P(LINE,"|",1)
|
W "Suppressed: ",C0CSUPP,!
|
||||||
. N RSAB S RSAB=$P(LINE,"|",4)
|
QUIT
|
||||||
. S $P(LINE,"|",1)=RSAB
|
;
|
||||||
. S $P(LINE,"|",4)=VCUI
|
;
|
||||||
. S ^C0CRXN(176.003,I,0)=$TR(LINE,"^|","|^")
|
SAB(PATH) ; Open the read RxNorm Sources file: RXNSAB.RRF
|
||||||
EX3 D CLOSE^%ZISH("FILE")
|
I PATH="" QUIT
|
||||||
N DIK S DIK="^C0CRXN(176.003," D IXALL^DIK
|
N FILENAME S FILENAME="RXNSAB.RRF"
|
||||||
N C0CI F C0CI=0:0 S C0CI=$O(^C0CRXN(176.003,C0CI)) Q:'C0CI D
|
D DELFILED(176.003) ; delete data
|
||||||
. S SABS($$GET1^DIQ(176.003,C0CI,.01))=$$GET1^DIQ(176.003,C0CI,"SRL")
|
N POP
|
||||||
QUIT
|
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||||
STY(PATH) ; Open and read RxNorm Semantic types file: RXNSTY.RRF
|
IF POP W "Error reading file..., Please check...",! G EX3
|
||||||
I PATH="" QUIT
|
N I F I=1:1 Q:$$STATUS^%ZISH D
|
||||||
N FILENAME S FILENAME="RXNSTY.RRF"
|
. U IO
|
||||||
D DELFILED(176.004) ; delete data
|
. N LINE R LINE:0
|
||||||
N LINES S LINES=$$GETLINES(PATH,FILENAME) ; Get # of lines
|
. IF $$STATUS^%ZISH QUIT
|
||||||
N POP
|
. U $P W I,! U IO ; Write I to the screen, then go back to reading the file
|
||||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
. ; Switch pieces 1 and 4 because 4 is always defined. Goes into .01 field.
|
||||||
IF POP W "Error reading file..., Please check...",! G EX4
|
. N VCUI S VCUI=$P(LINE,"|",1)
|
||||||
N I F I=1:1 Q:$$STATUS^%ZISH D
|
. N RSAB S RSAB=$P(LINE,"|",4)
|
||||||
. U IO
|
. S $P(LINE,"|",1)=RSAB
|
||||||
. N LINE R LINE:0
|
. S $P(LINE,"|",4)=VCUI
|
||||||
. IF $$STATUS^%ZISH QUIT
|
. S ^C0CRXN(176.003,I,0)=$TR(LINE,"^|","|^")
|
||||||
. I '(I#1000) U $P W I," of ",LINES," read ",! U IO ; update every 1000
|
EX3 D CLOSE^%ZISH("FILE")
|
||||||
. S ^C0CRXN(176.004,I,0)=$TR(LINE,"^|","|^")
|
N DIK S DIK="^C0CRXN(176.003," D IXALL^DIK
|
||||||
EX4 D CLOSE^%ZISH("FILE")
|
QUIT
|
||||||
N DIK S DIK="^C0CRXN(176.004," D IXALL^DIK
|
;
|
||||||
QUIT
|
LOADSABS(SABS) ;
|
||||||
;
|
N C0CI F C0CI=0:0 S C0CI=$O(^C0CRXN(176.003,C0CI)) Q:'C0CI D
|
||||||
REL(PATH) ; Open and read RxNorm Relationships file: RXNREL.RRF
|
. S SABS($$GET1^DIQ(176.003,C0CI,.01))=$$GET1^DIQ(176.003,C0CI,"SRL")
|
||||||
I PATH="" QUIT
|
QUIT
|
||||||
N FILENAME S FILENAME="RXNREL.RRF"
|
;
|
||||||
D DELFILED(176.005) ; delete data
|
STY(PATH) ; Open and read RxNorm Semantic types file: RXNSTY.RRF
|
||||||
N LINES S LINES=$$GETLINES(PATH,FILENAME) ; Get # of lines
|
I PATH="" QUIT
|
||||||
N POP
|
N FILENAME S FILENAME="RXNSTY.RRF"
|
||||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
D DELFILED(176.004) ; delete data
|
||||||
IF POP W "Error reading file..., Please check...",! G EX5
|
N LINES S LINES=$$GETLINES(PATH,FILENAME) ; Get # of lines
|
||||||
N I F I=1:1 Q:$$STATUS^%ZISH D
|
N POP
|
||||||
. U IO
|
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||||
. N LINE R LINE:0
|
IF POP W "Error reading file..., Please check...",! G EX4
|
||||||
. IF $$STATUS^%ZISH QUIT
|
N I F I=1:1 Q:$$STATUS^%ZISH D
|
||||||
. I '(I#1000) U $P W I," of ",LINES," read ",! U IO ; update every 1000
|
. U IO
|
||||||
. ; swap RXCUI1 location with SAB b/c SAB is required so can be .01 field
|
. N LINE R LINE:0
|
||||||
. N RXCUI1 S RXCUI1=$P(LINE,"|",1)
|
. IF $$STATUS^%ZISH QUIT
|
||||||
. N SAB S SAB=$P(LINE,"|",11)
|
. I '(I#1000) U $P W I," of ",LINES," read ",! U IO ; update every 1000
|
||||||
. S $P(LINE,"|",1)=SAB
|
. S ^C0CRXN(176.004,I,0)=$TR(LINE,"^|","|^")
|
||||||
. S $P(LINE,"|",11)=RXCUI1
|
EX4 D CLOSE^%ZISH("FILE")
|
||||||
. S ^C0CRXN(176.005,I,0)=$TR(LINE,"^|","|^")
|
N DIK S DIK="^C0CRXN(176.004," D IXALL^DIK
|
||||||
EX5 D CLOSE^%ZISH("FILE")
|
QUIT
|
||||||
N DIK S DIK="^C0CRXN(176.005," D IXALL^DIK
|
;
|
||||||
QUIT
|
REL(PATH) ; Open and read RxNorm Relationships file: RXNREL.RRF
|
||||||
DOC(PATH) ; Open the read RxNorm Abbreviation Documentation file: RXNDOC.RRF
|
I PATH="" QUIT
|
||||||
I PATH="" QUIT
|
N FILENAME S FILENAME="RXNREL.RRF"
|
||||||
N FILENAME S FILENAME="RXNDOC.RRF"
|
D DELFILED(176.005) ; delete data
|
||||||
D DELFILED(176.006) ; delete data
|
N LINES S LINES=$$GETLINES(PATH,FILENAME) ; Get # of lines
|
||||||
N LINES S LINES=$$GETLINES(PATH,FILENAME) ; Get # of lines
|
N POP
|
||||||
N POP
|
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
IF POP W "Error reading file..., Please check...",! G EX5
|
||||||
IF POP W "Error reading file..., Please check...",! G EX6
|
N C0CSUPP S C0CSUPP=0
|
||||||
N I F I=1:1 Q:$$STATUS^%ZISH D
|
N I F I=1:1 Q:$$STATUS^%ZISH D
|
||||||
. U IO
|
. U IO
|
||||||
. N LINE R LINE:0
|
. N LINE R LINE:0
|
||||||
. IF $$STATUS^%ZISH QUIT
|
. ;
|
||||||
. I '(I#1000) U $P W I," of ",LINES," read ",! U IO ; update every 1000
|
. ; If suppressed, quit
|
||||||
. S ^C0CRXN(176.006,I,0)=$TR(LINE,"^|","|^")
|
. N SUPP S SUPP=$P(LINE,"|",15)
|
||||||
EX6 D CLOSE^%ZISH("FILE")
|
. I SUPP="O"!(SUPP="Y")!(SUPP="E") S C0CSUPP=C0CSUPP+1 QUIT
|
||||||
N DIK S DIK="^C0CRXN(176.006," D IXALL^DIK
|
. ;
|
||||||
QUIT
|
. IF $$STATUS^%ZISH QUIT
|
||||||
|
. I '(I#1000) U $P W I," of ",LINES," read ",! U IO ; update every 1000
|
||||||
|
. ; swap RXCUI1 location with SAB b/c SAB is required so can be .01 field
|
||||||
|
. N RXCUI1 S RXCUI1=$P(LINE,"|",1)
|
||||||
|
. N SAB S SAB=$P(LINE,"|",11)
|
||||||
|
. S $P(LINE,"|",1)=SAB
|
||||||
|
. S $P(LINE,"|",11)=RXCUI1
|
||||||
|
. S ^C0CRXN(176.005,I,0)=$TR(LINE,"^|","|^")
|
||||||
|
EX5 D CLOSE^%ZISH("FILE")
|
||||||
|
N DIK S DIK="^C0CRXN(176.005," D IXALL^DIK
|
||||||
|
W "Suppressed: ",C0CSUPP,!
|
||||||
|
QUIT
|
||||||
|
DOC(PATH) ; Open the read RxNorm Abbreviation Documentation file: RXNDOC.RRF
|
||||||
|
I PATH="" QUIT
|
||||||
|
N FILENAME S FILENAME="RXNDOC.RRF"
|
||||||
|
D DELFILED(176.006) ; delete data
|
||||||
|
N LINES S LINES=$$GETLINES(PATH,FILENAME) ; Get # of lines
|
||||||
|
N POP
|
||||||
|
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||||
|
IF POP W "Error reading file..., Please check...",! G EX6
|
||||||
|
N I F I=1:1 Q:$$STATUS^%ZISH D
|
||||||
|
. U IO
|
||||||
|
. N LINE R LINE:0
|
||||||
|
. IF $$STATUS^%ZISH QUIT
|
||||||
|
. I '(I#1000) U $P W I," of ",LINES," read ",! U IO ; update every 1000
|
||||||
|
. S ^C0CRXN(176.006,I,0)=$TR(LINE,"^|","|^")
|
||||||
|
EX6 D CLOSE^%ZISH("FILE")
|
||||||
|
N DIK S DIK="^C0CRXN(176.006," D IXALL^DIK
|
||||||
|
QUIT
|
||||||
|
|
Loading…
Reference in New Issue