tlo.methods.pregnancy_supervisor module

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

This module is responsible for simulating the antenatal period of pregnancy (the period from conception until the termination of pregnancy). A number of outcomes are managed by this module including early pregnancy loss (induced/spontaneous abortion, ectopic pregnancy and antenatal stillbirth) and pregnancy complications of the antenatal period (nutritional deficiencies , anaemia, placental praevia/abruption, premature rupture of membranes (PROM), chorioamnionitis, hypertensive disorders (gestational hypertension, pre-eclampsia, eclampsia), gestational diabetes, maternal death). This module calculates likelihood of care seeking for routine antenatal care and emergency obstetric care in the event of severe complications.

Bases: tlo.core.Module

PARAMETERS:

Item

Type

Description

prob_ectopic_pregnancy

LIST

probability of ectopic pregnancy

prob_care_seeking_ectopic_pre_rupture

LIST

probability a woman will seek care for ectopic pregnancy prior to rupture

prob_ectopic_pregnancy_death

LIST

probability of a woman dying from a ruptured ectopic pregnancy

prob_multiples

LIST

probability that a woman is currently carrying more than one pregnancy

prob_placenta_praevia

LIST

probability that this womans pregnancy will be complicated by placenta praevia

rr_placenta_praevia_previous_cs

LIST

relative risk of placenta praevia in a woman who has previously delivered via caesarean section

prob_syphilis_during_pregnancy

LIST

probability that this womans will develop syphilis during her pregnancy

prob_previous_miscarriage_at_baseline

REAL

probability that a woman at baseline will have previously experienced a miscarriage

prob_spontaneous_abortion_per_month

LIST

underlying risk of spontaneous abortion per month

rr_spont_abortion_age_35

LIST

relative risk of spontaneous abortion in women aged 35 years or older

rr_spont_abortion_age_31_34

LIST

relative risk of spontaneous abortion in women aged 31-34 years old

rr_spont_abortion_prev_sa

LIST

relative risk of spontaneous abortion in women who have previously experiences spontaneous abortion

prob_complicated_sa

LIST

probability that a woman who experiences spontaneous abortion with experience any complications

prob_induced_abortion_per_month

LIST

underlying risk of induced abortion per month

prob_complicated_ia

LIST

probability that a woman who experiences induced abortion with experience any complications

prob_haemorrhage_post_abortion

LIST

probability of haemorrhage following an abortion

prob_sepsis_post_abortion

LIST

probability of sepsis following an abortion

prob_injury_post_abortion

LIST

probability of injury following an abortion

prob_induced_abortion_death

LIST

underlying risk of death following an induced abortion

prob_spontaneous_abortion_death

LIST

underlying risk of death following an spontaneous abortion

baseline_prob_anaemia_per_month

LIST

baseline risk of a woman developing anaemia secondary only to pregnant

rr_anaemia_maternal_malaria

LIST

relative risk of anaemia secondary to malaria infection

rr_anaemia_hiv_no_art

LIST

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

prob_mild_mod_sev_anaemia

LIST

probabilities that a womans anaemia will be mild, moderate or severe

prob_gest_diab_per_month

LIST

underlying risk of gestational diabetes per month without the impact of risk factors

rr_gest_diab_obesity

LIST

Relative risk of gestational diabetes for women who are obese

prob_gest_htn_per_month

LIST

underlying risk of gestational hypertension per month without the impact of risk factors

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

rr_pre_eclampsia_obesity

LIST

Relative risk of pre-eclampsia for women who are obese

rr_pre_eclampsia_multiple_pregnancy

LIST

Relative risk of pre-eclampsia for women who are pregnant with twins

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

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

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

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

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

LIST

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

prob_severe_pre_eclampsia_death

LIST

probability of death for a woman experiencing acute severe pre-eclampsia

prob_eclampsia_death

LIST

probability of death for a woman experiencing eclampsia

prob_monthly_death_severe_htn

LIST

monthly risk of death for a woman with severe hypertension

prob_placental_abruption_per_month

LIST

monthly probability that a woman will develop placental abruption

rr_placental_abruption_hypertension

LIST

Relative risk of placental abruption in women with hypertension

rr_placental_abruption_previous_cs

LIST

Relative risk of placental abruption in women who delivered previously via caesarean section

