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