Updated all meds files to use RxNorm codes instead of NDCs.
This commit is contained in:
parent
5d4ac99d6c
commit
33576f4179
43
p/C0CRXNRD.m
43
p/C0CRXNRD.m
|
@ -67,5 +67,46 @@ READNDC(PATH) ; Open and read NDC/RxNorm/VANDF relationship file: RXNSAT.RRF
|
|||
. D ^DIE
|
||||
D CLOSE^%ZISH("FILE")
|
||||
U $P ; reset back to principle device
|
||||
|
||||
Q
|
||||
;
|
||||
READSRC(PATH) ; Open the read RxNorm Sources file: RXNSAB.RRF
|
||||
I PATH="" QUIT
|
||||
N FILENAME S FILENAME="RXNSAB.RRF"
|
||||
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
|
||||
IF POP W "Error reading file..., Please check...",! BREAK
|
||||
F I=1:1 Q:$$STATUS^%ZISH D
|
||||
. U IO
|
||||
. N LINE R LINE
|
||||
. IF $$STATUS^%ZISH QUIT
|
||||
. U $P W I,! U IO ; Write I to the screen, then go back to reading the file
|
||||
. N VCUI,RCUI,VSAB,RSAB,SON,SF,SVER,SCIT ; Fileman fields numbers below
|
||||
. S VCUI=$P(LINE,"|",1) ; .01
|
||||
. S RCUI=$P(LINE,"|",2) ; 2
|
||||
. S VSAB=$P(LINE,"|",3) ; 3
|
||||
. S RSAB=$P(LINE,"|",4) ; 4
|
||||
. S SON=$P(LINE,"|",5) ; 5
|
||||
. S SF=$P(LINE,"|",6) ; 6
|
||||
. S SVER=$P(LINE,"|",7) ; 7
|
||||
. S SCIT=$P(LINE,"|",25) ; 25
|
||||
. ; Remove embedded "^"
|
||||
. S SCIT=$TR(SCIT,"^")
|
||||
. ; Convert SCIT into an array of 80 characters on each line
|
||||
. ; In each line, chop 80 characters off, reset SCIT to be the rest
|
||||
. N SCITLINE S SCITLINE=$L(SCIT)\80+1
|
||||
. F J=1:1:SCITLINE S SCIT(J)=$E(SCIT,1,80) S SCIT=$E(SCIT,81,$L(SCIT))
|
||||
. ; Now, construct the FDA array
|
||||
. N RXNFDA
|
||||
. S RXNFDA(176.003,"+"_I_",",.01)=VCUI
|
||||
. S RXNFDA(176.003,"+"_I_",",2)=RCUI
|
||||
. S RXNFDA(176.003,"+"_I_",",3)=VSAB
|
||||
. S RXNFDA(176.003,"+"_I_",",4)=RSAB
|
||||
. S RXNFDA(176.003,"+"_I_",",5)=SON
|
||||
. S RXNFDA(176.003,"+"_I_",",6)=SF
|
||||
. S RXNFDA(176.003,"+"_I_",",7)=SVER
|
||||
. D UPDATE^DIE("","RXNFDA")
|
||||
. I $D(^TMP("DIERR",$J)) U $P BREAK
|
||||
. ; Now, file WP field SCIT
|
||||
. D WP^DIE(176.003,I_",",25,,$NA(SCIT))
|
||||
D CLOSE^%ZISH("FILE")
|
||||
Q
|
||||
|
||||
|
|
53
p/CCRMEDS1.m
53
p/CCRMEDS1.m
|
@ -68,11 +68,48 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
. S @MAP@("MEDSTATUSTEXT")=$P(MED(100),U,2)
|
||||
. S @MAP@("MEDSOURCEACTORID")="ACTORPROVIDER_"_$P(MED(4),U)
|
||||
. S @MAP@("MEDPRODUCTNAMETEXT")=$P(MED(6),U,2)
|
||||
. S @MAP@("MEDPRODUCTNAMECODEVALUE")=MED(27)
|
||||
. S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
|
||||
. S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
|
||||
. S @MAP@("MEDBRANDNAMETEXT")=MED(6.5)
|
||||
. ; 12/30/08: I will be using RxNorm for coding...
|
||||
. ; 176.001 is the file for Concepts; 176.003 is the file for
|
||||
. ; sources (i.e. for RxNorm Version)
|
||||
. ;
|
||||
. ; We need the VUID first for the National Drug File entry first
|
||||
. ; We get the VUID of the drug, by looking up the VA Product entry
|
||||
. ; (file 50.68) using the call NDF^PSS50, returned in node 22.
|
||||
. ; Field 99.99 is the VUID.
|
||||
. ;
|
||||
. ; We use the VUID to look up the RxNorm in file 176.001; same idea.
|
||||
. ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. ; $$GET1^DIQ.
|
||||
. ;
|
||||
. ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. ; 176.003), by searching for "RXNORM", then get the data.
|
||||
. N MEDIEN S MEDIEN=$P(MED(6),U)
|
||||
. D NDF^PSS50(MEDIEN,,,,,"NDF")
|
||||
. N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
|
||||
. N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. ;
|
||||
. ; NDFIEN is not necessarily defined; it won't be if the drug
|
||||
. ; is not matched to the national drug file (e.g. if the drug is
|
||||
. ; new on the market, compounded, or is a fake drug [blue pill].
|
||||
. ; To protect against failure, I will put an if/else block
|
||||
. ;
|
||||
. N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER
|
||||
. I NDFIEN D
|
||||
. . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99)
|
||||
. . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID")
|
||||
. . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01)
|
||||
. . S SRCIEN=$$FIND1^DIC(176.003,,"B","RXNORM")
|
||||
. . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6)
|
||||
. . S RXNVER=$$GET1^DIQ(176.003,SRCIEN,7)
|
||||
. ;
|
||||
. E S (RXNORM,RXNNAME,RXNVER)=""
|
||||
. ; End if/else block
|
||||
. S @MAP@("MEDPRODUCTNAMECODEVALUE")=RXNORM
|
||||
. S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=RXNNAME
|
||||
. S @MAP@("MEDPRODUCTNAMECODEVERSION")=RXNVER
|
||||
. ;
|
||||
. S @MAP@("MEDBRANDNAMETEXT")=MED(6.5)
|
||||
. D DOSE^PSS50(MEDIEN,,,,,"DOSE")
|
||||
. N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
|
||||
. S @MAP@("MEDSTRENGTHVALUE")=DOSEDATA(901)
|
||||
|
@ -80,13 +117,9 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
. ; Units, concentration, etc, come from another call
|
||||
. ; $$CPRS^PSNAPIS which returns dosage-form^va class^strengh^unit
|
||||
. ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
|
||||
. ; NDF Entry IEN, and VA Product Name
|
||||
. ; NDF Entry IEN, and VA Product IEN
|
||||
. ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
|
||||
. ; Documented in the same manual.
|
||||
. D NDF^PSS50(MEDIEN,,,,,"CONC")
|
||||
. N NDFDATA M NDFDATA=^TMP($J,"CONC",MEDIEN)
|
||||
. N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. ; These have been collected above.
|
||||
. N CONCDATA
|
||||
. ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
|
||||
. ; and this will crash the call. So...
|
||||
|
|
52
p/CCRMEDS2.m
52
p/CCRMEDS2.m
|
@ -84,10 +84,46 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. ; series of fields that depend on it. We will use If and Else to deal
|
||||
. ; with that
|
||||
. N MEDIEN S MEDIEN=$P(MED(11),U)
|
||||
. I +MEDIEN>0 D
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$$GET1^DIQ(50,MEDIEN,31,"E")
|
||||
. . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
|
||||
. I +MEDIEN>0 D ; start of if/else block
|
||||
. . ; 12/30/08: I will be using RxNorm for coding...
|
||||
. . ; 176.001 is the file for Concepts; 176.003 is the file for
|
||||
. . ; sources (i.e. for RxNorm Version)
|
||||
. . ;
|
||||
. . ; We need the VUID first for the National Drug File entry first
|
||||
. . ; We get the VUID of the drug, by looking up the VA Product entry
|
||||
. . ; (file 50.68) using the call NDF^PSS50, returned in node 22.
|
||||
. . ; Field 99.99 is the VUID.
|
||||
. . ;
|
||||
. . ; We use the VUID to look up the RxNorm in file 176.001; same idea.
|
||||
. . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. . ; $$GET1^DIQ.
|
||||
. . ;
|
||||
. . ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. . ; 176.003), by searching for "RXNORM", then get the data.
|
||||
. . D NDF^PSS50(MEDIEN,,,,,"NDF")
|
||||
. . N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
|
||||
. . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . ;
|
||||
. . ; NDFIEN is not necessarily defined; it won't be if the drug
|
||||
. . ; is not matched to the national drug file (e.g. if the drug is
|
||||
. . ; new on the market, compounded, or is a fake drug [blue pill].
|
||||
. . ; To protect against failure, I will put an if/else block
|
||||
. . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER
|
||||
. . I NDFIEN D
|
||||
. . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99)
|
||||
. . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID")
|
||||
. . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01)
|
||||
. . . S SRCIEN=$$FIND1^DIC(176.003,,"B","RXNORM")
|
||||
. . . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6)
|
||||
. . . S RXNVER=$$GET1^DIQ(176.003,SRCIEN,7)
|
||||
. . ;
|
||||
. . E S (RXNORM,RXNNAME,RXNVER)=""
|
||||
. . ; End if/else block
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVALUE")=RXNORM
|
||||
. . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=RXNNAME
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVERSION")=RXNVER
|
||||
. . ;
|
||||
. . S @MAP@("MEDBRANDNAMETEXT")=""
|
||||
. . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
|
||||
. . N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
|
||||
|
@ -98,11 +134,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. . ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
|
||||
. . ; NDF Entry IEN, and VA Product Name
|
||||
. . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
|
||||
. . ; Documented in the same manual.
|
||||
. . D NDF^PSS50(MEDIEN,,,,,"CONC")
|
||||
. . N NDFDATA M NDFDATA=^TMP($J,"CONC",MEDIEN)
|
||||
. . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . ; Documented in the same manual; executed above.
|
||||
. . N CONCDATA
|
||||
. . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
|
||||
. . ; and this will crash the call. So...
|
||||
|
@ -133,7 +165,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. . S @MAP@("MEDSIZETEXT")=""
|
||||
. . S @MAP@("MEDQUANTITYVALUE")=""
|
||||
. . S @MAP@("MEDQUANTITYUNIT")=""
|
||||
. ;
|
||||
. ; end of if/else block
|
||||
. ;
|
||||
. ; --- START OF DIRECTIONS ---
|
||||
. ; Sig data is not in any API. We obtain it using the IEN from
|
||||
|
|
57
p/CCRMEDS3.m
57
p/CCRMEDS3.m
|
@ -20,7 +20,7 @@ CCRMEDS3 ; WV/CCDCCR/SMH - CCR/CCD PROCESSING FOR MEDICATIONS - Outside_
|
|||
W "NO ENTRY FROM TOP",!
|
||||
Q
|
||||
;
|
||||
EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
||||
EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template
|
||||
;
|
||||
; MINXML is the Input XML Template, passed by name
|
||||
; DFN is Patient IEN
|
||||
|
@ -77,10 +77,46 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. ; The actual drug entry in the drug file (MEDIEN) is not necessarily supplied.
|
||||
. ; It' node 1, internal form.
|
||||
. N MEDIEN S MEDIEN=MED(1,"I")
|
||||
. I +MEDIEN D
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$$GET1^DIQ(50,MEDIEN,31,"E")
|
||||
. . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
|
||||
. I +MEDIEN D ; start of if/else block
|
||||
. . ; 12/30/08: I will be using RxNorm for coding...
|
||||
. . ; 176.001 is the file for Concepts; 176.003 is the file for
|
||||
. . ; sources (i.e. for RxNorm Version)
|
||||
. . ;
|
||||
. . ; We need the VUID first for the National Drug File entry first
|
||||
. . ; We get the VUID of the drug, by looking up the VA Product entry
|
||||
. . ; (file 50.68) using the call NDF^PSS50, returned in node 22.
|
||||
. . ; Field 99.99 is the VUID.
|
||||
. . ;
|
||||
. . ; We use the VUID to look up the RxNorm in file 176.001; same idea.
|
||||
. . ; Get IEN first using $$FIND1^DIC, then get the RxNorm number by
|
||||
. . ; $$GET1^DIQ.
|
||||
. . ;
|
||||
. . ; I get the RxNorm name and version from the RxNorm Sources (file
|
||||
. . ; 176.003), by searching for "RXNORM", then get the data.
|
||||
. . D NDF^PSS50(MEDIEN,,,,,"NDF")
|
||||
. . N NDFDATA M NDFDATA=^TMP($J,"NDF",MEDIEN)
|
||||
. . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . ;
|
||||
. . ; NDFIEN is not necessarily defined; it won't be if the drug
|
||||
. . ; is not matched to the national drug file (e.g. if the drug is
|
||||
. . ; new on the market, compounded, or is a fake drug [blue pill].
|
||||
. . ; To protect against failure, I will put an if/else block
|
||||
. . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER
|
||||
. . I NDFIEN D
|
||||
. . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99)
|
||||
. . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID")
|
||||
. . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01)
|
||||
. . . S SRCIEN=$$FIND1^DIC(176.003,,"B","RXNORM")
|
||||
. . . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6)
|
||||
. . . S RXNVER=$$GET1^DIQ(176.003,SRCIEN,7)
|
||||
. . ;
|
||||
. . E S (RXNORM,RXNNAME,RXNVER)=""
|
||||
. . ; End if/else block
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVALUE")=RXNORM
|
||||
. . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=RXNNAME
|
||||
. . S @MAP@("MEDPRODUCTNAMECODEVERSION")=RXNVER
|
||||
. . ;
|
||||
. . S @MAP@("MEDBRANDNAMETEXT")=""
|
||||
. . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
|
||||
. . N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
|
||||
|
@ -91,15 +127,8 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. . ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
|
||||
. . ; NDF Entry IEN, and VA Product Name
|
||||
. . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
|
||||
. . ; Documented in the same manual.
|
||||
. . ; Documented in the same manual; executed above.
|
||||
. . ;
|
||||
. . ; If the drug is not matched to the National Drug File
|
||||
. . ; there will be no NDF Data.
|
||||
. . N NDFDATA,CONCDATA
|
||||
. . D NDF^PSS50(MEDIEN,,,,,"CONC")
|
||||
. . M NDFDATA=^TMP($J,"CONC",MEDIEN)
|
||||
. . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
|
||||
. . N VAPROD S VAPROD=$P(NDFDATA(22),U)
|
||||
. . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
|
||||
. . ; and this will crash the call. So...
|
||||
. . I NDFIEN="" S CONCDATA=""
|
||||
|
@ -129,7 +158,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. . S @MAP@("MEDSIZETEXT")=""
|
||||
. . S @MAP@("MEDQUANTITYVALUE")=""
|
||||
. . S @MAP@("MEDQUANTITYUNIT")=""
|
||||
. ;
|
||||
. ; End If/Else
|
||||
. ; --- START OF DIRECTIONS ---
|
||||
. ; Dosage is field 2, route is 3, schedule is 4
|
||||
. ; These are all free text fields, and don't point to any files
|
||||
|
|
Loading…
Reference in New Issue