Changeset 1630 for ccr/trunk/rxnorm/trunk/routines/C0CRXNRD.m
- Timestamp:
- Nov 14, 2013, 5:40:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/rxnorm/trunk/routines/C0CRXNRD.m
r1615 r1630 1 C0CRXNRD ; VEN/SMH - RxNorm Utilities: Routine to Read RxNorm files;2013- 03-06 4:32PM2 ;;2. 0;RX NORM;;May 11, 2012;Build 501 C0CRXNRD ; VEN/SMH - RxNorm Utilities: Routine to Read RxNorm files;2013-11-14 1:23 PM 2 ;;2.2;RXNORM FOR VISTA;;Nov 14, 2013;Build 8 3 3 ; (C) Sam Habiel 2013 4 4 ; See license for terms of use. 5 5 ; 6 6 W "No entry from top" Q 7 IMPORT(PATH ); PUBLIC ENTRY POINT. Rest are private7 IMPORT(PATH,RESTRICTED) ; PUBLIC ENTRY POINT. Rest are private 8 8 I PATH="" QUIT 9 S RESTRICTED=$G(RESTRICTED,0) 9 10 S U="^" 10 11 N STARTTIME S STARTTIME=$P($H,",")*24*60*60+$P($H,",",2) 11 D SAB(PATH),CONSO(PATH),SAT(PATH),STY(PATH),REL(PATH),DOC(PATH) 12 N SABS 13 D SAB(PATH,.SABS) ; Load restriction values into SAB. ; 176.006 14 D CONSO(PATH,.SABS,RESTRICTED),SAT(PATH,.SABS,RESTRICTED) ; 176.001,176.002 15 D STY(PATH),REL(PATH),DOC(PATH) ; 176.003-5 12 16 N ENDTIME S ENDTIME=$P($H,",")*24*60*60+$P($H,",",2) 13 17 W !,(ENDTIME-STARTTIME)/60_" minutes elapsed" … … 25 29 QUIT 26 30 GETLINES(PATH,FILENAME) ; Get number of lines in a file 31 N POP 27 32 D OPEN^%ZISH("FILE",PATH,FILENAME,"R") 33 Q:POP 28 34 U IO 29 35 N I,LINE … … 31 37 D CLOSE^%ZISH("FILE") 32 38 Q I-1 33 CONSO(PATH, INCRES) ; Open and read concepts file: RXNCONSO.RRF39 CONSO(PATH,SABS,RESTRICTED) ; Open and read concepts file: RXNCONSO.RRF 34 40 ; PATH ByVal, path of RxNorm files 35 ; INCRES ByVal, include restricted sources. 1 for yes, 0 for no 41 ; SABS ByRef, arrays of SABS(SAB)=restriction level 42 ; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no 36 43 I PATH="" QUIT 37 S INCRES=+$G(INCRES) ; if not passed, becomes zero.38 44 N FILENAME S FILENAME="RXNCONSO.RRF" 39 45 D DELFILED(176.001) ; delete data … … 48 54 . IF $$STATUS^%ZISH QUIT 49 55 . I '(C0CCOUNT#1000) U $P W C0CCOUNT," of ",LINES," read ",! U IO ; update every 1000 56 . ; 57 . ; Deal with restriction level 58 . N SAB S SAB=$P(LINE,"|",12) 59 . I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit 60 . ; 61 . ; Save data 50 62 . S ^C0CRXN(176.001,C0CCOUNT,0)=$TR(LINE,"|^","^|") 51 . ; TODO Implement Filtering:52 . ; If the source is a restricted source, decide what to do based on what's asked.53 . ; N SRCIEN S SRCIEN=$$FIND1^DIC(176.003,"","QX",SAB,"B") ; SrcIEN in RXNORM SOURCES file54 . ; N RESTRIC S RESTRIC=$$GET1^DIQ(176.003,SRCIEN,14,"I") ; 14 is restriction field; values 0-455 . ; If RESTRIC is zero, then it's unrestricted. Everything else is restricted.56 . ; If user didn't ask to include restricted sources, and the source is restricted, then quit57 . ; I 'INCRES,RESTRIC QUIT58 63 EX D CLOSE^%ZISH("FILE") 59 64 N DIK S DIK="^C0CRXN(176.001," D IXALL^DIK … … 61 66 ; 62 67 ; 63 SAT(PATH) ; Open and read Concept and Atom attributes: RXNSAT.RRF 68 SAT(PATH,SABS,RESTRICTED) ; Open and read Concept and Atom attributes: RXNSAT.RRF 69 ; PATH ByVal, path of RxNorm files 70 ; SABS ByRef, arrays of SABS(SAB)=restriction level 71 ; RESTRICTED ByVal, include restricted sources. 1 for yes, 0 for no 64 72 I PATH="" QUIT 65 73 N FILENAME S FILENAME="RXNSAT.RRF" … … 82 90 . S $P(LINE,"|",9)=RXCUI1 83 91 . ; 92 . ; Deal with restricted sources 93 . N SAB S SAB=$P(LINE,"|",10) 94 . I 'RESTRICTED,SABS(SAB) QUIT ; If not include restricted, and SABS(SAB) is not zero, quit 95 . ; 84 96 . ; Save off 85 97 . S ^C0CRXN(176.002,C0CCOUNT,0)=$TR(LINE,"|^","^|") … … 89 101 ; 90 102 ; 91 SAB(PATH ) ; Open the read RxNorm Sources file: RXNSAB.RRF103 SAB(PATH,SABS) ; Open the read RxNorm Sources file: RXNSAB.RRF 92 104 I PATH="" QUIT 93 105 N FILENAME S FILENAME="RXNSAB.RRF" … … 109 121 EX3 D CLOSE^%ZISH("FILE") 110 122 N DIK S DIK="^C0CRXN(176.003," D IXALL^DIK 123 N C0CI F C0CI=0:0 S C0CI=$O(^C0CRXN(176.003,C0CI)) Q:'C0CI D 124 . S SABS($$GET1^DIQ(176.003,C0CI,.01))=$$GET1^DIQ(176.003,C0CI,"SRL") 111 125 QUIT 112 126 STY(PATH) ; Open and read RxNorm Semantic types file: RXNSTY.RRF
Note:
See TracChangeset
for help on using the changeset viewer.