Intervention Scripts

Scripts for testing and running various TB intervention scenarios.

scripts.interventions.run_tb_interventions.build_sim(scenario=None, spars=None)[source]

Build and return a complete Starsim-based simulation instance for TB modeling, incorporating optional interventions and user-defined parameters.

Parameters:
  • scenario (dict, optional) –

    A dictionary defining scenario-specific components, such as intervention parameters and TB simulation settings. Expected keys:

    • ’tbpars’ (dict): TB-specific simulation parameters.

    • ’tptintervention’ (dict, optional): Parameters for TPT intervention.

    • ’bcgintervention’ (dict, optional): Parameters for BCG intervention.

  • spars (dict, optional) – General simulation parameters (e.g., timestep, duration). These override values in the DEFAULT_SPARS global dictionary.

Returns:

A fully initialized simulation object containing:
  • A population (People) with TB-related extra states.

  • A TB disease module initialized with merged parameters.

  • A list of social and household network layers.

  • Optional interventions (TPT, BCG or Beta) as defined by the scenario.

  • Demographic processes like births and deaths.

  • Core simulation parameters merged from defaults and user inputs.

Return type:

ss.Sim

Notes

  • If no parameters are provided, it will use the default values of the participating simulation components.

Example

sim = build_sim(scenario=my_scenario, spars={‘n_steps’: 200}) sim.run()

scripts.interventions.run_tb_interventions.get_scenarios()[source]

HELP Define a set of simulation scenarios for evaluating TB interventions.

Returns:

A dictionary where each key is the name of a scenario and the value is a dictionary of simulation parameters. Each scenario may include:

  • ’name’ (str): A human-readable scenario name.

  • ’tbpars’ (dict, optional): Parameters controlling the simulation timeframe.

  • ’bcgintervention’ (dict, optional): BCG vaccine intervention settings.

  • ’tptintervention’ (dict, optional): Tuberculosis Preventive Therapy settings.

  • ’betabyyear’ : (dict, optional): For changing the value of beta during the same simulation period.

Return type:

dict

Scenarios included:
  • ‘Baseline’: No intervention, default simulation window.

  • ‘BCG’: BCG vaccination with 90% coverage.

  • ‘TPT’: TPT with full eligibility, conditional on HIV status.

scripts.interventions.run_tb_interventions.run_scenarios(plot=True)[source]

Run all scenarios and optionally plot results.