Skip to content

Gabriel/syphilis - #1885

Open
Gabbie123king wants to merge 5 commits into
masterfrom
gabriel/syphilis
Open

Gabbie123king wants to merge 5 commits into
masterfrom
gabriel/syphilis

Conversation

@Gabbie123king

Copy link
Copy Markdown
Collaborator

Summary

This PR introduces a Syphilis module for the TLO model, focusing on maternal infection during pregnancy and its potential consequences for the fetus and newborn.

The current implementation establishes the core disease mechanics required before calibration, intervention analysis, and epidemiological validation.

Changes introduced

The module represents:

  • Pre-existing maternal syphilis at pregnancy entry
  • Incident syphilis infection during pregnancy
  • Primary, secondary, early latent, and late latent disease stages
  • Progression between disease stages
  • Maternal syphilis treatment
  • Vertical transmission to the fetus
  • Congenital syphilis
  • Syphilis-associated stillbirth
  • Relevant maternal and newborn properties and outputs
  • Interactions with pregnancy and newborn modules

Validation

A dedicated tests/test_syphilis.py test file has been added to validate the module’s core behaviour, including:

  • Module initialisation and parameter loading
  • Assignment of pre-existing infection
  • Initial disease-stage assignment
  • Incident infection
  • Disease progression
  • Maternal treatment
  • Vertical transmission
  • Congenital syphilis
  • Large-population simulation smoke testing

Current status

This PR focuses on establishing and reviewing the core disease mechanics. Calibration and full epidemiological validation are outside the scope of this PR.

Further work will include:

  • Resolving any remaining issues identified during review
  • Confirming interactions with PregnancySupervisor, CareOfWomenDuringPregnancy, and NewbornOutcomes
  • Calibrating baseline prevalence and disease-stage distribution
  • Adding screening and treatment cascade outputs
  • Developing intervention scenarios
  • Performing epidemiological validation
  • Preparing the module and methods documentation

Progresses #1884

Comment thread src/tlo/methods/syphilis.py
Comment thread src/tlo/methods/syphilis.py
Comment thread src/tlo/methods/syphilis.py
return

df.at[individual_id, 'ps_syphilis_state'] = 'primary'
df.at[individual_id, 'ps_syphilis_treated'] = False

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wont this be false already anyway?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Joe, It will usually already be False, but a woman could have received treatment earlier in the pregnancy before this scheduled incident infection occurs. Resetting it here ensures the new infection is treated as untreated and is not incorrectly prevented from progressing by the earlier treatment flag. Apologies for delays, am addressing some of the comments in the model and updating the write-up for each change, logic and code cleanup. It will be shared soon.

Comment thread src/tlo/methods/syphilis.py
df.loc[id_or_index, 'ps_premature_rupture_of_membranes'] = False
df.loc[id_or_index, 'ps_chorioamnionitis'] = False
df.loc[id_or_index, 'ps_emergency_event'] = False
self.sim.modules['Syphilis'].reset_pregnancy_syphilis_properties(id_or_index)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, if were having the separate syphilis module i think you can just set the properties within the syphilis module itself (its cleaner)

Comment thread src/tlo/methods/syphilis.py
self.module.apply_risk_of_premature_rupture_of_membranes_and_chorioamnionitis(
gestation_of_interest=gestation_of_interest)

self.sim.modules['Syphilis'].apply_risk_of_congenital_syphilis(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an epidemiological reason for only applying the risk of congenital infection starting at 22 weeks gestational age?

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

DETECTABLE_STAGES = ['primary', 'secondary', 'early_latent', 'late_latent']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the 'non-detectable stages'? or is this just a test

df.at[person, 'ps_congenital_syphilis'] = True
pregnancy_helper_functions.store_dalys_in_mni(
person, mni, 'congenital_syphilis_onset', module.sim.date
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does congenital infection have its own DALY weight attached?

future_stillbirth_weeks = [
week for week in CONGENITAL_SYPHILIS_STILLBIRTH_CHECKPOINTS
if week >= gestation_of_interest
]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain whats happening here?

df.at[child_id, 'nb_early_preterm'] = False
df.at[child_id, 'nb_late_preterm'] = False
df.at[child_id, 'nb_preterm_birth_disab'] = 'none'
self.sim.modules['Syphilis'].do_newborn_congenital_syphilis_handoff(mother_id, child_id)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would move this until after the properties are set and then add a comment explaining whats happening

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also - currently there are no newborn outcomes (death/disability) associated with congential syphils. is that the case?

Comment thread src/tlo/methods/pregnancy_supervisor.py
Comment thread src/tlo/methods/syphilis.py

# We assume that treatment is 100% effective at curing infection
df.at[person_id, 'ps_syphilis'] = False
self.sim.modules['Syphilis'].treat_maternal_syphilis(person_id)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok if this is the approach thats doing to be taken we need to review the parameters which determine if screening etc are delivered because currently treatment is essentially never delivered

Comment thread tests/test_pregnancy_supervisor.py


def test_congenital_syphilis_stillbirth_risk_is_drawn_once_at_transmission(seed):
"""Changing congenital stillbirth risk after infection should not create later repeated draws."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont follow the logic of this test! maybe some more description needed



def test_assigned_congenital_syphilis_stillbirth_is_applied_at_next_checkpoint(seed):
"""A congenital syphilis stillbirth assigned at infection should be applied at the next stillbirth checkpoint."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i understand the logic here - is there an epidemiological reason as to why you cant apply risk of congenital infection and stillbirth in the same month?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants