tlo.methods.malaria module

this is the malaria module which assigns malaria infections to the population: asymptomatic, clinical and severe it also holds the hsi events pertaining to malaria testing and treatment including the malaria RDT using DxTest

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

Bases: tlo.core.Module

PARAMETERS:

Item

Type

Description

interv

REAL

data frame of intervention coverage by year

clin_inc

REAL

data frame of clinical incidence by age, district, intervention coverage

inf_inc

REAL

data frame of infection incidence by age, district, intervention coverage

sev_inc

REAL

data frame of severe case incidence by age, district, intervention coverage

itn_district

REAL

data frame of ITN usage rates by district

irs_district

REAL

data frame of IRS usage rates by district

sev_symp_prob

REAL

probabilities of each symptom for severe malaria cases

sensitivity_rdt

REAL

Sensitivity of rdt

cfr

REAL

case-fatality rate for severe malaria

dur_asym

REAL

duration (days) of asymptomatic malaria

dur_clin

REAL

duration (days) of clinical symptoms of malaria

dur_clin_para

REAL

duration (days) of parasitaemia for clinical malaria cases

treatment_adjustment

REAL

probability of death from severe malaria if on treatment

p_sev_anaemia_preg

REAL

probability of severe anaemia in pregnant women with clinical malaria

itn_proj

REAL

coverage of ITN for projections 2020 onwards

mortality_adjust

REAL

adjustment of case-fatality rate to match WHO/MAP

data_end

REAL

final year of ICL malaria model outputs, after 2018 = projections

irs_rates_boundary

REAL

threshold for indoor residual spraying coverage

irs_rates_upper

REAL

indoor residual spraying high coverage

irs_rates_lower

REAL

indoor residual spraying low coverage

prob_malaria_case_tests

REAL

probability that a malaria case will have a scheduled rdt

itn

REAL

projected future itn coverage

rdt_testing_rates

REAL

per capita rdt testing rate of general population

scaling_factor_for_rdt_availability

REAL

scaling factor applied to the reports of rdt usage to compensate fornon-availability of rdts at some facilities

duration_iptp_protection_weeks

REAL

duration of protection against clinical malaria conferred by each dose of IPTp

rr_clinical_malaria_hiv_under5

REAL

relative risk of clinical malaria if HIV+ and aged under 5 years

rr_clinical_malaria_hiv_over5

REAL

relative risk of clinical malaria if HIV+ and aged over 5 years

rr_clinical_malaria_hiv_pregnant

REAL

relative risk of clinical malaria if HIV+ and pregnant

rr_clinical_malaria_cotrimoxazole

REAL

relative risk of clinical malaria if on cotrimoxazole

rr_clinical_malaria_art

REAL

relative risk of clinical malaria if HIV+ and on ART and virally suppressed

rr_clinical_malaria_iptp

REAL

relative risk of clinical malaria with each dose of IPTp

rr_severe_malaria_hiv_under5

REAL

relative risk of severe malaria if HIV+ and aged under 5 years

rr_severe_malaria_hiv_over5

REAL

relative risk of severe malaria if HIV+ and aged over 5 years

rr_severe_malaria_hiv_pregnant

REAL

relative risk of clinical malaria if HIV+ and pregnant

rr_severe_malaria_iptp

REAL

relative risk of severe malaria with each dose of IPTp

prob_of_treatment_success

REAL

probability that treatment will clear malaria symptoms

PROPERTIES:

Item

Type

Description

ma_is_infected

BOOL

Current status of malaria

ma_date_infected

DATE

Date of latest infection

ma_date_symptoms

DATE

Date of symptom start for clinical infection

ma_date_death

DATE

Date of death due to malaria

ma_tx

CATEGORICAL

Type of anti-malarial treatment person is currently using. Possible values are: [none, uncomplicated, complicated, ]

ma_date_tx

DATE

Date treatment started for most recent malaria episode

ma_inf_type

CATEGORICAL

specific symptoms with malaria infection. Possible values are: [none, asym, clinical, severe, ]

ma_age_edited

REAL

age values redefined to match with malaria data

ma_clinical_counter

INT

annual counter for malaria clinical episodes

ma_dx_counter

INT

annual counter for malaria diagnoses

ma_tx_counter

INT

annual counter for malaria treatment episodes

ma_clinical_preg_counter

INT