prob_aph_placenta_praevia

LIST

risk of antepartum haemorrhage due to ongoing placenta praevia

prob_aph_placental_abruption

LIST

risk of antepartum haemorrhage due to placental abruption

prob_mod_sev_aph

LIST

probabilities that APH is mild/moderate or severe

prob_antepartum_haemorrhage_death

LIST

probability of death for a woman suffering acute antepartum haemorrhage

prob_prom_per_month

LIST

monthly probability that a woman will experience premature rupture of membranes

prob_chorioamnionitis

LIST

monthly probability of a women developing chorioamnionitis

prob_antenatal_sepsis_death

LIST

case fatality rate for chorioamnionitis

baseline_prob_early_labour_onset

LIST

monthly baseline risk of labour onsetting before term

rr_preterm_labour_post_prom

LIST

relative risk of early labour onset following PROM

rr_preterm_labour_anaemia

LIST

relative risk of early labour onset in women with anaemia

rr_preterm_labour_malaria

LIST

relative risk of early labour onset in women with malaria

rr_preterm_labour_multiple_pregnancy

LIST

relative risk of early labour onset in women pregnant with twins

prob_still_birth_per_month

LIST

underlying risk of stillbirth per month without the impact of risk factors

rr_still_birth_ga_41

LIST

relative risk of still birth in women with gestational age 41 weeks

rr_still_birth_ga_42

LIST

relative risk of still birth in women with gestational age 42 weeks

rr_still_birth_ga_>42

LIST

relative risk of still birth in women with gestational age > 42 weeks

rr_still_birth_gest_diab

LIST

relative risk of still birth in women with gestational diabetes

rr_still_birth_diab_mellitus

LIST

relative risk of still birth in women with diabetes mellitus

rr_still_birth_maternal_malaria

LIST

relative risk of still birth in women with malaria

rr_still_birth_maternal_syphilis

LIST

relative risk of still birth in women with syphilis

rr_still_birth_pre_eclampsia

LIST

relative risk of still birth in women with pre-eclampsia

rr_still_birth_eclampsia

LIST

relative risk of still birth in women with eclampsia

rr_still_birth_gest_htn

LIST

relative risk of still birth in women with mild gestational hypertension

rr_still_birth_chronic_htn

LIST

relative risk of still birth in women with chronic hypertension

rr_still_birth_aph

LIST

relative risk of still birth in women with antepartum haemorrhage

rr_still_birth_chorio

LIST

relative risk of still birth in women with chorioamnionitis

prob_seek_care_pregnancy_complication

LIST

Probability that a woman who is pregnant will seek care in the event of a complication

prob_seek_care_pregnancy_loss

LIST

Probability that a woman who has developed complications post pregnancy loss will seek care

prob_seek_care_induction

LIST

Probability that a woman who is post term will seek care for induction of labour

prob_anc1_months_2_to_4

LIST

list of probabilities that a woman will attend her first ANC visit at either month 2, 3 or 4 of pregnancy

prob_anc1_months_5_to_9

LIST

list of probabilities that a woman will attend her first ANC visit on months 5-10

odds_early_init_anc4

LIST

probability of a woman undergoing 4 or more basic ANC visits with the first visit occurring prior or during month 4 of pregnancy (EANC4+)

aor_early_anc4_20_24

LIST

adjusted odds ratio of EANC4+ in women aged 20-24

aor_early_anc4_25_29

LIST

adjusted odds ratio of EANC4+ in women aged 25-29

aor_early_anc4_30_34

LIST

adjusted odds ratio of EANC4+ in women aged 30-34

aor_early_anc4_35_39

LIST

adjusted odds ratio of EANC4+ in women aged 35-39

aor_early_anc4_40_44

LIST

adjusted odds ratio of EANC4+ in women aged 40-44

aor_early_anc4_45_49

LIST

adjusted odds ratio of EANC4+ in women aged 45-49

aor_early_anc4_2010

LIST

adjusted odds ratio of EANC4+ in 2010

aor_early_anc4_2015

LIST

adjusted odds ratio of EANC4+ in 2015

aor_early_anc4_parity_2_3

LIST

adjusted odds ratio of EANC4+ in women with a parity of 2-3

aor_early_anc4_parity_4_5

