Interface

Access to vivarium simulation input data.

vivarium_inputs.interface.get_measure(entity, measure, location, years=None, data_type='draws')[source]

Pull GBD data for measure and entity and prep for simulation input.

Includes scrubbing all GBD conventions to replace IDs with meaningful values or ranges and expanding over all demographic dimensions.

To pull data using this function, please have at least 50GB of memory available.

Return type:

DataFrame

Parameters:
Available measures:
For entity kind ‘sequela’:

incidence_rate, prevalence, birth_prevalence, disability_weight

For entity kind ‘cause’:

incidence_rate, prevalence, birth_prevalence, disability_weight, remission_rate, cause_specific_mortality_rate, excess_mortality_rate

For entity kind ‘risk_factor’:

exposure, exposure_standard_deviation, exposure_distribution_weights, relative_risk, population_attributable_fraction, mediation_factors

For entity kind ‘etiology’:

population_attributable_fraction

For entity kind ‘alternative_risk_factor’:

exposure, exposure_standard_deviation, exposure_distribution_weights

For entity kind ‘covariate’:

estimate

Parameters:
  • entity (ModelableEntity) – Entity for which to pull measure.

  • measure (str) – Measure for which to pull data, should be a measure available for the kind of entity which entity is.

  • location (int | str | list[int | str]) – Location for which to pull data. This can be a location id as an int, the location name as a string, or a list of these two data types.

  • years (int | str | list[int] | None) – Years for which to extract data. If None, get most recent year. If ‘all’, get all available data. Defaults to None.

  • data_type (str | list[str]) – Data type for which to extract data. Supported values include ‘means’ for getting mean data and ‘draws’ for getting draw-level data. Can also be a list of values to get multiple data types. Defaults to ‘means’.

Returns:

Dataframe standardized to the format expected by vivarium simulations.

Return type:

DataFrame

vivarium_inputs.interface.get_population_structure(location, years=None)[source]

Pull GBD population data for the given location and standardize to the expected simulation input format, including scrubbing all GBD conventions to replace IDs with meaningful values or ranges and expanding over all demographic dimensions.

Return type:

DataFrame

Parameters:
  • location (int | str | list[int | str]) – Location for which to pull population data.

  • years (int | str | list[int] | None) – Years for which to extract data. If None, get most recent year. If ‘all’, get all available data. Defaults to None.

Returns:

Dataframe of population data for location, standardized to the format expected by vivarium simulations.

vivarium_inputs.interface.get_theoretical_minimum_risk_life_expectancy()[source]

Pull GBD theoretical minimum risk life expectancy data and standardize to the expected simulation input format, including binning age parameters as expected by simulations.

Return type:

DataFrame

Returns:

Dataframe of theoretical minimum risk life expectancy data, standardized to the format expected by vivarium simulations with binned age parameters.

vivarium_inputs.interface.get_age_bins()[source]

Pull GBD age bin data and standardize to the expected simulation input format.

Return type:

DataFrame

Returns:

Dataframe of age bin data, with bin start and end values as well as bin names.

vivarium_inputs.interface.get_demographic_dimensions(location, years=None)[source]

Pull the full demographic dimensions for GBD data, standardized to the expected simulation input format, including scrubbing all GBD conventions to replace IDs with meaningful values or ranges.

Return type:

DataFrame

Parameters:
  • location (int | str | list[int | str]) – Location for which to pull demographic dimension data.

  • years (int | str | list[int] | None) – Years for which to extract data. If None, get most recent year. If ‘all’, get all available data. Defaults to None.

Returns:

Dataframe with age and year bins from GBD, sexes, and the given location.

vivarium_inputs.interface.get_raw_data(entity, measure, location, years=None, data_type='means')[source]

Pull raw data from GBD for the requested entity, measure, and location.

Skip standard raw validation checks in order to return data that can be investigated for oddities. The only filter that occurs is by applicable measure id, metric id, or to most detailed causes where relevant.

Available measures: :rtype: Series | DataFrame

For entity kind ‘sequela’:

incidence_rate, prevalence, birth_prevalence, disability_weight

For entity kind ‘cause’:

incidence_rate, prevalence, birth_prevalence, disability_weight, remission_rate, deaths

For entity kind ‘risk_factor’:

exposure, exposure_standard_deviation, exposure_distribution_weights, relative_risk, population_attributable_fraction, mediation_factors

For entity kind ‘etiology’:

population_attributable_fraction

For entity kind ‘alternative_risk_factor’:

exposure, exposure_standard_deviation, exposure_distribution_weights

For entity kind ‘covariate’:

estimate

For entity kind ‘population’:

structure, theoretical_minimum_risk_life_expectancy

Parameters:
  • entity (ModelableEntity) – Entity for which to extract data.

  • measure (str) – Measure for which to extract data.

  • location (int | str | list[int | str]) – Location for which to extract data.

  • years (int | str | list[int] | None) – Years for which to extract data. If None, get most recent year. If ‘all’, get all available data. Defaults to None.

  • data_type (str | list[str]) – Data type for which to extract data. Supported values include ‘means’ for getting mean data and ‘draws’ for getting draw-level data. Can also be a list of values to get multiple data types. Defaults to ‘means’.

Returns:

Data for the entity-measure pair and specific location requested, with no formatting or reshaping.

Return type:

Series | DataFrame

vivarium_inputs.interface.get_lbwsg_birth_exposure(entity, location, years)[source]
Return type:

DataFrame

Parameters: