tlo.methods.diarrhoea module

Childhood Diarrhoea Module

Overview

Individuals are exposed to the risk of onset of diarrhoea. They can have diarrhoea caused by one pathogen at a time.

During an episode (prior to recovery- either natural or cured), the symptom of diarrhoea is present in addition to other possible symptoms. Diarrhoea may cause dehydration and this may progress to become ‘severe’ during an episode. The individual may recovery naturally or die.

Health care seeking is prompted by the onset of the symptom diarrhoea. The individual can be treated; if successful the

risk of death is removed and they are cured (symptom resolved) some days later.

Outstanding Issues * To include rotavirus vaccine

class Diarrhoea(name=None, resourcefilepath=None, do_checks=False)[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.

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

PARAMETERS:

Item

Type

Description

base_inc_rate_diarrhoea_by_rotavirus

LIST

incidence rate (per person-year) of diarrhoea caused by rotavirus in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_shigella

LIST

incidence rate (per person-year) of diarrhoea caused by shigella spp in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_adenovirus

LIST

incidence rate (per person-year) of diarrhoea caused by adenovirus 40/41 in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_cryptosporidium

LIST

incidence rate (per person-year) of diarrhoea caused by cryptosporidium in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_campylobacter

LIST

incidence rate (per person-year) of diarrhoea caused by campylobacter spp in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_ETEC

LIST

incidence rate (per person-year) of diarrhoea caused by ETEC in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_sapovirus

LIST

incidence rate (per person-year) of diarrhoea caused by sapovirus in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_norovirus

LIST

incidence rate (per person-year) of diarrhoea caused by norovirus in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_astrovirus

LIST

incidence rate (per person-year) of diarrhoea caused by astrovirus in age groups 0-11, 12-23, 24-59 months

base_inc_rate_diarrhoea_by_tEPEC

LIST

incidence rate (per person-year) of diarrhoea caused by tEPEC in age groups 0-11, 12-23, 24-59 months

rr_diarrhoea_HHhandwashing

REAL

relative rate of diarrhoea with household handwashing with soap

rr_diarrhoea_improved_sanitation

REAL

relative rate of diarrhoea for improved sanitation

rr_diarrhoea_clean_water

REAL

relative rate of diarrhoea for access to clean drinking water

rr_diarrhoea_exclusive_vs_partial_breastfeeding_<6mo

REAL

relative rate of diarrhoea for partial breastfeeding in <6 months old, compared to exclusive breastfeeding

rr_diarrhoea_exclusive_vs_no_breastfeeding_<6mo

REAL

relative rate of diarrhoea for no breastfeeding in <6 months old, compared to exclusive breastfeeding

rr_diarrhoea_any_vs_no_breastfeeding_6_11mo

REAL

relative rate of diarrhoea for no breastfeeding in 6 months old to 1 years old, compared to any breastfeeding at this age group

rr_diarrhoea_untreated_HIV

REAL

relative rate of diarrhoea for HIV positive status

rr_diarrhoea_SAM

REAL

relative rate of diarrhoea for severe malnutrition

proportion_AWD_in_rotavirus

REAL

acute diarrhoea type caused in rotavirus-attributed diarrhoea

proportion_AWD_in_shigella

REAL

acute diarrhoea type caused in shigella-attributed diarrhoea

proportion_AWD_in_adenovirus

REAL

acute diarrhoea type caused in adenovirus-attributed diarrhoea

proportion_AWD_in_cryptosporidium

REAL

acute diarrhoea type caused in cryptosporidium-attributed diarrhoea

proportion_AWD_in_campylobacter

REAL

acute diarrhoea type caused in campylobacter-attributed diarrhoea

proportion_AWD_in_ETEC

REAL

acute diarrhoea type caused in ETEC-attributed diarrhoea

proportion_AWD_in_sapovirus

REAL

acute diarrhoea type caused in sapovirus-attributed diarrhoea

proportion_AWD_in_norovirus

REAL

acute diarrhoea type caused in norovirus-attributed diarrhoea

proportion_AWD_in_astrovirus

REAL

acute diarrhoea type caused in astrovirus-attributed diarrhoea

proportion_AWD_in_tEPEC

REAL

acute diarrhoea type in tEPEC-attributed diarrhoea

prob_dehydration_by_rotavirus

REAL

probability of any dehydration caused by rotavirus

prob_dehydration_by_shigella

REAL

probability of any dehydration caused by shigella

prob_dehydration_by_adenovirus

REAL

probability of any dehydration caused by adenovirus

prob_dehydration_by_cryptosporidium

REAL

probability of any dehydration caused by cryptosporidium

prob_dehydration_by_campylobacter

REAL

probability of any dehydration caused by campylobacter

prob_dehydration_by_ETEC

REAL

probability of any dehydration caused by ETEC

prob_dehydration_by_sapovirus

REAL

probability of any dehydration caused by sapovirus

prob_dehydration_by_norovirus

REAL

probability of any dehydration caused by norovirus

prob_dehydration_by_astrovirus

REAL

probability of any dehydration caused by astrovirus

prob_dehydration_by_tEPEC

REAL

probability of any dehydration caused by tEPEC

probability_of_severe_dehydration_if_some_dehydration

REAL

probability that someone with diarrhoea and some dehydration develops severe dehydration

prob_prolonged_diarr_rotavirus

REAL

probability of prolonged episode in rotavirus-attributed diarrhoea

prob_prolonged_diarr_shigella

REAL

probability of prolonged episode by shigella-attributed diarrhoea

prob_prolonged_diarr_adenovirus

REAL

probability of prolonged episode by adenovirus-attributed diarrhoea

prob_prolonged_diarr_cryptosporidium

REAL

probability of prolonged episode by cryptosporidium-attributed diarrhoea

prob_prolonged_diarr_campylobacter

REAL

probability of prolonged episode by campylobacter-attributed diarrhoea

prob_prolonged_diarr_ETEC

REAL

probability of prolonged episode by ETEC-attributed diarrhoea

prob_prolonged_diarr_sapovirus

REAL

probability of prolonged episode by sapovirus-attributed diarrhoea

prob_prolonged_diarr_norovirus

REAL

probability of prolonged episode by norovirus-attributed diarrhoea

prob_prolonged_diarr_astrovirus

REAL

probability of prolonged episode by norovirus-attributed diarrhoea

prob_prolonged_diarr_tEPEC

REAL

probability of prolonged episode by tEPEC-attributed diarrhoea

prob_prolonged_to_persistent_diarr

REAL

probability of prolonged diarrhoea becoming persistent diarrhoea

rr_bec_persistent_age>6mo

REAL

relative rate of acute diarrhoea becoming persistent diarrhoea for children over 6 months

rr_bec_persistent_HIV

REAL

relative rate of acute diarrhoea becoming persistent diarrhoea for HIV positive

rr_bec_persistent_SAM

REAL

relative rate of acute diarrhoea becoming persistent diarrhoea for severely acute malnutrition

rr_bec_persistent_stunted

REAL

relative rate of acute diarrhoea becoming persistent diarrhoea for stunted children

min_dur_acute

INT

The minimum duration (in days) for an episode that is classified as an acute episode

min_dur_prolonged

INT

The minimum duration (in days) for an episode that is classified as a prolonged episode

min_dur_persistent

INT

The minimum duration (in days) for an episode that is classified as a persistent episode

max_dur_persistent

INT

The maximum duration (in days) for an episode that is classified as a persistent episode

prob_fever_by_rotavirus

REAL

probability of fever caused by rotavirus

prob_fever_by_shigella

REAL

probability of fever caused by shigella

prob_fever_by_adenovirus

REAL

probability of fever caused by adenovirus

prob_fever_by_cryptosporidium

REAL

probability of fever caused by cryptosporidium

prob_fever_by_campylobacter

REAL

probability of fever caused by campylobacter

prob_fever_by_ETEC

REAL

probability of fever caused by ETEC

prob_fever_by_sapovirus

REAL

probability of fever caused by sapovirus

prob_fever_by_norovirus

REAL

probability of fever caused by norovirus

prob_fever_by_astrovirus

REAL

probability of fever caused by astrovirus

prob_fever_by_tEPEC

REAL

probability of fever caused by tEPEC

prob_vomiting_by_rotavirus

REAL

probability of vomiting caused by rotavirus

prob_vomiting_by_shigella

REAL

probability of vomiting caused by shigella

prob_vomiting_by_adenovirus

REAL

probability of vomiting caused by adenovirus

prob_vomiting_by_cryptosporidium

REAL

probability of vomiting caused by cryptosporidium

prob_vomiting_by_campylobacter

REAL

probability of vomiting caused by campylobacter

prob_vomiting_by_ETEC

REAL

probability of vomiting caused by ETEC

prob_vomiting_by_sapovirus

REAL

probability of vomiting caused by sapovirus

prob_vomiting_by_norovirus

REAL

probability of vomiting caused by norovirus

prob_vomiting_by_astrovirus

REAL

probability of vomiting caused by astrovirus

prob_vomiting_by_tEPEC

REAL

probability of vomiting caused by tEPEC

adjustment_factor_on_cfr

REAL

Factor by which fatality probabilities are multiplied (to be used in calibration)

case_fatality_rate_AWD

REAL

case fatality rate for acute watery diarrhoea cases

rr_diarr_death_bloody

REAL

relative risk of diarrhoea death (compared to case_fatality_rate_AWD if the diarrhoea is of type “bloody” (i.e. dyssentry).

rr_diarr_death_age24to59mo

REAL

relative risk of diarrhoea death for ages 24 to 59 months

rr_diarr_death_if_duration_longer_than_13_days

REAL

relative risk of diarrhoea death if the duration episode is 13 days or longer

rr_diarr_death_severe_dehydration

REAL

relative risk of diarrhoea death for cases with severe dehyadration

rr_diarr_death_untreated_HIV

REAL

relative risk of diarrhoea death for untreated HIV

rr_diarr_death_SAM

REAL

relative risk of diarrhoea death for severe acute malnutrition

rr_diarr_death_alri

REAL

relative risk of diarrhoea death if concurrent lower respiratory infection

rr_diarr_death_cryptosporidium

REAL

relative risk of diarrhoea death if caused by cryptosporidium

rr_diarr_death_shigella

REAL

relative risk of diarrhoea death if caused by shigella

sensitivity_severe_dehydration_visual_inspection

REAL

sensitivity of IMCI severe dehydration algorithm for dehydration >9% loss of body weight

specificity_severe_dehydration_visual_inspection

REAL

specificity of IMCI severe dehydration algorithm for dehydration >9% loss of body weight

prob_hospitalization_on_danger_signs

REAL

probability of hospitalisation when danger signs are detected in an initial consultation

prob_WHOPlanC_cures_dehydration_if_severe_dehydration

REAL

probability that severe dehydration is cured by Treatment Plan C

prob_ORS_cures_dehydration_if_severe_dehydration

REAL

probability that severe dehydration is cured by ORS

prob_ORS_cures_dehydration_if_non_severe_dehydration

REAL

probability that non-severe dehydration is cured by ORS

prob_antibiotic_cures_dysentery

REAL

probability that blood-in-stool is removed by the use of antibiotics

number_of_days_reduced_duration_with_zinc

INT

number of days reduced duration with zinc

days_between_treatment_and_cure

INT

number of days between any treatment being given in an HSI and the cure occurring.

rr_severe_dehydration_due_to_rotavirus_with_R1_under1yo

REAL

relative risk of severe dehydration with rotavirus vaccine, for under 1 years old.

rr_severe_dehydration_due_to_rotavirus_with_R1_over1yo

REAL

relative risk of severe dehydration with rotavirus vaccine, for those aged 1 year and older.

PROPERTIES:

Item

Type

Description

gi_has_diarrhoea

BOOL

Whether or not the person currently has an episode of diarrhoea.

gi_pathogen

CATEGORICAL

The attributable pathogen for the current episode of diarrhoea (np.nan if the person does not currently have diarrhoea).. Possible values are: [rotavirus, shigella, adenovirus, cryptosporidium, campylobacter, ETEC, sapovirus, norovirus, astrovirus, tEPEC, ]

gi_type

CATEGORICAL

Type (watery or blood) of the current episode of diarrhoea (np.nan if the person does not currently have diarrhoea).. Possible values are: [watery, bloody, ]

gi_dehydration

CATEGORICAL

Severity of dehydration for the current episode of diarrhoea (np.nan if the person does not currently have diarrhoea).. Possible values are: [none, some, severe, ]

gi_duration_longer_than_13days

BOOL

Whether the duration of the current episode would last longer than 13 days if untreated. (False if does not have current episode)

gi_number_of_episodes

INT

Number of episodes of diarrhoea caused by a pathogen

gi_date_of_onset

DATE

Date of onset of current episode of diarrhoea (pd.NaT if does not have current episode of diarrhoea).

gi_scheduled_date_recovery

DATE

Scheduled date of recovery from current episode of diarrhoea (pd.NaT if does not have current episode or current episode is scheduled to result in death). This is scheduled when the episode is onset and may be revised subsequently if the episode is cured by a treatment

gi_scheduled_date_death

DATE

Scheduled date of death caused by current episode of diarrhoea (pd.NaT if does not have current episode or if current episode will not result in death). This is scheduled when the episode is onset and may be revised subsequently if the episode is cured by a treatment.

gi_date_end_of_last_episode

DATE

The date on which the last episode of diarrhoea is fully resolved, including allowing for the possibility of HSI events (pd.NaT if has never had an episode). This is used to determine when a new episode can begin and stops successive episodes interfering with one another.This is notnull when the person has ever had an episode of diarrhoea.

gi_treatment_date

DATE

The actual date on which treatment is first administered for the current episode (pd.NaT if does not have current episode or if no treatment has yet been provided in the current episode).

Class attributes:

ADDITIONAL_DEPENDENCIES : {‘Epi’, ‘Stunting’, ‘Alri’}

CAUSES_OF_DEATH : {‘Diarrhoea_rotavirus’: <tlo.methods.causes.Cause object at 0x129284f10>, ‘Diarrhoea_shigella’: <tlo.methods.causes.Cause object at 0x129285cd0>, ‘Diarrhoea_adenovirus’: <tlo.methods.causes.Cause object at 0x129286150>, ‘Diarrhoea_cryptosporidium’: <tlo.methods.causes.Cause object at 0x129286690>, ‘Diarrhoea_campylobacter’: <tlo.methods.causes.Cause object at 0x129287d90>, ‘Diarrhoea_ETEC’: <tlo.methods.causes.Cause object at 0x129286390>, ‘Diarrhoea_sapovirus’: <tlo.methods.causes.Cause object at 0x129285110>, ‘Diarrhoea_norovirus’: <tlo.methods.causes.Cause object at 0x1292857d0>, ‘Diarrhoea_astrovirus’: <tlo.methods.causes.Cause object at 0x129285f10>, ‘Diarrhoea_tEPEC’: <tlo.methods.causes.Cause object at 0x1292867d0>}

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

INIT_DEPENDENCIES : {‘Hiv’, ‘Lifestyle’, ‘NewbornOutcomes’, ‘Demography’, ‘SymptomManager’, ‘HealthSystem’, ‘Wasting’}

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

OPTIONAL_INIT_DEPENDENCIES : {‘HealthBurden’}

__annotations__ : {}

pathogens : [‘rotavirus’, ‘shigella’, ‘adenovirus’, ‘cryptosporidium’, ‘campylobacter’, ‘ETEC’, ‘sapovirus’, ‘norovirus’, ‘astrovirus’, ‘tEPEC’]

Functions (defined or overridden in class Diarrhoea):

__init__(name=None, resourcefilepath=None, do_checks=False)[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]

Setup parameters values used by the module

initialise_population(population)[source]

Sets that there is no one with diarrhoea at initiation.

initialise_simulation(sim)[source]

Prepares for simulation: * Schedules the main polling event * Schedules the main logging event * Schedule the check properties event (if needed) * Establishes the linear models and other data structures using the parameters that have been read-in * Store the consumables that are required in each of the HSI * Register test for the determination of ‘danger signs’

on_birth(mother_id, child_id)[source]

On birth, all children will have no diarrhoea

on_hsi_alert(person_id, treatment_id)[source]

This is called whenever there is an HSI event commissioned by one of the other disease modules.

report_daly_values()[source]

This returns person-time live with disability values to the HealthBurden module. At the end of each episode, a record is made in a list, self.unreported_dalys, of the form (person_id, duration_in_days_of_episode * average_daly_weight). This record is used to create the pd.Series that is returned (index: person_id for all those alive, value: the average disability weight during the preceding month). The list is then cleared.

look_up_consumables()[source]

Look up and store the consumables item codes used in each of the HSI.

do_treatment(person_id, hsi_event)[source]

Method called by the HSI that enacts decisions about a treatment and its effect for diarrhoea caused by a pathogen. (It will do nothing if the diarrhoea is caused by another module.) Actions: * If the episode will cause death: if the treatment is successful, prevents this episode of diarrhoea from

causing a death and schedules Cure Event

  • If the episode will not cause death: if treatment is succesful, schedules a CureEvent that will occur earlier

than the NaturalRecovery event.

  • Records that treatment is provided.

NB. Provisions for cholera are not included See this report:

cancel_death_date(person_id)[source]

Cancels a scheduled date of death due to diarrhoea for a person. This is called prior to the scheduling the CureEvent to prevent deaths happening in the time between a treatment being given and the cure event occurring.

end_episode(person_id, outcome)[source]

Helper function that enacts the end of the episode of diarrhoea (either by natural recovery, death or cure) * Logs that the episode has ended * Stores the total time-lived-with-disability during the episode * Enacts the death (if the outcome==’death’); Otherwise, removes symptoms and resets properties

check_properties()[source]

Check that the properties are ok: for use in testing only

do_at_generic_first_appt(person_id: int, individual_properties: IndividualProperties, schedule_hsi_event: HSIEventScheduler, symptoms: List[str], diagnosis_function: DiagnosisFunction, **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.

class DiarrhoeaPollingEvent(module)[source]

This is the main event that runs the acquisition of pathogens that cause Diarrhoea. It determines who is infected and schedules individual IncidentCase events to represent onset.

A known issue is that diarrhoea events are scheduled based on the risk of current age but occur a short time

later when the children will be slightly older. This means that when comparing the model output with data, the model slightly under-represents incidence among younger age-groups and over-represents incidence among older age-groups. This is a small effect when the frequency of the polling event is high.

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 DiarrhoeaPollingEvent):

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

compute_fraction_of_year_between_polling_event()[source]

Compute fraction of a year that elapses between polling event. This is used to adjust the risk of infection

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 DiarrhoeaIncidentCase(module, person_id, pathogen)[source]
This Event is for the onset of the infection that causes diarrhoea.
  • Refreshes all the properties so that they pertain to this current episode of diarrhoea

  • Imposes the symptoms

  • Schedules relevant natural history event {(DiarrhoeaSevereDehydrationEvent) and (either DiarrhoeaNaturalRecoveryEvent or DiarrhoeaDeathEvent)}

  • Updates a counter for incident cases

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 DiarrhoeaIncidentCase):

__init__(module, person_id, pathogen)[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 DiarrhoeaNaturalRecoveryEvent(module, person_id)[source]

This is the Natural Recovery event. It is part of the natural history and represents the end of an episode of Diarrhoea. It does the following:

  • resolves all symptoms caused by diarrhoea

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 DiarrhoeaNaturalRecoveryEvent):

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

This Event is for the death of someone that is caused by the infection with a pathogen that causes diarrhoea. The person dies if the ‘diarrhoea_death_date’ that was set at onset of the episode is equal to the current date. (It will have been reset to pd.NaT if there has been a treatment in the intervening time).

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 DiarrhoeaDeathEvent):

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

