Ignore:
Timestamp:
Nov 14, 2013, 5:40:26 PM (10 years ago)
Author:
Sam Habiel
Message:

Two routines modified: C0CRXNRD and C0CRXNLK.

C0CRXNRD (loader utility):

  • Can now import RxNorm prescribably subset
  • Will import public domain by default except if RESTRICTED is passed to IMPORT as 1 (second parameter).

C0CRXNLK (lookup utilities):

  • FDB Unit Tests don't run if FDB from RxNorm isn't loaded.
  • New API: $$RXN2GCN - Get GCNs from RXNCUI (+UT).
  • New API: $$VUI2GCN - Get VUIDs from GCN (No UT supplied).
  • New API: $$RXN2NDC - Get NDCs for a given RxNorm CUI (+UT).
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:32 PM
    2         ;;2.0;RX NORM;;May 11, 2012;Build 50
     1C0CRXNRD        ; 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
    33        ; (C) Sam Habiel 2013
    44        ; See license for terms of use.
    55        ;
    66        W "No entry from top" Q
    7 IMPORT(PATH) ; PUBLIC ENTRY POINT. Rest are private
     7IMPORT(PATH,RESTRICTED) ; PUBLIC ENTRY POINT. Rest are private
    88        I PATH="" QUIT
     9        S RESTRICTED=$G(RESTRICTED,0)
    910        S U="^"
    1011        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
    1216        N ENDTIME S ENDTIME=$P($H,",")*24*60*60+$P($H,",",2)
    1317        W !,(ENDTIME-STARTTIME)/60_" minutes elapsed"
     
    2529        QUIT
    2630GETLINES(PATH,FILENAME) ; Get number of lines in a file
     31        N POP
    2732        D OPEN^%ZISH("FILE",PATH,FILENAME,"R")
     33        Q:POP
    2834        U IO
    2935        N I,LINE
     
    3137        D CLOSE^%ZISH("FILE")
    3238        Q I-1
    33 CONSO(PATH,INCRES)      ; Open and read concepts file: RXNCONSO.RRF
     39CONSO(PATH,SABS,RESTRICTED)     ; Open and read concepts file: RXNCONSO.RRF
    3440        ; 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
    3643        I PATH="" QUIT
    37         S INCRES=+$G(INCRES) ; if not passed, becomes zero.
    3844        N FILENAME S FILENAME="RXNCONSO.RRF"
    3945        D DELFILED(176.001) ; delete data
     
    4854        . IF $$STATUS^%ZISH QUIT
    4955        . 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
    5062        . 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 file
    54         . ; N RESTRIC S RESTRIC=$$GET1^DIQ(176.003,SRCIEN,14,"I") ; 14 is restriction field; values 0-4
    55         . ; 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 quit
    57         . ; I 'INCRES,RESTRIC QUIT
    5863EX      D CLOSE^%ZISH("FILE")
    5964        N DIK S DIK="^C0CRXN(176.001," D IXALL^DIK
     
    6166        ;
    6267        ;
    63 SAT(PATH)       ; Open and read Concept and Atom attributes: RXNSAT.RRF
     68SAT(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
    6472        I PATH="" QUIT
    6573        N FILENAME S FILENAME="RXNSAT.RRF"
     
    8290        . S $P(LINE,"|",9)=RXCUI1
    8391        . ;
     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        . ;
    8496        . ; Save off
    8597        . S ^C0CRXN(176.002,C0CCOUNT,0)=$TR(LINE,"|^","^|")
     
    89101        ;
    90102        ;
    91 SAB(PATH)       ; Open the read RxNorm Sources file: RXNSAB.RRF
     103SAB(PATH,SABS)  ; Open the read RxNorm Sources file: RXNSAB.RRF
    92104        I PATH="" QUIT
    93105        N FILENAME S FILENAME="RXNSAB.RRF"
     
    109121EX3     D CLOSE^%ZISH("FILE")
    110122        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")
    111125        QUIT
    112126STY(PATH)       ; Open and read RxNorm Semantic types file: RXNSTY.RRF
Note: See TracChangeset for help on using the changeset viewer.