source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXLOG1.m@ 1574

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

initial load of WorldVistAEHR

File size: 6.5 KB
RevLine 
[613]1OCXLOG1 ;SLC/RJS,CLA - Rule Display (Expert System - Data Field Frequency in OCXLog Report) ;8/04/98 16:01
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5S ;
6 ;
7 K OCXTOTL,OCXPROG,OCXGETC,OCXGETN,OCXCOD2,OCXERR,OCXDF,OXCDFN
8 K OCXTOT,OCXNAM,OCXPARM,OCXPATH,OCXCON,OCXDPTR,OCXREC
9 K ^TMP("OCXDF",$J) S OCXWARN=0
10 S ^TMP("OCXDF",$J)=($P($H,",",2)+($H*86400)+(2*60*60))_" <- ^TMP ENTRY EXPIRATION DATE FOR ^OCXOPURG"
11 ;
12 W !!," Generating Data Navigation code..." D WAIT^DICD
13 ;
14 D S OCXDFN="" F S OCXDFN=$O(^OCXS(860.4,"B",OCXDFN)) Q:'$L(OCXDFN) D Q:OCXWARN
15 .Q S OCXDF=0 F S OCXDF=$O(^OCXS(860.4,"B",OCXDFN,OCXDF)) Q:'OCXDF D Q:OCXWARN
16 ..I $D(^OCXS(860.4,OCXDF,0)) K OCXREC(4) M OCXREC(4)=^OCXS(860.4,OCXDF)
17 ..E Q
18 ..W:($X>60) ! W "."
19 ..S OCXCON=0 F S OCXCON=$O(OCXREC(4,"LINK",OCXCON)) Q:'OCXCON D Q:OCXWARN
20 ...S OCXWARN=0
21 ...Q:$P($G(^OCXS(860.6,OCXCON,0)),U,3)
22 ...S OCXCONN=$P($G(^OCXS(860.6,OCXCON,0)),U,1) I '$L(OCXCONN) D WARN^OCXOCMPV("Data context IEN #"_(+OCXCON)_" not defined in Data Context file...",4,OCXDF,$P($T(+1)," ",1)) Q
23 ...S OCXCONA=$P($G(^OCXS(860.6,OCXCON,0)),U,2) I '$L(OCXCONA) D WARN^OCXOCMPV("Data context abbreviation for '"_OCXCONN_"' not defined in Data Context file...",4,OCXDF,$P($T(+1)," ",1)) Q
24 ...S OCXCONS=OCXCONA
25 ...S OCXTOTL(OCXCONS)=0
26 ...W:($X>60) ! W "."
27 ...;
28 ...N OCXATT,OCXDTYP,OCXDTYPN,OCXERR,OCXGETC,OCXLNK,OCXNAM,OCXPARM,OCXPATH
29 ...S OCXTOTL(OCXCONS,OCXDF)=0
30 ...S OCXNAM=$P($G(OCXREC(4,0)),U,1) Q:'$L(OCXNAM)
31 ...S OCXPATH=$G(OCXREC(4,"LINK",OCXCON,"DATAPATH")) I '$L(OCXPATH) D WARN^OCXOCMPV("Data Link-Path not defined",4,OCXDF,$P($T(+1)," ",1)) Q
32 ...S OCXLNK=$O(^OCXS(863.3,"B",OCXPATH,0)) I 'OCXLNK D WARN^OCXOCMPV("Data Link-Path '"_OCXPATH_"' not defined in Meta-Dictionary Link file...",4,OCXDF,$P($T(+1)," ",1)) Q
33 ...S OCXATT=$P($G(^OCXS(863.3,OCXLNK,0)),U,5) I 'OCXATT D WARN^OCXOCMPV("Data Link-Attribute '"_OCXPATH_"' ("_OCXLNK_") not defined in Meta-Dictionary Attribute file...",4,OCXDF,$P($T(+1)," ",1)) Q
34 ...;
35 ...S $P(OCXREC(4,0),U,3)=""
36 ...F OCXPARM="OCXO EXTERNAL FUNCTION CALL","OCXO VARIABLE NAME","OCXO VT-BAR PIECE NUMBER","OCXO UP-ARROW PIECE NUMBER","OCXO SEMI-COLON PIECE NUMBER","OCXO HL7 SEGMENT ID","OCXO FILE POINTER" D
37 ....Q:'$O(^OCXS(863.8,"B",OCXPARM,0))
38 ....S OCXPARM(OCXPARM)=$$GETPARM(33,OCXPATH,OCXPARM)
39 ....I '$L(OCXPARM(OCXPARM)) K OCXPARM(OCXPARM)
40 ...S OCXDTYP=$$GETPARM(34,OCXATT,"DATA TYPE")
41 ...I '$L(OCXDTYP) D WARN^OCXOCMPV("Data Link-Attribute '"_OCXPATH_"' Data Type not defined in Meta-Dictionary Attribute file...",4,OCXDF,$P($T(+1)," ",1)) Q
42 ...S:'OCXDTYP OCXDTYP=$O(^OCXS(864.1,"B",OCXDTYP,0)) S OCXDTYPN=$P($G(^OCXS(864.1,+OCXDTYP,0)),U,1)
43 ...I '$L(OCXDTYPN) D WARN^OCXOCMPV("Data Link-Attribute '"_OCXPATH_"' Data Type '"_OCXDTYP_"' not defined in Meta-Dictionary Data Type file...",4,OCXDF,$P($T(+1)," ",1)) Q
44 ...;
45 ...Q:$G(OCXERR) Q:OCXWARN
46 ...;
47 ...I '$L($G(OCXPARM("OCXO VARIABLE NAME"))) D Q
48 ....D WARN^OCXOCMPV("Not enough information in the MetaDictionary link file to generate navigation code.",4,OCXDF,$P($T(+1)," ",1)) S OCXERR=1 Q
49 ...S OCXDFV=OCXPARM("OCXO VARIABLE NAME")
50 ...S OCXTOTL(OCXCONS,OCXDF,"VAR")=OCXDFV
51 ...S OCXGETC="$G("_OCXDFV_")"
52 ...;
53 ...Q:OCXWARN
54 ...;
55 ...S:$L($G(OCXPARM("OCXO VT-BAR PIECE NUMBER"))) OCXGETC="$P("_OCXGETC_",""|"","_(OCXPARM("OCXO VT-BAR PIECE NUMBER")+1)_")"
56 ...S:$G(OCXPARM("OCXO UP-ARROW PIECE NUMBER")) OCXGETC="$P("_OCXGETC_",""^"","_OCXPARM("OCXO UP-ARROW PIECE NUMBER")_")"
57 ...S:$G(OCXPARM("OCXO SEMI-COLON PIECE NUMBER")) OCXGETC="$P("_OCXGETC_","";"","_OCXPARM("OCXO SEMI-COLON PIECE NUMBER")_")"
58 ...;
59 ...Q:'$L(OCXGETC)
60 ...S OCXPROG(OCXCONS,OCXDF)=OCXGETC
61 ...;
62 ;
63 W !!," Scanning Data Log..." D WAIT^DICD
64 ;
65 ;
66 S OCXD0=0 F S OCXD0=$O(^OCXD(861,OCXD0)) Q:'OCXD0 D
67 .I $D(^OCXD(861,OCXD0,0)) K OCXREC M OCXREC=^OCXD(861,OCXD0)
68 .E Q
69 .W:($X>60) !,"...",+OCXREC(0),"..." W:'(OCXD0#10) "."
70 .S OCXCONS=$G(OCXREC("SOURCE")) Q:'$L(OCXCONS)
71 .;
72 .Q:'(OCXCONS="OEPS")
73 .;
74 .D I (OCXCONS="HL7") S OCXD0=0 F S OCXD0=$O(^OCXD(861,OCXCONS,OCXD0)) Q:'OCXD0 D
75 ..Q N OCXODATA
76 ..S OCXTOT=$G(OCXTOT)+1
77 ..S OCXTOTL(OCXCONS)=$G(OCXTOTL(OCXCONS))+1
78 ..K OCXODATA M OCXODATA=^OCXD(861,OCXCONS,OCXD0) D CONV(.OCXODATA)
79 ..S OCXDF=0 F S OCXDF=$O(OCXPROG(OCXCONS,OCXDF)) Q:'OCXDF D
80 ...X "S OCXX="_OCXPROG(OCXCONS,OCXDF)
81 ...I $L(OCXX) S OCXTOTL(OCXCONS,OCXDF)=$G(OCXTOTL(OCXCONS,OCXDF))+1
82 ...;
83 .;
84 .I '(OCXCONS="HL7") S OCXD0=0 F S OCXD0=$O(OCXREC("DATA",OCXD0)) Q:'OCXD0 D
85 ..N OCXVAR,OCXVAL
86 ..S OCXTOT=$G(OCXTOT)+1
87 ..S OCXTOTL(OCXCONS)=$G(OCXTOTL(OCXCONS))+1
88 ..S OCXVAR=$P($G(OCXREC("DATA",OCXD0,0)),"=",1)
89 ..S OCXVAL=$P($G(OCXREC("DATA",OCXD0,0)),"=",2,999)
90 ..W !,?10,OCXVAR," = ",OCXVAL R XXX:60 Q
91 ..S @OCXVAR=OCXVAL
92 ..S OCXDF=0 F S OCXDF=$O(OCXPROG(OCXCONS,OCXDF)) Q:'OCXDF D
93 ...X "S OCXX="_OCXPROG(OCXCONS,OCXDF)
94 ...I $L(OCXX) S OCXTOTL(OCXCONS,OCXDF)=$G(OCXTOTL(OCXCONS,OCXDF))+1
95 ..K @OCXVAR
96 ;
97 K IOP D ^%ZIS
98 ;
99 U IO D W *12 D ^%ZISC
100 .S OCXCONS="" F S OCXCONS=$O(OCXTOTL(OCXCONS)) Q:'$L(OCXCONS) D Q:$$PAUSE
101 ..W !!,OCXCONS," Data Field Frequency in OCXLog (",OCXTOTL(OCXCONS)," entries)",!
102 ..S OCXDFN="" F S OCXDFN=$O(^OCXS(860.4,"B",OCXDFN)) Q:'$L(OCXDFN) D
103 ...S OCXDF=0 F S OCXDF=$O(^OCXS(860.4,"B",OCXDFN,OCXDF)) Q:'OCXDF I $D(OCXTOTL(OCXCONS,OCXDF)) D
104 ....W !,$J(OCXTOTL(OCXCONS,OCXDF),5)," ",OCXDFN," [",OCXDF,"] ",$G(OCXPROG(OCXCONS,OCXDF))
105 .W !!,$J(OCXTOT,5)," Total arrays scanned"
106 .;
107 Q
108 ;
109ARCNT(SUB) ;
110 I '$G(^OCXD(861,SUB)) Q 0
111 Q (+$G(^OCXD(861,OCXCONS))-$O(^OCXD(861,OCXCONS,0)))+1
112 ;
113UDEFPARM(PARM) ;
114 Q:$D(OCXPARM(PARM)) 0
115 D WARN^OCXOCMPV(" '"_PARM_"' parameter missing, in MetaDictionary link file.",4,OCXDF,$P($T(+1)," ",1)) Q 1
116 ;
117GETPARM(FILE,INST,PARM) ;
118 Q:'$L(FILE) "" Q:'$L(INST) "" Q:'$L(PARM) ""
119 N OCXP,OCXP1,OCXI,OCXTEMP,OCXGL
120 S OCXGL="^OCXS" S:(FILE=1) OCXGL="^OCXD" S:(FILE=7) OCXGL="^OCXD" S:(FILE=10) OCXGL="^OCXD"
121 S FILE=FILE/10+860
122 Q:'$D(@OCXGL@(+FILE,0)) ""
123 I (PARM=+PARM),$D(^OCXS(863.8,PARM,0)) S OCXP=PARM
124 E S OCXP=$O(^OCXS(863.8,"B",PARM,0))
125 Q:'OCXP ""
126 I (INST=+INST),$D(@OXCGL@(FILE,INST,0)) S OCXI=INST
127 E S OCXI=$O(@OCXGL@(FILE,"B",INST,0))
128 Q:'OCXI ""
129 M OCXTEMP=@OCXGL@(FILE,OCXI)
130 S OCXP1=$O(OCXTEMP("PAR","B",OCXP,0)) Q:'OCXP1 ""
131 Q $G(OCXTEMP("PAR",OCXP1,"VAL"))
132 ;
133PAUSE() Q:'($E(IOST,1)="C") 0
134 N ANS
135 W !," Press <return> to continue... " R ANS:DTIME E Q 1
136 Q (ANS[U)
137 ;
138CONV(ARRAY) ;
139 ;
140 N TEMP,INDEX
141 M TEMP=ARRAY K ARRAY
142 K TEMP("TIMELOG"),TEMP(0)
143 S INDEX=0 F S INDEX=$O(TEMP(INDEX)) Q:'INDEX D
144 .N PC,SEG
145 .S SEG=$P(TEMP(INDEX),"|",1)
146 .F PC=2:1:$L(TEMP(INDEX),"|") S ARRAY(SEG,PC-1)=$P(TEMP(INDEX),"|",PC)
147 Q
148 ;
Note: See TracBrowser for help on using the repository browser.