HLEVSRV2 ;O-OIFO/LJA - Event Monitor SERVER ;02/04/2004 14:42
;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
;
QUERYSTR ; Generate $QUERY strings...
N IOINHI,IOINORM,STRING,X
;
S X="IOINHI;IOINORM" D ENDR^%ZISS
;
D HD,EX,TELL^HLEVMST0("","0^0^999","Press RETURN to continue... ")
;
F S STRING=$$STRING QUIT:STRING']"" D
. S STRING(STRING)=""
. W !!,"Search string = ",IOINHI,STRING,IOINORM
;
QUIT:$O(STRING(""))']"" ;->
W !!,IOINHI,"Paste the following ""search strings"" into an email message and send to the"
W !,"S.HLEV-INFORMATION-SERVER@REMOTE-SITE.",IOINORM
W !!
;
S STRING=""
F S STRING=$O(STRING(STRING)) Q:STRING']"" D
. W !,STRING
;
Q
;
STRING() ; Ask user to input values to be built into a search string
N FILTER,LIMIT,ROOT,STOP
S ROOT=$$QUERYRT QUIT:ROOT']"" "" ;->
S STOP=$$QUERYST(ROOT) QUIT:STOP']"" "" ;->
S LIMIT=$$QUERYLM
S FILTER=$$QUERYFL
Q ROOT_U_STOP_U_LIMIT_U_FILTER
;
QUERYRT() ;
N VAL
D TAG("$QUERY ROOT")
D EXRT
W !
S VAL=$$FT("Enter $QUERY ROOT") QUIT:VAL']""!(VAL=U) "" ;->
Q VAL
;
EXRT N I,T F I=1:1 S T=$T(EXRT+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
;;Enter the $QUERY root now. For example...
;;
;; - If you want to see all data for ^HL(772,25132), including the zero node
;; and all data, enter "HL(772,25132)".
;; - If you want to see all data for HLMA(9132), including the zero node and
;; all data, enter "^HLMA(9132)".
;;
;;NOTE: Do not enter the leading up-arrow before a global reference.
Q
;
QUERYST(ROOT) ;
N VAL
D TAG("$QUERY Stop Value")
D EXST
S VAL=$E(ROOT,$L(ROOT)),VAL=$S(VAL=")":$E(ROOT,1,$L(ROOT)-1)_",",1:ROOT)
W !
S VAL=$$FT("Enter $QUERY STOP VALUE",VAL) QUIT:VAL']""!(VAL=U) "" ;->
Q VAL
;
EXST N I,T F I=1:1 S T=$T(EXST+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
;;Enter the $QUERY stop value now. For example...
;;
;; - Assuming you entered "HL(772,25132)" (see helps under root entry above),
;; you would enter a stop value of "HL(772,25132,".
;; - Assuming you entered "HLMA(9132)", enter a stop value of "HLMA(9132,".
Q
;
QUERYLM() ;
N VAL
D TAG("Data Node Limit")
D EXLM
R !!,"Enter LIMIT: ",VAL:60 Q:VAL'>0 "" ;->
QUIT:VAL>1000 1000 ;->
Q VAL
;
EXLM N I,T F I=1:1 S T=$T(EXLM+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
;;You can limit the number of nodes that are returned. This is especially
;;helpful when you don't know how many data nodes exist and will be returned by
;;your request. (You don't want to send a request, thinking you'll get around
;;20 data nodes back, when 20,000 data nodes exist!)
;;
;;Enter the maximum number of nodes you want returned.
;;
;;NOTE: The maximum number of data nodes returnable by each $QUERY search
;; string is 1000. So, there is no point entering any limit above 1000!
Q
;
QUERYFL() ;
N VAL
D TAG("Filter Reference")
D EXFL
W !
S VAL=$$FT("Enter FILTER REFERENCE","","O") QUIT:VAL']""!(VAL=U) "" ;->
Q VAL
;
EXFL N I,T F I=1:1 S T=$T(EXFL+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
;;$QUERY returns all data nodes no matter the structure of the subscripts. At
;;times you might want to filter out the data nodes whose subscripting does not
;;follow a specific format. You can define such a filter now. Some filter
;;examples are shown below.
;;
;; - If you only want to see ^HL(772,IEN,"IN",1,0) enter a filter of "HL(772,#,"IN",1,0)".
;; - If you want to see the message text in a file 772 entry, enter a filter of
;; "HL(772,#,"IN",#,0)".
;;
;;You probably noticed that the "#" symbol must be placed at every subscript
;;location where you want "any IEN" to be included.
Q
;
TAG(TXT) W !!,$$CJ^XLFSTR("----------- "_IOINHI_TXT_IOINORM_"-----------",IOM+$L(IOINHI)+$L(IOINORM))
Q
;
HD W @IOF,$$CJ^XLFSTR("$QUERY String Generator",IOM)
W !,$$REPEAT^XLFSTR("=",IOM)
QUIT
;
EX N I,T F I=1:1 S T=$T(EX+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
;;$QUERY-based search strings can be sent to the S.HLEV-INFORMATION-SERVER at
;;remote sites requesting data to be returned to the HL7SystemMonitoring mail
;;group. Structuring $QUERY search strings can be complicated. This utility
;;will assist you in creating these search strings.
;;
;;The search string(s) created should be pasted into the mail message sent to
;;the remote site.
;;
;;The parts of the $QUERY search string are listed below.
;;
;; - $QUERY root
;; - $QUERY stop value
;; - # nodes to return
;; - Node filter format
QUIT
;
MONITOR(TXT) ; User requested that a monitor be run...
; XTMP -- req
N HLEVIENE,MONM,PCE,QTIME,RECIP,VAL
;
; Email data request format: MONITOR^monitor-name^queue-time^recip's
;
S MONM=$P(TXT,U) QUIT:MONM']"" ;->
S HLEVIENE=$O(^HLEV(776.1,"B",MONM,0)) QUIT:HLEVIENE'>0 ;->
QUIT:$P($G(^HLEV(776.1,+HLEVIENE,0)),U,5)'=1 ;-> Not remote requestable
S QTIME=$P(TXT,U,2) I QTIME'?7N1"."1.N S QTIME=$$NOW^XLFDT
;
D ADDREQHD^HLEVSRV ; Initial header
D ADDREQ^HLEVSRV("Monitor: "_MONM_" [#"_HLEVIENE_"]")
;
S ^XTMP(XTMP,"MONREQ","MON",HLEVIENE)=MONM
;
S VAL=$P(TXT,U,2,999) Q:VAL']"" ;->
F PCE=1:1:$L(VAL,U) D
. S RECIP=$P(VAL,U,PCE) QUIT:RECIP']"" ;->
. S ^XTMP(XTMP,"MONREQ","MON",+HLEVIENE,RECIP)=""
. D ADDREQ^HLEVSRV(" recipient = "_RECIP)
;
S ^XTMP(XTMP,"MONREQ","TASK")=$$Q1TIME^HLEVAPI0(HLEVIENE,1,QTIME,XTMP)
;
Q
;
FT(PMT,DEF,WAY) ; Return user-input text...
N DIR,DIRUT,DTOUT,DUOUT,X,Y
S DIR(0)="F"_$G(WAY)
S DIR("A")=PMT
I $G(DEF)]"" S DIR("B")=DEF
D ^DIR
I Y?1"^"1.E&($L(Y,U)=2) QUIT $P(Y,U,2) ;->
QUIT:$D(DIRUT)!($D(DTOUT))!($D(DUOUT)) U ;->
Q Y
;
ADDMAIL(TXT) ; Add TXT, but be sure it is on or after NUM
N SNO
QUIT:$G(HLEVOVER) ;-> Over 5000 line limit...
S SNO=$O(^XTMP(XTMP,"HLMAIL",":"),-1)+1
I SNO<100 S SNO=100 ; Leave room at the top for messages
I SNO>5100 D QUIT ;->
. S HLEVOVER=1
. S TXT=" ***** 5000 Line Limit Reached! Some text not included. *****"
. S ^XTMP(XTMP,"HLMAIL",+SNO)=""
. S ^XTMP(XTMP,"HLMAIL",+SNO+1)=""
. S ^XTMP(XTMP,"HLMAIL",+SNO+2)=TXT
. S ^XTMP(XTMP,"HLMAIL",1)=""
. S ^XTMP(XTMP,"HLMAIL",2)=TXT
. S ^XTMP(XTMP,"HLMAIL",3)=""
S ^XTMP(XTMP,"HLMAIL",+SNO)=TXT
Q
;
EOR ;HLEVSRV2 - Event Monitor SERVER ;5/16/03 14:42
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLEVSRV2 6342 printed Nov 22, 2024@17:08:03 Page 2
HLEVSRV2 ;O-OIFO/LJA - Event Monitor SERVER ;02/04/2004 14:42
+1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
+2 ;
QUERYSTR ; Generate $QUERY strings...
+1 NEW IOINHI,IOINORM,STRING,X
+2 ;
+3 SET X="IOINHI;IOINORM"
DO ENDR^%ZISS
+4 ;
+5 DO HD
DO EX
DO TELL^HLEVMST0("","0^0^999","Press RETURN to continue... ")
+6 ;
+7 FOR
SET STRING=$$STRING
if STRING']""
QUIT
Begin DoDot:1
+8 SET STRING(STRING)=""
+9 WRITE !!,"Search string = ",IOINHI,STRING,IOINORM
End DoDot:1
+10 ;
+11 ;->
if $ORDER(STRING(""))']""
QUIT
+12 WRITE !!,IOINHI,"Paste the following ""search strings"" into an email message and send to the"
+13 WRITE !,"S.HLEV-INFORMATION-SERVER@REMOTE-SITE.",IOINORM
+14 WRITE !!
+15 ;
+16 SET STRING=""
+17 FOR
SET STRING=$ORDER(STRING(STRING))
if STRING']""
QUIT
Begin DoDot:1
+18 WRITE !,STRING
End DoDot:1
+19 ;
+20 QUIT
+21 ;
STRING() ; Ask user to input values to be built into a search string
+1 NEW FILTER,LIMIT,ROOT,STOP
+2 ;->
SET ROOT=$$QUERYRT
if ROOT']""
QUIT ""
+3 ;->
SET STOP=$$QUERYST(ROOT)
if STOP']""
QUIT ""
+4 SET LIMIT=$$QUERYLM
+5 SET FILTER=$$QUERYFL
+6 QUIT ROOT_U_STOP_U_LIMIT_U_FILTER
+7 ;
QUERYRT() ;
+1 NEW VAL
+2 DO TAG("$QUERY ROOT")
+3 DO EXRT
+4 WRITE !
+5 ;->
SET VAL=$$FT("Enter $QUERY ROOT")
if VAL']""!(VAL=U)
QUIT ""
+6 QUIT VAL
+7 ;
EXRT NEW I,T
FOR I=1:1
SET T=$TEXT(EXRT+I)
if T'[";;"
QUIT
WRITE !,$PIECE(T,";;",2,99)
+1 ;;Enter the $QUERY root now. For example...
+2 ;;
+3 ;; - If you want to see all data for ^HL(772,25132), including the zero node
+4 ;; and all data, enter "HL(772,25132)".
+5 ;; - If you want to see all data for HLMA(9132), including the zero node and
+6 ;; all data, enter "^HLMA(9132)".
+7 ;;
+8 ;;NOTE: Do not enter the leading up-arrow before a global reference.
+9 QUIT
+10 ;
QUERYST(ROOT) ;
+1 NEW VAL
+2 DO TAG("$QUERY Stop Value")
+3 DO EXST
+4 SET VAL=$EXTRACT(ROOT,$LENGTH(ROOT))
SET VAL=$SELECT(VAL=")":$EXTRACT(ROOT,1,$LENGTH(ROOT)-1)_",",1:ROOT)
+5 WRITE !
+6 ;->
SET VAL=$$FT("Enter $QUERY STOP VALUE",VAL)
if VAL']""!(VAL=U)
QUIT ""
+7 QUIT VAL
+8 ;
EXST NEW I,T
FOR I=1:1
SET T=$TEXT(EXST+I)
if T'[";;"
QUIT
WRITE !,$PIECE(T,";;",2,99)
+1 ;;Enter the $QUERY stop value now. For example...
+2 ;;
+3 ;; - Assuming you entered "HL(772,25132)" (see helps under root entry above),
+4 ;; you would enter a stop value of "HL(772,25132,".
+5 ;; - Assuming you entered "HLMA(9132)", enter a stop value of "HLMA(9132,".
+6 QUIT
+7 ;
QUERYLM() ;
+1 NEW VAL
+2 DO TAG("Data Node Limit")
+3 DO EXLM
+4 ;->
READ !!,"Enter LIMIT: ",VAL:60
if VAL'>0
QUIT ""
+5 ;->
if VAL>1000
QUIT 1000
+6 QUIT VAL
+7 ;
EXLM NEW I,T
FOR I=1:1
SET T=$TEXT(EXLM+I)
if T'[";;"
QUIT
WRITE !,$PIECE(T,";;",2,99)
+1 ;;You can limit the number of nodes that are returned. This is especially
+2 ;;helpful when you don't know how many data nodes exist and will be returned by
+3 ;;your request. (You don't want to send a request, thinking you'll get around
+4 ;;20 data nodes back, when 20,000 data nodes exist!)
+5 ;;
+6 ;;Enter the maximum number of nodes you want returned.
+7 ;;
+8 ;;NOTE: The maximum number of data nodes returnable by each $QUERY search
+9 ;; string is 1000. So, there is no point entering any limit above 1000!
+10 QUIT
+11 ;
QUERYFL() ;
+1 NEW VAL
+2 DO TAG("Filter Reference")
+3 DO EXFL
+4 WRITE !
+5 ;->
SET VAL=$$FT("Enter FILTER REFERENCE","","O")
if VAL']""!(VAL=U)
QUIT ""
+6 QUIT VAL
+7 ;
EXFL NEW I,T
FOR I=1:1
SET T=$TEXT(EXFL+I)
if T'[";;"
QUIT
WRITE !,$PIECE(T,";;",2,99)
+1 ;;$QUERY returns all data nodes no matter the structure of the subscripts. At
+2 ;;times you might want to filter out the data nodes whose subscripting does not
+3 ;;follow a specific format. You can define such a filter now. Some filter
+4 ;;examples are shown below.
+5 ;;
+6 ;; - If you only want to see ^HL(772,IEN,"IN",1,0) enter a filter of "HL(772,#,"IN",1,0)".
+7 ;; - If you want to see the message text in a file 772 entry, enter a filter of
+8 ;; "HL(772,#,"IN",#,0)".
+9 ;;
+10 ;;You probably noticed that the "#" symbol must be placed at every subscript
+11 ;;location where you want "any IEN" to be included.
+12 QUIT
+13 ;
TAG(TXT) WRITE !!,$$CJ^XLFSTR("----------- "_IOINHI_TXT_IOINORM_"-----------",IOM+$LENGTH(IOINHI)+$LENGTH(IOINORM))
+1 QUIT
+2 ;
HD WRITE @IOF,$$CJ^XLFSTR("$QUERY String Generator",IOM)
+1 WRITE !,$$REPEAT^XLFSTR("=",IOM)
+2 QUIT
+3 ;
EX NEW I,T
FOR I=1:1
SET T=$TEXT(EX+I)
if T'[";;"
QUIT
WRITE !,$PIECE(T,";;",2,99)
+1 ;;$QUERY-based search strings can be sent to the S.HLEV-INFORMATION-SERVER at
+2 ;;remote sites requesting data to be returned to the HL7SystemMonitoring mail
+3 ;;group. Structuring $QUERY search strings can be complicated. This utility
+4 ;;will assist you in creating these search strings.
+5 ;;
+6 ;;The search string(s) created should be pasted into the mail message sent to
+7 ;;the remote site.
+8 ;;
+9 ;;The parts of the $QUERY search string are listed below.
+10 ;;
+11 ;; - $QUERY root
+12 ;; - $QUERY stop value
+13 ;; - # nodes to return
+14 ;; - Node filter format
+15 QUIT
+16 ;
MONITOR(TXT) ; User requested that a monitor be run...
+1 ; XTMP -- req
+2 NEW HLEVIENE,MONM,PCE,QTIME,RECIP,VAL
+3 ;
+4 ; Email data request format: MONITOR^monitor-name^queue-time^recip's
+5 ;
+6 ;->
SET MONM=$PIECE(TXT,U)
if MONM']""
QUIT
+7 ;->
SET HLEVIENE=$ORDER(^HLEV(776.1,"B",MONM,0))
if HLEVIENE'>0
QUIT
+8 ;-> Not remote requestable
if $PIECE($GET(^HLEV(776.1,+HLEVIENE,0)),U,5)'=1
QUIT
+9 SET QTIME=$PIECE(TXT,U,2)
IF QTIME'?7N1"."1.N
SET QTIME=$$NOW^XLFDT
+10 ;
+11 ; Initial header
DO ADDREQHD^HLEVSRV
+12 DO ADDREQ^HLEVSRV("Monitor: "_MONM_" [#"_HLEVIENE_"]")
+13 ;
+14 SET ^XTMP(XTMP,"MONREQ","MON",HLEVIENE)=MONM
+15 ;
+16 ;->
SET VAL=$PIECE(TXT,U,2,999)
if VAL']""
QUIT
+17 FOR PCE=1:1:$LENGTH(VAL,U)
Begin DoDot:1
+18 ;->
SET RECIP=$PIECE(VAL,U,PCE)
if RECIP']""
QUIT
+19 SET ^XTMP(XTMP,"MONREQ","MON",+HLEVIENE,RECIP)=""
+20 DO ADDREQ^HLEVSRV(" recipient = "_RECIP)
End DoDot:1
+21 ;
+22 SET ^XTMP(XTMP,"MONREQ","TASK")=$$Q1TIME^HLEVAPI0(HLEVIENE,1,QTIME,XTMP)
+23 ;
+24 QUIT
+25 ;
FT(PMT,DEF,WAY) ; Return user-input text...
+1 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y
+2 SET DIR(0)="F"_$GET(WAY)
+3 SET DIR("A")=PMT
+4 IF $GET(DEF)]""
SET DIR("B")=DEF
+5 DO ^DIR
+6 ;->
IF Y?1"^"1.E&($LENGTH(Y,U)=2)
QUIT $PIECE(Y,U,2)
+7 ;->
if $DATA(DIRUT)!($DATA(DTOUT))!($DATA(DUOUT))
QUIT U
+8 QUIT Y
+9 ;
ADDMAIL(TXT) ; Add TXT, but be sure it is on or after NUM
+1 NEW SNO
+2 ;-> Over 5000 line limit...
if $GET(HLEVOVER)
QUIT
+3 SET SNO=$ORDER(^XTMP(XTMP,"HLMAIL",":"),-1)+1
+4 ; Leave room at the top for messages
IF SNO<100
SET SNO=100
+5 ;->
IF SNO>5100
Begin DoDot:1
+6 SET HLEVOVER=1
+7 SET TXT=" ***** 5000 Line Limit Reached! Some text not included. *****"
+8 SET ^XTMP(XTMP,"HLMAIL",+SNO)=""
+9 SET ^XTMP(XTMP,"HLMAIL",+SNO+1)=""
+10 SET ^XTMP(XTMP,"HLMAIL",+SNO+2)=TXT
+11 SET ^XTMP(XTMP,"HLMAIL",1)=""
+12 SET ^XTMP(XTMP,"HLMAIL",2)=TXT
+13 SET ^XTMP(XTMP,"HLMAIL",3)=""
End DoDot:1
QUIT
+14 SET ^XTMP(XTMP,"HLMAIL",+SNO)=TXT
+15 QUIT
+16 ;
EOR ;HLEVSRV2 - Event Monitor SERVER ;5/16/03 14:42