LIST

adjusted odds ratio of EANC4+ in women with a parity of 4-5

aor_early_anc4_parity_6+

LIST

adjusted odds ratio of EANC4+ in women with a parity of 6+

aor_early_anc4_primary_edu

LIST

adjusted odds ratio of EANC4+ in women with primary education

aor_early_anc4_secondary_edu

LIST

adjusted odds ratio of EANC4+ in women with secondary education

aor_early_anc4_tertiary_edu

LIST

adjusted odds ratio of EANC4+ in women with tertiary education

aor_early_anc4_middle_wealth

LIST

adjusted odds ratio of EANC4+ in women in the middle wealth quintile

aor_early_anc4_richer_wealth

LIST

adjusted odds ratio of EANC4+ in women in the richer wealth quintile

aor_early_anc4_richest_wealth

LIST

adjusted odds ratio of EANC4+ in women in the richest wealth quintile

aor_early_anc4_married

LIST

adjusted odds ratio of EANC4+ in women who are married

aor_early_anc4_previously_married

LIST

adjusted odds ratio of EANC4+ in women who were previously married (divorced/widowed)

prob_late_initiation_anc4

LIST

probability a woman will undertake 4 or more ANC visits with the first being after 4 months

prob_early_initiation_anc_below4

LIST

probabilities a woman will attend fewer than 4 ANC visits but the first visit will occur before month 4

prob_early_anc_at_facility_level_1_2

LIST

probabilities a woman will attend ANC 1 at facility levels 1 or 2

treatment_effect_ectopic_pregnancy_treatment

LIST

Treatment effect of ectopic pregnancy case management

treatment_effect_post_abortion_care

LIST

Treatment effect of post abortion care

treatment_effect_iron_folic_acid_anaemia

LIST

relative effect of daily iron and folic acid treatment on risk of maternal anaemia

treatment_effect_calcium_pre_eclamp

LIST

risk reduction of pre-eclampsia for women taking daily calcium supplementation

treatment_effect_gest_htn_calcium

LIST

Effect of calcium supplementation on risk of developing gestational hypertension

treatment_effect_anti_htns_progression

LIST

Effect of anti hypertensive medication in reducing the risk of progression from mild to severe hypertension

prob_glycaemic_control_diet_exercise

LIST

probability a womans GDM is controlled by diet and exercise during the first month of treatment

prob_glycaemic_control_orals

LIST

probability a womans GDM is controlled by oral anti-diabetics during the first month of treatment

treatment_effect_gdm_case_management

LIST

Treatment effect of GDM case management on mothers risk of stillbirth

treatment_effect_still_birth_food_sups

LIST

risk reduction of still birth for women receiving nutritional supplements

treatment_effect_modifier_all_delays

LIST

factor by which treatment effectiveness is reduced in the presences of multiple delays

treatment_effect_modifier_one_delay

LIST

factor by which treatment effectiveness is reduced in the presences of one delays

anc_service_structure

INT

stores type of ANC service being delivered in the model (anc4 or anc8) and is used in analysis scripts to change ANC structure

switch_anc_coverage

BOOL

used to signal if a change in parameters governing ANC coverage should be made at some predetermined time point

target_anc_coverage_for_analysis

REAL

contains a target level of coverage for analysis so that a linear model of choice can be scaled to force set level of intervention coverage

PROPERTIES:

Item

Type

Description

ps_gestational_age_in_weeks

REAL

current gestational age, in weeks, of a womans pregnancy

ps_date_of_anc1

DATE

Date first ANC visit is scheduled for

ps_ectopic_pregnancy

CATEGORICAL

Whether a womans is experiencing ectopic pregnancy and its current state. Possible values are: [none, not_ruptured, ruptured, ]

ps_multiple_pregnancy

BOOL

Whether a womans is pregnant with multiple fetuses

ps_placenta_praevia

BOOL

Whether a womans pregnancy will be complicated by placentapraevia

ps_syphilis

BOOL

Whether a womans has syphilis during pregnancy

ps_anaemia_in_pregnancy

CATEGORICAL

Whether a woman has anaemia in pregnancy and its severity. Possible values are: [none, mild, moderate, severe, ]

ps_anc4

BOOL

