Added web service call as an example
This commit is contained in:
parent
3a8d6017d5
commit
be4ee11729
|
@ -1,7 +1,30 @@
|
||||||
C0CRXNAD ; VEN/SMH - Add a drug to VISTA from RxNorm;2013-04-19 5:39 PM
|
C0CRXNAD ; VEN/SMH - Add a drug to VISTA from RxNorm;2013-04-19 5:39 PM
|
||||||
;;2.5;RXNORM FOR VISTA;;Apr 27, 2016;Build 17
|
;;2.5;RXNORM FOR VISTA;;Apr 27, 2016;Build 17
|
||||||
; (C) 2013 Sam Habiel
|
; (C) 2016 Sam Habiel
|
||||||
; Proprietary Code. Don't use if license terms aren't supplied.
|
;
|
||||||
|
N X
|
||||||
|
R "Enter GCNSEQNO (with leading zeros): ",X:DTIME,!
|
||||||
|
E QUIT
|
||||||
|
I X="" QUIT
|
||||||
|
I X="^" QUIT
|
||||||
|
N URL S URL="https://rxnav.nlm.nih.gov/REST/rxcui.json?idtype=GCN_SEQNO&id="_X
|
||||||
|
K ^TMP("C0CJSON",$J),^TMP("C0CARR1",$J)
|
||||||
|
N STATUS S STATUS=$$GETURL^XTHC10(URL,1,$NA(^TMP("C0CJSON",$J)))
|
||||||
|
I +STATUS'=200 W "ERROR",! QUIT
|
||||||
|
D DECODE^VPRJSON($NA(^TMP("C0CJSON",$J)),$NA(^TMP("C0CARR1",$J)))
|
||||||
|
N I F I=0:0 S I=$O(^TMP("C0CARR1",$J,"idGroup","rxnormId",I)) Q:'I D
|
||||||
|
. N RXN S RXN=^TMP("C0CARR1",$J,"idGroup","rxnormId",I)
|
||||||
|
. S URL="https://rxnav.nlm.nih.gov/REST/rxcui/{RXN}/property.json?propName=VUID"
|
||||||
|
. N % S %("{RXN}")=RXN
|
||||||
|
. S URL=$$REPLACE^XLFSTR(URL,.%)
|
||||||
|
. K ^TMP("C0CJSON",$J),^TMP("C0CARR2",$J)
|
||||||
|
. N STATUS S STATUS=$$GETURL^XTHC10(URL,1,$NA(^TMP("C0CJSON",$J)))
|
||||||
|
. D DECODE^VPRJSON($NA(^TMP("C0CJSON",$J)),$NA(^TMP("C0CARR2",$J)))
|
||||||
|
. N DONE S DONE=0
|
||||||
|
. N J F J=0:0 S J=$O(^TMP("C0CARR2",$J,"propConceptGroup","propConcept",J)) Q:'J D Q:DONE
|
||||||
|
.. N VAPRDVUID S VAPRDVUID=^TMP("C0CARR2",$J,"propConceptGroup","propConcept",J,"propValue")
|
||||||
|
.. S DONE=$$ADDDRUG2(RXN,VAPRDVUID)
|
||||||
|
QUIT
|
||||||
;
|
;
|
||||||
ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
|
ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
|
||||||
; Input: RXN - RxNorm Semantic Clinical Drug CUI by Value. Required.
|
; Input: RXN - RxNorm Semantic Clinical Drug CUI by Value. Required.
|
||||||
|
@ -13,8 +36,6 @@ ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
|
||||||
I '$G(RXN) S $EC=",U1," ; Required
|
I '$G(RXN) S $EC=",U1," ; Required
|
||||||
I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1,"
|
I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1,"
|
||||||
;
|
;
|
||||||
N PSSZ S PSSZ=1 ; Needed for the drug file to let me in!
|
|
||||||
;
|
|
||||||
; If RXN refers to a brand drug, get the generic instead.
|
; If RXN refers to a brand drug, get the generic instead.
|
||||||
I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN)
|
I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN)
|
||||||
W !,"(debug) RxNorm is "_RXN,!
|
W !,"(debug) RxNorm is "_RXN,!
|
||||||
|
@ -22,6 +43,11 @@ ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
|
||||||
; Get first VUID for this RxNorm drug
|
; Get first VUID for this RxNorm drug
|
||||||
N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN)
|
N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN)
|
||||||
Q:'VUID
|
Q:'VUID
|
||||||
|
G NEXT
|
||||||
|
ADDDRUG2(RXN,VUID) ;
|
||||||
|
NEXT ;
|
||||||
|
N PSSZ S PSSZ=1 ; Needed for the drug file to let me in!
|
||||||
|
;
|
||||||
W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,!
|
W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,!
|
||||||
;
|
;
|
||||||
; IEN in 50.68
|
; IEN in 50.68
|
||||||
|
@ -44,7 +70,7 @@ ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File
|
||||||
. S C0XFDA(50.1,"+2,+1,",1)="Q"
|
. S C0XFDA(50.1,"+2,+1,",1)="Q"
|
||||||
;
|
;
|
||||||
; Brand Names
|
; Brand Names
|
||||||
N BNS S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands
|
N BNS S BNS="" ; S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands
|
||||||
I $L(BNS) N I F I=1:1:$L(BNS,U) D
|
I $L(BNS) N I F I=1:1:$L(BNS,U) D
|
||||||
. N IENS S IENS=I+2
|
. N IENS S IENS=I+2
|
||||||
. S C0XFDA(50.1,"+"_IENS_",+1,",.01)=$$UP^XLFSTR($E($P(BNS,U,I),1,40))
|
. S C0XFDA(50.1,"+"_IENS_",+1,",.01)=$$UP^XLFSTR($E($P(BNS,U,I),1,40))
|
||||||
|
|
Loading…
Reference in New Issue