annual counter for malaria clinical episodes in pregnant women

ma_iptp

BOOL

if woman has IPTp in current pregnancy

Class attributes:

ADDITIONAL_DEPENDENCIES : {‘Tb’, ‘Hiv’}

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

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

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

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

OPTIONAL_INIT_DEPENDENCIES : {‘HealthBurden’}

Functions (defined or overridden in class Malaria):

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

Create instance of Malaria module

Parameters:
  • name – Name of this module (optional, defaults to name of class)

  • resourcefilepath – Path to the TLOmodel resources directory

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.

pre_initialise_population()[source]
  • Establish the Linear Models

if HIV is registered, the conditional predictors will apply otherwise only IPTp will affect risk of clinical/severe malaria

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

malaria_poll2(population)[source]
general_population_rdt_scheduler(population)[source]

schedule rdt for general population - performed in the community by DCSAs independent of any current symptoms rates are set to match rdt usage reports from WHO / NMCP

initialise_simulation(sim)[source]
    1. Schedule the Main Regular Polling Events

    1. Define the DxTests

    1. Look-up and save the codes for consumables

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

report_daly_values()[source]
check_if_fever_is_caused_by_malaria(true_malaria_infection_type: str, diagnosis_function: Callable[[str, bool, bool], Any], patient_id: int | None = None, fever_is_a_symptom: bool | None = True, patient_age: int | float | None = None, facility_level: str | None = None, treatment_id: str | None = None) Literal['severe_malaria', 'clinical_malaria', 'negative_malaria_test'][source]

Run by an HSI when an adult presents with fever. Determine if the cause is malaria.

Optional arguments are used by the logger, and are not needed in the diagnosis.

do_at_generic_first_appt(patient_id: int, patient_details: PatientDetails, symptoms: List[str], diagnosis_function: DiagnosisFunction, facility_level: str, treatment_id: str, **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], diagnosis_function: DiagnosisFunction, facility_level: str, treatment_id: str, **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 MalariaPollingEventDistrict(module)[source]

this calls functions to assign new malaria infections and schedules rdt at a community level (non-symptom driven)

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaPollingEventDistrict):

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

malaria prophylaxis for pregnant women

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaIPTp):

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

This resets the properties of a person on IPTp the protective effects ends after 6 weeks and so the property is reset to prevent the malaria poll assuming that this person still has reduced susceptibility to malaria infection

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

Functions (defined or overridden in class MalariaEndIPTpProtection):

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

Performs the Death operation on an individual and logs it.

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

Functions (defined or overridden in class MalariaDeathEvent):

__init__(module, person_id, cause)[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_Malaria_rdt(module, person_id, facility_level='1a')[source]

this is a point-of-care malaria rapid diagnostic test, with results within 2 minutes default facility level is 1a unless specified

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class HSI_Malaria_rdt):

__init__(module, person_id, facility_level='1a')[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_Malaria_rdt_community(module, person_id)[source]

this is a point-of-care malaria rapid diagnostic test, with results within 2 minutes this is performed in the community at facility level 0 by a DCSA positive result will schedule a referral to HSI_Malaria_rdt at facility level 1a where a confirmatory rdt will be performed and treatment will be scheduled

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class HSI_Malaria_rdt_community):

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

this is anti-malarial treatment for all ages. Includes treatment plus one rdt

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class HSI_Malaria_Treatment):

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

get_drugs(age_of_person)[source]
Parameters:

age_of_person

Returns:

Helper function to get treatment according to the age of the person being treated. Returns bool to indicate whether drugs were available

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.

class HSI_Malaria_Treatment_Complicated(module, person_id)[source]

this is anti-malarial treatment for complicated malaria in all ages

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class HSI_Malaria_Treatment_Complicated):

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

class HSI_MalariaIPTp(module, person_id)[source]

this is IPTp for pregnant women

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class HSI_MalariaIPTp):

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

class MalariaUpdateEvent(module)[source]

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaUpdateEvent):

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

this is a regular event for clinical and severe cases which: * assigns symptoms * schedules rdt * cures people currently on treatment for malaria * clears symptoms for those not on treatment * clears parasites if treated

class MalariaParasiteClearanceEvent(module)[source]

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaParasiteClearanceEvent):

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

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaLoggingEvent):

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

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaTxLoggingEvent):

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

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaPrevDistrictLoggingEvent):

__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