Whether this womans is predicted to attend 4 or more antenatal care visits during her pregnancy

ps_abortion_complications

INT

Bitset column holding types of abortion complication

ps_prev_spont_abortion

BOOL

Whether this woman has had any previous pregnancies end in spontaneous abortion

ps_prev_stillbirth

BOOL

Whether this woman has had any previous pregnancies end in still birth

ps_htn_disorders

CATEGORICAL

if this woman suffers from a hypertensive disorder of pregnancy. Possible values are: [none, gest_htn, severe_gest_htn, mild_pre_eclamp, severe_pre_eclamp, eclampsia, ]

ps_prev_pre_eclamp

BOOL

whether this woman has experienced pre-eclampsia in a previous pregnancy

ps_gest_diab

CATEGORICAL

whether this woman is experiencing gestational diabetes. Possible values are: [none, uncontrolled, controlled, ]

ps_prev_gest_diab

BOOL

whether this woman has ever suffered from gestational diabetes during a previous pregnancy

ps_placental_abruption

BOOL

Whether this woman is experiencing placental abruption

ps_antepartum_haemorrhage

CATEGORICAL

severity of this womans antepartum haemorrhage. Possible values are: [none, mild_moderate, severe, ]

ps_premature_rupture_of_membranes

BOOL

whether this woman has experience rupture of membranes before the onset of labour. If this is <37 weeks from gestation the woman has preterm premature rupture of membranes

ps_chorioamnionitis

BOOL

Whether a womans is experiencing chorioamnionitis

ps_emergency_event

BOOL

signifies a woman in undergoing an acute emergency event in her pregnancy- used to consolidated care seeking in the instance of multiple complications

Class attributes:

ADDITIONAL_DEPENDENCIES : {‘CareOfWomenDuringPregnancy’, ‘Lifestyle’, ‘Labour’, ‘HealthSystem’, ‘Contraception’}

CAUSES_OF_DEATH : {‘ectopic_pregnancy’: <tlo.methods.causes.Cause object at 0x7feb91fe3430>, ‘spontaneous_abortion’: <tlo.methods.causes.Cause object at 0x7feb91fe3910>, ‘induced_abortion’: <tlo.methods.causes.Cause object at 0x7feb91fe3970>, ‘antepartum_haemorrhage’: <tlo.methods.causes.Cause object at 0x7feb91fe39d0>, ‘severe_gestational_hypertension’: <tlo.methods.causes.Cause object at 0x7feb91fe3a30>, ‘severe_pre_eclampsia’: <tlo.methods.causes.Cause object at 0x7feb91fe3a90>, ‘eclampsia’: <tlo.methods.causes.Cause object at 0x7feb91fe3af0>, ‘antenatal_sepsis’: <tlo.methods.causes.Cause object at 0x7feb91fe3b50>}

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

INIT_DEPENDENCIES : {‘Demography’}

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

OPTIONAL_INIT_DEPENDENCIES : {‘CardioMetabolicDisorders’, ‘Malaria’, ‘HealthBurden’, ‘Hiv’}

Functions (defined or overridden in class PregnancySupervisor):

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

This function calculates and reports the monthly daly weight values accumulated from Maternal Disorders. For simplicity all daly weights from Maternal Disorders are reported in this module (though may be attributable to conditions occurring antenatally, intrapartum or postnatally). Individual level monthly-daly weights are calculated using the mni dictionary where date of complication onset/resolution is stored. :return: daly_series

pregnancy_supervisor_property_reset(id_or_index)[source]

This function is called when all properties housed in the PregnancySupervisorModule should be reset. For example following pregnancy loss :param id_or_index: pass the function either an individual ID (INT) or index of subset of data frame

