Skip to content

Commit

Permalink
introduce the probability of checking and correct diagnosis for a stu…
Browse files Browse the repository at this point in the history
…nted person to calibrate the use of U5Malnutr appointment (#831)
  • Loading branch information
BinglingICL authored Feb 27, 2023
1 parent 67bff08 commit 6b9a1d5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 10 deletions.
4 changes: 2 additions & 2 deletions resources/ResourceFile_Stunting.xlsx
Git LFS file not shown
17 changes: 12 additions & 5 deletions src/tlo/methods/stunting.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ class Stunting(Module):
'effectiveness_of_food_supplementation_in_stunting_reduction': Parameter(
Types.REAL,
'Probability of stunting being reduced by one standard deviation (category) by supplementary feeding.'),

# The probability of a (severe) stunting person being checked and correctly diagnosed
'prob_stunting_diagnosed_at_generic_appt': Parameter(
Types.REAL,
'Probability of a stunted or severely stunted person being checked and correctly diagnosed'),
}

PROPERTIES = {
Expand Down Expand Up @@ -274,15 +279,17 @@ def do_routine_assessment_for_chronic_undernutrition(self, person_id):
df = self.sim.population.props
person = df.loc[person_id]
is_stunted = person.un_HAZ_category in ('HAZ<-3', '-3<=HAZ<-2')
p_stunting_diagnosed = self.parameters['prob_stunting_diagnosed_at_generic_appt']

if not is_stunted:
return

# Schedule the HSI for provision of treatment
self.sim.modules['HealthSystem'].schedule_hsi_event(
hsi_event=HSI_Stunting_ComplementaryFeeding(module=self, person_id=person_id),
priority=2, # <-- lower priority that for wasting and most other HSI
topen=self.sim.date)
# Schedule the HSI for provision of treatment based on the probability of stunting diagnosis
if p_stunting_diagnosed > self.rng.random_sample():
self.sim.modules['HealthSystem'].schedule_hsi_event(
hsi_event=HSI_Stunting_ComplementaryFeeding(module=self, person_id=person_id),
priority=2, # <-- lower priority that for wasting and most other HSI
topen=self.sim.date)

def do_treatment(self, person_id, prob_success):
"""Represent the treatment with supplementary feeding. If treatment is successful, effect the recovery
Expand Down
44 changes: 41 additions & 3 deletions tests/test_stunting.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ def test_polling_event_progression(seed):
assert (df.loc[df.is_alive & (df.age_years >= 5), 'un_HAZ_category'] == 'HAZ>=-2').all()


def test_routine_assessment_for_chronic_undernutrition_if_stunted(seed):
def test_routine_assessment_for_chronic_undernutrition_if_stunted_and_correctly_diagnosed(seed):
"""Check that a call to `do_routine_assessment_for_chronic_undernutrition` can lead to immediate recovery for a
stunted child (via an HSI)."""
stunted child (via an HSI), if there is checking and correct diagnosis."""
popsize = 100
sim = get_sim(seed)
sim.make_initial_population(n=popsize)
Expand All @@ -237,6 +237,9 @@ def test_routine_assessment_for_chronic_undernutrition_if_stunted(seed):
df.loc[person_id, 'age_exact_year'] = 2.0
df.loc[person_id, 'un_HAZ_category'] = '-3<=HAZ<-2'

# Make the probability of stunting checking/diagnosis as 1.0
sim.modules['Stunting'].parameters['prob_stunting_diagnosed_at_generic_appt'] = 1.0

# Subject the person to `do_routine_assessment_for_chronic_undernutrition`
sim.modules['Stunting'].do_routine_assessment_for_chronic_undernutrition(person_id=person_id)

Expand Down Expand Up @@ -281,6 +284,41 @@ def test_routine_assessment_for_chronic_undernutrition_if_stunted(seed):
]


def test_routine_assessment_for_chronic_undernutrition_if_stunted_but_no_checking(seed):
"""Check that a call to `do_routine_assessment_for_chronic_undernutrition` does not lead to an HSI for a stunted
child, if there is no checking/diagnosis."""
popsize = 100
sim = get_sim(seed)
sim.make_initial_population(n=popsize)
sim.simulate(end_date=sim.start_date)
sim.modules['HealthSystem'].reset_queue()

# Make one person have severe stunting
df = sim.population.props
person_id = 0
df.loc[person_id, 'age_years'] = 2
df.loc[person_id, 'age_exact_year'] = 2.0
df.loc[person_id, 'un_HAZ_category'] = 'HAZ<-3'

# Make the probability of stunting checking/diagnosis as 0.0
sim.modules['Stunting'].parameters['prob_stunting_diagnosed_at_generic_appt'] = 0.0

# Subject the person to `do_routine_assessment_for_chronic_undernutrition`
sim.modules['Stunting'].do_routine_assessment_for_chronic_undernutrition(person_id=person_id)

# Check that there is no HSI scheduled for this person
hsi_event_scheduled = [ev[1] for ev in sim.modules['HealthSystem'].find_events_for_person(person_id) if
isinstance(ev[1], HSI_Stunting_ComplementaryFeeding)]
assert 0 == len(hsi_event_scheduled)

# Then make the probability of stunting checking/diagnosis as 1.0 and check the HSI is scheduled for this person
sim.modules['Stunting'].parameters['prob_stunting_diagnosed_at_generic_appt'] = 1.0
sim.modules['Stunting'].do_routine_assessment_for_chronic_undernutrition(person_id=person_id)
hsi_event_scheduled = [ev[1] for ev in sim.modules['HealthSystem'].find_events_for_person(person_id) if
isinstance(ev[1], HSI_Stunting_ComplementaryFeeding)]
assert 1 == len(hsi_event_scheduled)


def test_routine_assessment_for_chronic_undernutrition_if_not_stunted(seed):
"""Check that a call to `do_routine_assessment_for_chronic_undernutrition` does not lead to an HSI if there is no
stunting."""
Expand All @@ -300,7 +338,7 @@ def test_routine_assessment_for_chronic_undernutrition_if_not_stunted(seed):
# Subject the person to `do_routine_assessment_for_chronic_undernutrition`
sim.modules['Stunting'].do_routine_assessment_for_chronic_undernutrition(person_id=person_id)

# Check that there is an HSI scheduled for this person
# Check that there is no HSI scheduled for this person
hsi_event_scheduled = [ev[1] for ev in sim.modules['HealthSystem'].find_events_for_person(person_id) if
isinstance(ev[1], HSI_Stunting_ComplementaryFeeding)]
assert 0 == len(hsi_event_scheduled)
Expand Down

0 comments on commit 6b9a1d5

Please sign in to comment.