source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDHUA.m@ 1046

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

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1KMPDHUA ;OAK/RAK - Remote Synchronous HL7 Protocol ;3/15/04 07:48
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;;Mar 22, 2002
3 ;
4EN ;-entry point
5 ;
6 N DIC,I,KMPDATE,KMPDNMSP,KMPDPROT,KMPDSRCH,POP,X,Y
7 N ZTDESC,ZTRTN,ZTSAVE,ZTSK,%ZIS
8 ;
9 ; option header
10 D HDR^KMPDUTL4(" Synchronous Remote Protocol Distribution ") W !!
11 ; select protocol
12 S DIC=101,DIC(0)="AELMQZ",DIC("A")="Select Protocol: "
13 D ^DIC Q:(+Y)<0 S KMPDPROT=Y
14 ;
15 ; select namespace (package file)
16 D NMSPARRY(.KMPDNMSP) Q:'$D(KMPDNMSP)
17 ;
18 ; select date range
19 D DATERNG^KMPDUTL2(.KMPDATE) Q:'KMPDATE
20 ;
21 ; element to rate protocols
22 K DIR
23 S DIR(0)="SO^1:Message Size;2:Character Transmission Rate;3:Message Transmission Rate"
24 S DIR("B")=1
25 D ^DIR Q:$G(Y)=""!($G(Y)="^")
26 S KMPDSRCH=$S(Y:Y_"^"_$G(Y(0)),1:Y)
27 ;
28 ; select output device.
29 S %ZIS="Q",%ZIS("A")="Device: ",%ZIS("B")="HOME"
30 W ! D ^%ZIS I POP W !,"No action taken." Q
31 ; if queued.
32 I $D(IO("Q")) K IO("Q") D Q
33 .S ZTDESC="Synchronous Distribution Report"
34 .S ZTRTN="EN1^KMPDHUA"
35 .F I="KMPDATE","KMPDNMSP","KMPDPROT","KMPDSRCH" S ZTSAVE(I)=""
36 .D ^%ZTLOAD W:$G(ZTSK) !,"Task #",ZTSK
37 .D EXIT
38 ;
39 D EN1
40 ;
41 Q
42 ;
43EN1 ;-- entry point from taskman
44 ;
45 Q:'$G(KMPDATE)
46 Q:'$D(KMPDNMSP)
47 Q:'$G(KMPDSRCH)
48 ;
49 N END,ERROR,STR,X
50 ;
51 S STR=$P(KMPDATE,U),END=$P(KMPDATE,U,2)
52 Q:'STR!('END)
53 ;
54 ; get data from hl7 api
55 W:'$D(ZTQUEUED) !,"Gathering HL7 data..."
56 K ^TMP("KMPDH",$J),^TMP("KMPDH-1",$J)
57 ;
58 D DATA,PRINT,EXIT
59 ;
60 Q
61 ;
62DATA ;
63 ; if 'all' namespaces
64 I $G(KMPDNMSP(0))="*" D
65 .S X=$$CMF^HLUCM(STR,END,1,KMPDPROT,"KMPDH","EITHER",.ERROR)
66 ; if 'specific' namespaces
67 E D
68 .S X=$$CMF^HLUCM(STR,END,.KMPDNMSP,KMPDPROT,"KMPDH","BOTH",.ERROR)
69 ;
70 ; determine search list
71 S FAC=""
72 F S FAC=$O(^TMP("KMPDH",$J,"RFAC","LR","R",FAC)) Q:FAC="" D
73 .S NMSP=""
74 .F S NMSP=$O(^TMP("KMPDH",$J,"RFAC","LR","R",FAC,NMSP)) Q:NMSP="" S TOT=^(NMSP) D
75 ..; 1 - message size = chr/message
76 ..; 2 - charater transmission rate - chr/sec/msg
77 ..; 3 - message transmission rate - sec/msg
78 ..S SRCH=""
79 ..I (+KMPDSRCH)=1 S SRCH=$P(TOT,U)/$P(TOT,U,2)
80 ..I (+KMPDSRCH)=2 S SRCH=($P(TOT,U)/$P(TOT,U,3))/$P(TOT,U,2)
81 ..I (+KMPDSRCH)=3 S SRCH=$P(TOT,U,3)/$P(TOT,U,2)
82 ..Q:SRCH=""
83 ..S ^TMP("KMPDH-1",$J,SRCH,FAC,NMSP)=""
84 ;
85 Q
86 ;
87EXIT ;
88 S:$D(ZTQUEUED) ZTREQ="@"
89 K KMPDATE,KMPDNMSP,KMPDPROT,KMPDSRCH
90 K ^TMP("KMPDH",$J),^TMP("KMPDH-1",$J)
91 D ^%ZISC
92 Q
93 ;
94PRINT ;-- print sync/facility data
95 N DATA,DATE,FAC,I,J,NMSP,PROT,RANK,SRCH
96 D HDR
97 I '$D(^TMP("KMPDH-1",$J)) W !?5," No Data to Report" Q
98 S SRCH="A",RANK=1
99 F S SRCH=$O(^TMP("KMPDH-1",$J,SRCH),-1) Q:'SRCH D
100 .W !,RANK,".",?5,$J($FN(SRCH,",",$S((+KMPDSRCH)=3:2,1:0)),10)
101 .S FAC="",RANK=RANK+1
102 .F S FAC=$O(^TMP("KMPDH-1",$J,SRCH,FAC)) Q:FAC="" D
103 ..W ?17,$E($P(FAC,"~",2),1,18) S NMSP=""
104 ..F S NMSP=$O(^TMP("KMPDH-1",$J,SRCH,FAC,NMSP)) Q:NMSP="" D
105 ...W ?37,NMSP S DATE=0 K TOT
106 ...F S DATE=$O(^TMP("KMPDH",$J,"RFAC","LR","R",FAC,NMSP,DATE)) Q:'DATE D
107 ....S PROT=""
108 ....F S PROT=$O(^TMP("KMPDH",$J,"RFAC","LR","R",FAC,NMSP,DATE,PROT)) Q:PROT="" S DATA=^(PROT) D
109 .....; tcp/mail/unknown
110 .....S DATA("T")=$G(^TMP("KMPDH",$J,"HR","TM","T",FAC,DATE,NMSP,PROT))
111 .....S DATA("M")=$G(^TMP("KMPDH",$J,"HR","TM","M",FAC,DATE,NMSP,PROT))
112 .....S DATA("TMU")=$G(^TMP("KMPDH",$J,"HR","TM","U",FAC,DATE,NMSP,PROT))
113 .....; incoming/outgoing/unknown
114 .....S DATA("I")=$G(^TMP("KMPDH",$J,"NMSP","IO","I",FAC,NMSP,DATE,PROT))
115 .....S DATA("O")=$G(^TMP("KMPDH",$J,"NMSP","IO","O",FAC,NMSP,DATE,PROT))
116 .....S DATA("IOU")=$G(^TMP("KMPDH",$J,"NMSP","IO","U",FAC,NMSP,DATE,PROT))
117 .....; calculate sub-totals
118 .....F I=1:1:3 D
119 ......S $P(TOT,U,I)=$P($G(TOT),U,I)+$P(DATA,U,I)
120 ......S $P(TOT("T"),U,I)=$P($G(TOT("T")),U,I)+$P(DATA("T"),U,I)
121 ......S $P(TOT("M"),U,I)=$P($G(TOT("M")),U,I)+$P(DATA("M"),U,I)
122 ......S $P(TOT("TMU"),U,I)=$P($G(TOT("TMU")),U,I)+$P(DATA("TMU"),U,I)
123 ......S $P(TOT("I"),U,I)=$P($G(TOT("I")),U,I)+$P(DATA("I"),U,I)
124 ......S $P(TOT("O"),U,I)=$P($G(TOT("O")),U,I)+$P(DATA("O"),U,I)
125 ......S $P(TOT("IOU"),U,I)=$P($G(TOT("IOU")),U,I)+$P(DATA("IOU"),U,I)
126 ...;
127 ...; back to NMSP level
128 ...;
129 ...W ?45,$J($FN($P(TOT,U),",",0),9)
130 ...W ?56,$J($FN($P(TOT,U,2),",",0),9)
131 ...W ?67,$J($FN($P(TOT,U,3),",",0),9)
132 ...W !
133 ...F I="T","M","TMU","I","O","IOU" D
134 ....W ! W:I="I"!(I="L") !
135 ....W ?21,$S(I="T":"TCP",I="M":"Mail",I="TMU":"T/M Unknown",1:"")
136 ....W ?21,$S(I="I":"Incoming",I="O":"Outgoing",I="IOU":"I/O Unknown",1:"")
137 ....F J=1:1:3 W ?$S(J=1:45,J=2:56,1:67),$J($FN($P($G(TOT(I)),U,J),",",0),9)
138 ..W !
139 ;
140 Q
141 ;
142HDR ;
143 S KMPDATE=$G(KMPDATE)
144 S KMPDPROT=$G(KMPDPROT)
145 S KMPDSRCH=$G(KMPDSRCH)
146 W @IOF
147 N X
148 S X=$$SITE^VASITE,X=$P(X,U,2)_" ("_$P(X,U)_")"
149 W !?(80-$L(X)\2),X,?62,"Printed: ",$$FMTE^XLFDT(DT,2)
150 W !?21,"Synchronous Remote Protocol Distribution"
151 S X="'"_$P(KMPDPROT,"^",2)_"'"
152 W !?((80-$L(X))\2),X
153 S X=$P($P(KMPDATE,U,3),"@")_": "_$P($P(KMPDATE,U,3),"@",2)
154 S X=X_" - "_$P($P(KMPDATE,U,4),"@")_": "_$P($P(KMPDATE,U,4),"@",2)
155 W !?(80-$L(X)\2),X
156 S X=$P(KMPDSRCH,U)_" - "_$P(KMPDSRCH,U,2)
157 W !?((80-$L(X))\2),X
158 S X=$S((+KMPDSRCH)=1:" Chr/Msg",(+KMPDSRCH)=2:"Ch/Sc/Mg",(+KMPDSRCH)=3:" Sec/Msg",1:"OTHER")
159 W !
160 W !,"Rank",?6,X,?17,"Remote Facility",?37,"Nmsp",?45,$J("Chrs",9),?56,$J("Messages",9),?67,$J("Seconds",9)
161 W !,"----",?6,"---------",?17,"------------------",?37,"----",?45,"---------",?56,"---------",?67,"---------"
162 ;
163 Q
164 ;
165NMSPARRY(KMPDNMSP) ;-- namespace arry
166 K KMPDNMSP
167 N DIC,NM1,NMSP,PKG,X,Y
168 S DIC=9.4,DIC(0)="AEMQZ",DIC("A")="Select Namespace: "
169 W ! D SELECT^KMPDUT4("KMPDNMSP",1,5)
170 Q:$G(KMPDNMSP(0))=""
171 Q:KMPDNMSP(0)'="*"&($O(KMPDNMSP(0))="")
172 I KMPDNMSP(0)'="*" K KMPDNMSP(0),NM1 D
173 .S I="" F S I=$O(KMPDNMSP(I)) Q:I="" S PKG=KMPDNMSP(I) D:PKG
174 ..S NMSP=$P($G(^DIC(9.4,PKG,0)),U,2)
175 ..S:NMSP'="" NM1(NMSP)=PKG
176 ..K KMPDNMSP(I)
177 .M KMPDNMSP=NM1
178 ;
179 Q
Note: See TracBrowser for help on using the repository browser.