source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLEVREP1.m@ 1328

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

initial load of FOIAVistA 6/30/08 version

File size: 7.7 KB
Line 
1HLEVREP1 ;O-OIFO/LJA - Event Monitor REPORTS ;02/04/2004 14:42
2 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
3 ;
4CTRL ; Menu map display...
5 N CT,DATE,DATEFRST,DATELAST,DATENXT,DATESEL,IOINHI,IOINORM
6 N LINE,NO,TXT,X,Y
7 ;
8 S X="IOINHI;IOINORM" D ENDR^%ZISS
9 ;
10 KILL ^TMP($J,"HLMAP")
11 D HD("Event Monitor Display")
12 D EX
13 D PURGING
14 W !
15 QUIT:$$BTE^HLCSMON("Press RETURN to collect data, or '^' to exit... ") ;->
16 W !!,"Collecting..."
17 D MAPALL
18 D MONVALL^HLEVREP2
19 ;
20 I '$D(^TMP($J,"HLMAP","S","D")) D QUIT ;->
21 . D TELL^HLEVMST0("No data exists!","1^2^999")
22 ;
23 S DATEFRST=$O(^TMP($J,"HLMAP","S","D",0))
24 S (DATELAST,DATENXT)=$O(^TMP($J,"HLMAP","S","D",":"),-1)
25 ;
26 W !!,"Data found for ",$$FMTE^XLFDT(DATEFRST)
27 I DATELAST=DATEFRST W "."
28 I DATELAST'=DATEFRST W " to ",$$FMTE^XLFDT(DATELAST),"."
29 W !!,"Loading most recent date..."
30 ;
31 H 2
32 ;
33 S CT=0
34 F D QUIT:DATE']"" ;->
35 . S CT=CT+1
36 . S (DATE,DATESEL)=$S(CT=1:DATELAST,1:$$MAPDATE(DATENXT)) QUIT:DATE'?7N ;->
37 . S DATENXT=$$FMADD^XLFDT(DATE,-1) ; Next date to be prompted...
38 . S TXT="Event Monitor Map - "_$$FMTE^XLFDT(DATE)
39 . S LINE=$O(^TMP($J,"HLMAP","S","D",DATE,":"),-1)
40 . I LINE<22 D
41 . . W @IOF,$$CJ^XLFSTR(TXT,IOM),!,$$REPEAT^XLFSTR("=",IOM)
42 . . S NO=0
43 . . F S NO=$O(^TMP($J,"HLMAP","S","D",DATE,NO)) Q:'NO D
44 . . . W !,^TMP($J,"HLMAP","S","D",DATE,NO)
45 . I LINE'<22 D
46 . . D BROWSE^DDBR("^TMP($J,""HLMAP"",""S"",""D"","_DATE_")","N",TXT)
47 . D CTRLMON^HLEVREP3 ; All user to call up individual monitor run info...
48 . I DATENXT<DATEFRST D QUIT ;->
49 . . W !!,"You just viewed the ",IOINHI,"earliest",IOINORM
50 . . W " day on record. (You must manually enter the"
51 . . W !,"next date to view.)"
52 . . W !
53 . . S DATENXT=""
54 . I DATENXT=DATEFRST D QUIT ;->
55 . . W !!,$$FMTE^XLFDT(DATENXT)," is the earliest date on record."
56 . . W !
57 . W !!,"The next earlier date is prompted below."
58 . W !
59 ;
60 Q
61 ;
62MAPDEVCE ; Just dump to screen...
63 N ABRT,CT,DAY,NO,X
64 S DAY=0,ABRT=0,CT=0
65 F S DAY=$O(^TMP($J,"HLMAP","S","D",DAY)) Q:'DAY!(ABRT) D
66 . W !!,$$CJ^XLFSTR(" Event Monitor Information - "_$$FMTE^XLFDT(DAY)_" ",IOM,"=")
67 . S CT=CT+2
68 . S NO=0
69 . F S NO=$O(^TMP($J,"HLMAP","S","D",DAY,NO)) Q:NO'>0 D
70 . . S CT=CT+1
71 . . W !,^TMP($J,"HLMAP","S","D",DAY,NO)
72 . . QUIT:CT<22 ;->
73 . . R X:999 S CT=0
74 R:CT X:999
75 Q
76 ;
77MAPDATE(DATEPMT) ; Select date...
78 N ANS,DIR,DIRUT,DTOUT,DUOUT,X,Y
79 S DIR(0)="DO^"_DATEFRST_":"_DATELAST_":EX"
80 S DIR("A")="Select DATE",DIR("?")="Enter a report date, (but don't enter time of day.)"
81 I $G(DATEPMT)?7N S DIR("B")=$$FMTE^XLFDT(DATEPMT)
82 D ^DIR
83 QUIT:+Y?7N +Y ;->
84 S ANS=Y
85 I $$UP^XLFSTR($TR(X," ",""))["DUMP" D MAPDEVCE ;->
86 Q ""
87 ;
88PURGING ; How for back does purging start?
89 N DATA,PURGEHR
90 S PURGEHR=$P($G(^HLEV(776.999,1,0)),U,4)
91 S PURGEHR=$S(PURGEHR:PURGEHR,1:96)
92 W !!,$$CJ^XLFSTR("--- Data before NOW-"_PURGEHR_" hours has been deleted ---",IOM)
93 Q
94 ;
95HD(TXT) W @IOF,$$CJ^XLFSTR(TXT,IOM)
96 W !,$$REPEAT^XLFSTR("=",IOM)
97 QUIT
98 ;
99EX N I,T F I=1:1 S T=$T(EX+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
100 ;;This option collects all existing event monitor information for review. You
101 ;;can view a "map" of each monitor that ran, showing hour-by-hour when the
102 ;;"run" occurred. You may also select individual monitors for a more detailed
103 ;;display.
104 QUIT
105 ;
106MAPALL ; Do everything to get ^TMP($J,"HLMAP") data ready for printing...
107 KILL ^TMP($J,"HLMAP")
108 D MAPCOLLE ; Find events...
109 D MAPCOLLM ; Find master job runs
110 D MAPBUILD ; Build date array
111 D MAPSCRN ; Build daily screens
112 Q
113 ;
114MAPCOLLM ; Collect map ^TMP data - Master job runs...
115 N DATA,IENM,MONM,STAT,TIME
116 S IENM=0
117 F S IENM=$O(^HLEV(776.2,IENM)) Q:'IENM D
118 . S DATA=$G(^HLEV(776.2,IENM,0)) QUIT:$P(DATA,U)']"" ;->
119 . S STAT=$P(DATA,U,4) QUIT:STAT'="F" ;->
120 . S TIME=$$ROUNDHR(+$P(DATA,U,2)) QUIT:TIME']"" ;->
121 . S ^TMP($J,"HLMAP","T")=$G(^TMP($J,"HLMAP","T"))+1
122 . S ^TMP($J,"HLMAP","T","M")=$G(^TMP($J,"HLMAP","T","M"))+1
123 . S ^TMP($J,"HLMAP","D",TIME,"M")=$G(^TMP($J,"HLMAP","D",TIME,"M"))+1
124 . S ^TMP($J,"HLMAP","D",TIME,"M",IENM)=""
125 Q
126 ;
127MAPCOLLE ; Collect map ^TMP data - Events...
128 N DATA,IENM,IENMST,MONIEN,MONM,STAT,TIME
129 S IENM=0
130 F S IENM=$O(^HLEV(776,IENM)) Q:'IENM D
131 . S DATA=$G(^HLEV(776,IENM,0)) QUIT:$P(DATA,U)']"" ;->
132 . S STAT=$P(DATA,U,4) QUIT:STAT'="F"
133 . S TIME=$$ROUNDHR(+DATA) QUIT:TIME']"" ;->
134 . S MONIEN=$P(DATA,U,3) QUIT:MONIEN'>0 ;->
135 . S MONIEN=MONIEN QUIT:MONIEN'>0 ;->
136 . S MONM=$P($G(^HLEV(776.1,+MONIEN,0)),U) QUIT:MONM']"" ;->
137 . S MONM=MONM_"["_MONIEN_"]"
138 . S IENMST=$P(DATA,U,9),IENMST=$S(IENMST>0:IENMST,1:9999999)
139 . S ^TMP($J,"HLMAP","T")=$G(^TMP($J,"HLMAP","T"))+1
140 . S ^TMP($J,"HLMAP","T","E")=$G(^TMP($J,"HLMAP","T","E"))+1
141 . S ^TMP($J,"HLMAP","D",TIME,"E")=$G(^TMP($J,"HLMAP","D",TIME,"E"))+1
142 . S ^TMP($J,"HLMAP","D",TIME,"E",MONM)=$G(^TMP($J,"HLMAP","D",TIME,"E",MONM))+1
143 . S ^TMP($J,"HLMAP","D",TIME,"E",MONM,IENMST,IENM)=""
144 . S MONM=$P(MONM,"[") QUIT:MONM']"" ;->
145 . S ^TMP($J,"HLMAP","E",+MONIEN,+TIME\1,+IENM)=MONM
146 Q
147 ;
148MAPBUILD ; Make lines for browsing report
149 N EVNM,GBL,HOUR
150 S GBL=$NA(^TMP($J,"HLMAP","D"))
151 S HOUR=""
152 F S HOUR=$O(@GBL@(HOUR)) Q:HOUR']"" D
153 . I $O(@GBL@(HOUR,"M",0))>0 D MAPHOUR("MASTER JOB",HOUR)
154 . S EVNM=""
155 . F S EVNM=$O(@GBL@(HOUR,"E",EVNM)) Q:EVNM']"" D
156 . . D MAPHOUR(EVNM,HOUR)
157 Q
158 ;
159MAPHOUR(EVNM,HOUR) ; Store in display global...
160 S ^TMP($J,"HLMAP","M",EVNM,+$P(HOUR,"."),+$P(HOUR,".",2))=""
161 Q
162 ;
163MAPSCRN ; Build screen for days...
164 N DATA,DAY,EVNM,HOUR,HR,TXT,X
165 ;
166 S EVNM=""
167 F S EVNM=$O(^TMP($J,"HLMAP","M",EVNM)) Q:EVNM']"" D
168 . S DAY=0
169 . F S DAY=$O(^TMP($J,"HLMAP","M",EVNM,DAY)) Q:DAY'>0 D
170 . . S TXT=$$EVNM(EVNM,31)
171 . . F HOUR=1:1:24 D
172 . . . S DATA=$S($D(^TMP($J,"HLMAP","M",EVNM,DAY,HOUR_0)):1,1:0)
173 . . . S TXT=TXT_$S(DATA:"-X",1:"--")
174 . . S ^TMP($J,"HLMAP","X",DAY,EVNM)=TXT
175 ;
176 S DAY=0
177 F S DAY=$O(^TMP($J,"HLMAP","X",DAY)) Q:DAY'>0 D
178 . D ADDHDR(DAY)
179 . I $D(^TMP($J,"HLMAP","X",DAY,"MASTER JOB")) D
180 . . D ADDLINE(DAY,^TMP($J,"HLMAP","X",DAY,"MASTER JOB"))
181 . S EVNM=""
182 . F S EVNM=$O(^TMP($J,"HLMAP","X",DAY,EVNM)) Q:EVNM']"" D
183 . . QUIT:EVNM="MASTER JOB" ;->
184 . . D ADDLINE(DAY,^TMP($J,"HLMAP","X",DAY,EVNM))
185 ;
186 Q
187 ;
188ADDHDR(DAY) ; Add HDR code...
189 D ADDLINE(DAY,$$CJ^XLFSTR(" "_$$FMTE^XLFDT(DAY)_" ",IOM,"="))
190 D ADDLINE(DAY," |"_IOINHI_" Hours "_IOINORM_"| - 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2")
191 D ADDLINE(DAY,"Monitor |"_IOINHI_" in Day "_IOINORM_"| - 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4")
192 D ADDLINE(DAY,$$REPEAT^XLFSTR("=",IOM))
193 Q
194 ;
195ADDLINE(DAY,TXT) ; Add one line of text to screen ^TMP global
196 N NO
197 S ^TMP($J,"HLMAP","S","D",DAY)=$G(^TMP($J,"HLMAP","S","D",DAY))+1
198 S NO=$O(^TMP($J,"HLMAP","S","D",DAY,":"),-1)+1
199 I '(NO#24) D ; Mid-screen extra header
200 . S ^TMP($J,"HLMAP","S","D",DAY,NO)=$$REPEAT^XLFSTR("-",IOM)
201 . S NO=NO+1,^TMP($J,"HLMAP","S","D",DAY,NO)=" Hours - 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2"
202 . S NO=NO+1,^TMP($J,"HLMAP","S","D",DAY,NO)="Monitor in Day - 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4"
203 . S NO=NO+1,^TMP($J,"HLMAP","S","D",DAY,NO)=$$REPEAT^XLFSTR("-",IOM)
204 . S NO=NO+1
205 S ^TMP($J,"HLMAP","S","D",DAY,+NO)=TXT
206 Q
207 ;
208EVNM(EVNM,LEN) ; Convert event name[ien] to LENgth, truncating name part prn
209 N IEN,NM,X
210 I EVNM="MASTER JOB" QUIT $$REPEAT^XLFSTR("-",LEN-$L("MASTER JOB")-1)_"MASTER JOB-" ;->
211 S NM=$P(EVNM,"["),IEN="["_$P(EVNM,"[",2,99)
212 S NM(1)=$E(NM,1,LEN-$L(IEN))
213 I NM'=NM(1) S NM(1)=$E(NM(1),1,$L(NM(1))-1)_"~"
214 S NM=NM(1)_IEN
215 S NM=$E(NM_$$REPEAT^XLFSTR("-",LEN),1,LEN)
216 Q NM
217 ;
218ROUNDHR(FM) ;
219 N HR
220 S FM=$G(FM)
221 I FM'?7N&(FM'?7N1"."1.N) QUIT "" ;->
222 S:FM?7N FM=FM_"." S FM=$E(FM_"00",1,10)
223 S HR=+$P(FM,".",2)+1 S:HR<10 HR=0_HR
224 S FM=FM\1_"."_HR_0
225 Q FM
226 ;
227EOR ;HLEVREP1 - Event Monitor REPORTS ;5/16/03 14:42
Note: See TracBrowser for help on using the repository browser.