tlo.methods.copd module

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

The module responsible for determining Chronic Obstructive Pulmonary Diseases (COPD) status and outcomes. and initialises parameters and properties associated with COPD plus functions and events related to COPD.

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.

Bases: tlo.core.Module, tlo.methods.hsi_generic_first_appts.GenericFirstAppointmentsMixin

PARAMETERS:

Item

Type

Description

prob_mod_exacerb

LIST

probability of moderate exacerbation given lung function, for each lung function category.

prob_sev_exacerb

LIST

probability of severe exacerbation given lung function, for each lung function category.

prob_progress_to_next_cat

REAL

probability of changing from a lower lung function category to a higher lung function category

prob_will_die_sev_exacerbation_ge80

REAL

probability that a person equal to or greater than 80 years will die of severe exacerbation

prob_will_die_sev_exacerbation_7079

REAL

probability that a person between 70 to 79 years will die of severe exacerbation

prob_will_die_sev_exacerbation_6069

REAL

probability that a person between 60 to 99 years will die of severe exacerbation

prob_will_die_sev_exacerbation_5059

REAL

probability that a person between 50 to 59 years will die of severe exacerbation

prob_will_die_sev_exacerbation_4049

REAL

probability that a person between 40 to 49 years will die of severe exacerbation

prob_will_die_sev_exacerbation_3039

REAL

probability that a person between 30 to 39 years will die of severe exacerbation

prob_will_die_sev_exacerbation_lt30

REAL

probability that a person less than 30 years will die of severe exacerbation

eff_oxygen

REAL

the effect of oxygen on individuals with severe exacerbation

rel_risk_progress_per_higher_cat

REAL

relative risk of progression to the next higher level of lung function for each higher level

rel_risk_tob

REAL

relative effect of tobacco on the rate of lung function progression

rel_risk_wood_burn_stove

REAL

relative risk of wood burn stove on the rate of lung function progression

prob_not_tob_lung_func_15_39

LIST

probability of lung function categories in individuals aged 15-39 and do not smoke tobacco

prob_not_tob_lung_func_40_59

LIST

probability of lung function categories in individuals aged 40-59 and do not smoke tobacco

prob_not_tob_lung_func_gr59

LIST

probability of lung function categories in individuals aged 60+ and do not smoke tobacco

prob_tob_lung_func_15_39

LIST

probability of lung function categories in individuals aged 15-39 who smoke tobacco

prob_tob_lung_func_40_59

LIST

probability of lung function categories in individuals aged 40-59 who smoke tobacco

prob_tob_lung_func_gr59

LIST

probability of lung function categories in individuals aged 60+ who smoke tobacco

PROPERTIES:

Item

Type

Description

ch_lungfunction

CATEGORICAL

Lung function of the person.0 for those under 15; on a 7-point scale for others, from 0 (Perfect) to 6 (End-Stage COPD).. Possible values are: [0, 1, 2, 3, 4, 5, 6, ]

ch_will_die_this_episode

BOOL

Whether this person will die during a current severe exacerbation

ch_has_inhaler

BOOL

Whether the person is currently using an inhaler

Class attributes:

ADDITIONAL_DEPENDENCIES : set()

CAUSES_OF_DEATH : {‘COPD_cat0’: <tlo.methods.causes.Cause object at 0x128ae28d0>, ‘COPD_cat1’: <tlo.methods.causes.Cause object at 0x128ae2fd0>, ‘COPD_cat2’: <tlo.methods.causes.Cause object at 0x128ae2050>, ‘COPD_cat3’: <tlo.methods.causes.Cause object at 0x128ae3550>, ‘COPD_cat4’: <tlo.methods.causes.Cause object at 0x11809a250>, ‘COPD_cat5’: <tlo.methods.causes.Cause object at 0x1289c0410>, ‘COPD_cat6’: <tlo.methods.causes.Cause object at 0x1289c1850>}

