HMPDMDC ;SLC/MKB,DP,ASMR/RRB - CLiO extract;8/2/11 15:29
;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Sep 01, 2011;Build 63
;Per VA Directive 6402, this routine should not be modified.
;
; External References DBIA#
; ------------------- -----
; ^MDC(704.101 5748 (Private)
; ^MDC(704.102 5748 (Private)
; ^MDC(704.117 5748 (Private)
; ^MDC(704.118 5811 (Private)
; DIC 2051
; DIQ 2056
; XLFDT 10103
; XLFSTR 10104
Q
; ------------ Get observations from VistA ------------
;
EN(DFN,BEG,END,MAX,ID) ; -- find patient's observations
N HMPCLIO,HMPN,HMPITM,HMPCNT,X
;
; get one observation
I $L($G(ID)) D EN1(ID,.HMPITM),XML(.HMPITM) Q
;
; get all patient observations
S DFN=+$G(DFN) Q:DFN<1
S BEG=$G(BEG,1410101),END=$G(END,4141015),MAX=$G(MAX,9999),HMPCNT=0
;D QRYPT^MDCLIO1("HMPCLIO",DFN,BEG,END) ;all [verified] observations
D QRYPT("HMPCLIO",DFN,BEG,END) ;all [verified] observations
S HMPN=0 F S HMPN=$O(HMPCLIO(HMPN)) Q:(HMPN<1)!(HMPCNT'<MAX) D
. S ID=$G(HMPCLIO(HMPN)) K HMPITM ;GUID
. D EN1(ID,.HMPITM) Q:'$D(HMPITM)
. D XML(.HMPITM) S HMPCNT=HMPCNT+1
Q
;
EN1(GUID,CLIO) ; -- return an observation in CLIO("attribute")=value
N HMPT,HMPC,LOC,I,X,Y K CLIO
S GUID=$G(GUID) Q:GUID="" ;invalid GUID
;D QRYOBS^MDCLIO1("HMPC",GUID) Q:'$D(HMPC) ;doesn't exist
D QRYOBS("HMPC",GUID) Q:'$D(HMPC) ;doesn't exist
Q:$L($G(HMPC("PARENT_ID","E"))) ;PARENT also in list
S CLIO("id")=GUID,CLIO("vuid")=$G(HMPC("TERM_ID","I"))
S CLIO("name")=$G(HMPC("TERM_ID","E"))
S CLIO("value")=$G(HMPC("SVALUE","E"))
S CLIO("units")=$G(HMPC("UNIT_ID","ABBV"))
S CLIO("entered")=$G(HMPC("ENTERED_DATE_TIME","I"))
S CLIO("observed")=$G(HMPC("OBSERVED_DATE_TIME","I"))
;D QRYTYPES^MDCLIO1("HMPT")
D QRYTYPES("HMPT")
F I=3:1:7 S X=$G(HMPT(I,"XML")) Q:I<1 I $L($G(HMPC(X,"E"))) D
. S Y=HMPT(I,"NAME"),Y=$S(Y="LOCATION":"bodySite",1:$$LOW^XLFSTR(Y))
. S CLIO(Y)=HMPC(X,"I")_U_HMPC(X,"E")
S CLIO("range")=$G(HMPC("RANGE","E"))
S CLIO("status")=$G(HMPC("STATUS","E"))
S LOC=$G(HMPC("HOSPITAL_LOCATION_ID","I")),CLIO("facility")=$$FAC^HMPD(LOC)
S CLIO("location")=LOC_U_$G(HMPC("HOSPITAL_LOCATION_ID","E"))
S CLIO("comment")=$G(HMPC("COMMENT","E"))
Q
;
; ------------ Return data to middle tier ------------
;
XML(OBS) ; -- Return observation as XML in @HMP@(#)
N ATT,X,Y,I,J,P,NAMES,TAG
D ADD("<observation>") S HMPTOTL=$G(HMPTOTL)+1
S ATT="" F S ATT=$O(OBS(ATT)) Q:ATT="" D
. S X=$G(OBS(ATT)),Y="" Q:'$L(X)
. I X'["^" S Y="<"_ATT_" value='"_$$ESC^HMPD(X)_"' />" D ADD(Y) Q
. I $L(X)>1 D
.. S Y="<"_ATT_" "
.. F P=1:1 S TAG=$P("code^name^Z",U,P) Q:TAG="Z" I $L($P(X,U,P)) S Y=Y_TAG_"='"_$$ESC^HMPD($P(X,U,P))_"' "
.. S Y=Y_"/>" D ADD(Y)
D ADD("</observation>")
Q
;
LOOP() ; -- build sub-items string from NAMES and X
N STR,P,TAG S STR=""
F P=1:1 S TAG=$P(NAMES,U,P) Q:TAG="Z" I $L($P(X,U,P)) S STR=STR_TAG_"='"_$$ESC^HMPD($P(X,U,P))_"' "
Q STR
;
ADD(X) ; Add a line @HMP@(n)=X
S HMPI=$G(HMPI)+1
S @HMP@(HMPI)=X
Q
;
; -- CliO specific code accessing the ^MDC( global for data
;
QRYPT(HMPRET,HMPDFN,HMPFR,HMPTO,HMPSTAT) ; List of observations by pt, datetime, status
K @HMPRET
N HMPDT,HMPIEN
S HMPSTAT=$G(HMPSTAT,1) ; Default to Verified
F HMPDT=HMPFR-.0000001:0 S HMPDT=$O(^MDC(704.117,"AS",HMPSTAT,HMPDFN,HMPDT)) Q:'HMPDT!(HMPDT>HMPTO) D
. F HMPIEN=0:0 S HMPIEN=$O(^MDC(704.117,"AS",HMPSTAT,HMPDFN,HMPDT,HMPIEN)) Q:'HMPIEN D
. . S:$P(^MDC(704.117,HMPIEN,0),U,9)=HMPSTAT @HMPRET@(HMPIEN)=$P(^MDC(704.117,HMPIEN,0),U)
Q
;
QRYOBS(HMPRET,HMPID) ; Return a single observation
K @HMPRET
N HMPTMP,HMPIEN
S HMPIEN=$$FIND1^DIC(704.117,"","PKX",HMPID,"PK")
I HMPIEN<1 S @HMPRET@(0)="-1^No such observation '"_HMPID_"'" Q
D GETS^DIQ(704.117,HMPIEN_",","*","EIR","HMPTMP")
M @HMPRET=HMPTMP(704.117,HMPIEN_",") K HMPTMP
S @HMPRET@("TERM_ID","I")=$$GET1^DIQ(704.117,HMPIEN_",",".07:99.99")
S @HMPRET@("TERM_ID","E")=$$GET1^DIQ(704.117,HMPIEN_",",".07:.02")
S @HMPRET@("TERM_ID","GUID")=$$GET1^DIQ(704.117,HMPIEN_",",".07")
S @HMPRET@("TERM_ID","ABBV")=$$GET1^DIQ(704.117,HMPIEN_",",".07:.03")
D:$$GET1^DIQ(704.117,HMPIEN_",",".07:.06","I")=3 ; Coded data values
. S HMPTMP=$$FIND1^DIC(704.101,"","PKX",@HMPRET@("SVALUE","I"),"PK")
. S @HMPRET@("SVALUE","E")=$$GET1^DIQ(704.101,HMPTMP_",",.02)
D QRYQUAL(HMPRET,HMPIEN)
D QRYCTX($NA(@HMPRET@("CONTEXT")),HMPID)
Q
;
QRYQUAL(HMPRET,HMPIEN) ; Returns the qualifiers for obs in HMPIEN
; We do NOT want to kill HMPRET here because it points at the parent node of the return
N HMPQUAL
F Y=0:0 S Y=$O(^MDC(704.118,"PK",HMPIEN,Y)) Q:'Y D ;ICR 5811 DE2818 ASF 11/25/15
. S HMPQUAL=$$GET1^DIQ(704.101,Y_",",".05:.02")
. S @HMPRET@(HMPQUAL,"I")=$$GET1^DIQ(704.101,Y_",","99.99")
. S @HMPRET@(HMPQUAL,"E")=$$GET1^DIQ(704.101,Y_",",".02")
. S @HMPRET@(HMPQUAL,"GUID")=$$GET1^DIQ(704.101,Y_",",".01")
. S @HMPRET@(HMPQUAL,"ABBV")=$$GET1^DIQ(704.101,Y_",",".03")
Q
;
QRYCTX(HMPRET,HMPID) ; We need a terminology based context observation relationship here
N HMPIEN,HMPCTX,HMPDT,HMPFR,HMPTO,HMPDFN,HMPTERM,HMPCNT,HMPXID,HMPOBS
S HMPIEN=+$$FIND1^DIC(704.117,"","PKX",HMPID,"PK") Q:HMPIEN<1
S HMPCTX=$$GET1^DIQ(704.117,HMPIEN_",",.07) ; GET THE PRIMARY TERM (GUID)
; FILTER OUT EVERYTHING BUT SpO2 for now
Q:HMPCTX'="{5F84DD55-3CCF-094C-2536-B51EB7FAD999}"
S HMPDFN=+$$GET1^DIQ(704.117,HMPIEN_",",.08,"I") ; GET THE PATIENT
S HMPDT=+$$GET1^DIQ(704.117,HMPIEN_",",.05,"I") ; GET THE OBS DATE
S HMPFR=$$FMADD^XLFDT(HMPDT,0,0,0,-30) ; PREVIOUS 30 SECONDS
S HMPTO=$$FMADD^XLFDT(HMPDT,0,0,0,30) ; NEXT 30 SECONDS
; Now we find the context observations
F HMPDT=HMPFR:0 S HMPDT=$O(^MDC(704.117,"PT",HMPDFN,HMPDT)) Q:'HMPDT!(HMPDT>HMPTO) D ;ICR 5810 DE2818 ASF 11/25/15
. F HMPOBS=0:0 S HMPOBS=$O(^MDC(704.117,"PT",HMPDFN,HMPDT,HMPOBS)) Q:'HMPOBS D
. . Q:$$GET1^DIQ(704.117,HMPOBS_",",.09,"I")'=1 ; Verified Only
. . S HMPXID=$$GET1^DIQ(704.117,HMPOBS_",",.01)
. . Q:HMPXID=HMPID ; You should ignore yourself in this loop
. . S HMPTERM=$$GET1^DIQ(704.117,HMPOBS_",",".07")
. . ; INSERT FILTER CODE FOR O2 Flowrate and Concentration here - In the future we will find all context terms for an observation in terminology
. . Q:(HMPTERM'="{56F82CAC-3564-46CE-A520-1025020DADE9}")&(HMPTERM'="{3BB314E8-9BBB-480E-B34E-B56EDE43BAC4}")
. . S HMPCNT=$O(@HMPRET@(""),-1)+1,@HMPRET@(0)=HMPCNT
. . S @HMPRET@(HMPCNT,"OBS_ID","I")=HMPXID
. . S @HMPRET@(HMPCNT,"OBS_ID","E")=HMPXID
. . S @HMPRET@(HMPCNT,"TERM_ID","I")=$$GET1^DIQ(704.117,HMPOBS_",",".07:99.99")
. . S @HMPRET@(HMPCNT,"TERM_ID","E")=$$GET1^DIQ(704.117,HMPOBS_",",".07:.02")
. . S @HMPRET@(HMPCNT,"SVALUE","I")=$$GET1^DIQ(704.117,HMPOBS_",",".1","I")
. . S @HMPRET@(HMPCNT,"SVALUE","E")=$$GET1^DIQ(704.117,HMPOBS_",",".1","E")
. . D QRYQUAL($NA(@HMPRET@(HMPCNT)),HMPOBS)
Q
;
QRYTYPES(HMPRET) ; Return the terminology Term Types
K @HMPRET
N X
F X=0:0 S X=$O(^MDC(704.102,X)) Q:'X D ;ICR 5748 DE2818 ASF 11/25/15
. S @HMPRET@(X,"NAME")=$P(^MDC(704.102,X,0),U,1)
. S @HMPRET@(X,"XML")=$P(^MDC(704.102,X,0),U,2)
. S @HMPRET@("B",$P(^MDC(704.102,X,0),U,1),X)=""
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPDMDC 7410 printed Dec 13, 2024@01:53:42 Page 2
HMPDMDC ;SLC/MKB,DP,ASMR/RRB - CLiO extract;8/2/11 15:29
+1 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Sep 01, 2011;Build 63
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ; External References DBIA#
+5 ; ------------------- -----
+6 ; ^MDC(704.101 5748 (Private)
+7 ; ^MDC(704.102 5748 (Private)
+8 ; ^MDC(704.117 5748 (Private)
+9 ; ^MDC(704.118 5811 (Private)
+10 ; DIC 2051
+11 ; DIQ 2056
+12 ; XLFDT 10103
+13 ; XLFSTR 10104
+14 QUIT
+15 ; ------------ Get observations from VistA ------------
+16 ;
EN(DFN,BEG,END,MAX,ID) ; -- find patient's observations
+1 NEW HMPCLIO,HMPN,HMPITM,HMPCNT,X
+2 ;
+3 ; get one observation
+4 IF $LENGTH($GET(ID))
DO EN1(ID,.HMPITM)
DO XML(.HMPITM)
QUIT
+5 ;
+6 ; get all patient observations
+7 SET DFN=+$GET(DFN)
if DFN<1
QUIT
+8 SET BEG=$GET(BEG,1410101)
SET END=$GET(END,4141015)
SET MAX=$GET(MAX,9999)
SET HMPCNT=0
+9 ;D QRYPT^MDCLIO1("HMPCLIO",DFN,BEG,END) ;all [verified] observations
+10 ;all [verified] observations
DO QRYPT("HMPCLIO",DFN,BEG,END)
+11 SET HMPN=0
FOR
SET HMPN=$ORDER(HMPCLIO(HMPN))
if (HMPN<1)!(HMPCNT'<MAX)
QUIT
Begin DoDot:1
+12 ;GUID
SET ID=$GET(HMPCLIO(HMPN))
KILL HMPITM
+13 DO EN1(ID,.HMPITM)
if '$DATA(HMPITM)
QUIT
+14 DO XML(.HMPITM)
SET HMPCNT=HMPCNT+1
End DoDot:1
+15 QUIT
+16 ;
EN1(GUID,CLIO) ; -- return an observation in CLIO("attribute")=value
+1 NEW HMPT,HMPC,LOC,I,X,Y
KILL CLIO
+2 ;invalid GUID
SET GUID=$GET(GUID)
if GUID=""
QUIT
+3 ;D QRYOBS^MDCLIO1("HMPC",GUID) Q:'$D(HMPC) ;doesn't exist
+4 ;doesn't exist
DO QRYOBS("HMPC",GUID)
if '$DATA(HMPC)
QUIT
+5 ;PARENT also in list
if $LENGTH($GET(HMPC("PARENT_ID","E")))
QUIT
+6 SET CLIO("id")=GUID
SET CLIO("vuid")=$GET(HMPC("TERM_ID","I"))
+7 SET CLIO("name")=$GET(HMPC("TERM_ID","E"))
+8 SET CLIO("value")=$GET(HMPC("SVALUE","E"))
+9 SET CLIO("units")=$GET(HMPC("UNIT_ID","ABBV"))
+10 SET CLIO("entered")=$GET(HMPC("ENTERED_DATE_TIME","I"))
+11 SET CLIO("observed")=$GET(HMPC("OBSERVED_DATE_TIME","I"))
+12 ;D QRYTYPES^MDCLIO1("HMPT")
+13 DO QRYTYPES("HMPT")
+14 FOR I=3:1:7
SET X=$GET(HMPT(I,"XML"))
if I<1
QUIT
IF $LENGTH($GET(HMPC(X,"E")))
Begin DoDot:1
+15 SET Y=HMPT(I,"NAME")
SET Y=$SELECT(Y="LOCATION":"bodySite",1:$$LOW^XLFSTR(Y))
+16 SET CLIO(Y)=HMPC(X,"I")_U_HMPC(X,"E")
End DoDot:1
+17 SET CLIO("range")=$GET(HMPC("RANGE","E"))
+18 SET CLIO("status")=$GET(HMPC("STATUS","E"))
+19 SET LOC=$GET(HMPC("HOSPITAL_LOCATION_ID","I"))
SET CLIO("facility")=$$FAC^HMPD(LOC)
+20 SET CLIO("location")=LOC_U_$GET(HMPC("HOSPITAL_LOCATION_ID","E"))
+21 SET CLIO("comment")=$GET(HMPC("COMMENT","E"))
+22 QUIT
+23 ;
+24 ; ------------ Return data to middle tier ------------
+25 ;
XML(OBS) ; -- Return observation as XML in @HMP@(#)
+1 NEW ATT,X,Y,I,J,P,NAMES,TAG
+2 DO ADD("<observation>")
SET HMPTOTL=$GET(HMPTOTL)+1
+3 SET ATT=""
FOR
SET ATT=$ORDER(OBS(ATT))
if ATT=""
QUIT
Begin DoDot:1
+4 SET X=$GET(OBS(ATT))
SET Y=""
if '$LENGTH(X)
QUIT
+5 IF X'["^"
SET Y="<"_ATT_" value='"_$$ESC^HMPD(X)_"' />"
DO ADD(Y)
QUIT
+6 IF $LENGTH(X)>1
Begin DoDot:2
+7 SET Y="<"_ATT_" "
+8 FOR P=1:1
SET TAG=$PIECE("code^name^Z",U,P)
if TAG="Z"
QUIT
IF $LENGTH($PIECE(X,U,P))
SET Y=Y_TAG_"='"_$$ESC^HMPD($PIECE(X,U,P))_"' "
+9 SET Y=Y_"/>"
DO ADD(Y)
End DoDot:2
End DoDot:1
+10 DO ADD("</observation>")
+11 QUIT
+12 ;
LOOP() ; -- build sub-items string from NAMES and X
+1 NEW STR,P,TAG
SET STR=""
+2 FOR P=1:1
SET TAG=$PIECE(NAMES,U,P)
if TAG="Z"
QUIT
IF $LENGTH($PIECE(X,U,P))
SET STR=STR_TAG_"='"_$$ESC^HMPD($PIECE(X,U,P))_"' "
+3 QUIT STR
+4 ;
ADD(X) ; Add a line @HMP@(n)=X
+1 SET HMPI=$GET(HMPI)+1
+2 SET @HMP@(HMPI)=X
+3 QUIT
+4 ;
+5 ; -- CliO specific code accessing the ^MDC( global for data
+6 ;
QRYPT(HMPRET,HMPDFN,HMPFR,HMPTO,HMPSTAT) ; List of observations by pt, datetime, status
+1 KILL @HMPRET
+2 NEW HMPDT,HMPIEN
+3 ; Default to Verified
SET HMPSTAT=$GET(HMPSTAT,1)
+4 FOR HMPDT=HMPFR-.0000001:0
SET HMPDT=$ORDER(^MDC(704.117,"AS",HMPSTAT,HMPDFN,HMPDT))
if 'HMPDT!(HMPDT>HMPTO)
QUIT
Begin DoDot:1
+5 FOR HMPIEN=0:0
SET HMPIEN=$ORDER(^MDC(704.117,"AS",HMPSTAT,HMPDFN,HMPDT,HMPIEN))
if 'HMPIEN
QUIT
Begin DoDot:2
+6 if $PIECE(^MDC(704.117,HMPIEN,0),U,9)=HMPSTAT
SET @HMPRET@(HMPIEN)=$PIECE(^MDC(704.117,HMPIEN,0),U)
End DoDot:2
End DoDot:1
+7 QUIT
+8 ;
QRYOBS(HMPRET,HMPID) ; Return a single observation
+1 KILL @HMPRET
+2 NEW HMPTMP,HMPIEN
+3 SET HMPIEN=$$FIND1^DIC(704.117,"","PKX",HMPID,"PK")
+4 IF HMPIEN<1
SET @HMPRET@(0)="-1^No such observation '"_HMPID_"'"
QUIT
+5 DO GETS^DIQ(704.117,HMPIEN_",","*","EIR","HMPTMP")
+6 MERGE @HMPRET=HMPTMP(704.117,HMPIEN_",")
KILL HMPTMP
+7 SET @HMPRET@("TERM_ID","I")=$$GET1^DIQ(704.117,HMPIEN_",",".07:99.99")
+8 SET @HMPRET@("TERM_ID","E")=$$GET1^DIQ(704.117,HMPIEN_",",".07:.02")
+9 SET @HMPRET@("TERM_ID","GUID")=$$GET1^DIQ(704.117,HMPIEN_",",".07")
+10 SET @HMPRET@("TERM_ID","ABBV")=$$GET1^DIQ(704.117,HMPIEN_",",".07:.03")
+11 ; Coded data values
if $$GET1^DIQ(704.117,HMPIEN_",",".07
Begin DoDot:1
+12 SET HMPTMP=$$FIND1^DIC(704.101,"","PKX",@HMPRET@("SVALUE","I"),"PK")
+13 SET @HMPRET@("SVALUE","E")=$$GET1^DIQ(704.101,HMPTMP_",",.02)
End DoDot:1
+14 DO QRYQUAL(HMPRET,HMPIEN)
+15 DO QRYCTX($NAME(@HMPRET@("CONTEXT")),HMPID)
+16 QUIT
+17 ;
QRYQUAL(HMPRET,HMPIEN) ; Returns the qualifiers for obs in HMPIEN
+1 ; We do NOT want to kill HMPRET here because it points at the parent node of the return
+2 NEW HMPQUAL
+3 ;ICR 5811 DE2818 ASF 11/25/15
FOR Y=0:0
SET Y=$ORDER(^MDC(704.118,"PK",HMPIEN,Y))
if 'Y
QUIT
Begin DoDot:1
+4 SET HMPQUAL=$$GET1^DIQ(704.101,Y_",",".05:.02")
+5 SET @HMPRET@(HMPQUAL,"I")=$$GET1^DIQ(704.101,Y_",","99.99")
+6 SET @HMPRET@(HMPQUAL,"E")=$$GET1^DIQ(704.101,Y_",",".02")
+7 SET @HMPRET@(HMPQUAL,"GUID")=$$GET1^DIQ(704.101,Y_",",".01")
+8 SET @HMPRET@(HMPQUAL,"ABBV")=$$GET1^DIQ(704.101,Y_",",".03")
End DoDot:1
+9 QUIT
+10 ;
QRYCTX(HMPRET,HMPID) ; We need a terminology based context observation relationship here
+1 NEW HMPIEN,HMPCTX,HMPDT,HMPFR,HMPTO,HMPDFN,HMPTERM,HMPCNT,HMPXID,HMPOBS
+2 SET HMPIEN=+$$FIND1^DIC(704.117,"","PKX",HMPID,"PK")
if HMPIEN<1
QUIT
+3 ; GET THE PRIMARY TERM (GUID)
SET HMPCTX=$$GET1^DIQ(704.117,HMPIEN_",",.07)
+4 ; FILTER OUT EVERYTHING BUT SpO2 for now
+5 if HMPCTX'="{5F84DD55-3CCF-094C-2536-B51EB7FAD999}"
QUIT
+6 ; GET THE PATIENT
SET HMPDFN=+$$GET1^DIQ(704.117,HMPIEN_",",.08,"I")
+7 ; GET THE OBS DATE
SET HMPDT=+$$GET1^DIQ(704.117,HMPIEN_",",.05,"I")
+8 ; PREVIOUS 30 SECONDS
SET HMPFR=$$FMADD^XLFDT(HMPDT,0,0,0,-30)
+9 ; NEXT 30 SECONDS
SET HMPTO=$$FMADD^XLFDT(HMPDT,0,0,0,30)
+10 ; Now we find the context observations
+11 ;ICR 5810 DE2818 ASF 11/25/15
FOR HMPDT=HMPFR:0
SET HMPDT=$ORDER(^MDC(704.117,"PT",HMPDFN,HMPDT))
if 'HMPDT!(HMPDT>HMPTO)
QUIT
Begin DoDot:1
+12 FOR HMPOBS=0:0
SET HMPOBS=$ORDER(^MDC(704.117,"PT",HMPDFN,HMPDT,HMPOBS))
if 'HMPOBS
QUIT
Begin DoDot:2
+13 ; Verified Only
if $$GET1^DIQ(704.117,HMPOBS_",",.09,"I")'=1
QUIT
+14 SET HMPXID=$$GET1^DIQ(704.117,HMPOBS_",",.01)
+15 ; You should ignore yourself in this loop
if HMPXID=HMPID
QUIT
+16 SET HMPTERM=$$GET1^DIQ(704.117,HMPOBS_",",".07")
+17 ; INSERT FILTER CODE FOR O2 Flowrate and Concentration here - In the future we will find all context terms for an observation in terminology
+18 if (HMPTERM'="{56F82CAC-3564-46CE-A520-1025020DADE9}")&(HMPTERM'="{3BB314E8-9BBB-480E-B34E-B56EDE43BAC4}")
QUIT
+19 SET HMPCNT=$ORDER(@HMPRET@(""),-1)+1
SET @HMPRET@(0)=HMPCNT
+20 SET @HMPRET@(HMPCNT,"OBS_ID","I")=HMPXID
+21 SET @HMPRET@(HMPCNT,"OBS_ID","E")=HMPXID
+22 SET @HMPRET@(HMPCNT,"TERM_ID","I")=$$GET1^DIQ(704.117,HMPOBS_",",".07:99.99")
+23 SET @HMPRET@(HMPCNT,"TERM_ID","E")=$$GET1^DIQ(704.117,HMPOBS_",",".07:.02")
+24 SET @HMPRET@(HMPCNT,"SVALUE","I")=$$GET1^DIQ(704.117,HMPOBS_",",".1","I")
+25 SET @HMPRET@(HMPCNT,"SVALUE","E")=$$GET1^DIQ(704.117,HMPOBS_",",".1","E")
+26 DO QRYQUAL($NAME(@HMPRET@(HMPCNT)),HMPOBS)
End DoDot:2
End DoDot:1
+27 QUIT
+28 ;
QRYTYPES(HMPRET) ; Return the terminology Term Types
+1 KILL @HMPRET
+2 NEW X
+3 ;ICR 5748 DE2818 ASF 11/25/15
FOR X=0:0
SET X=$ORDER(^MDC(704.102,X))
if 'X
QUIT
Begin DoDot:1
+4 SET @HMPRET@(X,"NAME")=$PIECE(^MDC(704.102,X,0),U,1)
+5 SET @HMPRET@(X,"XML")=$PIECE(^MDC(704.102,X,0),U,2)
+6 SET @HMPRET@("B",$PIECE(^MDC(704.102,X,0),U,1),X)=""
End DoDot:1
+7 QUIT
+8 ;