Changeset 1770 for ccr/trunk/rxnorm


Ignore:
Timestamp:
Aug 5, 2016, 2:35:54 PM (8 years ago)
Author:
Sam Habiel
Message:

Added web service call as an example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/rxnorm/trunk/routines/C0CRXNAD.m

    r1730 r1770  
    11C0CRXNAD ; VEN/SMH - Add a drug to VISTA from RxNorm;2013-04-19  5:39 PM
    22 ;;2.5;RXNORM FOR VISTA;;Apr 27, 2016;Build 17
    3  ; (C) 2013 Sam Habiel
    4  ; Proprietary Code. Don't use if license terms aren't supplied.
     3 ; (C) 2016 Sam Habiel
     4 ;
     5 N X
     6 R "Enter GCNSEQNO (with leading zeros): ",X:DTIME,!
     7 E  QUIT
     8 I X="" QUIT
     9 I X="^" QUIT
     10 N URL S URL="https://rxnav.nlm.nih.gov/REST/rxcui.json?idtype=GCN_SEQNO&id="_X
     11 K ^TMP("C0CJSON",$J),^TMP("C0CARR1",$J)
     12 N STATUS S STATUS=$$GETURL^XTHC10(URL,1,$NA(^TMP("C0CJSON",$J)))
     13 I +STATUS'=200 W "ERROR",! QUIT
     14 D DECODE^VPRJSON($NA(^TMP("C0CJSON",$J)),$NA(^TMP("C0CARR1",$J)))
     15 N I F I=0:0 S I=$O(^TMP("C0CARR1",$J,"idGroup","rxnormId",I)) Q:'I  D
     16 . N RXN S RXN=^TMP("C0CARR1",$J,"idGroup","rxnormId",I)
     17 . S URL="https://rxnav.nlm.nih.gov/REST/rxcui/{RXN}/property.json?propName=VUID"
     18 . N % S %("{RXN}")=RXN
     19 . S URL=$$REPLACE^XLFSTR(URL,.%)
     20 . K ^TMP("C0CJSON",$J),^TMP("C0CARR2",$J)
     21 . N STATUS S STATUS=$$GETURL^XTHC10(URL,1,$NA(^TMP("C0CJSON",$J)))
     22 . D DECODE^VPRJSON($NA(^TMP("C0CJSON",$J)),$NA(^TMP("C0CARR2",$J)))
     23 . N DONE S DONE=0
     24 . N J F J=0:0 S J=$O(^TMP("C0CARR2",$J,"propConceptGroup","propConcept",J)) Q:'J  D  Q:DONE
     25 .. N VAPRDVUID S VAPRDVUID=^TMP("C0CARR2",$J,"propConceptGroup","propConcept",J,"propValue")
     26 .. S DONE=$$ADDDRUG2(RXN,VAPRDVUID)
     27 QUIT
    528 ;
    629ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
     
    1437 I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1,"
    1538 ;
    16  N PSSZ S PSSZ=1    ; Needed for the drug file to let me in!
    17  ;
    1839 ; If RXN refers to a brand drug, get the generic instead.
    1940 I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN)
     
    2344 N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN)
    2445 Q:'VUID
     46 G NEXT
     47ADDDRUG2(RXN,VUID) ;
     48NEXT ;
     49 N PSSZ S PSSZ=1    ; Needed for the drug file to let me in!
     50 ;
    2551 W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,!
    2652 ;
     
    4571 ;
    4672 ; Brand Names
    47  N BNS S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands
     73 N BNS S BNS="" ; S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands
    4874 I $L(BNS) N I F I=1:1:$L(BNS,U) D
    4975 . N IENS S IENS=I+2
Note: See TracChangeset for help on using the changeset viewer.