apply_linear_model(lm, df_slice)[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_slice: The dataframe :return: Series with same index containing outcomes (bool)

schedule_anc_one(individual_id, anc_month)[source]
This functions calculates the correct date each woman will attend her first ANC contact and schedules the visit

for newly pregnant women depending on their predicted month of attendance

Parameters
  • anc_month – month of pregnancy that woman will attend ANC 1

  • individual_id – individual_id

apply_risk_of_spontaneous_abortion(gestation_of_interest)[source]

This function applies risk of spontaneous abortion to a slice of data frame and is called by PregnancySupervisorEvent. It calls the do_after_abortion function for women who loose their pregnancy. :param gestation_of_interest: gestation in weeks

apply_risk_of_induced_abortion(gestation_of_interest)[source]

This function applies risk of induced abortion to a slice of data frame and is called by PregnancySupervisorEvent. It calls the do_after_abortion for women who loose their pregnancy. :param gestation_of_interest: gestation in weeks

do_after_abortion(individual_id, type_abortion)[source]

This function is called for all women who experience a spontaneous or induced abortion. The function logs the pregnancy loss, resets key variables and determines risk of complication. :param individual_id: individual id :param type_abortion: STR “induced” or “spontaneous”

apply_risk_of_abortion_complications(individual_id, cause)[source]

This function makes stores the type of complication experience by a woman following abortion. :param individual_id: individual_id :param cause: ‘type’ of abortion (spontaneous abortion OR induced abortion) (str)

apply_risk_of_anaemia(gestation_of_interest)[source]

This function applies risk of anaemia to a slice of the data frame. It is called by PregnancySupervisorEvent :param gestation_of_interest: gestation in weeks

apply_risk_of_gestational_diabetes(gestation_of_interest)[source]

This function applies risk of gestational diabetes to a slice of the data frame. It is called by PregnancySupervisorEvent. :param gestation_of_interest: gestation in weeks

apply_risk_of_hypertensive_disorders(gestation_of_interest)[source]

This function applies risk of mild pre-eclampsia and mild gestational diabetes to a slice of the data frame. It is called by PregnancySupervisorEvent. :param gestation_of_interest: gestation in weeks

apply_risk_of_progression_of_hypertension(gestation_of_interest)[source]

This function applies a risk of progression of hypertensive disorders to women who are experiencing one of the hypertensive disorders. It is called by PregnancySupervisorEvent :param gestation_of_interest: gestation in weeks

apply_risk_of_death_from_hypertension(gestation_of_interest)[source]

This function applies risk of death to women with severe hypertensive disease (severe gestational hypertension/ severe pre-eclampsia). For women who die this function schedules InstantaneousDeathEvent. :param gestation_of_interest: gestation in weeks

apply_risk_of_placental_abruption(gestation_of_interest)[source]

This function applies risk of placental abruption to a slice of the dataframe. It is called by PregnancySupervisorEvent. :param gestation_of_interest: gestation in weeks

apply_risk_of_antepartum_haemorrhage(gestation_of_interest)[source]

This function applies risk of antepartum haemorrhage to a slice of the dataframe. It is called by PregnancySupervisorEvent. :param gestation_of_interest: gestation in weeks

apply_risk_of_sepsis_post_prom(gestation_of_interest)[source]

This function applies risk of chorioamnionitis to women who have experienced premature rupture of membranes during labour :param gestation_of_interest: gestation in weeks

apply_risk_of_premature_rupture_of_membranes(gestation_of_interest)[source]

This function applies risk of premature rupture of membranes to a slice of the dataframe. It is called by PregnancySupervisorEvent. :param gestation_of_interest: gestation in weeks

apply_risk_of_preterm_labour(gestation_of_interest)[source]

This function applies risk of preterm labour to a slice of the dataframe. It is called by PregnancySupervisorEvent. :param gestation_of_interest: gestation in weeks

update_variables_post_still_birth_for_data_frame(women)[source]

This function updates variables for a slice of the dataframe who have experience antepartum stillbirth :param women: women who are experiencing stillbirth

update_variables_post_still_birth_for_individual(individual_id)[source]

This function is called to reset all the relevant pregnancy and treatment variables for a woman who undergoes stillbirth outside of the PregnancySupervisor polling event. :param individual_id: individual_id

apply_risk_of_still_birth(gestation_of_interest)[source]

This function applies risk of still birth to a slice of the data frame. It is called by PregnancySupervisorEvent :param gestation_of_interest: INT used to select women from the data frame at certain gestation

induction_care_seeking_and_still_birth_risk(gestation_of_interest)[source]

This function is called for post term women and applies a probability that they will seek care for induction and if not will experience risk of antenatal stillbirth :param gestation_of_interest: INT used to select women from the data frame at certain gestation

care_seeking_pregnancy_loss_complications(individual_id, cause)[source]

This function manages care seeking for women experiencing ectopic pregnancy or complications following spontaneous/induced abortion. :param individual_id: individual_id :param cause: ‘abortion’, ‘ectopic_pre_rupture’, ‘ectopic_ruptured’ :return: Returns True/False value to signify care seeking

apply_risk_of_death_from_monthly_complications(individual_id)[source]

This function calculates the risk of death for women who have developed complications but have not received treatment. It is called by the PregnancySupervisor Event and HSI_CareOfWomenDuringPregnancy_Maternal EmergencyAssessment if care cant be delivered . :param individual_id: individual_id

schedule_first_anc_contact_for_new_pregnancy(gestation_of_interest)[source]
This function is called by the PregnancySupervisorEvent for all pregnant women at 8 weeks gestational age to

determine if/when they will attend their first ANC visit.

Parameters

gestation_of_interest – INT used to select women from the data frame at certain gestation

class PregnancySupervisorEvent(module)[source]

This is the PregnancySupervisorEvent, it is a weekly event which has four primary functions. 1.) It updates the gestational age (in weeks) of all women who are pregnant 2.) It applies monthly risk of key complications associated with pregnancy 3.) It determines if women who experience life seeking complications associated with pregnancy will seek care 4.) It applies risk of death and stillbirth to women who do not seek care following complications

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

