tlo.methods.depression module

This is the Depression Module.

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

Bases: tlo.core.Module

PARAMETERS:

Item

Type

Description

init_pr_depr_m_age1519_no_cc_wealth123

REAL

Initial probability of being depressed in male age1519 with no chronic condition with wealth level 1 or 2 or 3

init_rp_depr_f_not_rec_preg

REAL

Initial relative prevalence of being depressed in females not recently pregnant

init_rp_depr_f_rec_preg

REAL

Initial relative prevalence of being depressed in females recently pregnant

init_rp_depr_age2059

REAL

Initial relative prevalence of being depressed in 20-59 year olds vs 15-19

init_rp_depr_agege60

REAL

Initial relative prevalence of being depressed in 60+ year olds vs 15-19

init_rp_depr_cc

REAL

Initial relative prevalence of being depressed in people with chronic condition

init_rp_depr_wealth45

REAL

Initial relative prevalence of being depressed in people with wealth level 4 or 5 vs 1 or 2 or 3

init_rp_ever_depr_per_year_older_m

REAL

Initial relative prevalence ever depression per year older in men

init_rp_ever_depr_per_year_older_f

REAL

Initial relative prevalence ever depression per year older in women

init_pr_ever_talking_therapy_if_diagnosed

REAL

Initial probability of ever having had talking therapy if ever diagnosed with depression

init_pr_antidepr_curr_depr

REAL

Initial probability of being on antidepressants if currently depressed

init_rp_antidepr_ever_depr_not_curr

REAL

Initial relative prevalence of being on antidepressants if ever depressed but not currently

init_pr_ever_diagnosed_depression

REAL

Initial probability of having ever been diagnosed with depression, amongst people with ever depression and not on antidepressants

init_pr_ever_self_harmed_if_ever_depr

REAL

Initial probability of having ever self harmed if ever depressed

base_3m_prob_depr

REAL

Probability of onset of depression in a 3 month period if male, wealth 1 2 or 3, no chronic condition and never previously depressed

rr_depr_wealth45

REAL

Relative rate of depression when in wealth level 4 or 5 vs 1 or 2 or 3

rr_depr_cc

REAL

Relative rate of depression if has any chronic disease

rr_depr_pregnancy

REAL

Relative rate of depression when pregnant or recently pregnant

rr_depr_female

REAL

Relative rate of depression for females vs males

rr_depr_prev_epis

REAL

Relative rate of depression associated with previous depression vs never previously depressed

rr_depr_on_antidepr

REAL

Relative rate of depression episode if on antidepressants

rr_depr_age1519

REAL

Relative rate of depression associated with 15-20 year olds

rr_depr_agege60

REAL

Relative rate of depression associated with age > 60

depr_resolution_rates

LIST

Risk of depression resolving in 3 months if no chronic conditions and no treatments.Each individual is equally likely to be assigned each of these risks

rr_resol_depr_cc

REAL

Relative rate of resolving depression if has any chronic disease

rr_resol_depr_on_antidepr

REAL

Relative rate of resolving depression if on antidepressants

rr_resol_depr_current_talk_ther

REAL

Relative rate of resolving depression if has ever had talking therapy vs has never had talking therapy

prob_3m_stop_antidepr

REAL

Probability per 3 months of stopping antidepressants when not currently depressed.

prob_3m_default_antidepr

REAL

Probability per 3 months of stopping antidepressants when still depressed.

prob_3m_suicide_depr_m

REAL

Probability per 3 months of suicide in currently depressed men

rr_suicide_depr_f

REAL

Relative risk of suicide in women compared with men

prob_3m_selfharm_depr

REAL

Probability per 3 months of non-fatal self harm in those currently depressed

sensitivity_of_assessment_of_depression

REAL

The sensitivity of the clinical assessment in detecting the true current status of depression

pr_assessed_for_depression_in_generic_appt_level1

REAL

Probability that a person is assessed for depression during a non-emergency generic appointmentlevel 1

anti_depressant_medication_item_code

INT

The item code used for one month of anti-depressant treatment

pr_assessed_for_depression_for_perinatal_female

REAL

Probability that a perinatal female is assessed for depression during antenatal or postnatal services

PROPERTIES:

Item

Type

Description

de_depr

BOOL

whether this person is currently depressed

de_ever_depr

BOOL

whether this person has ever experienced depression

de_date_init_most_rec_depr

DATE

date this person last initiated a depression episode

de_date_depr_resolved

DATE

date this person resolved last episode of depression

de_intrinsic_3mo_risk_of_depr_resolution

REAL

the risk per 3 mo of an episode of depression being resolved in absence of any treatment

de_ever_diagnosed_depression

BOOL

whether ever diagnosed with depression

