Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RORUPD

RORUPD.m

Go to the documentation of this file.
  1. RORUPD ;HCIOFO/SG - REGISTRY UPDATE ;7/21/05 10:28am
  1. ;;1.5;CLINICAL CASE REGISTRIES;**19**;Feb 17, 2006;Build 43
  1. ;
  1. ;******************************************************************************
  1. ;******************************************************************************
  1. ; --- ROUTINE MODIFICATION LOG ---
  1. ;
  1. ;PKG/PATCH DATE DEVELOPER MODIFICATION
  1. ;----------- ---------- ----------- ----------------------------------------
  1. ;ROR*1.5*19 FEB 2012 K GUPTA Support for ICD-10 Coding System,
  1. ; no code changes, updated RORUPD structure
  1. ;******************************************************************************
  1. ;******************************************************************************
  1. ;
  1. ; RORLRC -------------- LIST OF LAB RESULT CODES TO CHECK
  1. ;
  1. ; RORLRC(Seq#) Lab result code (see the LA7SC parameter of
  1. ; the GCPR^LA7QRY entry point)
  1. ; ^1: Result code
  1. ; ^2: Coding system ("LN" or "NLT")
  1. ;
  1. ; RORUPD -------------- REGISTRY UPDATE DESCRIPTOR
  1. ;
  1. ; RORUPD("DT") Date/time when update process started
  1. ;
  1. ; RORUPD("DSBEG") Start date of the data scan
  1. ; RORUPD("DSEND") End date of the data scan
  1. ; (these nodes are set by $$PREPARE1^RORUPR)
  1. ;
  1. ; RORUPD("EETS") Timestamp of the earliest event reference
  1. ;
  1. ; RORUPD("ERRCNT") Counter of errors during processing of the
  1. ; current patient
  1. ;
  1. ; RORUPD("FLAGS") Flags to control processing (see the
  1. ; TASK^ROR for possible values).
  1. ;
  1. ; RORUPD("IMPDATE", Stores the implementation date of coding system
  1. ; "ICD10") Implementation date for ICD-10.
  1. ;
  1. ; RORUPD("JOB") Job number of the main task. This node is
  1. ; defined only if the registry update is
  1. ; running in the multitask mode.
  1. ;
  1. ; RORUPD("LD", Instead of checking data in the interval
  1. ; from start date till end date, update process
  1. ; starts checks from the start date minus
  1. ; appropriate number of lag days. Thus, data
  1. ; entered retrospectively will not be missed.
  1. ; 1) Lag days for data examination
  1. ;
  1. ; RORUPD("LM", Loop control mode. It defines when to stop
  1. ; looping through records of the patient:
  1. ; 0 always loop through all records
  1. ; 1 all top level rules have been triggered
  1. ; for the patient (default)
  1. ; 2 patient has been marked for addition to
  1. ; all registries being processed
  1. ; 1,Rule Name) Current list of names of top level rules
  1. ; 2,Registry#) Current list of registry IENs
  1. ;
  1. ; RORUPD("LM1", STATIC LIST OF TOP LEVEL RULES
  1. ; Rule Name)
  1. ;
  1. ; RORUPD("LM2", STATIC LIST OF REGISTRIES
  1. ; Registry#) ^1: 1 - if the current patient can be added
  1. ; to the registry; 0 - if the patient is
  1. ; already in the registry or he/she is
  1. ; an employee and should be skipped.
  1. ; ^2: 1 if the employees must not be added
  1. ; to the registry.
  1. ;
  1. ; RORUPD("MAXPPCNT") When counters in the ROR PATIENT EVENTS
  1. ; file reach a value stored in this node, the
  1. ; corresponding patient will be skipped until
  1. ; someone fixes the error(s) and resets the
  1. ; counters to 1.
  1. ;
  1. ; RORUPD("ROOT",File#) Closed root of the file
  1. ;
  1. ; RORUPD("SR", PREPARED SELECTION RULES
  1. ; File#, This node is defined if the file should be
  1. ; processed
  1. ;
  1. ; "A", List of rules that should be applied after
  1. ; processing sub-files and linked files.
  1. ; "B", List of rules that should be applied before
  1. ; processing sub-files and linked files.
  1. ; Seq#, ^1: Selection Rule Name
  1. ; ^2: Rule# (Selection Rule IEN)
  1. ; ^3: 1 if registry should be updated if
  1. ; the expression evaluated as True
  1. ; (top-level seelction rule)
  1. ; 1) MUMPS expression that implements the rule
  1. ; 2,Registry#) List of IENs of affected registries
  1. ; 3) Coding system
  1. ;
  1. ; "F", A list of data elements that should be loaded
  1. ; before applying selection rules is created
  1. ; under this node. The elements are grouped by
  1. ; the APIs used to load the values.
  1. ; API#, For API #1 (FileMan GETS^DIQ) this node
  1. ; contains a list of fields separated by ';'.
  1. ; DataCode, For data elements associated with the API #1
  1. ; this node stores the field number.
  1. ; "E") If an external value of the field should be
  1. ; loaded, a value of the field 4.1 of the
  1. ; subfile #799.22 is assigned to this node.
  1. ; "I") If an internal value of the field should be
  1. ; loaded, a value of the field 4.2 of the
  1. ; subfile #799.22 is assigned to this node.
  1. ;
  1. ; RORUPD("SUSPEND") SUBTASKS SUSPENSION PARAMETERS
  1. ; ^1: Suspension start time (FileMan)
  1. ; ^2: Suspension end time (FileMan)
  1. ;
  1. ; For example, to suspend subtasks from
  1. ; 7:00 until 18:00 this node should have
  1. ; the following value: ".07^.18".
  1. ;
  1. ; RORUPD("UPD", CALL-BACK ENTRY POINTS
  1. ; Registry#,1) Entry point of a MUMPS external function
  1. ; that assign values of additional fields to
  1. ; the registry FDA before registry update
  1. ; (opt'l).
  1. ; Registry#,2) Entry point of a MUMPS external function
  1. ; that is called right after registry update
  1. ; (opt'l).
  1. ;
  1. ; RORUPDPI ------------ CLOSED ROOT OF THE TEMPORARY STORAGE
  1. ; (the ^TMP("RORUPD",$J), ^XTMP("RORUPDJ"_$J)
  1. ; or ^XTMP("RORUPDR"_Registry#) node)
  1. ;
  1. ; See also a description of ^XTMP("RORUPD"_) in the ^ROR01 routine.
  1. ;
  1. Q
  1. ;
  1. ;***** UPDATES THE REGISTRIES
  1. ;
  1. ; .REGLST Reference to a local array containing registry
  1. ; names as subscripts and registry IENs as values
  1. ;
  1. ; [MAXNTSK] Maximum number of the data processing subtasks.
  1. ; See description of the $$PROCESS^RORUPD05 function
  1. ; for details.
  1. ;
  1. ; [SUSPEND] Subtask suspension parameters:
  1. ; See description of the RORUPD("SUSPEND") node
  1. ; for details.
  1. ;
  1. ; [FLAGS] Flags to control processing.
  1. ; See description of the TASK^ROR for
  1. ; possible values of the flags).
  1. ;
  1. ; Return Values:
  1. ; <0 Error code (see MSGLIST^RORERR20)
  1. ; 0 Ok
  1. ;
  1. UPDATE(REGLST,MAXNTSK,SUSPEND,FLAGS) ;
  1. N RORERRDL ; Default error location
  1. N RORLOG ; Log subsystem constants & variables
  1. N RORLRC ; List of Lab result codes to check
  1. N RORUPD ; Update descriptor
  1. N RORUPDPI ; Closed root of the temporary storage
  1. N RORVALS ; Calculated values
  1. ;
  1. N COUNTERS,RC,TMP
  1. D INIT^RORUTL01("RORUPD")
  1. S RORUPD("FLAGS")=$$UP^XLFSTR($G(FLAGS))
  1. D CLEAR^RORERR("UPDATE^RORUPD")
  1. ;--- Value of the RORUPDPI variable is modified by the
  1. ; $$PROCESS^RORUPD05 function if the registry update
  1. ;--- process runs in the multi-task mode.
  1. S RORUPDPI=$NA(^TMP("RORUPD",$J))
  1. ;--- Open a new log
  1. S TMP=$$SETUP^RORLOG(.REGLST)
  1. S TMP=$$OPEN^RORLOG(.REGLST,1,"REGISTRY UPDATE STARTED")
  1. D
  1. . ;--- Check a list of registries
  1. . I $D(REGLST)<10 D Q
  1. . . S RC=$$ERROR^RORERR(-28,,,,"update")
  1. . ;--- Lock parameters of the registries being processed
  1. . S RC=$$LOCKREG^RORUTL02(.REGLST,1,,"REGISTRY UPDATE") Q:RC<0
  1. . I 'RC D K REGLST Q
  1. . . S RC=$$ERROR^RORERR(-11,,,,"registries being processed")
  1. . ;--- Prepare selection rules
  1. . S:$G(SUSPEND)>0 RORUPD("SUSPEND")=SUSPEND
  1. . S RC=$$PREPARE^RORUPR(.REGLST)
  1. . I RC<0 S RC=$$ERROR^RORERR(-14) Q
  1. . ;--- Display the debug information
  1. . D:$G(RORPARM("DEBUG"))>1 DEBUG^RORUPDUT
  1. . ;--- Look for new patients and update the registries
  1. . S RC=$$PROCESS^RORUPD05($G(MAXNTSK)) Q:RC<0
  1. . S COUNTERS=RC
  1. . ;--- Update registry parameters
  1. . S TMP=$$TMSTMP^RORUPD01(.REGLST)
  1. . ;--- Update demographic data
  1. . D LOG^RORLOG(,"Demographic Update")
  1. . S RC=$$UPDDEM^RORUPD51(.REGLST)
  1. ;
  1. ;--- Unlock parameters of processed registries
  1. S TMP=$$LOCKREG^RORUTL02(.REGLST,0)
  1. ;--- Statistics & Cleanup
  1. S TMP="REGISTRY UPDATE "_$S(RC<0:"ABORTED",1:"COMPLETED")
  1. D CLOSE^RORLOG(TMP,$G(COUNTERS))
  1. D:'$G(RORPARM("DEBUG"))
  1. . D INIT^RORUTL01("RORUPD")
  1. . ;--- Do not kill the list of processed patients ("U" subnode)
  1. . ; in case of an error or crash during the initial registry
  1. . ;--- population (registry setup).
  1. . K:'$G(RORPARM("SETUP"))!(RC'<0) @RORUPDPI
  1. Q $S(RC<0:RC,1:0)