Functions (defined or overridden in class PregnancySupervisorEvent):

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

This is EctopicPregnancyEvent. It is scheduled by the set_pregnancy_complications function within PregnancySupervisorEvent for women who have experienced ectopic pregnancy. This event makes changes to the data frame for women with ectopic pregnancies, applies a probability of care seeking and schedules the EctopicRuptureEvent.

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

Functions (defined or overridden in class EctopicPregnancyEvent):

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

  • priority – a keyword-argument to set the priority (see Priority enum)

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

This is EctopicPregnancyRuptureEvent. It is scheduled by the EctopicPregnancyEvent for women who have experienced an ectopic pregnancy which has ruptured due to lack of treatment. This event manages care seeking post rupture and schedules EarlyPregnancyLossDeathEvent

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

Functions (defined or overridden in class EctopicPregnancyRuptureEvent):

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

  • priority – a keyword-argument to set the priority (see Priority enum)

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

This is EarlyPregnancyLossDeathEvent. It is scheduled by the EctopicPregnancyRuptureEvent & abortion for women who are at risk of death following a loss of their pregnancy

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

Functions (defined or overridden in class EarlyPregnancyLossDeathEvent):

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

This is GestationalDiabetesGlycaemicControlEvent. It is scheduled by CareOfWomenDuringPregnancy module after a woman is started on treatment for gestational diabetes. This event determines if the treatment a woman has been started on for GDM will effectively control her blood sugars

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

Functions (defined or overridden in class GestationalDiabetesGlycaemicControlEvent):

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

  • priority – a keyword-argument to set the priority (see Priority enum)

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

This is SyphilisInPregnancyEvent. It is scheduled by PregnancySupervisorEvent module after a woman becomes pregnant and is predicted to experience syphilis during their pregnancy. This event onsets Syphilis in those women

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

Functions (defined or overridden in class SyphilisInPregnancyEvent):

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

  • priority – a keyword-argument to set the priority (see Priority enum)

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

This is ParameterUpdateEvent. It is scheduled to occur once on 2015 to update parameters being used by the maternal and newborn health model

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

Functions (defined or overridden in class ParameterUpdateEvent):

__init__(module)[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(population)[source]

Apply this event to the population.

Must be implemented by subclasses.

Parameters

population – the current population

class OverrideKeyParameterForAnalysis(module)[source]
This is OverrideKeyParameterForAnalysis. This event is scheduled in initialise_simulation and allows for a parameter

value/values to be overridden at a set time point within a simulation run.

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

Functions (defined or overridden in class OverrideKeyParameterForAnalysis):

__init__(module)[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(population)[source]

Apply this event to the population.

Must be implemented by subclasses.

Parameters

population – the current population

class PregnancyLoggingEvent(module)[source]

This is PregnancyLoggingEvent. It runs yearly to produce summary statistics around pregnancy.

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

Functions (defined or overridden in class PregnancyLoggingEvent):

__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