This is the cure event. It is scheduled by an HSI treatment event. It enacts the actual “cure” of the person that is caused (after some delay) by the treatment administered. It does the following:

  • Sets the date of recovery to today’s date

  • Resolves all symptoms caused by diarrhoea

NB. This is the event that would be called if another module has caused the symptom of diarrhoea and care is sought.

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 DiarrhoeaCureEvent):

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

This is a treatment for diarrhoea administered at outpatient. NB. This can be called when a child presents with Diarrhoea that is caused by another module/Symptom Manager.

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_Diarrhoea_Treatment_Outpatient):

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

Run do_treatment for this person from an out-potient setting.

class HSI_Diarrhoea_Treatment_Inpatient(module, person_id)[source]

This is a treatment for acute diarrhoea with severe dehydration administered at inpatient when danger_signs have been diagnosed.

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_Diarrhoea_Treatment_Inpatient):

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

Run do_treatment for this person from an in-potient setting.

class DiarrhoeaPropertiesOfOtherModules(name=None)[source]

For the purpose of the testing, this module generates the properties upon which the Alri module relies

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

PROPERTIES:

Item

Type

Description

hv_inf

BOOL

temporary property for HIV infection status

hv_art

CATEGORICAL

temporary property for ART status. Possible values are: [not, on_VL_suppressed, on_not_VL_suppressed, ]

