Event Reports

⚠️ How-To: report on broadcast events that occur during simulations

EMOD is capable of tracking a variety of built-in events as well as custom campaign events. Custom events can be particularly useful for explicitly tracking and counting the number of interventions distributed. For example, in the simple SMC intervention (see add drug campaigns how to) we defined an event called 'Received_SMC' to describe children who actually received SMC drugs in the simulation. The add_treatment_seeking function automatically generates a 'Received_Treatment' event for each individual receiving treatment for symptomatic malaria. Adding custom events to the config parameter 'Custom_Individual_Events' is automatically handled by emodpy during campaign creation.

Aggregate Events - ReportEventCounter

To track how many events are occurring each day, request ReportEventCounter with add_report_event_counter() and specify the list of events you would like to track, in this case receiving either of the two above drug-based interventions:

from emodpy_malaria.reporters.builtin import *

sim_years = 5
add_report_event_counter(task, manifest, start_day=365, end_day=sim_years*365,
                             event_trigger_list=['Received_SMC', 'Received_Treatment'],
                             filename_suffix="drug_interventions")

This generates a ReportEventCounter.json file that reports that total number of the specified events in each day of the simulation. Reporting a subset of node IDs (node_ids), restricting on age (min_age_years, max_age_years), and restricting on individual property (must_have_ip_key_value) are all configurable. The format of the .json is identical to InsetChart.json, so analyzers written for InsetChart.json can be easily adapted for ReportEventCounter.

Individual Events - ReportEventRecorder

Sometimes you may want to track individual-level events. To do so, we use add_event_recorder() to call the ReportEventRecorder, which is similar to ReportEventCounter but lists each event as it occurs and provides information about the person experiencing the event. The calls for these two reports are quite similar but the recorder uses event_list rather than event_trigger_list and has no filename_suffix:

from emodpy_malaria.reporters.builtin import *

sim_years = 5
add_event_recorder(task, start_day=365, end_day=sim_years*365,
                       event_list=['Received_SMC', 'Received_Treatment'],
                       node_ids=[1], min_age_years=0,
                       max_age_years=100)

Note: If you want to return all events from the simulation, leave the “events” array empty and set only_include_events_in_list to False.

After running, a file called ReportEventRecorder.csv will be generated in the output/ folder for the simulation. Each row of the report represents a distinct event, with the following information in its columns:

Event Details: - Time (when did event occur) - Node_ID (where did event occur) - Event_Name (what happened)

Individual Details (who did it happen to?): - Individual_ID - Age - Gender - Infected (1 = True) - Infectiousness - RelativeBitingRate - TrueParasiteDensity - TrueGametocyteDensity - HasClinicalSymptoms

Plus an additional column for the value of any IPs requested through ips_to_record.

You can include additional customization following the documentation