-
Notifications
You must be signed in to change notification settings - Fork 0
03. Health Conditions
This page describes how health conditions (HCs) are defined, parameterized, and simulated in the MIGHTI framework.
MIGHTI supports both infectious and noncommunicable diseases, with flexible modeling capabilities for acquisition, progression, remission, and mortality.
Health conditions in MIGHTI inherit from Starsim's disease base classes and fall into the following categories:
- RemittingDisease: Used for conditions that can spontaneously resolve or remit (e.g., depression, alcohol use disorder)
- ChronicDisease: Used for lifelong conditions without natural remission (e.g., chronic kidney disease, diabetes type 1)
- AcuteDisease: Used for short-term conditions (e.g., road injuries, interpersonal violence)
- AcuteSurgicalDisease: Used for acute conditions that can be surgically treated (e.g., congenital heart anomalies, digestive congenital anomalies)
- GenericSIS: For infections with repeated acquisition and recovery (e.g., Flu)
- GenericSIR: For infections with acquisition, recovery, and immunity (e.g., Diarrheal Disease)
- NonAcquiredDisease: Used for conditions present at birth or acquired at birth (e.g., neonatal sepsis, congenital anomalies)
- StaticCondition: Used for conditions that are present at birth and do not change (e.g., Down syndrome, chromosomal abnormalities)
All health condition modules are located in:
mighti/diseases/Each condition has its own file (e.g., type2diabetes.py, chronickidneydisease.py, flu.py).
Each class inherits from a Starsim disease base and implements:
-
__init__()constructor with parameter loading - Methods to define disease acquisition, mortality, remission, and condition progression
Each disease reads parameters from a central CSV file (e.g., eswatini_parameters.csv):
Key fields include:
-
condition: Name of the disease (e.g., Type2Diabetes) -
p_death: Annual conditional probability of death (if untreated) -
dur_condition: Average duration of disease in years -
rel_sus: Relative susceptibility if comorbid with HIV -
remission_rate: Probability of spontaneous remission -
disease_class: Class to use (ChronicDisease,RemittingDisease, etc.)
Some modeled conditions are treated as non-fatal states (they do not directly cause deaths in the simulation). For these conditions, p_death is set to 0 in the parameter file to avoid double-counting mortality and to prevent missing values from falling back to a nonzero default during parameter loading.
Current list:
AnxietyDisorderBipolarDisorderChronicPainHyperlipidemiaHypertensionObesityTobaccoUse
Parameters are loaded using:
self.pars = get_disease_parameters(csv_path, disease_name)Disease modules are added in your script like this:
cls = getattr(mi, dis, None)
if cls is not None:
disease_objects.append(cls(csv_path=csv_path_params, pars={"init_prev": ss.bernoulli(get_prev_fn(dis))}))Each disease will:
- Initialize agents with prevalence (by age/sex or fixed)
- Track individual state (e.g., affected, cured, dead)
- Be eligible for interventions or interactions
Many diseases support a severity system that tracks disease severity levels (e.g., mild, moderate, severe). This can be enabled or disabled per disease:
# Disable severity for a disease
disease_obj = mi.Type2Diabetes(
csv_path=csv_path_params,
pars={"init_prev": init_prev, "enable_severity": False}
)
# Enable severity (default if severity data exists)
disease_obj = mi.Type2Diabetes(
csv_path=csv_path_params,
pars={"init_prev": init_prev, "enable_severity": True}
)When severity is enabled, the disease tracks a severity_level state variable and uses severity-specific disability weights and mortality multipliers. See SEVERITY_TOGGLE_USAGE.md for more details.
Each module can define:
-
update(): What happens each timestep (e.g., disease progression, mortality) -
calculate_p_acquire(): Acquisition probability (baseline or modulated by risk) -
update_mortality(): If the disease contributes to death -
update_remission(): If remission is possible
These follow the Starsim framework and are invoked automatically in the simulation loop.
To add a new disease:
- Create a new Python file in
mighti/diseases/ - Inherit from one of the base classes
- Define
__init__()and relevant update methods - Add parameter row in the CSV
- Add the condition name to your script and prevalence file
Example:
class MyDisease(ChronicDisease):
def __init__(self, csv_path=None, pars=None):
super().__init__()
self.load_parameters(csv_path, 'MyDisease')- mighti/diseases/base_disease.py: Base disease classes
- mighti/diseases/*.py: One file per disease
- mighti/data/eswatini_parameters.csv: Parameter file