Defining a Monitoring Algorithm¶
Monitoring algorithms are the combination of three sub-algorithms :
- A Screening algorithm, that processes the available data and outputs description parameters of this data.
- A Triggering algorithm that analyses the description parameters and returns a binary decision, regarding the necessity to go verify the data in reported in a given reported.
- A Supervision algorithm, that describes the concrete implementation of the monitoring in the field.
The combination of these three elements uniquely define a monitoring strategy for a program. At each steps, the facility objects are updated to include the values of the supervision paraemters, and the result of the trigger algorithm.
The Screening algorithms input can be classified along two dimentsions :
- Longitudinal vs Transversal :
- Longitudinal data : Using only one facility, the algorithm considers the past validated values and infers the characteristics of the next expected values.
- Transversal data : Using a group of facilities, the algorithm compares the different facilities performances and their values.
- Simple reports vs Validation trail :
- Simple reports : The algorithm uses only the values previously validated in the facilities.
- Validation trails : The algorithm uses both the reported values and the validated values.
We need to specify these two dimensions when initiating the algorithm object, to orient the pre-processing of the data. The inputed data is then processed to form an appropriate training set that can be fed in the Screening algorithm.
-
class
monitoring_algorithms.algorithms_definition.
monitoring_algorithm
(algorithm_name, screening_method, alert_trigger, implementation_simulation=None, transversal=False, validation_trail=True, verbose=False)¶ Monitoring Algorithm objects
Parameters: algorithm_name : string
The name of the algorithm, to identify the output in the facility objects
screening_method : function
The Screening algorithm. More description on its characteristics in the function.
alert_trigger : function
The Triggering algorithm. More description on its characteristics in the function.
implementation_simulation : function
The Supervision algorithm. More description on its characteristics in the function.
transversal : boolean
True if the data is transveral, False if it is longitudinal. False by default.
validation_trail : boolean
True if the screening method uses a validation trail as input, False if it uses simple reports. False by default.
verbose : boolean
True if the user wants to have some monitoring prints in different parts of the functions.
Methods
make_training_set
make_transversal_TS
monitor
return_parameters
simulate_implementation
trigger_supervisions
-
make_training_set
(facility_data, mois)¶ Preparing the training set to be fed in the algorithm data processing routine. The processing varies depending if the algorithm uses longitudinal or transversal data. For the rest, it essentially takes all the data collected before the processing month and keeps the claimed or the verified data depending on the supervision status for the given month.
Parameters: facility_data : DataFrame
The data collected in the OpenRBF system. It does not need to be the subset of the data on which to fit algorithm for the observed month.
mois : The month for which the algorithm is fit.
-
monitor
(facility_data, mois, **kwargs)¶ Monitoring function
This function is the workhorse of the algorithm. It extracts the training set from the facility data, and performs the appropriate screening for the month indicated.
Parameters: facility_data : DataFrame
The data collected in the OpenRBF system. It does not need to be the subset of the data on which to fit algorithm for the observed month.
mois : The month for which the algorithm is fit.
**kwargs : Additional arguments necessary for the specific algorithm
-
simulate_implementation
(date_start, date_stop, data, **kwargs)¶ Simulates the implementation of the algorithm. Runs the data processing and triggering rules, and applies the supervision rule, then saves the supervision status of the reporting month for each facility.
Parameters: date_start : Start date of the simulation
date_stop : Finish date of the simulation
data : Full open rbf data formatted in facilities objects
**kwargs : Additional arguments necessary for the specific algorithm
-
trigger_supervisions
(mois, **kwargs)¶ Raising an alarm if the description parameters computed by the monitoring function are problematic according to the alert_trigger function.
Parameters: mois : The month for which the algorithm is fit.
**kwargs : Additional arguments necessary for the specific algorithm
-