de_on_antidepr

BOOL

is currently on anti-depressants

de_ever_talk_ther

BOOL

whether this person has ever had a session of talking therapy

de_ever_non_fatal_self_harm_event

BOOL

ever had a non-fatal self harm event

de_cc

BOOL

whether this person has chronic condition

de_recently_pregnant

BOOL

whether this person is female and is either currently pregnant or had a last pregnancy less than one year ago

Class attributes:

CAUSES_OF_DEATH : {‘Suicide’: <tlo.methods.causes.Cause object at 0x136171690>}

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

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

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

OPTIONAL_INIT_DEPENDENCIES : {‘HealthBurden’}

Functions (defined or overridden in class Depression):

__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 parameters, register disease module with healthsystem and register symptoms

apply_linear_model(lm, df)[source]

Helper function will apply the linear model (lm) on the dataframe (df) to get a probability of some event happening to each individual. It then returns a series with same index with bools indicating the outcome based on the toss of the biased coin. :param lm: The linear model :param df: The dataframe :return: Series with same index containing outcomes (bool)

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]

Launch the main polling event and the logging event. Schedule the refill prescriptions for those on antidepressants. Register the assessment of depression with the DxManager.

on_birth(mother_id, child_id)[source]

Initialise our properties for a newborn individual – they will not have depression or any history of it. :param mother_id: the mother for this child :param child_id: the new child

on_hsi_alert(person_id, treatment_id)[source]

Nothing happens if this module is alerted to a person attending an HSI

report_daly_values()[source]

Report DALYs based status in the previous month. A DALY weight is attached to a status of depression for as long as the depression lasted in the previous month.

do_on_presentation_to_care(person_id, hsi_event)[source]

This member function is called when a person is in an HSI, and there may need to be screening for depression.

do_when_suspected_depression(person_id, hsi_event)[source]

This is called by the a generic HSI event when depression is suspected or otherwise investigated. :param person_id: :param hsi_event: The HSI event that has called this event :return:

class DepressionPollingEvent(module)[source]

The regular event that actually changes individuals’ depression status. It occurs every 3 months and this cannot be changed. The onset and resolution of depression events occurs at the polling event and synchronously for all persons. Individual level events (HSI, self-harm/suicide events) may occur at other times.

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class DepressionPollingEvent):

__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 DepressionSelfHarmEvent(module, person_id)[source]

This is a Self-Harm event. It has been scheduled to occur by the DepressionPollingEvent. It imposes the Injuries_From_Self_Harm symptom, which will lead to emergency care being sought

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

Functions (defined or overridden in class DepressionSelfHarmEvent):

__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 DepressionSuicideEvent(module, person_id)[source]

This is a Suicide event. It has been scheduled to occur by the DepressionPollingEvent. It causes the immediate death of the person.

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

Functions (defined or overridden in class DepressionSuicideEvent):

__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 DepressionLoggingEvent(module)[source]

This is the LoggingEvent for Depression. It runs every 3 months and gives: * population summaries for statuses for Depression at that time. * counts of events of self-harm and suicide that have occurred in the 3 months prior

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class DepressionLoggingEvent):

__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 HSI_Depression_TalkingTherapy(module, person_id)[source]

This is a Health System Interaction Event in which a person receives a session of talking therapy. It is one of a course of 5 sessions (at months 0, 6, 12, 18, 24). If one of these HSI does not happen then no further sessions occur. Sessions after the first have no direct effect, as the only property affected is reflects ever having had one session of talking therapy.

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

Functions (defined or overridden in class HSI_Depression_TalkingTherapy):

__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]

Set the property de_ever_talk_ther to be True and schedule the next session in the course if the person has not yet had 5 sessions.

class HSI_Depression_Start_Antidepressant(module, person_id)[source]

This is a Health System Interaction Event in which a person is started on anti-depressants. The facility_level is modified as a input parameter.

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

Functions (defined or overridden in class HSI_Depression_Start_Antidepressant):

__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]

Apply this event to the population.

Must be implemented by subclasses.

class HSI_Depression_Refill_Antidepressant(module, person_id)[source]

This is a Health System Interaction Event in which a person seeks a refill prescription of anti-depressants. The next refill of anti-depressants is also scheduled. If the person is flagged as not being on antidepressants, then the event does nothing and returns a blank footprint. If it does not run, then person ceases to be on anti-depressants and no further refill HSI are scheduled.

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

Functions (defined or overridden in class HSI_Depression_Refill_Antidepressant):

__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]

Apply this event to the population.

Must be implemented by subclasses.

did_not_run()[source]

Called when this event is due but it is not run. Return False to prevent the event being rescheduled, or True to allow the rescheduling. This is called each time that the event is tried to be run but it cannot be.