Disease States
This module contains tools to manage standard disease states.
- class vivarium_public_health.disease.state.BaseDiseaseState(state_id, allow_self_transition=False, side_effect_function=None, cause_type='cause')[source]
- Parameters:
- property columns_created
Provides names of columns created by the component.
- Returns:
Names of the columns created by this component, or an empty list if none.
- Return type:
List[str]
- property columns_required: List[str] | None
Provides names of columns required by the component.
- Returns:
Names of required columns not created by this component. An empty list means all available columns are needed. None means no additional columns are necessary.
- Return type:
Optional[List[str]]
- property initialization_requirements: Dict[str, List[str]]
Provides the names of all values required by this component during simulant initialization.
- on_initialize_simulants(pop_data)[source]
Adds this state’s columns to the simulation state table.
- Parameters:
pop_data (SimulantData) –
- Return type:
None
- get_initialization_parameters()[source]
Exclude side effect function and cause type from name and __repr__.
- get_initial_event_times(pop_data)[source]
- Parameters:
pop_data (SimulantData) –
- Return type:
- transition_side_effect(index, event_time)[source]
Updates the simulation state and triggers any side effects associated with this state.
- Parameters:
index (Index) – An iterable of integer labels for the simulants.
event_time (pandas.Timestamp) – The time at which this transition occurs.
- Return type:
None
- add_rate_transition(output, get_data_functions=None, triggered=Trigger.NOT_TRIGGERED)[source]
Builds a RateTransition from this state to the given state.
- Parameters:
output (BaseDiseaseState) – The end state after the transition.
get_data_functions (Dict[str, Callable]) – map from transition type to the function to pull that transition’s data
triggered –
- Returns:
The created transition object.
- Return type:
- add_proportion_transition(output, get_data_functions=None, triggered=Trigger.NOT_TRIGGERED)[source]
Builds a ProportionTransition from this state to the given state.
- Parameters:
output (BaseDiseaseState) – The end state after the transition.
get_data_functions (Dict[str, Callable]) – map from transition type to the function to pull that transition’s data
- Returns:
The created transition object.
- Return type:
- add_dwell_time_transition(output, triggered=Trigger.NOT_TRIGGERED)[source]
- Parameters:
output (BaseDiseaseState) –
- Return type:
- class vivarium_public_health.disease.state.NonDiseasedState(state_id, allow_self_transition=False, side_effect_function=None, cause_type='cause', name_prefix='')[source]
- Parameters:
- add_rate_transition(output, get_data_functions=None, **kwargs)[source]
Builds a RateTransition from this state to the given state.
- Parameters:
output (BaseDiseaseState) – The end state after the transition.
get_data_functions (Dict[str, Callable]) – map from transition type to the function to pull that transition’s data
triggered –
- Returns:
The created transition object.
- Return type:
- class vivarium_public_health.disease.state.SusceptibleState(state_id, allow_self_transition=False, side_effect_function=None, cause_type='cause')[source]
- class vivarium_public_health.disease.state.RecoveredState(state_id, allow_self_transition=False, side_effect_function=None, cause_type='cause')[source]
- class vivarium_public_health.disease.state.DiseaseState(state_id, allow_self_transition=False, side_effect_function=None, cause_type='cause', get_data_functions=None, cleanup_function=None)[source]
State representing a disease in a state machine model.
- Parameters:
- setup(builder)[source]
Performs this component’s simulation setup.
- Parameters:
builder (engine.Builder) – Interface to several simulation tools.
- Return type:
None
- get_prevalence(builder, prevalence_data)[source]
Builds a LookupTable for the prevalence of this state.
- Parameters:
- Returns:
The LookupTable for the prevalence of this state.
- Return type:
LookupTable
- get_birth_prevalence(builder, birth_prevalence_data)[source]
Builds a LookupTable for the birth prevalence of this state.
- Parameters:
- Returns:
The LookupTable for the birth prevalence of this state.
- Return type:
LookupTable
- get_base_disability_weight(builder, disability_weight_data)[source]
Builds a LookupTable for the base disability weight of this state.
- Parameters:
- Returns:
The LookupTable for the disability weight of this state.
- Return type:
LookupTable
- get_base_excess_mortality_rate(builder, excess_mortality_data)[source]
Builds a LookupTable for the base excess mortality rate of this state.
- Parameters:
- Returns:
The LookupTable for the base excess mortality rate of this state.
- Return type:
LookupTable
- add_rate_transition(output, get_data_functions=None, **kwargs)[source]
Builds a RateTransition from this state to the given state.
- Parameters:
output (BaseDiseaseState) – The end state after the transition.
get_data_functions (Dict[str, Callable]) – map from transition type to the function to pull that transition’s data
triggered –
- Returns:
The created transition object.
- Return type:
- add_dwell_time_transition(output, **kwargs)[source]
- Parameters:
output (BaseDiseaseState) –
- Return type:
- next_state(index, event_time, population_view)[source]
Moves a population among different disease states.
- Parameters:
index (Index) – An iterable of integer labels for the simulants.
event_time (Timestamp) – The time at which this transition occurs.
population_view (PopulationView) – A view of the internal state of the simulation.
- Return type:
None
- compute_disability_weight(index)[source]
Gets the disability weight associated with this state.
- Parameters:
index (Index) – An iterable of integer labels for the simulants.
- Returns:
An iterable of disability weights indexed by the provided index.
- Return type:
pandas.Series
- adjust_mortality_rate(index, rates_df)[source]
Modifies the baseline mortality rate for a simulant if they are in this state.
- get_initial_event_times(pop_data)[source]
- Parameters:
pop_data (SimulantData) –
- Return type: