tlo.methods.postnatal_supervisor module

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

This module is responsible for the key conditions/complications experienced by a mother and by a neonate following labour and the immediate postpartum period (this period, from birth to day +1, is covered by the labour module).

For mothers: This module applies risk of complications across the postnatal period, which is defined as birth until day 42 post-delivery. PostnatalWeekOneMaternalEvent represents the first week post birth where risk of complications remains high. The primary mortality causing complications here are infection/sepsis, secondary postpartum haemorrhage and hypertension. Women with or without complications may/may not seek Postnatal Care within the Labour module for assessment and treatment of any complications assigned in this module. Additionally the PostnatalSupervisorEvent applies risk of complications in the following 3 weeks of the postnatal period.

For neonates: This module applies risk of complications during the neonatal period, from birth until day 28. The PostnatalWeekOneNeonatalEvent Event applies risk of early onset neonatal sepsis (sepsis onsetting prior to day 7 of life). Care may be sought (as described above) and neonates can be admitted for treatment. The PostnatalSupervisor Event applies risk of late onset neonatal sepsis from week 2-4 (ending on day 28). This event also determines additional care seeking for neonates who are unwell during this time period. All neonatal variables are reset on day 28.

Bases: tlo.core.Module

PARAMETERS:

Item

Type

Description

prob_obstetric_fistula

LIST

probability of a woman developing an obstetric fistula after birth

rr_obstetric_fistula_obstructed_labour

LIST

relative risk of obstetric fistula in women who experienced obstructed labour

prevalence_type_of_fistula

LIST

prevalence of 1.) vesicovaginal 2.)rectovaginal fistula

prob_secondary_pph

LIST

baseline probability of secondary PPH

rr_secondary_pph_endometritis

LIST

relative risk of secondary postpartum haemorrhage in women with sepsis secondary to endometritis

prob_secondary_pph_severity

LIST

probability of mild, moderate or severe secondary PPH

cfr_secondary_postpartum_haemorrhage

LIST

case fatality rate for secondary pph

rr_death_from_pph_with_anaemia

LIST

relative risk of death from PPH in women with anaemia

prob_htn_resolves

LIST

Weekly probability of resolution of hypertension

weekly_prob_gest_htn_pn

LIST

weekly probability of a woman developing gestational hypertension during the postnatal period

rr_gest_htn_obesity

LIST

Relative risk of gestational hypertension for women who are obese

prob_pre_eclampsia_per_month

LIST

underlying risk of pre-eclampsia per month without the impact of risk factors

weekly_prob_pre_eclampsia_pn

LIST

weekly probability of a woman developing mild pre-eclampsia during the postnatal period

rr_pre_eclampsia_obesity

LIST

Relative risk of pre-eclampsia for women who are obese

rr_pre_eclampsia_chronic_htn

LIST

Relative risk of pre-eclampsia in women who are chronically hypertensive

rr_pre_eclampsia_diabetes_mellitus

LIST

Relative risk of pre-eclampsia in women who have diabetes mellitus

probs_for_mgh_matrix_pn

LIST

probability of mild gestational hypertension moving between states: gestational hypertension, severe gestational hypertension, mild pre-eclampsia, severe pre-eclampsia, eclampsia

probs_for_sgh_matrix_pn

LIST

probability of severe gestational hypertension moving between states: gestational hypertension, severe gestational hypertension, mild pre-eclampsia, severe pre-eclampsia, eclampsia

probs_for_mpe_matrix_pn

LIST

probability of mild pre-eclampsia moving between states: gestational hypertension, severe gestational hypertension, mild pre-eclampsia, severe pre-eclampsia, eclampsia

probs_for_spe_matrix_pn

LIST

probability of severe pre-eclampsia moving between states: gestational hypertension, severe gestational hypertension, mild pre-eclampsia, severe pre-eclampsia, eclampsia

probs_for_ec_matrix_pn

LIST

probability of eclampsia moving between states: gestational hypertension, severe gestational hypertension, mild pre-eclampsia, severe pre-eclampsia, eclampsia

cfr_eclampsia

LIST

case fatality rate of eclampsia in the postnatal period

cfr_severe_pre_eclampsia

LIST

case fatality rate of severe pre-eclampsia in the postnatal period

weekly_prob_death_severe_gest_htn

LIST

weekly risk of death from severe hypertension in the postnatal period

baseline_prob_anaemia_per_week

LIST

Weekly probability of anaemia in pregnancy

rr_anaemia_maternal_malaria

LIST

relative risk of anaemia secondary to malaria infection

rr_anaemia_recent_haemorrhage

LIST

relative risk of anaemia secondary to recent haemorrhage

rr_anaemia_hiv_no_art

LIST

relative risk of anaemia for a woman with HIV not on ART

prob_type_of_anaemia_pn

LIST

probability of a woman with anaemia having mild, moderate or severe anaemia

prob_late_sepsis_endometritis

LIST