CAUSES_OF_DISABILITY : {‘COPD’: <tlo.methods.causes.Cause object at 0x1289c07d0>}

INIT_DEPENDENCIES : {‘Lifestyle’, ‘SymptomManager’, ‘HealthSystem’}

METADATA : {<Metadata.USES_HEALTHSYSTEM: 3>, <Metadata.USES_SYMPTOMMANAGER: 2>, <Metadata.USES_HEALTHBURDEN: 4>, <Metadata.DISEASE_MODULE: 1>}

__annotations__ : {}

Functions (defined or overridden in class Copd):

__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 all parameters and define symptoms (if any)

pre_initialise_population()[source]

Things to do before processing the population: * Generate the models

initialise_population(population)[source]

Set initial values of properties values for all individuals

initialise_simulation(sim)[source]

Get ready for simulation start: * Schedule the main polling event * Look-up item codes for consumables

on_birth(mother_id, child_id)[source]

Initialise COPD properties for a newborn individual.

report_daly_values()[source]

Return disability weight for alive persons, based on the current status of ch_lungfunction.

define_symptoms()[source]

Define and register Symptoms

lookup_item_codes()[source]

Look-up the item-codes for the consumables needed in the HSI Events for this module.

do_logging()[source]

Log current states.

_common_first_appt(person_id: int, individual_properties: IndividualProperties, symptoms: List[str], schedule_hsi_event: HSIEventScheduler, consumables_checker: ConsumablesChecker)[source]

What to do when a person presents at the generic first appt HSI with a symptom of breathless_severe or breathless_moderate. * If severe –> give the inhaler and schedule the HSI for Treatment * Otherwise –> just give inhaler.

do_at_generic_first_appt(person_id: int, individual_properties: IndividualProperties, symptoms: List[str], schedule_hsi_event: HSIEventScheduler, consumables_checker: ConsumablesChecker, **kwargs) None[source]

Actions to take during a non-emergency generic health system interaction (HSI).

Derived classes should overwrite this method so that they are compatible with the HealthSystem module, and can schedule HSI events when a individual presents symptoms indicative of the corresponding illness or condition.

When overwriting, arguments that are not required can be left out of the definition. If done so, the method must take a **kwargs input to avoid errors when looping over all disease modules and running their generic HSI methods.

HSI events should be scheduled by the Module subclass implementing this method using the schedule_hsi_event argument.

Implementations of this method should not make any updates to the population dataframe directly - if the target individuals properties need to be updated this should be performed by updating the individual_properties argument.

Parameters:
  • person_id – Row index (ID) of the individual target of the HSI event in the population dataframe.

  • individual_properties – Properties of individual target as provided in the population dataframe. Updates to individual properties may be written to this object.

  • symptoms – List of symptoms the patient is experiencing.

  • schedule_hsi_event – A function that can schedule subsequent HSI events.

  • diagnosis_function – A function that can run diagnosis tests based on the patient’s symptoms.

  • consumables_checker – A function that can query the health system to check for available consumables.

  • facility_level – The level of the facility that the patient presented at.

  • treatment_id – The treatment id of the HSI event triggering the generic appointment.

do_at_generic_first_appt_emergency(person_id: int, individual_properties: IndividualProperties, symptoms: List[str], schedule_hsi_event: HSIEventScheduler, consumables_checker: ConsumablesChecker, **kwargs) None[source]

Actions to take during an emergency generic health system interaction (HSI).

Call signature is identical to the do_at_generic_first_appt() method.

Derived classes should overwrite this method so that they are compatible with the :py:class`~.HealthSystem` module, and can schedule HSI events when a individual presents symptoms indicative of the corresponding illness or condition.

class CopdPollEvent(module)[source]

An event that controls the COPD infection process and logs current states. It repeats every 3 months.

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)

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class CopdPollEvent):

__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]
  • Progress persons to higher categories of ch_lungfunction

  • Schedules Exacerbation (Moderate / Severe) events.

  • Log current states.

