Good copy of C0CRXNRD

This commit is contained in:
sam 2009-10-21 18:13:44 +00:00
parent 8e0196faf6
commit 7dfacb9382
1 changed files with 41 additions and 0 deletions

View File

@ -67,3 +67,44 @@ READNDC(PATH) ; Open and read NDC/RxNorm/VANDF relationship file: RXNSAT.RRF
D CLOSE^%ZISH("FILE")
U $P ; reset back to principle device
QUIT
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