Modify campaign: Add HIV vaccine
Prerequisites
Before starting this tutorial, please complete the following:
- Create project tutorial to create a new project with a baseline frame.
- Run EMOD tutorial to understand how to run simulations and plot results with baseline frame.
- Modify Campaign: Minimal Campaign to understand the basics of campaign structure, including the cascade of care (CoC).
Modify the campaign inside a frame directly
You may want to simulate a change in outcomes (like introducing a vaccine) without modeling every step in the
delivery system. The easiest and most direct way to do this is to modify the campaign.py inside a frame directly.
Please follow the steps below to add a vaccine to campaign.
a. Extend frame
Let's extend the baseline frame to create a new frame called vaccine:
b. Add HIV vaccine directly
Modify campaign.py under my_project/frames/vaccine folder to include a function that
adds a vaccine intervention. This tutorial adds:
- Add a ControlledVaccine with a constant WaningConfig.
- Set initial efficacy = 1.0 as default.
- Distribute the vaccine when the person sexually debuts - on the
STIDebutevent. - Start listening and distributing the vaccine on January 1st, 2026.
- Make initial efficacy a hyperparameter of the method.
Here is an example of how to implement this: (add the following import lines and function to campaign.py)
In the same campaign.py file, update the get_campaign_parameterized_calls function by adding a call to
add_hiv_vaccine (see line 4 in the code snippet below). Insert the new ParameterizedCall after the existing
calls (see line 5). This makes vaccine_efficacy a hyperparameter that can be modified when running the simulation:
c. Check hyperparameter
You can check that the vaccine_efficacy is now an available hyperparameter in campaign.py by running:
You should see vaccine_efficacy listed under Campaign parameters.

d. Run EMOD
Now you can run EMOD with the new vaccine frame:
Please see the run EMOD tutorial for more details on this command.
e. Plot InsetChart
After running the simulation, you can examine the results by plotting the InsetChart to compare the vaccine frame with the baseline.
-
Download the InsetChart to the
results/vaccinedirectory: -
Plot InsetChart and compare with baseline:
After plotting, you should see prevalence drops but costs go up after year 2026 when the vaccine is introduced. The red line is the baseline and the blue line is the vaccine frame.
Visualize results:

f. Plot ReportHIVByAgeAndGender
You can plot ReportHIVByAgeAndGender so you can look at infection count across age groups.
-
Download the ReportHIVByAgeAndGender to the
results/vaccinedirectory: -
Visualize infection counts across age groups:
Here is an example of what you might see in the ReportHIVByAgeAndGender for vaccine frame:

Next steps
You have successfully added an HIV vaccine to the campaign inside a frame directly. You can further explore the
following options:
- Experiment with different vaccine efficacies by modifying the vaccine_efficacy hyperparameter when running the
simulation. Please see the Sweep Parameter tutorial for more details.
- Learn how to update the campaign by modifying the CountryModel in the Modify Campaign: Modify Country Model tutorial.