tlo.methods.healthburden module

This Module runs the counting of Life-years Lost, Life-years Lived with Disability, and Disability-Adjusted Life-years (DALYS).

class HealthBurden(name=None, resourcefilepath=None)[source]

This module holds all the stuff to do with recording DALYS

Bases: tlo.core.Module

PARAMETERS:

Item

Type

Description

DALY_Weight_Database

DATA_FRAME

DALY Weight Database from GBD

Age_Limit_For_YLL

REAL

The age up to which deaths are recorded as having induced a lost of life years

gbd_causes_of_disability

LIST

List of the strings of causes of disability defined in the GBD data

Class attributes:

ADDITIONAL_DEPENDENCIES : {‘Lifestyle’}

INIT_DEPENDENCIES : {‘Demography’}

METADATA : {}

Functions (defined or overridden in class HealthBurden):

__init__(name=None, resourcefilepath=None)[source]

Construct a new disease module ready to be included in a simulation.

Initialises an empty parameters dictionary and module-specific random number generator.

Parameters:

name – the name to use for this module. Defaults to the concrete subclass’ name.

read_parameters(data_folder)[source]

Read parameter values from file, if required.

Must be implemented by subclasses.

Parameters:

data_folder – path of a folder supplied to the Simulation containing data files. Typically, modules would read a particular file within here.

initialise_population(population)[source]

Set our property values for the initial population.

Must be implemented by subclasses.

This method is called by the simulation when creating the initial population, and is responsible for assigning initial values, for every individual, of those properties ‘owned’ by this module, i.e. those declared in its PROPERTIES dictionary.

TODO: We probably need to declare somehow which properties we ‘read’ here, so the simulation knows what order to initialise modules in!

Parameters:

population – the population of individuals

initialise_simulation(sim)[source]

Do before simulation starts: 1) Prepare data storage structures 2) Collect the module that will use this HealthBurden module 3) Process the declarations of causes of disability made by the disease modules 4) Launch the DALY Logger to run every month, starting with the end of the first month of simulation 5) Schedule Healthburden_WriteToLog that will write to log annually (end of each year)

process_causes_of_disability()[source]
  1. Collect causes of disability that are reported by each disease module

2) Define the “Other” tlo_cause of disability (corresponding to those gbd_causes that are not represented by the disease modules in this sim.) 3) Output to the log mappers for causes of disability to the label

process_causes_of_dalys()[source]
  1. Collect causes of DALYS (i.e., death _and_ disability) that are reported by each disease module

2) Define the “Other” tlo_cause of DALYS (corresponding to those gbd_causes that are not represented by the disease modules in this sim.) 3) Output to the log mappers for causes of disability to the label

on_birth(mother_id, child_id)[source]

Initialise our properties for a newborn individual.

Must be implemented by subclasses.

This is called by the simulation whenever a new person is born.

Parameters:
  • mother_id – the person id for the mother of this child (can be -1 if the mother is not identified).

  • child_id – the person id of new child

on_simulation_end()[source]

Write to the log anything that has not already been logged (i.e., if simulation terminating mid-way through a year when the WriteToLog event has not run.

get_dalys(yld: DataFrame, yll: DataFrame) DataFrame[source]

Returns pd.DataFrame of DALYS that is the sum of the ‘Years Lived with Disability’ (yld) and the ‘Years of Life Lost’ (yll), under their common ‘labels’. (i.e. multiple causes of yld and of yll may occur on the same labels, and these labels unite the causes across yll and yld.)

get_daly_weight(sequlae_code)[source]

This can be used to look up the DALY weight for a particular condition identified by the ‘sequela code’ Sequela code for particular conditions can be looked-up in ResourceFile_DALY_Weights.csv :param sequela_code: :return: the daly weight associated with that sequela code

report_live_years_lost(sex=None, wealth=None, date_of_birth=None, age_range=None, cause_of_death=None)[source]

Calculate and store the period for which there is ‘years of lost life’ when someone dies (assuming that the person has died on today’s date in the simulation). :param sex: sex of the person that had died :param wealth: the value ‘li_wealth’ for the person at the time of death :param date_of_birth: date_of_birth of the person that has died :param age_range: The age-range for the person at the time of death :param cause_of_death: title for the column in YLL dataframe (of form <ModuleName>_<Cause>)

decompose_yll_by_age_and_time(start_date, end_date, date_of_birth)[source]

This helper function will decompose a period of years of lost life into time-spent in each age group in each calendar year :return: a dataframe (X) of the person-time (in years) spent by age-group and time-period

write_to_log(year: int)[source]

Write to the log the YLL, YLD and DALYS for a specific year. N.B. This is called at the end of the simulation as well as at the end of each year, so we need to check that the year is not being written to the log more than once.

check_multi_index()[source]

Check that the multi-index of the dataframes are as expected

class Get_Current_DALYS(module)[source]

This event runs every months and asks each disease module to report the average disability weight for each living person during the previous month. It reconciles this with reports from other disease modules to ensure that no person has a total weight greater than one. A known (small) limitation of this is that persons who died during the previous month do not contribute any YLD.

Bases: tlo.events.RegularEvent, tlo.events.Event, tlo.events.PopulationScopeEventMixin

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class Get_Current_DALYS):

__init__(module)[source]

Create a new regular event.

Parameters:
  • module – the module that created this event

  • frequency (pandas.tseries.offsets.DateOffset) – the interval from one occurrence to the next (must be supplied as a keyword argument)

apply(population)[source]

Apply this event to the given target.

This is a no-op; subclasses should override this method.

Parameters:

target – the target of the event

class Healthburden_WriteToLog(module)[source]

This event runs every year, as the last event on the last day of the year, and writes to the log the YLD, YLL and DALYS accrued in that year.

Bases: tlo.events.RegularEvent, tlo.events.Event, tlo.events.PopulationScopeEventMixin

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class Healthburden_WriteToLog):

__init__(module)[source]

Create a new regular event.

Parameters:
  • module – the module that created this event

  • frequency (pandas.tseries.offsets.DateOffset) – the interval from one occurrence to the next (must be supplied as a keyword argument)

apply(population)[source]

Apply this event to the given target.

This is a no-op; subclasses should override this method.

Parameters:

target – the target of the event