Changeset 1770 for ccr/trunk/rxnorm
- Timestamp:
- Aug 5, 2016, 2:35:54 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/rxnorm/trunk/routines/C0CRXNAD.m
r1730 r1770 1 1 C0CRXNAD ; VEN/SMH - Add a drug to VISTA from RxNorm;2013-04-19 5:39 PM 2 2 ;;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 5 28 ; 6 29 ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File … … 14 37 I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1," 15 38 ; 16 N PSSZ S PSSZ=1 ; Needed for the drug file to let me in!17 ;18 39 ; If RXN refers to a brand drug, get the generic instead. 19 40 I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN) … … 23 44 N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN) 24 45 Q:'VUID 46 G NEXT 47 ADDDRUG2(RXN,VUID) ; 48 NEXT ; 49 N PSSZ S PSSZ=1 ; Needed for the drug file to let me in! 50 ; 25 51 W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,! 26 52 ; … … 45 71 ; 46 72 ; Brand Names 47 N BNS S BNS= $$RXN2BNS^C0CRXNLK(RXN) ; Brands73 N BNS S BNS="" ; S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands 48 74 I $L(BNS) N I F I=1:1:$L(BNS,U) D 49 75 . N IENS S IENS=I+2
Note:
See TracChangeset
for help on using the changeset viewer.