source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORUPD.m@ 1593

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

initial load of WorldVistAEHR

File size: 8.5 KB
Line 
1RORUPD ;HCIOFO/SG - REGISTRY UPDATE ; 7/21/05 10:28am
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 ; RORLRC -------------- LIST OF LAB RESULT CODES TO CHECK
5 ;
6 ; RORLRC(Seq#) Lab result code (see the LA7SC parameter of
7 ; the GCPR^LA7QRY entry point)
8 ; ^1: Result code
9 ; ^2: Coding system ("LN" or "NLT")
10 ;
11 ; RORUPD -------------- REGISTRY UPDATE DESCRIPTOR
12 ;
13 ; RORUPD("DT") Date/time when update process started
14 ;
15 ; RORUPD("DSBEG") Start date of the data scan
16 ; RORUPD("DSEND") End date of the data scan
17 ; (these nodes are set by $$PREPARE1^RORUPR)
18 ;
19 ; RORUPD("EETS") Timestamp of the earliest event reference
20 ;
21 ; RORUPD("ERRCNT") Counter of errors during processing of the
22 ; current patient
23 ;
24 ; RORUPD("FLAGS") Flags to control processing (see the
25 ; TASK^ROR for possible values).
26 ;
27 ; RORUPD("JOB") Job number of the main task. This node is
28 ; defined only if the registry update is
29 ; running in the multitask mode.
30 ;
31 ; RORUPD("LD", Instead of checking data in the interval
32 ; from start date till end date, update process
33 ; starts checks from the start date minus
34 ; appropriate number of lag days. Thus, data
35 ; entered retrospectively will not be missed.
36 ; 1) Lag days for data examination
37 ;
38 ; RORUPD("LM", Loop control mode. It defines when to stop
39 ; looping through records of the patient:
40 ; 0 always loop through all records
41 ; 1 all top level rules have been triggered
42 ; for the patient (default)
43 ; 2 patient has been marked for addition to
44 ; all registries being processed
45 ; 1,Rule Name) Current list of names of top level rules
46 ; 2,Registry#) Current list of registry IENs
47 ;
48 ; RORUPD("LM1", STATIC LIST OF TOP LEVEL RULES
49 ; Rule Name)
50 ;
51 ; RORUPD("LM2", STATIC LIST OF REGISTRIES
52 ; Registry#) ^1: 1 - if the current patient can be added
53 ; to the registry; 0 - if the patient is
54 ; already in the registry or he/she is
55 ; an employee and should be skipped.
56 ; ^2: 1 if the employees must not be added
57 ; to the registry.
58 ;
59 ; RORUPD("MAXPPCNT") When counters in the ROR PATIENT EVENTS
60 ; file reach a value stored in this node, the
61 ; corresponding patient will be skipped until
62 ; someone fixes the error(s) and resets the
63 ; counters to 1.
64 ;
65 ; RORUPD("ROOT",File#) Closed root of the file
66 ;
67 ; RORUPD("SR", PREPARED SELECTION RULES
68 ; File#, This node is defined if the file should be
69 ; processed
70 ;
71 ; "A", List of rules that should be applied after
72 ; processing sub-files and linked files.
73 ; "B", List of rules that should be applied before
74 ; processing sub-files and linked files.
75 ; Seq#, ^1: Selection Rule Name
76 ; ^2: Rule# (Selection Rule IEN)
77 ; ^3: 1 if registry should be updated if
78 ; the expression evaluated as True
79 ; (top-level seelction rule)
80 ; 1) MUMPS expression that implements the rule
81 ; 2,Registry#) List of IENs of affected registries
82 ;
83 ; "F", A list of data elements that should be loaded
84 ; before applying selection rules is created
85 ; under this node. The elements are grouped by
86 ; the APIs used to load the values.
87 ; API#, For API #1 (FileMan GETS^DIQ) this node
88 ; contains a list of fields separated by ';'.
89 ; DataCode, For data elements associated with the API #1
90 ; this node stores the field number.
91 ; "E") If an external value of the field should be
92 ; loaded, a value of the field 4.1 of the
93 ; subfile #799.22 is assigned to this node.
94 ; "I") If an internal value of the field should be
95 ; loaded, a value of the field 4.2 of the
96 ; subfile #799.22 is assigned to this node.
97 ;
98 ; RORUPD("SUSPEND") SUBTASKS SUSPENSION PARAMETERS
99 ; ^1: Suspension start time (FileMan)
100 ; ^2: Suspension end time (FileMan)
101 ;
102 ; For example, to suspend subtasks from
103 ; 7:00 until 18:00 this node should have
104 ; the following value: ".07^.18".
105 ;
106 ; RORUPD("UPD", CALL-BACK ENTRY POINTS
107 ; Registry#,1) Entry point of a MUMPS external function
108 ; that assign values of additional fields to
109 ; the registry FDA before registry update
110 ; (opt'l).
111 ; Registry#,2) Entry point of a MUMPS external function
112 ; that is called right after registry update
113 ; (opt'l).
114 ;
115 ; RORUPDPI ------------ CLOSED ROOT OF THE TEMPORARY STORAGE
116 ; (the ^TMP("RORUPD",$J), ^XTMP("RORUPDJ"_$J)
117 ; or ^XTMP("RORUPDR"_Registry#) node)
118 ;
119 ; See also a description of ^XTMP("RORUPD"_) in the ^ROR01 routine.
120 ;
121 Q
122 ;
123 ;***** UPDATES THE REGISTRIES
124 ;
125 ; .REGLST Reference to a local array containing registry
126 ; names as subscripts and registry IENs as values
127 ;
128 ; [MAXNTSK] Maximum number of the data processing subtasks.
129 ; See description of the $$PROCESS^RORUPD05 function
130 ; for details.
131 ;
132 ; [SUSPEND] Subtask suspension parameters:
133 ; See description of the RORUPD("SUSPEND") node
134 ; for details.
135 ;
136 ; [FLAGS] Flags to control processing.
137 ; See description of the TASK^ROR for
138 ; possible values of the flags).
139 ;
140 ; Return Values:
141 ; <0 Error code (see MSGLIST^RORERR20)
142 ; 0 Ok
143 ;
144UPDATE(REGLST,MAXNTSK,SUSPEND,FLAGS) ;
145 N RORERRDL ; Default error location
146 N RORLOG ; Log subsystem constants & variables
147 N RORLRC ; List of Lab result codes to check
148 N RORUPD ; Update descriptor
149 N RORUPDPI ; Closed root of the temporary storage
150 N RORVALS ; Calculated values
151 ;
152 N COUNTERS,RC,TMP
153 D INIT^RORUTL01("RORUPD")
154 S RORUPD("FLAGS")=$$UP^XLFSTR($G(FLAGS))
155 D CLEAR^RORERR("UPDATE^RORUPD")
156 ;--- Value of the RORUPDPI variable is modified by the
157 ; $$PROCESS^RORUPD05 function if the registry update
158 ;--- process runs in the multi-task mode.
159 S RORUPDPI=$NA(^TMP("RORUPD",$J))
160 ;--- Open a new log
161 S TMP=$$SETUP^RORLOG(.REGLST)
162 S TMP=$$OPEN^RORLOG(.REGLST,1,"REGISTRY UPDATE STARTED")
163 D
164 . ;--- Check a list of registries
165 . I $D(REGLST)<10 D Q
166 . . S RC=$$ERROR^RORERR(-28,,,,"update")
167 . ;--- Lock parameters of the registries being processed
168 . S RC=$$LOCKREG^RORUTL02(.REGLST,1,,"REGISTRY UPDATE") Q:RC<0
169 . I 'RC D K REGLST Q
170 . . S RC=$$ERROR^RORERR(-11,,,,"registries being processed")
171 . ;--- Prepare selection rules
172 . S:$G(SUSPEND)>0 RORUPD("SUSPEND")=SUSPEND
173 . S RC=$$PREPARE^RORUPR(.REGLST)
174 . I RC<0 S RC=$$ERROR^RORERR(-14) Q
175 . ;--- Display the debug information
176 . D:$G(RORPARM("DEBUG"))>1 DEBUG^RORUPDUT
177 . ;--- Look for new patients and update the registries
178 . S RC=$$PROCESS^RORUPD05($G(MAXNTSK)) Q:RC<0
179 . S COUNTERS=RC
180 . ;--- Update registry parameters
181 . S TMP=$$TMSTMP^RORUPD01(.REGLST)
182 . ;--- Update demographic data
183 . D LOG^RORLOG(,"Demographic Update")
184 . S RC=$$UPDDEM^RORUPD51(.REGLST)
185 ;
186 ;--- Unlock parameters of processed registries
187 S TMP=$$LOCKREG^RORUTL02(.REGLST,0)
188 ;--- Statistics & Cleanup
189 S TMP="REGISTRY UPDATE "_$S(RC<0:"ABORTED",1:"COMPLETED")
190 D CLOSE^RORLOG(TMP,$G(COUNTERS))
191 D:'$G(RORPARM("DEBUG"))
192 . D INIT^RORUTL01("RORUPD")
193 . ;--- Do not kill the list of processed patients ("U" subnode)
194 . ; in case of an error or crash during the initial registry
195 . ;--- population (registry setup).
196 . K:'$G(RORPARM("SETUP"))!(RC'<0) @RORUPDPI
197 Q $S(RC<0:RC,1:0)
Note: See TracBrowser for help on using the repository browser.