probability of developing sepsis following postpartum endometritis infection

rr_sepsis_endometritis_post_cs

LIST

relative risk of endometritis following caesarean delivery

prob_late_sepsis_urinary_tract

LIST

probability of developing sepsis following postpartum UTI

prob_late_sepsis_skin_soft_tissue

LIST

probability of developing sepsis following postpartum skin/soft tissue infection

rr_sepsis_sst_post_cs

LIST

relative risk of skin/soft tissue sepsis following caesarean delivery

cfr_postpartum_sepsis

LIST

case fatality rate for postnatal sepsis

prob_early_onset_neonatal_sepsis_week_1

LIST

Baseline probability of a newborn developing sepsis in week one of life

rr_eons_maternal_chorio

LIST

relative risk of EONS in newborns whose mothers have chorioamnionitis

rr_eons_maternal_prom

LIST

relative risk of EONS in newborns whose mothers have PROM

rr_eons_preterm_neonate

LIST

relative risk of EONS in preterm newborns

cfr_early_onset_neonatal_sepsis

LIST

case fatality for early onset neonatal sepsis

prob_late_onset_neonatal_sepsis

LIST

probability of late onset neonatal sepsis (all cause)

cfr_late_neonatal_sepsis

LIST

Risk of death from late neonatal sepsis

prob_sepsis_disabilities

LIST

Probabilities of varying disability levels after neonatal sepsis

prob_care_seeking_postnatal_emergency

LIST

baseline probability of emergency care seeking for women in the postnatal period

prob_care_seeking_postnatal_emergency_neonate

LIST

baseline probability care will be sought for a neonate with a complication

odds_care_seeking_fistula_repair

LIST

odds of a woman seeking care for treatment of obstetric fistula

aor_cs_fistula_age_15_19

LIST

odds ratio for care seeking for treatment of obstetric fistula in 15-19 year olds

aor_cs_fistula_age_lowest_education

LIST

odds ratio for care seeking for treatment of obstetric fistula in women in the lowest education quantile

treatment_effect_early_init_bf

LIST

effect of early initiation of breastfeeding on neonatal sepsis rates

treatment_effect_iron_folic_acid_anaemia

LIST

effect of iron and folic acid supplementation on anaemia risk

treatment_effect_abx_prom

LIST

effect of early antibiotics given to a mother with PROM on neonatal sepsis rates

treatment_effect_clean_birth

LIST

Treatment effect of clean birth practices on early onset neonatal sepsis risk

treatment_effect_cord_care

LIST

Treatment effect of chlorhexidine cord care on early onset neonatal sepsis risk

treatment_effect_anti_htns_progression_pn

LIST

Treatment effect of oral anti hypertensives on progression from mild/mod to severe gestationalhypertension

PROPERTIES:

Item

Type

Description

pn_postnatal_period_in_weeks

REAL

The number of weeks a woman is in the postnatal period (1-6)

pn_htn_disorders

CATEGORICAL

Hypertensive disorders of the postnatal period. Possible values are: [none, resolved, gest_htn, severe_gest_htn, mild_pre_eclamp, severe_pre_eclamp, eclampsia, ]

pn_postpartum_haem_secondary

BOOL

Whether this woman is experiencing a secondary postpartum haemorrhage

pn_sepsis_late_postpartum

BOOL

Whether this woman is experiencing postnatal (day7+) sepsis

pn_obstetric_fistula

CATEGORICAL

Type of fistula developed after birth. Possible values are: [none, vesicovaginal, rectovaginal, ]

pn_sepsis_early_neonatal

BOOL

Whether this neonate has developed early onset neonatal sepsis during week one of life

pn_sepsis_late_neonatal

BOOL

Whether this neonate has developed late neonatal sepsis following discharge

pn_neonatal_sepsis_disab

CATEGORICAL

Level of disability experience from a neonate post sepsis. Possible values are: [none, mild_motor_and_cog, mild_motor, moderate_motor, severe_motor, ]

pn_deficiencies_following_pregnancy

INT

bitset column, stores types of anaemia causing deficiencies following pregnancy

pn_anaemia_following_pregnancy

CATEGORICAL

severity of anaemia following pregnancy. Possible values are: [none, mild, moderate, severe, ]

pn_emergency_event_mother

BOOL

Whether a mother is experiencing an emergency complication postnatally

Class attributes:

ADDITIONAL_DEPENDENCIES : {‘NewbornOutcomes’, ‘Labour’, ‘PregnancySupervisor’, ‘Lifestyle’}

CAUSES_OF_DEATH : {‘secondary_postpartum_haemorrhage’: <tlo.methods.causes.Cause object at 0x7ff86b6360d0>, ‘postpartum_sepsis’: <tlo.methods.causes.Cause object at 0x7ff86b636520>, ‘severe_pre_eclampsia’: <tlo.methods.causes.Cause object at 0x7ff86b636580>, ‘eclampsia’: <tlo.methods.causes.Cause object at 0x7ff86b6365e0>, ‘severe_gestational_hypertension’: <tlo.methods.causes.Cause object at 0x7ff86b636640>, ‘early_onset_sepsis’: <tlo.methods.causes.Cause object at 0x7ff86b6366a0>, ‘late_onset_sepsis’: <tlo.methods.causes.Cause object at 0x7ff86b636700>}

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

