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

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

initial load of WorldVistAEHR

File size: 7.4 KB
Line 
1ROR ;HCIOFO/SG - CLINICAL CASE REGISTRIES ; 6/22/06 3:33pm
2 ;;1.5;CLINICAL CASE REGISTRIES;**1**;Feb 17, 2006;Build 24
3 ;
4 ; LOCAL VARIABLE ------ DESCRIPTION
5 ;
6 ; RORCACHE In-memory cache
7 ; RORERRDL Default error location
8 ; RORERROR Error processing data
9 ; RORPARM Task-wide constants and variables
10 ;
11 ; See the source code of the ^ROR02 routine for more details.
12 ;
13 ; ROREXT Regular data extraction (See ^ROREXT)
14 ; RORHDT Historical data extraction (See ^RORHDT)
15 ; RORLOG Log subsystem data (See ^RORLOG)
16 ; RORUPD Registry update parameters (See ^RORUPD)
17 ;
18 ; TEMPORARY NODE ------ DESCRIPTION
19 ;
20 ; ^TMP("RORHDT") Control data of historical data extraction
21 ; ^TMP("RORTMP") Temporary storage
22 ; ^TMP("RORUPD") Registry update temporary data
23 ;
24 ; ^TMP(rtn_name) Temporary storage used by the rtn_name
25 ; routine (mostly, the RPC's)
26 ;
27 ; ^TMP($J,"RORTMP-"_) Generic temporary storage used by ^RORTMP
28 ;
29 ; ^XTMP("RORHDT") Control data of historical data extraction
30 ; ^XTMP("RORUPDJ") Registry update temporary data (multitask)
31 ; ^XTMP("RORUPDR") Registry update temporary data (installation)
32 ;
33 ; See detailed description of the temporary global nodes in
34 ; the source code of the ^ROR01 routine.
35 ;
36 ; NAMESPACE ----------- DESCRIPTION
37 ;
38 ; RORAPI* Supported APIs
39 ; RORDD* Routines used by the Data Dictionary
40 ; RORERR* Error processing
41 ; ROREVT* Event protocols
42 ; ROREX* Regular data extraction & transmission
43 ; RORHDT* Historical data extraction
44 ; RORHIV* HIV registry-specific routines
45 ; RORHL* HL7 utilities
46 ; RORKIDS* Low-level installation utilities (KIDS)
47 ; RORLOCK* Locks and transactions
48 ; RORLOG* Error recording
49 ;
50 ; RORPnnn* Patch installation routines (KIDS)
51 ; nnn - patch number
52 ; RORPUT* High-level installation utilities
53 ;
54 ; RORREP* Roll-and-scroll reports
55 ; RORRP* Remote procedures
56 ; RORSET* Registry setup routines
57 ; RORTXT* Text resource routines
58 ; RORUP* Registry update
59 ; RORUTL* Utilities
60 ; RORVM* Entry points for VistA menu options
61 ; RORXnnn* XML reports (nnn - report code)
62 ; RORXU* Utilities for XML reports
63 ;
64 ; DIALOG -------------- DESCRIPTION
65 ;
66 ; 7980000.* Various messages and templates
67 ; 7981???.* Report templates (XSL)
68 ;
69 ; MENU OPTION --------- DESCRIPTION
70 ;
71 ; [ROR TASK] Registry update and data extraction option
72 ; (must be scheduled; do not run it directly)
73 ; [ROR SETUP] Registry Setup
74 ; [RORHDT MAIN] Historical data extraction menu
75 ; [RORMNT MAIN] Maintenance menu
76 ;
77 ; SPECIAL ENTRY POINT - DESCRIPTION
78 ;
79 ; ^RORUTL06 Menu for developer's utilities
80 ; DISTPREP^RORUTL06 Prepares registry for KIDS distribution
81 ; PRTMDE^RORUTL06 Prints the data element metadata
82 ; VERIFY^RORUTL06 Checks the registry definition
83 ;
84 ; EXTRACT^RORUTL07 Data extraction & transmission in debug mode
85 ; UPDATE^RORUTL07 Registry update in debug mode
86 ;
87 ; INITIALS ------------ DEVELOPER
88 ;
89 ; BH Brent Hicks
90 ; CRT Cameron Taylor
91 ; SG Sergey Gavrilov
92 ;
93 Q
94 ;
95 ;***** RETURNS THE TEST BUILD NUMBER FOR THE DATA EXTRACTION
96BUILD() ;
97 Q 1
98 ;
99 ;***** REGISTRY UPDATE AND DATA EXTRACTION TASK
100 ;
101 ; ZTQPARAM String that contains a list of registry names
102 ; separated by commas. You must define the list as
103 ; a value of the TASK PARAMETERS field during
104 ; scheduling of the [ROR TASK] option that uses
105 ; this entry point.
106 ;
107 ; The following task parameters are optional. They can be defined
108 ; on the second page of the option scheduling form as the pairs of
109 ; variable names and values. See description of the ROR TASK option
110 ; for more details regarding these parameters.
111 ;
112 ; [RORFLCLR] Clear flags to control processing (default: "").
113 ; [RORFLSET] Set flags to control processing (default: "EX").
114 ;
115 ; D Run the task(s) in Debug Mode #1
116 ;
117 ; E Use the event references (file #798.3)
118 ;
119 ; S Run the data extraction in single-task mode
120 ;
121 ; X Suspend the data extraction task in the
122 ; same way as the registry update
123 ;
124 ; [RORMNTSK] Maximum number of the registry update subtasks.
125 ; The default value of the parameter is "2-3-AUTO".
126 ;
127 ; [RORSUSP] Suspension parameters of the registry update and
128 ; data extraction subtasks. The subtasks are not
129 ; suspended by default.
130 ;
131TASK ;
132 N RORERROR ; Error processing data
133 N RORLOG ; Log subsystem constants & variables
134 N RORPARM ; Application parameters
135 ;
136 N CNT,FLAGS,I,RC,REGLST,REGNAME,RORERRDL K ZTREQ
137 ;--- Initialize constants and variables
138 D INIT^RORUTL01("ROR",1)
139 D CLEAR^RORERR("TASK^ROR",1)
140 ;--- Open a new log
141 S RC=$$SETUP^RORLOG()
142 S RC=$$OPEN^RORLOG(,7,"ROR TASK STARTED")
143 ;
144 ;--- Check and log the task parameters and force the <UNDEF>
145 ;--- error in case of a missing/invalid critical value
146 I $$TASKPRMS^ROR10(.REGLST)<0 K ZTQPARAM S RC=ZTQPARAM
147 ;--- Clear/Set the flags (override the default value)
148 S FLAGS=$TR("EX",RORFLCLR_RORFLSET)_RORFLSET
149 ;--- Associate the log with the registries
150 S RC=$$SETRGLST^RORLOG(.REGLST)
151 ;--- Enable debug mode if requested
152 S:FLAGS["D" RORPARM("DEBUG")=1
153 ;
154 ;--- Rebuild the "ACL" cross-reference
155 S RC=$$RNDXACL^RORUTL11()
156 ;--- Remove inactive registries from the list
157 S RC=$$ARLST^RORUTL02(.REGLST) G:RC<0 ABORT
158 ;--- Check the status of last HL7 message(s)
159 S RC=$$CHECKMSG^ROR10(.REGLST) G:RC<0 ABORT
160 ;
161 ;--- Update the registries
162 S RC=$$UPDATE^RORUPD(.REGLST,RORMNTSK,RORSUSP,FLAGS)
163 ;--- Process the errors
164 I RC<0 D G:RC<0 ABORT
165 . ;--- Quit if stop is requested (via the TaskMan User option)
166 . I RC=-42 D ALERT^RORUTL01(.REGLST,-42) S ZTSTOP=1 Q
167 . ;--- Do not send the alert for some warnings
168 . I RC=-28 S RC=0 Q
169 . ;--- Send the alert in case of other errors/warnings
170 . D ALERT^RORUTL01(.REGLST,-43,,,,"registry update")
171 . S RC=0
172 ;
173 ;--- Mark registry records 1 month after the installation so that
174 ; the local registry data and demographic data will be resent
175 ;--- to restore the data overwritten with the historical data
176 S RC=$$REMARK^RORUTL05(.REGLST,31)
177 ;
178 ;--- Perform the data extraction
179 S RC=$$EXTRACT^ROREXT(.REGLST,,RORSUSP,FLAGS)
180 ;--- Process the errors
181 I RC<0 D G:RC<0 ABORT
182 . ;--- Quit if stop is requested (via the TaskMan User option)
183 . I RC=-42 D ALERT^RORUTL01(.REGLST,-42) S ZTSTOP=1 Q
184 . ;--- Do not send the alert for some warnings
185 . I RC=-28 S RC=0 Q
186 . ;--- Send the alert in case of other errors/warnings
187 . D ALERT^RORUTL01(.REGLST,-43,,,,"data extraction")
188 . S RC=0
189 ;
190 ;--- Purge the old tasks
191 S RC=$$PURGE^RORTSK02(14)
192 ;--- Purge the old logs
193 S RC=$$PURGE^RORLOG01(31)
194 ;--- Purge the old event references
195 S RC=$$EPDATE^RORUTL05()
196 S:RC>0 RC=$$PURGE^RORUPP02(RC)
197 ;---
198 S ZTREQ="@"
199ABORT ;
200 S I=$S($G(ZTREQ)="@":"COMPLETED",1:"ABORTED")
201 D CLOSE^RORLOG("ROR TASK "_I)
202 Q
Note: See TracBrowser for help on using the repository browser.