gen_random_date_in_next_three_months()[source]

Returns a datetime for a day that is chosen randomly to be within the next 3 months.

static increment_category(ser: Series) Series[source]

Returns a pd.Series with same index as ser but with the categories shifted to next higher one.

progress_to_next_lung_function(df)[source]

make individuals progress to a next higher lung function

class CopdExacerbationEvent(module, person_id, severe: bool = False)[source]

An Exacerbation, which may be ‘Severe’ (severe=True) or ‘Moderate’ (severe=False). * A Moderate Exacerbation will not cause death but may cause non-emergency healthcare seeking; * A Severe Exacerbation may cause death and may cause emergency healthcare seeking.

Create a new event.

Note that just creating an event does not schedule it to happen; that must be done by calling Simulation.schedule_event.

Parameters:
  • module – the module that created this event. All subclasses of Event take this as the first argument in their constructor, but may also take further keyword arguments.

  • priority – a keyword-argument to set the priority (see Priority enum)

Bases: tlo.events.Event, tlo.events.IndividualScopeEventMixin

Functions (defined or overridden in class CopdExacerbationEvent):

__init__(module, person_id, severe: bool = False)[source]

Create a new event.

Note that just creating an event does not schedule it to happen; that must be done by calling Simulation.schedule_event.

Parameters:
  • module – the module that created this event. All subclasses of Event take this as the first argument in their constructor, but may also take further keyword arguments.

  • priority – a keyword-argument to set the priority (see Priority enum)

apply(person_id)[source]

Apply this event to the given target.

Must be implemented by subclasses.

Parameters:

target – the target of the event

class CopdDeath(module, person_id)[source]

This event will cause the person to die to ‘COPD’ if the person’s property ch_will_die_this_episode is True. It is scheduled when a Severe Exacerbation is lethal, but can be cancelled if a subsequent treatment is successful.

Create a new event.

Note that just creating an event does not schedule it to happen; that must be done by calling Simulation.schedule_event.

Parameters:
  • module – the module that created this event. All subclasses of Event take this as the first argument in their constructor, but may also take further keyword arguments.

  • priority – a keyword-argument to set the priority (see Priority enum)

Bases: tlo.events.Event, tlo.events.IndividualScopeEventMixin

Functions (defined or overridden in class CopdDeath):

__init__(module, person_id)[source]

Create a new event.

Note that just creating an event does not schedule it to happen; that must be done by calling Simulation.schedule_event.

Parameters:
  • module – the module that created this event. All subclasses of Event take this as the first argument in their constructor, but may also take further keyword arguments.

  • priority – a keyword-argument to set the priority (see Priority enum)

apply(person_id)[source]

Apply this event to the given target.

Must be implemented by subclasses.

Parameters:

target – the target of the event

class HSI_Copd_TreatmentOnSevereExacerbation(module, person_id)[source]

HSI event for issuing treatment to all individuals with severe exacerbation. We first check the availability of oxygen at the default facility(1a). If no oxygen is found we refer individuals to the next higher level facility until either we find oxygen or we are at the highest facility level. Here facility levels are [“1a”, “1b”, “2”]

Create a new event.

Note that just creating an event does not schedule it to happen; that must be done by calling Simulation.schedule_event.

Parameters:

module – the module that created this event. All subclasses of Event take this as the first argument in their constructor, but may also take further keyword arguments.

Bases: tlo.methods.hsi_event.HSI_Event, tlo.events.IndividualScopeEventMixin

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class HSI_Copd_TreatmentOnSevereExacerbation):

__init__(module, person_id)[source]

Create a new event.

Note that just creating an event does not schedule it to happen; that must be done by calling Simulation.schedule_event.

Parameters:

module – the module that created this event. All subclasses of Event take this as the first argument in their constructor, but may also take further keyword arguments.

apply(person_id, squeeze_factor)[source]

What to do when someone presents for care with an exacerbation. * Provide treatment: whatever is available at this facility at this time (no referral).