INIT_DEPENDENCIES : {‘Demography’, ‘HealthSystem’}

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

Functions (defined or overridden in class PostnatalSupervisor):

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

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]

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_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 – the mother for this child (can be -1 if the mother is not identified).

  • child – the new child

further_on_birth_postnatal_supervisor(mother_id)[source]

This function is called by the on_birth function of NewbornOutcomes module or following an intrapartum stillbirth in the Labour Module. This function contains additional code related to the postnatal supervisor module that should be ran on_birth. These additional on_birth functions ensure each modules (pregnancy,antenatal care, labour, newborn, postnatal) on_birth code is ran in the correct sequence (as this can vary depending on how modules are registered) :param mother_id: mothers individual id

on_hsi_alert(person_id, treatment_id)[source]
report_daly_values()[source]
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)

set_postnatal_complications_mothers(week)[source]

This function is called by the PostnatalSupervisor event. It applies risk of key complications to a subset of women during each week of the postnatal period starting from week 2. Currently this includes sepsis, anaemia and hypertension :param week: week in the postnatal period used to select women in the data frame.

apply_risk_of_neonatal_complications_in_week_one(child_id, mother_id)[source]

This function is called by PostnatalWeekOneEvent for newborns to determine risk of complications. Currently this is limited to early onset neonatal sepsis :param child_id: childs individual id :param mother_id: mothers individual id :return:

set_postnatal_complications_neonates(upper_and_lower_day_limits)[source]

This function is called by the PostnatalSupervisor event. It applies risk of key complication to neonates during each week of the neonatal period after week one (weeks 2, 3 & 4). This is currently limited to sepsis but may be expanded at a later date :param upper_and_lower_day_limits: 2 value list of the first and last day of each week of the neonatal period

apply_risk_of_maternal_or_neonatal_death_postnatal(mother_or_child, individual_id)[source]

This function is called to calculate an individuals risk of death following the onset of a complication. For individuals who dont seek care this is immediately after the onset of complications. For those who seek care it is called at the end of the HSI to allow for treatment effects. Either a mother or a child can be passed to the function. :param mother_or_child: Person of interest for the effect of this function - pass ‘mother’ or ‘child’ to

apply risk of death correctly

Parameters

individual_id – individual_id

class PostnatalSupervisorEvent(module)[source]

This is the PostnatalSupervisorEvent. This event runs every week and is responsible for apply risk of complications to mothers and newborns in the postnatal and neonatal periods. Risk is applied after the first week of life as this is managed via PostnatalWeekOneMaternalEvent and PostnatalWeekOneNeonatalEvent. In addition this event ensures that the relevant postnatal/neonatal variables are reset for those who survive.

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

Functions (defined or overridden in class PostnatalSupervisorEvent):

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

Must be implemented by subclasses.

Parameters

population – the current population

class PostnatalWeekOneMaternalEvent(module, individual_id)[source]

This is PostnatalWeekOneMaternalEvent. It is scheduled for all mothers who survive labour and the first 48 hours after birth. This event applies risk of key complications that can occur in the first week after birth. This event also schedules postnatal care for those women predicted to attend after 48 hours or in the situation where they have developed a complication. For women who dont seek care for themselves risk of death is applied.

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

Functions (defined or overridden in class PostnatalWeekOneMaternalEvent):

__init__(module, individual_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(individual_id)[source]

Apply this event to the given person.

Must be implemented by subclasses.

Parameters

person_id – the person the event happens to

class PostnatalWeekOneNeonatalEvent(module, individual_id)[source]

This is PostnatalWeekOneEvent. It is scheduled for all newborns who survive labour and the first 48 hours after birth. This event applies risk of key complications that can occur in the first week after birth. This event also schedules postnatal care for those newborns predicted to attend after 48 hours or in the situation where they have developed a complication. For newborns who dont seek care for themselves risk of death is applied.

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

Functions (defined or overridden in class PostnatalWeekOneNeonatalEvent):

__init__(module, individual_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(individual_id)[source]

Apply this event to the given person.

Must be implemented by subclasses.

Parameters

person_id – the person the event happens to

class HSI_PostnatalSupervisor_TreatmentForObstetricFistula(module, person_id)[source]
This is HSI_PostnatalSupervisor_TreatmentForObstetricFistula. It is scheduled by the on_birth function of this

module for women have developed obstetric fistula and choose to seek care. Treatment delivered in this event

includes surgical correction of obstetric fistula

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

Functions (defined or overridden in class HSI_PostnatalSupervisor_TreatmentForObstetricFistula):

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