Modify reports
Reports are output (files) generated by EMOD. There are multiple built-in EMOD reports that are configured by Python code as well as the ability to create custom reports for a project.
Overview
Reports are specified as Python code in a country model or a frame that builds from one. Reports that are frequently
used and/or infrequently modified for a given country model are often located in it. Project-specific reports or
custom configurations of common reports are typically located in the config.py file in a frame.
Important
The more data items and/or stratification levels a report is configured to capture the larger the files generated. Keep reporting configurations as minimal as useful for a project to avoid massive files that are difficult to process.
Prerequisites
This tutorial requires you to have done the following:
Modify an existing report configuration
Here we demonstrate overriding the existing configuration of a report in a project frame that utilizes the ZambiaForTraining country model.
The ZambiaForTraining country model class exists in: emodpy_hiv/countries/zambia.py. The following snippet from the
ZambiaForTraining country model (it inherits from class Zambia above it) indicates its default specification of the
InsetChart report:
If we wish to override this behavior in a project frame without modifying the country model we will need to override
it in our frame. Reports are specified as part of the EMOD config file, so we edit the frame file:config.py. This
file typically contains (at minimum) the following function definition ready for us to use:
Important
Each report can only have at most ONE configuration. Duplicative configurations will generate an error.
First, remove the existing report that you do not want. Then we add a new definition of the report to replace it. For example, if you want to add information about pregnancies and potential mothers in the model, copy/paste the InsetChart definition from the ZambiaForTraining country model (again, it inherits this from class Zambia, above it) and modify the appropriate parameter (include_pregnancies=True) (labeled below with NEW CODE):
Future executions of EMOD using this frame will now generate an InsetChart.json output file containing pregnancy
related data.
Run EMOD
Plot InsetChart.json
Example result with pregnancy related information:

Adding a new report configuration
Suppose we now want to add a project-specific report (ReportRelationshipEnd) that is not already included in the
ZambiaForTraining country model or our frame config.py. We will need to add the report in the build_reports
function in our frame. Building on the prior example, we edit the frame config`.py like so (labeled below with
NEW CODE):
Future executions of EMOD using this frame will now generate an output/RelationshipEnd.csv output file containing
information regarding the end of modeled relationships.
Run EMOD
The result will look something like this sample: