Simple Intervention Models
This module contains simple intervention models that work at the population level by providing direct shifts to epidemiological measures.
- class vivarium_public_health.treatment.magic_wand.AbsoluteShift(target)[source]
Apply an absolute shift to a target epidemiological measure.
This component registers a value modifier on the target pipeline that replaces the current value with a configured absolute value for simulants within a specified age range. When the configured
target_valueis"baseline", no modification is applied.The target measure is specified at instantiation as a
TargetStringof the form"entity.measure"(e.g."cause.incidence_rate").- Parameters:
target (str)
- CONFIGURATION_DEFAULTS: dict[str, Any] = {'intervention': {'age_end': 125, 'age_start': 0, 'target_value': 'baseline'}}
A dictionary containing the defaults for any configurations managed by this component. An empty dictionary indicates no managed configurations. Components will look for a
data_sourcesblock in this dictionary to build lookup tables automatically.
- property configuration_defaults: dict[str, Any]
Provides default configuration values for this intervention.
Configuration structure:
intervention_on_{target_name}: target_value: str or float Value to set for the target measure. Use ``"baseline"`` to apply no intervention effect, or a numeric value to set an absolute value for the measure. Default is ``"baseline"`` (no effect). age_start: float Minimum age (in years) for the intervention to apply. Simulants below this age are unaffected. Default is 0. age_end: float Maximum age (in years) for the intervention to apply. Simulants above this age are unaffected. Default is 125.
- intervention_effect(index, value)[source]
Apply the configured absolute shift to the target measure.
Replace the value for simulants within the configured age range with the configured
target_value. Iftarget_valueis"baseline", return the value unmodified.- Parameters:
index (
Index) – Index of the simulants to consider.value (
Series) – Current values of the target measure for the given simulants.
- Return type:
Series- Returns:
The modified target measure values.