Results Stratifier

This module contains tools for stratifying observed quantities by specified characteristics through the vivarium results interface.

class vivarium_public_health.results.stratification.ResultsStratifier[source]

A component for registering common public health stratifications.

The purpose of this component is to encapsulate all common public health stratification registrations in one place. This is not enforced, however, and stratification registrations can be done in any component.

age_bins

The age bins for stratifying by age.

start_year

The start year of the simulation.

end_year

The end year of the simulation.

setup(builder)[source]

Set up the stratifier.

Define age bins and simulation years and register default stratifications.

Return type:

None

Parameters:

builder (Builder)

register_stratifications(builder)[source]

Register stratifications for the simulation.

Return type:

None

Parameters:

builder (Builder)

map_age_groups(pop)[source]

Map age with age group name strings.

Parameters:

pop (DataFrame) – A table with one column, an age to be mapped to an age group name string.

Return type:

Series

Returns:

The age group name strings corresponding to the pop passed into the function.

static map_year(pop)[source]

Map datetime with year.

Parameters:

pop (DataFrame) – A table with one column, a datetime to be mapped to year.

Return type:

Series

Returns:

The years corresponding to the pop passed into the function.

static get_age_bins(builder)[source]

Get the age bins for stratifying by age.

Parameters:

builder (Builder) – The builder object for the simulation.

Return type:

DataFrame

Returns:

The age bins for stratifying by age.