source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLEVSRV2.m@ 1521

Last change on this file since 1521 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.0 KB
Line 
1HLEVSRV2 ;O-OIFO/LJA - Event Monitor SERVER ;02/04/2004 14:42
2 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
3 ;
4QUERYSTR ; Generate $QUERY strings...
5 N IOINHI,IOINORM,STRING,X
6 ;
7 S X="IOINHI;IOINORM" D ENDR^%ZISS
8 ;
9 D HD,EX,TELL^HLEVMST0("","0^0^999","Press RETURN to continue... ")
10 ;
11 F S STRING=$$STRING QUIT:STRING']"" D
12 . S STRING(STRING)=""
13 . W !!,"Search string = ",IOINHI,STRING,IOINORM
14 ;
15 QUIT:$O(STRING(""))']"" ;->
16 W !!,IOINHI,"Paste the following ""search strings"" into an email message and send to the"
17 W !,"S.HLEV-INFORMATION-SERVER@REMOTE-SITE.",IOINORM
18 W !!
19 ;
20 S STRING=""
21 F S STRING=$O(STRING(STRING)) Q:STRING']"" D
22 . W !,STRING
23 ;
24 Q
25 ;
26STRING() ; Ask user to input values to be built into a search string
27 N FILTER,LIMIT,ROOT,STOP
28 S ROOT=$$QUERYRT QUIT:ROOT']"" "" ;->
29 S STOP=$$QUERYST(ROOT) QUIT:STOP']"" "" ;->
30 S LIMIT=$$QUERYLM
31 S FILTER=$$QUERYFL
32 Q ROOT_U_STOP_U_LIMIT_U_FILTER
33 ;
34QUERYRT() ;
35 N VAL
36 D TAG("$QUERY ROOT")
37 D EXRT
38 W !
39 S VAL=$$FT("Enter $QUERY ROOT") QUIT:VAL']""!(VAL=U) "" ;->
40 Q VAL
41 ;
42EXRT N I,T F I=1:1 S T=$T(EXRT+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
43 ;;Enter the $QUERY root now. For example...
44 ;;
45 ;; - If you want to see all data for ^HL(772,25132), including the zero node
46 ;; and all data, enter "HL(772,25132)".
47 ;; - If you want to see all data for HLMA(9132), including the zero node and
48 ;; all data, enter "^HLMA(9132)".
49 ;;
50 ;;NOTE: Do not enter the leading up-arrow before a global reference.
51 Q
52 ;
53QUERYST(ROOT) ;
54 N VAL
55 D TAG("$QUERY Stop Value")
56 D EXST
57 S VAL=$E(ROOT,$L(ROOT)),VAL=$S(VAL=")":$E(ROOT,1,$L(ROOT)-1)_",",1:ROOT)
58 W !
59 S VAL=$$FT("Enter $QUERY STOP VALUE",VAL) QUIT:VAL']""!(VAL=U) "" ;->
60 Q VAL
61 ;
62EXST N I,T F I=1:1 S T=$T(EXST+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
63 ;;Enter the $QUERY stop value now. For example...
64 ;;
65 ;; - Assuming you entered "HL(772,25132)" (see helps under root entry above),
66 ;; you would enter a stop value of "HL(772,25132,".
67 ;; - Assuming you entered "HLMA(9132)", enter a stop value of "HLMA(9132,".
68 Q
69 ;
70QUERYLM() ;
71 N VAL
72 D TAG("Data Node Limit")
73 D EXLM
74 R !!,"Enter LIMIT: ",VAL:60 Q:VAL'>0 "" ;->
75 QUIT:VAL>1000 1000 ;->
76 Q VAL
77 ;
78EXLM N I,T F I=1:1 S T=$T(EXLM+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
79 ;;You can limit the number of nodes that are returned. This is especially
80 ;;helpful when you don't know how many data nodes exist and will be returned by
81 ;;your request. (You don't want to send a request, thinking you'll get around
82 ;;20 data nodes back, when 20,000 data nodes exist!)
83 ;;
84 ;;Enter the maximum number of nodes you want returned.
85 ;;
86 ;;NOTE: The maximum number of data nodes returnable by each $QUERY search
87 ;; string is 1000. So, there is no point entering any limit above 1000!
88 Q
89 ;
90QUERYFL() ;
91 N VAL
92 D TAG("Filter Reference")
93 D EXFL
94 W !
95 S VAL=$$FT("Enter FILTER REFERENCE","","O") QUIT:VAL']""!(VAL=U) "" ;->
96 Q VAL
97 ;
98EXFL N I,T F I=1:1 S T=$T(EXFL+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
99 ;;$QUERY returns all data nodes no matter the structure of the subscripts. At
100 ;;times you might want to filter out the data nodes whose subscripting does not
101 ;;follow a specific format. You can define such a filter now. Some filter
102 ;;examples are shown below.
103 ;;
104 ;; - If you only want to see ^HL(772,IEN,"IN",1,0) enter a filter of "HL(772,#,"IN",1,0)".
105 ;; - If you want to see the message text in a file 772 entry, enter a filter of
106 ;; "HL(772,#,"IN",#,0)".
107 ;;
108 ;;You probably noticed that the "#" symbol must be placed at every subscript
109 ;;location where you want "any IEN" to be included.
110 Q
111 ;
112TAG(TXT) W !!,$$CJ^XLFSTR("----------- "_IOINHI_TXT_IOINORM_"-----------",IOM+$L(IOINHI)+$L(IOINORM))
113 Q
114 ;
115HD W @IOF,$$CJ^XLFSTR("$QUERY String Generator",IOM)
116 W !,$$REPEAT^XLFSTR("=",IOM)
117 QUIT
118 ;
119EX N I,T F I=1:1 S T=$T(EX+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
120 ;;$QUERY-based search strings can be sent to the S.HLEV-INFORMATION-SERVER at
121 ;;remote sites requesting data to be returned to the HL7SystemMonitoring mail
122 ;;group. Structuring $QUERY search strings can be complicated. This utility
123 ;;will assist you in creating these search strings.
124 ;;
125 ;;The search string(s) created should be pasted into the mail message sent to
126 ;;the remote site.
127 ;;
128 ;;The parts of the $QUERY search string are listed below.
129 ;;
130 ;; - $QUERY root
131 ;; - $QUERY stop value
132 ;; - # nodes to return
133 ;; - Node filter format
134 QUIT
135 ;
136MONITOR(TXT) ; User requested that a monitor be run...
137 ; XTMP -- req
138 N HLEVIENE,MONM,PCE,QTIME,RECIP,VAL
139 ;
140 ; Email data request format: MONITOR^monitor-name^queue-time^recip's
141 ;
142 S MONM=$P(TXT,U) QUIT:MONM']"" ;->
143 S HLEVIENE=$O(^HLEV(776.1,"B",MONM,0)) QUIT:HLEVIENE'>0 ;->
144 QUIT:$P($G(^HLEV(776.1,+HLEVIENE,0)),U,5)'=1 ;-> Not remote requestable
145 S QTIME=$P(TXT,U,2) I QTIME'?7N1"."1.N S QTIME=$$NOW^XLFDT
146 ;
147 D ADDREQHD^HLEVSRV ; Initial header
148 D ADDREQ^HLEVSRV("Monitor: "_MONM_" [#"_HLEVIENE_"]")
149 ;
150 S ^XTMP(XTMP,"MONREQ","MON",HLEVIENE)=MONM
151 ;
152 S VAL=$P(TXT,U,2,999) Q:VAL']"" ;->
153 F PCE=1:1:$L(VAL,U) D
154 . S RECIP=$P(VAL,U,PCE) QUIT:RECIP']"" ;->
155 . S ^XTMP(XTMP,"MONREQ","MON",+HLEVIENE,RECIP)=""
156 . D ADDREQ^HLEVSRV(" recipient = "_RECIP)
157 ;
158 S ^XTMP(XTMP,"MONREQ","TASK")=$$Q1TIME^HLEVAPI0(HLEVIENE,1,QTIME,XTMP)
159 ;
160 Q
161 ;
162FT(PMT,DEF,WAY) ; Return user-input text...
163 N DIR,DIRUT,DTOUT,DUOUT,X,Y
164 S DIR(0)="F"_$G(WAY)
165 S DIR("A")=PMT
166 I $G(DEF)]"" S DIR("B")=DEF
167 D ^DIR
168 I Y?1"^"1.E&($L(Y,U)=2) QUIT $P(Y,U,2) ;->
169 QUIT:$D(DIRUT)!($D(DTOUT))!($D(DUOUT)) U ;->
170 Q Y
171 ;
172ADDMAIL(TXT) ; Add TXT, but be sure it is on or after NUM
173 N SNO
174 QUIT:$G(HLEVOVER) ;-> Over 5000 line limit...
175 S SNO=$O(^XTMP(XTMP,"HLMAIL",":"),-1)+1
176 I SNO<100 S SNO=100 ; Leave room at the top for messages
177 I SNO>5100 D QUIT ;->
178 . S HLEVOVER=1
179 . S TXT=" ***** 5000 Line Limit Reached! Some text not included. *****"
180 . S ^XTMP(XTMP,"HLMAIL",+SNO)=""
181 . S ^XTMP(XTMP,"HLMAIL",+SNO+1)=""
182 . S ^XTMP(XTMP,"HLMAIL",+SNO+2)=TXT
183 . S ^XTMP(XTMP,"HLMAIL",1)=""
184 . S ^XTMP(XTMP,"HLMAIL",2)=TXT
185 . S ^XTMP(XTMP,"HLMAIL",3)=""
186 S ^XTMP(XTMP,"HLMAIL",+SNO)=TXT
187 Q
188 ;
189EOR ;HLEVSRV2 - Event Monitor SERVER ;5/16/03 14:42
Note: See TracBrowser for help on using the repository browser.