updated RPMS Meds...; still working on RxNorm

This commit is contained in:
sam 2009-11-03 19:29:36 +00:00
parent 20208f27ed
commit 4c2511b09c
3 changed files with 17 additions and 34 deletions

View File

@ -40,10 +40,12 @@ EXTRACT(MINXML,DFN,OUTXML,FLAGS) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLA
; -- DFN is passed by value (required)
; -- DAYS is passed by value (optional; if not passed defaults to 365)
;
; Return:
; ~Type^PharmID^Drug^InfRate^StopDt^RefRem^TotDose^UnitDose^OrderID
; ^Status^LastFill^Chronic^Issued^Rx #^Provider^
; Status Reason^DEA Handling
; Return:
; ~Type(1)^PharmID(2)^Drug(3)^InfRate(4)^StopDt(5)^RefRem(6)^
; TotDose(7)^UnitDose(8)^OrderID(9)^Status(10)^LastFill(11)^
; Days Supply(12)^Quantity(13)^Chronic(14)^Issued(15)^
; Rx #(16)^Provider(17)^Status Reason(18)^DEA Handling(19)^
; Pharmacy Site(20)
;
N MEDS,MEDS1,MAP
D GETRXS^BEHORXFN("MEDS1",DFN,$P($P(FLAGS,U,2),"-",2)) ; 2nd piece of FLAGS is # of days to retrieve, which comes in the form "T-360"
@ -73,11 +75,11 @@ EXTRACT(MINXML,DFN,OUTXML,FLAGS) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLA
. I DEBUG W "MAP= ",MAP,!
. S @MAP@("MEDOBJECTID")="MED"_MEDCNT ; MEDCNT FOR ID
. S @MAP@("MEDISSUEDATETXT")="Issue Date"
. S @MAP@("MEDISSUEDATE")=$$FMDTOUTC^C0CUTIL($P(MEDS(MEDCNT),U,13))
. S @MAP@("MEDISSUEDATE")=$$FMDTOUTC^C0CUTIL($P(MEDS(MEDCNT),U,15))
. S @MAP@("MEDLASTFILLDATETXT")="Last Fill Date"
. S @MAP@("MEDLASTFILLDATE")=$$FMDTOUTC^C0CUTIL($P(MEDS(MEDCNT),U,11))
. S @MAP@("MEDRXNOTXT")="Prescription Number"
. S @MAP@("MEDRXNO")=$P(MEDS(MEDCNT),U,14)
. S @MAP@("MEDRXNO")=$P(MEDS(MEDCNT),U,16)
. S @MAP@("MEDTYPETEXT")="Medication"
. S @MAP@("MEDDETAILUNADORNED")="" ; Leave blank, field has its uses
. S @MAP@("MEDSTATUSTEXT")=$P(MEDS(MEDCNT),U,10)

View File

@ -2,23 +2,15 @@ C0CRXNRD ; WV/SMH - CCR/CCD PROJECT: Routine to Read RxNorm files;11/15/08
;;0.1;CCDCCR;nopatch;noreleasedate
W "No entry from top" Q
;
DELFILED(FN,ERR) ; Delete file data; PEP procedure; READ WARNING
DELFILED(FN) ; Delete file data; PEP procedure; only for RxNorm files
; FN is Filenumber passed by Value
; ERR is error info, passed by reference
; If ERR is 1, then the operation failed.
; WARNING: THIS IS VERY DANGEROUS OPERATION
; I DON'T EVEN CHECK THE DEL NODE ON THE FILE!!!!
;
QUIT:$E(FN,1,3)'=176 ; Quit if not RxNorm files
D CLEAN^DILF ; Clean FM variables
N C0CFINFO ; File info
D FILE^DID(FN,"","GLOBAL NAME","C0CROOT") ; Get file info
I $D(DIERR) D EN^DDIOL("Error...") S ERR=1 QUIT
N ROOT2 S ROOT2=C0CROOT("GLOBAL NAME") ; Open global root
N CLROOT S CLROOT=$$CREF^DILF(ROOT2) ; Closed Root
N ZERO S ZERO=@CLROOT@(0) ; Save zero node
N ROOT S ROOT=$$ROOT^DILFD(FN,"",1) ; global root
N ZERO S ZERO=@ROOT@(0) ; Save zero node
S $P(ZERO,U,3,9999)="" ; Remove entry # and last edited
K @CLROOT ; Kill the file -- so sad!
S @CLROOT@(0)=ZERO ; It riseth again!
K @ROOT ; Kill the file -- so sad!
S @ROOT@(0)=ZERO ; It riseth again!
QUIT
GETLINES(PATH,FILENAME) ; Get number of lines in a file
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
@ -30,9 +22,7 @@ GETLINES(PATH,FILENAME) ; Get number of lines in a file
READCON(PATH) ; Open and read concepts file: RXNCONSO.RRF
I PATH="" QUIT
N FILENAME S FILENAME="RXNCONSO.RRF"
N ERR
D DELFILED(176.001,.ERR) ; delete data
IF $G(ERR) D EN^DDIOL("Couldn't delete file") G EX
D DELFILED(176.001) ; delete data
N LINES S LINES=$$GETLINES(PATH,FILENAME)
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
IF POP D EN^DDIOL("Error reading file..., Please check...") G EX
@ -71,9 +61,7 @@ EX D CLOSE^%ZISH("FILE")
READNDC(PATH) ; Open and read NDC/RxNorm/VANDF relationship file: RXNSAT.RRF
I PATH="" QUIT
N FILENAME S FILENAME="RXNSAT.RRF"
N ERR
D DELFILED(176.002,.ERR) ; delete data
IF $G(ERR) D EN^DDIOL("Couldn't delete file") G EX2
D DELFILED(176.002) ; delete data
N LINES S LINES=$$GETLINES(PATH,FILENAME)
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
IF POP W "Error reading file..., Please check...",! G EX2
@ -98,9 +86,7 @@ EX2 D CLOSE^%ZISH("FILE")
READSRC(PATH) ; Open the read RxNorm Sources file: RXNSAB.RRF
I PATH="" QUIT
N FILENAME S FILENAME="RXNSAB.RRF"
N ERR
D DELFILED(176.003,.ERR) ; delete data
IF $G(ERR) D EN^DDIOL("Couldn't delete file") G EX2
D DELFILED(176.003) ; delete data
D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
IF POP W "Error reading file..., Please check...",! G EX3
F I=1:1 Q:$$STATUS^%ZISH D

View File

@ -112,8 +112,3 @@ Most of the command line interface functions in the package are intended to also
The "RIM" variables and attributes that are now being stored in ^TMP("C0CRIM") are intended to be maintained in a standard FILEMAN global, and to take advantage of FILEMAN indexing for efficient batch analysis and processing.
It is intended that menu interfaces be provided in addition to command line interfaces for all package functions.