ri_current_infection_status

BOOL

temporary property

nb_breastfeeding_status

CATEGORICAL

temporary property. Possible values are: [none, non_exclusive, exclusive, ]

un_clinical_acute_malnutrition

CATEGORICAL

temporary property. Possible values are: [MAM, SAM, well, ]

un_HAZ_category

CATEGORICAL

temporary property. Possible values are: [HAZ<-3, -3<=HAZ<-2, HAZ>=-2, ]

va_rota_all_doses

BOOL

temporary property

Class attributes:

ALTERNATIVE_TO : {‘Epi’, ‘Hiv’, ‘Wasting’, ‘Stunting’, ‘Alri’}

INIT_DEPENDENCIES : {‘Demography’}

__annotations__ : {}

Functions (defined or overridden in class DiarrhoeaPropertiesOfOtherModules):

__init__(name=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.

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.

By default, all Property``s in ``self.PROPERTIES will have their columns in the population dataframe set to the default value.

Modules that wish to implement this behaviour do not need to implement this method, it will be inherited automatically. Modules that wish to perform additional steps during the initialise_population stage should reimplement this method and call

`python super().initialise_population(population=population) `

at the beginning of the method, then proceed with their additional steps. Modules that do not wish to inherit this default behaviour should re-implement initialise_population without the call to super() above.

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 in the simulation.

initialise_simulation(sim)[source]

Get ready for simulation start.

Must be implemented by subclasses.

This method is called just before the main simulation loop begins, and after all modules have read their parameters and the initial population has been created. It is a good place to add initial events to the event queue.

on_birth(mother, child)[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

class DiarrhoeaCheckPropertiesEvent(module)[source]

This event runs daily and checks properties are in the right configuration. Only use whilst debugging!

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 DiarrhoeaCheckPropertiesEvent):

__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