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)

Create instance of Malaria module

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

  • resourcefilepath – Path to the TLOmodel resources directory

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

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

type_of_scaleup

STRING

argument to determine type scale-up of program which will be implemented, can be ‘none’, ‘target’ or ‘max’

scaleup_start_year

INT

the year when the scale-up starts (it will occur on 1st January of that year)

scaleup_parameters

DATA_FRAME

the parameters and values changed in scenario analysis

PROPERTIES:

Item

Type

Description

ma_is_infected

BOOL

Current status of malaria, infected with malaria parasitaemia

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:

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

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

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

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

OPTIONAL_INIT_DEPENDENCIES : {‘HealthBurden’, ‘Hiv’}

__annotations__ : {}

Functions (defined or overridden in class Malaria):

__init__(name=None, resourcefilepath=None)

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)

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

Do things required before the population is created * Build the LinearModels

_build_linear_models()

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)

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.

malaria_poll2(population)
general_population_rdt_scheduler(population)

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)
    1. Schedule the Main Regular Polling Events

    1. Define the DxTests

    1. Look-up and save the codes for consumables

update_parameters_for_program_scaleup()

options for program scale-up are ‘target’ or ‘max’

on_birth(mother_id, child_id)

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()
check_if_fever_is_caused_by_malaria(true_malaria_infection_type: str, diagnosis_function: DiagnosisFunction, person_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']

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(person_id: int, individual_properties: IndividualProperties, symptoms: List[str], schedule_hsi_event: HSIEventScheduler, diagnosis_function: DiagnosisFunction, facility_level: str, treatment_id: str, **kwargs) None

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, diagnosis_function: DiagnosisFunction, facility_level: str, treatment_id: str, **kwargs) None

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 MalariaPollingEventDistrict(module)

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

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

__init__(module)

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)

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 MalariaScaleUpEvent(module)

This event exists to change parameters or functions depending on the scenario for projections which has been set It only occurs once on date: scaleup_start_date, called by initialise_simulation

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

Class attributes:

__annotations__ : {}

Functions (defined or overridden in class MalariaScaleUpEvent):

__init__(module)

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(population)

Apply this event to the given target.

Must be implemented by subclasses.

Parameters:

target – the target of the event

class MalariaIPTp(module)

malaria prophylaxis for pregnant women

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

__init__(module)

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)

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)

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

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

__init__(module, person_id)

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)

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)

Performs the Death operation on an individual and logs it.

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

__init__(module, person_id, cause)

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)

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

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

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

__init__(module, person_id, facility_level='1a')

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)

Apply this event to the population.

Must be implemented by subclasses.

class HSI_Malaria_rdt_community(module, person_id)

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

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

__init__(module, person_id)

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)

Apply this event to the population.

Must be implemented by subclasses.

class HSI_Malaria_Treatment(module, person_id)

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

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

__init__(module, person_id)

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)

Apply this event to the population.

Must be implemented by subclasses.

get_drugs(age_of_person)
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()

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)

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

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

__init__(module, person_id)

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)

Apply this event to the population.

Must be implemented by subclasses.

did_not_run()

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)

this is IPTp for pregnant women

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

__init__(module, person_id)

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)

Apply this event to the population.

Must be implemented by subclasses.

did_not_run()

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)

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

__init__(module)

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)

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 but self-cured * clears parasites if treated

class MalariaParasiteClearanceEvent(module)

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

__init__(module)

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)

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)

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

__init__(module)

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)

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)

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

__init__(module)

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)

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)

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

__init__(module)

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)

Apply this event to the given target.

This is a no-op; subclasses should override this method.

Parameters:

target – the target of the event