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.
Bases:
tlo.core.Module
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 0x135dc2550>, ‘COPD_cat1’: <tlo.methods.causes.Cause object at 0x135dc3ed0>, ‘COPD_cat2’: <tlo.methods.causes.Cause object at 0x135dc3090>, ‘COPD_cat3’: <tlo.methods.causes.Cause object at 0x135dc2690>, ‘COPD_cat4’: <tlo.methods.causes.Cause object at 0x135dc18d0>, ‘COPD_cat5’: <tlo.methods.causes.Cause object at 0x135dc1b90>, ‘COPD_cat6’: <tlo.methods.causes.Cause object at 0x135dc0910>}
CAUSES_OF_DISABILITY : {‘COPD’: <tlo.methods.causes.Cause object at 0x135dc1910>}
INIT_DEPENDENCIES : {‘SymptomManager’, ‘Lifestyle’}
METADATA : {<Metadata.USES_SYMPTOMMANAGER: 2>, <Metadata.USES_HEALTHBURDEN: 4>, <Metadata.USES_HEALTHSYSTEM: 3>, <Metadata.DISEASE_MODULE: 1>}
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.
- 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
- report_daly_values()[source]
Return disability weight for alive persons, based on the current status of ch_lungfunction.
- lookup_item_codes()[source]
Look-up the item-codes for the consumables needed in the HSI Events for this module.
- _common_first_appt(patient_id: int, patient_details: PatientDetails, symptoms: List[str], 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(patient_id: int, patient_details: PatientDetails, symptoms: List[str], consumables_checker: ConsumablesChecker, **kwargs) IndividualPropertyUpdates [source]
Actions to be take during a NON-emergency generic HSI.
Derived classes should overwrite this method so that they are compatible with the HealthSystem module, and can schedule HSI events when a patient 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 implementing this method using the
Module.healthsystem.schedule_hsi()
method. However, they should not write updates back to the population DataFrame in this method - these values should be returned as a dictionary as described below:The return value of this function should be a dictionary containing any changes that need to be made to the individual’s row in the population DataFrame. Key/value pairs should be the column name and the new value to assign to the patient. In the event no updates are required; return an object that evaluates to False when cast to a bool. Your options are: - Omit a return statement and value (preferred). - Return an empty dictionary. Use this case when patient details might need updating conditionally, on EG patient symptoms or consumable availability. In which case, an empty dictionary should be created and key-value pairs added to this dictionary as such conditionals are checked. If no conditionals are met, the empty dictionary will be returned. - Use a return statement with no values (use if the logic of your module-specific method necessitates the explicit return). - Return None (not recommended, use “return” on its own, as above).
- Parameters:
patient_id – Row index (ID) of the individual target of the HSI event in the population DataFrame.
patient_details – Patient details as provided in the population DataFrame.
symptoms – List of symptoms the patient is experiencing.
diagnosis_function – A function that can run diagnosis tests based on the patient’s symptoms.
consumables_checker – A function that can query the HealthSystem 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.
random_state – Random number generator to be used when making random choices during event creation.
- do_at_generic_first_appt_emergency(patient_id: int, patient_details: PatientDetails, symptoms: List[str], consumables_checker: ConsumablesChecker, **kwargs) IndividualPropertyUpdates [source]
Actions to be take during an EMERGENCY generic HSI. Call signature and return values are identical to the
do_at_generic_first_appt()
method. Derived classes should overwrite this method so that they are compatible with the HealthSystem module, and can schedule HSI events when a patient 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.
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.
- 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.
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)
- 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.
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)
- 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”]
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.