Disability Observers

This module contains tools for observing years lived with disability (YLDs) in the simulation.

class vivarium_public_health.results.disability.DisabilityObserver[source]

Count years lived with disability.

By default, this counts both aggregate and cause-specific years lived with disability over the full course of the simulation.

In the model specification, your configuration for this component should be specified as, e.g.:

configuration:
    stratification:
        disability:
            exclude:
                - "sex"
            include:
                - "sample_stratification"
step_size

The time step size of the simulation.

disability_weight

The pipeline that produces disability weights.

causes_of_disability

The causes of disability to be observed.

property disability_classes: list[type]

The classes to be considered as causes of disability.

setup(builder)[source]

Set up the observer.

Return type:

None

Parameters:

builder (Builder)

set_causes_of_disability(builder)[source]

Set the causes of disability to be observed.

The causes to be observed are any registered components of class types found in the disability_classes property excluding any listed in the model spec as excluded_categories.

Return type:

None

Parameters:

builder (Builder)

Notes

We implement exclusions here instead of during the stratification call like most other categories because disabilities are unique in that they are not actually registered stratifications.

Also note that we add an ‘all_causes’ category here.

register_observations(builder)[source]

Register an observation for years lived with disability.

Return type:

None

Parameters:

builder (Builder)

disability_weight_aggregator(dw)[source]

Aggregate disability weights for the time step.

Parameters:

dw (DataFrame) – The disability weights to aggregate.

Return type:

float | Series

Returns:

The aggregated disability weights.

format(measure, results)[source]

Format wide YLD results to match typical/long stratified results.

YLDs are unique in that we can’t stratify by cause of disability (because there can be multiple at once), and so the results here are actually wide by disability weight pipeline name. This method formats the results to be long by cause of disability.

Parameters:
  • measure (str) – The measure.

  • results (DataFrame) – The wide results to format.

Return type:

DataFrame

Returns:

The results stacked by causes of disability.

Notes

This method also adds the ‘sub_entity’ column to the results.

get_entity_type_column(measure, results)[source]

Get the ‘entity_type’ column values.

Return type:

Series

Parameters:
  • measure (str)

  • results (DataFrame)

get_entity_column(measure, results)[source]

Get the ‘entity’ column values.

Return type:

Series

Parameters:
  • measure (str)

  • results (DataFrame)

get_sub_entity_column(measure, results)[source]

Get the ‘sub_entity’ column values.

Return type:

Series

Parameters:
  • measure (str)

  • results (DataFrame)