- Timestamp:
- Oct 21, 2009, 7:59:28 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/p/C0CRXNRD.m
r581 r582 3 3 W "No entry from top" Q 4 4 ; 5 DELFILED(FN,ERR) ; Delete file data; PEP procedure; READ WARNING 6 ; FN is Filenumber passed by Value 7 ; ERR is error info, passed by reference 8 ; If ERR is 1, then the operation failed. 9 ; WARNING: THIS IS VERY DANGEROUS OPERATION 10 ; I DON'T EVEN CHECK THE DEL NODE ON THE FILE!!!! 11 ; 12 D CLEAN^DILF ; Clean FM variables 13 N C0CFINFO ; File info 14 D FILE^DID(FN,"","GLOBAL NAME","C0CROOT") ; Get file info 15 I $D(DIERR) D EN^DDIOL("Error...") S ERR=1 QUIT 16 N ROOT2 S ROOT2=C0CROOT("GLOBAL NAME") ; Open global root 17 N CLROOT S CLROOT=$$CREF^DILF(ROOT2) ; Closed Root 18 N ZERO S ZERO=@CLROOT@(0) ; Save zero node 19 S $P(ZERO,U,3,9999)="" ; Remove entry # and last edited 20 K @CLROOT ; Kill the file -- so sad! 21 S @CLROOT@(0)=ZERO ; It riseth again! 22 QUIT 23 GETLINES(PATH,FILENAME) ; Get number of lines in a file 24 D OPEN^%ZISH("FILE",PATH,FILENAME,"R") 25 U IO 26 N I 27 F I=1:1 R LINE Q:$$STATUS^%ZISH 28 D CLOSE^%ZISH("FILE") 29 Q I-1 5 30 READCON(PATH) ; Open and read concepts file: RXNCONSO.RRF 6 31 I PATH="" QUIT 7 32 N FILENAME S FILENAME="RXNCONSO.RRF" 33 N ERR 34 D DELFILED(176.001,.ERR) ; delete data 35 IF $G(ERR) D EN^DDIOL("Couldn't delete file") G EX 36 N LINES S LINES=$$GETLINES(PATH,FILENAME) 8 37 D OPEN^%ZISH("FILE",PATH,FILENAME,"R") 9 IF POP W "Error reading file..., Please check...",! BREAK 10 F I=1:1 Q:$$STATUS^%ZISH D 38 IF POP D EN^DDIOL("Error reading file..., Please check...") G EX 39 N C0CCOUNT 40 F C0CCOUNT=1:1 D Q:$$STATUS^%ZISH 11 41 . U IO 12 42 . N LINE R LINE 13 43 . IF $$STATUS^%ZISH QUIT 14 . U $P W I,! U IO ; Write I to the screen, then go back to reading the file44 . I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000 15 45 . N RXCUI,RXAUI,SAB,TTY,CODE,STR ; Fileman fields numbers below 16 46 . S RXCUI=$P(LINE,"|",1) ; .01 … … 25 55 . N STRLINE S STRLINE=$L(STR)\80+1 26 56 . ; In each line, chop 80 characters off, reset STR to be the rest 27 . F J=1:1:STRLINE S STR(J)=$E(STR,1,80) S STR=$E(STR,81,$L(STR))57 . N J F J=1:1:STRLINE S STR(J)=$E(STR,1,80) S STR=$E(STR,81,$L(STR)) 28 58 . ; Now, construct the FDA array 29 59 . N RXNFDA 30 . S RXNFDA(176.001,"+"_ I_",",.01)=RXCUI31 . S RXNFDA(176.001,"+"_ I_",",1)=RXAUI32 . S RXNFDA(176.001,"+"_ I_",",2)=SAB33 . S RXNFDA(176.001,"+"_ I_",",3)=TTY34 . S RXNFDA(176.001,"+"_ I_",",4)=CODE60 . S RXNFDA(176.001,"+"_C0CCOUNT_",",.01)=RXCUI 61 . S RXNFDA(176.001,"+"_C0CCOUNT_",",1)=RXAUI 62 . S RXNFDA(176.001,"+"_C0CCOUNT_",",2)=SAB 63 . S RXNFDA(176.001,"+"_C0CCOUNT_",",3)=TTY 64 . S RXNFDA(176.001,"+"_C0CCOUNT_",",4)=CODE 35 65 . D UPDATE^DIE("","RXNFDA") 36 . I $D(^TMP("DIERR",$J)) U $P BREAK66 . I $D(^TMP("DIERR",$J)) D EN^DDIOL("ERROR") G EX 37 67 . ; Now, file WP field STR 38 . D WP^DIE(176.001,I_",",5,,$NA(STR)) 39 D CLOSE^%ZISH("FILE") 40 Q 41 ; 68 . D WP^DIE(176.001,C0CCOUNT_",",5,,$NA(STR)) 69 EX D CLOSE^%ZISH("FILE") 70 QUIT 42 71 READNDC(PATH) ; Open and read NDC/RxNorm/VANDF relationship file: RXNSAT.RRF 43 72 I PATH="" QUIT 44 73 N FILENAME S FILENAME="RXNSAT.RRF" 74 N ERR 75 D DELFILED(176.002,.ERR) ; delete data 76 IF $G(ERR) D EN^DDIOL("Couldn't delete file") G EX2 77 N LINES S LINES=$$GETLINES(PATH,FILENAME) 45 78 D OPEN^%ZISH("FILE",PATH,FILENAME,"R") 46 IF POP W "Error reading file..., Please check...",! BREAK47 F I=1:1 Q:$$STATUS^%ZISH D79 IF POP W "Error reading file..., Please check...",! G EX2 80 F C0CCOUNT=1:1 Q:$$STATUS^%ZISH D 48 81 . U IO 49 82 . N LINE R LINE 50 83 . IF $$STATUS^%ZISH QUIT 51 . U $P W I U IO52 . IF LINE'["NDC|RXNORM" U $P W ?20,"No NDC Here :-)",! U IOQUIT84 . I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000 85 . IF LINE'["NDC|RXNORM" QUIT 53 86 . ; Otherwise, we are good to go 54 . U $P W ?20,"Found RXNORM/NDC Set",! U IO55 87 . N RXCUI,NDC ; Fileman fields below 56 88 . S RXCUI=$P(LINE,"|",1) ; .01 … … 59 91 . N DIC,X,DA,DR 60 92 . K DO 61 . S DIC="^C0CRXN(176.002,",DIC(0)="F",X=RXCUI 93 . S DIC="^C0CRXN(176.002,",DIC(0)="F",X=RXCUI,DIC("DR")="2////"_NDC 62 94 . D FILE^DICN 63 . I Y<1 U $P W !,"THERE IS TROUBLE IN RIVER CITY",! BREAK 64 . S DIE=DIC,DA=$P(Y,"^") 65 . S DR="2////^S X=NDC" 66 . D ^DIE 67 D CLOSE^%ZISH("FILE") 68 U $P ; reset back to principle device 95 . I Y<1 U $P W !,"THERE IS TROUBLE IN RIVER CITY",! G EX2 96 EX2 D CLOSE^%ZISH("FILE") 69 97 QUIT 70 98 READSRC(PATH) ; Open the read RxNorm Sources file: RXNSAB.RRF 71 99 I PATH="" QUIT 72 100 N FILENAME S FILENAME="RXNSAB.RRF" 101 N ERR 102 D DELFILED(176.003,.ERR) ; delete data 103 IF $G(ERR) D EN^DDIOL("Couldn't delete file") G EX2 73 104 D OPEN^%ZISH("FILE",PATH,FILENAME,"R") 74 IF POP W "Error reading file..., Please check...",! BREAK105 IF POP W "Error reading file..., Please check...",! G EX3 75 106 F I=1:1 Q:$$STATUS^%ZISH D 76 107 . U IO … … 103 134 . S RXNFDA(176.003,"+"_I_",",7)=SVER 104 135 . D UPDATE^DIE("","RXNFDA") 105 . I $D(^TMP("DIERR",$J)) U $P BREAK136 . I $D(^TMP("DIERR",$J)) U $P W "ERR" G EX 106 137 . ; Now, file WP field SCIT 107 138 . D WP^DIE(176.003,I_",",25,,$NA(SCIT)) 108 D CLOSE^%ZISH("FILE")139 EX3 D CLOSE^%ZISH("FILE") 109 140 Q 110 141
Note:
See TracChangeset
for help on using the changeset viewer.