Core Intervention Functionality¶
This module provides the core intervention infrastructure and base classes for TBsim interventions.
Main Interventions Module¶
- class tbsim.interventions.interventions.Product(name, efficacy, doses)[source]¶
Bases:
Module
Class to define a vaccine product with specific attributes.
- class tbsim.interventions.interventions.TBVaccinationCampaign(year=1900, product=None, rate=.015, target_gender='All', target_age=10, target_state=None, new_value_fraction=1, prob=None, *args, **kwargs)[source]¶
Bases:
Intervention
Base class for any intervention that uses campaign delivery; handles interpolation of input years.
- __init__(year=1900, product=None, rate=.015, target_gender='All', target_age=10, target_state=None, new_value_fraction=1, prob=None, *args, **kwargs)[source]¶
Available Classes¶
- BaseIntervention
Base class for all TBsim interventions
- InterventionManager
Central manager for coordinating multiple interventions
Key Features¶
Base Classes: Common functionality for all interventions
Intervention Management: Coordinate multiple intervention types
Standardized Interface: Consistent API across interventions
Integration Support: Easy integration with TB and comorbidity models
Extensibility: Framework for custom intervention development
Usage Examples¶
Creating custom interventions:
from tbsim.interventions.interventions import BaseIntervention
class CustomIntervention(BaseIntervention):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Custom initialization
def step(self):
# Custom intervention logic
pass
Using intervention manager:
from tbsim.interventions.interventions import InterventionManager
# Create manager for multiple interventions
manager = InterventionManager()
# Add interventions
manager.add_intervention(bcg)
manager.add_intervention(tpt)
manager.add_intervention(treatment)
Key Methods¶
- BaseIntervention
__init__(): Initialize intervention parameters
step(): Execute intervention logic each time step
init_results(): Initialize result tracking
update_results(): Update results during simulation
- InterventionManager
add_intervention(): Register new intervention
remove_intervention(): Remove intervention
get_interventions(): List all active interventions
step_all(): Execute all interventions
Intervention Lifecycle¶
Initialization: Set up parameters and state
Registration: Add to simulation framework
Execution: Run intervention logic each time step
Tracking: Monitor intervention effects and outcomes
Analysis: Evaluate intervention impact and effectiveness
For specific intervention types, see the individual intervention modules above.