Utilities
This module contains utility functions for the placeholder components.
- vivarium_public_health.causal_factor.utilities.pivot_categorical(data, pivot_column='parameter', reset_index=True)[source]
Pivots data that is long on categories to be wide.
- vivarium_public_health.causal_factor.utilities.get_exposure_post_processor(builder, risk)[source]
Build a post-processor that bins continuous exposure into categories.
If category thresholds are configured, return a callable that bins exposure values using
pd.cut. Otherwise, return an empty list (no post-processing).- Parameters:
builder – Access point for utilizing framework interfaces during setup.
risk (
str) – The name of the risk in the configuration.
- Returns:
A callable post-processor or an empty list.
- vivarium_public_health.causal_factor.utilities.load_exposure_data(builder, risk)[source]
Load exposure data for a risk from its configured data source.
- Parameters:
builder (
Builder) – Access point for utilizing framework interfaces during setup.risk (
EntityString) – The entity string identifying the risk.
- Return type:
DataFrame- Returns:
The exposure data as a DataFrame.