source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXDEBUG.m@ 1683

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

initial load of FOIAVistA 6/30/08 version

File size: 5.9 KB
Line 
1OCXDEBUG ;SLC/RJS,CLA - ORDER CHECK COMPILED CODE DEBUGGER (SINGLE/MULTI);10/29/98 12:37
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5SINGLE ;
6 ;
7 N OCXOLOG,IOP
8 ;
9 I '$O(^OCXD(861,1)) W !!,"No entries in the raw data log..." Q
10 ;
11 K ^TMP("OCXDEBUG",$J)
12 S ^TMP("OCXDEBUG",$J)=($P($H,",",2)+($H*86400)+(4*60*60))_" <- ^TMP ENTRY EXPIRATION DATE FOR ^OCXOPURG"
13 S IOP=0 D ^%ZIS K IOP S X=132 U IO X ^%ZOSF("RM")
14 ;
15 F W !! S OCXOLOG=+$$LOOKUP("Select Log entry number: ") Q:'OCXOLOG D RUN(OCXOLOG,$$ASKFLAG,$$ASKPURG),REPORT
16 Q
17 ;
18ASKFLAG() Q ('$$READ("Y","Do you want to send any alerts generated ","NO")*10)+1
19 ;
20ASKPURG() Q $$READ("Y","Do you want purge rule events ","NO")
21 ;
22SMOKE(OCXTRACE) ;
23 N OCXOLOG,OCXP,OCX1,OCX2,OCX3
24 ;
25 I '$O(^OCXD(861,1)) W !!,"No entries in the raw data log..." Q
26 S:'$L($G(OCXTRACE)) OCXTRACE=11
27 ;
28 W !
29 W !,"First Entry: ",+$O(^OCXD(861,1))
30 W !,"Last Entry: ",+$O(^OCXD(861," "),-1)
31 K ^TMP("OCXDEBUG",$J)
32 S ^TMP("OCXDEBUG",$J)=($P($H,",",2)+($H*86400)+(4*60*60))_" <- ^TMP ENTRY EXPIRATION DATE FOR ^OCXOPURG"
33 S IOP=0 D ^%ZIS K IOP S X=132 U IO X ^%ZOSF("RM")
34 ;
35 S OCXP=$$ASKPURG
36 S OCX1=$$LOOKUP("Start at Log Number: ")
37 S OCX2=$$LOOKUP(" Stop at Log Number: ")
38 S:(OCX1>OCX2) OCX3=OCX2,OCX2=OCX1,OCX1=OCX3
39 S OCXOLOG=OCX1 D F S OCXOLOG=$O(^OCXD(861,OCXOLOG)) Q:'OCXOLOG Q:(OCXOLOG>OCX2) D
40 .W @IOF D RUN(OCXOLOG,OCXTRACE,OCXP)
41 D ^%ZIS
42 U IO D REPORT D ^%ZISC
43 Q
44 ;
45REPORT ;
46 N OCXD0,OCXD1
47 I '$O(^TMP("OCXDEBUG",$J,0)) W !!,"No rules triggered.",!! Q
48 W !!,"************* Rules triggered ****************",!
49 S OCXD0=0 F S OCXD0=$O(^TMP("OCXDEBUG",$J,OCXD0)) Q:'OCXD0 D
50 .S OCXD1=0 F S OCXD1=$O(^TMP("OCXDEBUG",$J,OCXD0,OCXD1)) Q:'OCXD1 D
51 ..W !,"Rule: (",(+OCXD0),") ",$P($G(^OCXS(860.2,+OCXD0,0)),U,1)
52 ..W !,"Relation: (",(+OCXD1),") ",$G(^OCXS(860.2,+OCXD0,"R",+OCXD1,"E"))
53 ..W !," Number triggered: ",+$G(^TMP("OCXDEBUG",$J,OCXD0,OCXD1))
54 ..W !
55 Q
56 ;
57RUN(OCXDEBUG,OCXTRACE,OCXPURGE) ;
58 ;
59 Q:'$D(^OCXD(861,OCXDEBUG)) Q:'$D(^OCXD(861,OCXDEBUG,"SOURCE"))
60 ;
61 N OCXA,OCXAR,OCXD0
62 ;
63 M OCXA=^OCXD(861,OCXDEBUG)
64 ;
65 W !,"RUN: ",OCXDEBUG," ",OCXA("SOURCE")
66 ;
67 I OCXPURGE D
68 .N DFN S DFN=+$P($G(OCXA("PATIENT")),"[",2) Q:'DFN
69 .K ^OCXD(860.7,DFN,1)
70 .K ^OCXD(860.7,"AT",+$H,DFN)
71 ;
72 I (OCXA("SOURCE")="HL7") D Q
73 .S OCXAR=OCXA("ARRAY")
74 .I '(OCXAR[U) N @OCXAR
75 .N OCXDBMSG
76 .S OCXD0=0 F S OCXD0=$O(OCXA("DATA",OCXD0)) Q:'OCXD0 D
77 ..N LAST,TEXT
78 ..S LAST=$O(@OCXAR@(" "),-1)
79 ..S TEXT=OCXA("DATA",OCXD0,0)
80 ..I LAST,($E(TEXT,1,3)=">>>") S TEXT=$E(TEXT,4,$L(TEXT))
81 ..E S LAST=LAST+1
82 ..S @OCXAR@(LAST)=$G(@OCXAR@(LAST))_TEXT
83 .S OCXDBMSG=""
84 .W !!
85 .I '(OCXAR[U) X "D SILENT^OCXOHL7(."_OCXAR_",.OCXDBMSG)" I 1
86 .E D SILENT^OCXOHL7(.OCXAR,.OCXDBMSG)
87 .I ($D(OCXDBMSG)>1) D ZW("OCXDBMSG")
88 .I (OCXAR[U) K @OCXAR
89 ;
90 I (OCXA("SOURCE")="DGPM") D Q
91 .N DGPM0,DGPMA,DGPMDA,DFN,OCXDBMSG
92 .S OCXD0=0 F S OCXD0=$O(OCXA("DATA",OCXD0)) Q:'OCXD0 D
93 ..N TEXT S TEXT=OCXA("DATA",OCXD0,0)
94 ..S @$P(TEXT,"=",1)=$P(TEXT,"=",2,999)
95 .S DFN=+$P($G(OCXA("PATIENT")),"[",2)
96 .S OCXDBMSG=""
97 .W !! D SILENT^OCXODGPM(.OCXDBMSG)
98 .I ($D(OCXDBMSG)>1) D ZW("OCXDBMSG")
99 ;
100 I (OCXA("SOURCE")="OEPS") D Q
101 .N OCXPSD,OCXPSM,DFN,OCXDBMSG
102 .S OCXD0=0 F S OCXD0=$O(OCXA("DATA",OCXD0)) Q:'OCXD0 D
103 ..N TEXT S TEXT=OCXA("DATA",OCXD0,0)
104 ..S @$P(TEXT,"=",1)=$P(TEXT,"=",2,999)
105 .S DFN=+$P($G(OCXA("PATIENT")),"[",2)
106 .S OCXDBMSG=""
107 .W ! D EN^OCXOEPS(.OCXDBMSG,DFN,OCXPSD,OCXPSM) ;
108 .I ($D(OCXDBMSG)>1) D ZW("OCXDBMSG")
109 ;
110 I (OCXA("SOURCE")="OERR") D Q
111 .N OCXORD,DFN,OCXDBMSG
112 .S OCXD0=0 F S OCXD0=$O(OCXA("DATA",OCXD0)) Q:'OCXD0 D
113 ..N TEXT S TEXT=OCXA("DATA",OCXD0,0)
114 ..S @$P(TEXT,"=",1)=$P(TEXT,"=",2,999)
115 .S DFN=+$P($G(OCXA("PATIENT")),"[",2)
116 .S OCXDBMSG=""
117 .W ! D SILENT^OCXOERR(OCXORD,.OCXDBMSG) ;
118 .I ($D(OCXDBMSG)>1) D ZW("OCXDBMSG")
119 Q
120 ;
121LOOKUP(OCXDLG) ;
122 ;
123 N DIC,X,Y
124 S:$L($G(OCXDLG)) DIC("A")=OCXDLG
125 S DIC="^OCXD(861,",DIC(0)="AMNEQ"
126 S DIC("S")="I (Y>1)"
127 S DIC("W")="W "" "",$G(^(""SOURCE"")),"" "",$G(^(""PATIENT""))"
128 S Y=0 D ^DIC
129 Q:(Y<0) 0 Q +Y
130 ;
131ZW(ARRAY) ;
132 W !,ARRAY
133 N NODE
134 I ($D(@ARRAY)#10) W !,ARRAY," = ",@ARRAY
135 S:($E(ARRAY,$L(ARRAY))=")") ARRAY=$E(ARRAY,1,$L(ARRAY)-1)_","
136 S NODE=ARRAY F S NODE=$Q(@NODE) Q:'$L(NODE) Q:'($E(NODE,1,$L(ARRAY))=ARRAY) W !,NODE," = ",@NODE
137 Q
138 ;
139LOGAL(OCXR0,OCXR1,OCXN,OCXDFN,OCXNUM,OCXADUZ,OCXPMSG,OCXPDATA) ;
140 ;
141 ; OCXR0: Rule IEN
142 ; OCXR1: Relation IEN
143 ; OCXN: notification identifier (required)
144 ; OCXDFN: patient identifier (required)
145 ; OCXNUM: order number - used to determine ordering provider
146 ; OCXADUZ: array of package-identified recipients
147 ; OCXPMSG: package-defined message
148 ; OCXPDATA: package-defined data for follow-up action
149 ;
150 I $G(OCXR0),$G(OCXR1) S ^TMP("OCXDEBUG",$J,+OCXR0,+OCXR1)=$G(^TMP("OCXDEBUG",$J,+OCXR0,+OCXR1))+1
151 ;
152 Q
153 ;
154READ(OCXZ0,OCXZA,OCXZB,OCXZL) ;
155 N OCXLINE,DIR,DTOUT,DUOUT,DIRUT,DIROUT
156 Q:'$L($G(OCXZ0)) U
157 S DIR(0)=OCXZ0
158 S:$L($G(OCXZA)) DIR("A")=OCXZA
159 S:$L($G(OCXZB)) DIR("B")=OCXZB
160 F OCXLINE=1:1:($G(OCXZL)-1) W !
161 D ^DIR
162 I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT) Q U
163 Q Y
164 ;
165TIME ;
166 ;
167 N OCXD0,OCXT1,OCXT2,OCXT3,OCXTIME,OCXMAX
168 ;
169 S (OCXMAX,OCXD0)=0 F S OCXD0=$O(^OCXD(861,OCXD0)) Q:'OCXD0 D
170 .Q:'$D(^OCXD(861,OCXD0,"STATUS"))
171 .S OCXT1=+$G(^OCXD(861,OCXD0,0))
172 .S OCXT1=$P(OCXT1,".",2)
173 .S OCXT1=$E(OCXT1_"000000",1,6)
174 .S OCXT1=($E(OCXT1,1,2)*3600)+($E(OCXT1,3,4)*60)+($E(OCXT1,5,6))
175 .S OCXT2=$G(^OCXD(861,OCXD0,"STATUS"))
176 .S OCXT2=+$P(OCXT2," AT ",2)
177 .S OCXT2=$P(OCXT2,".",2)
178 .S OCXT2=$E(OCXT2_"000000",1,6)
179 .S OCXT2=($E(OCXT2,1,2)*3600)+($E(OCXT2,3,4)*60)+($E(OCXT2,5,6))
180 .S OCXT3=(OCXT2-OCXT1) Q:(OCXT3<0)
181 .I (OCXT3>OCXMAX) S OCXMAX=OCXT3_U_OCXD0
182 .S OCXTIME(OCXT3)=$G(OCXTIME(OCXT3))+1
183 ;
184 W !!,"Number of seconds",?20,"Number of occurences",!
185 S OCXT1="" F S OCXT1=$O(OCXTIME(OCXT1)) Q:'$L(OCXT1) D
186 .I OCXT1 W !,$J(OCXT1,4)
187 .E W !,"Less than 1 second"
188 .W ?20,$J(+$G(OCXTIME(OCXT1)),6)
189 I $P(OCXMAX,U,2) W !!,"Maximum wait: ",+OCXMAX," second(s). Log entry: ",$P(OCXMAX,U,2)
190 ;
191 Q
192 ;
Note: See TracBrowser for help on using the repository browser.