From 6b9a1d5e8bd7e6817cf479b3fec7391a969a68ae Mon Sep 17 00:00:00 2001 From: BinglingICL <86234515+BinglingICL@users.noreply.github.com> Date: Mon, 27 Feb 2023 22:04:57 +0000 Subject: [PATCH] introduce the probability of checking and correct diagnosis for a stunted person to calibrate the use of U5Malnutr appointment (#831) --- resources/ResourceFile_Stunting.xlsx | 4 +-- src/tlo/methods/stunting.py | 17 +++++++---- tests/test_stunting.py | 44 ++++++++++++++++++++++++++-- 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/resources/ResourceFile_Stunting.xlsx b/resources/ResourceFile_Stunting.xlsx index 9a04833ba8..75e239f64b 100644 --- a/resources/ResourceFile_Stunting.xlsx +++ b/resources/ResourceFile_Stunting.xlsx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50761e7a5a53b94146fb594aa5c81b64965a7a9eef0929a3fd7052937324ec21 -size 16206 +oid sha256:3d337e117612c4bc2119edb584ce61c5e346a6f355b1a2dc971c4165c585836a +size 16162 diff --git a/src/tlo/methods/stunting.py b/src/tlo/methods/stunting.py index e89d3a5a80..2ed382f628 100644 --- a/src/tlo/methods/stunting.py +++ b/src/tlo/methods/stunting.py @@ -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 = { @@ -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 diff --git a/tests/test_stunting.py b/tests/test_stunting.py index 805b8ace94..fcb047f5da 100644 --- a/tests/test_stunting.py +++ b/tests/test_stunting.py @@ -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) @@ -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) @@ -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.""" @@ -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)