From b0b99838c680ca7fbaff367480d8d2a80e457de7 Mon Sep 17 00:00:00 2001 From: tdm32 Date: Mon, 9 Dec 2024 11:56:46 +0000 Subject: [PATCH 1/5] add HIV test at ART initiation --- src/tlo/methods/hiv.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tlo/methods/hiv.py b/src/tlo/methods/hiv.py index a8c621b6c1..4eb4908b47 100644 --- a/src/tlo/methods/hiv.py +++ b/src/tlo/methods/hiv.py @@ -2830,6 +2830,14 @@ def do_at_initiation(self, person_id): # ART is first item in drugs_available dict if drugs_available.get('art', False): + + # get confirmatory test + test_result = self.sim.modules["HealthSystem"].dx_manager.run_dx_test( + dx_tests_to_run="hiv_rapid_test", hsi_event=self + ) + df.at[person_id, "hv_number_tests"] += 1 + df.at[person_id, "hv_last_test_date"] = self.sim.date + # Assign person to be suppressed or un-suppressed viral load # (If person is VL suppressed This will prevent the Onset of AIDS, or an AIDS death if AIDS has already # onset) From 03fe82a9a913285a0bc3f2d79e274b9ab4a07969 Mon Sep 17 00:00:00 2001 From: tdm32 Date: Mon, 9 Dec 2024 12:27:57 +0000 Subject: [PATCH 2/5] add confirmatory test prior to VMMC procedure --- .../hiv/projections_jan2023/analysis_logged_deviance.py | 2 +- src/tlo/methods/enhanced_lifestyle.py | 2 +- src/tlo/methods/hiv.py | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/scripts/hiv/projections_jan2023/analysis_logged_deviance.py b/src/scripts/hiv/projections_jan2023/analysis_logged_deviance.py index 3902e5d49b..59023a7544 100644 --- a/src/scripts/hiv/projections_jan2023/analysis_logged_deviance.py +++ b/src/scripts/hiv/projections_jan2023/analysis_logged_deviance.py @@ -70,7 +70,7 @@ resourcefilepath=resourcefilepath, service_availability=["*"], # all treatment allowed mode_appt_constraints=1, # mode of constraints to do with officer numbers and time - cons_availability="all", # mode for consumable constraints (if ignored, all consumables available) + cons_availability="default", # mode for consumable constraints (if ignored, all consumables available) ignore_priority=False, # do not use the priority information in HSI event to schedule capabilities_coefficient=1.0, # multiplier for the capabilities of health officers use_funded_or_actual_staffing="actual", # actual: use numbers/distribution of staff available currently diff --git a/src/tlo/methods/enhanced_lifestyle.py b/src/tlo/methods/enhanced_lifestyle.py index 26c79d9587..74e2492cb9 100644 --- a/src/tlo/methods/enhanced_lifestyle.py +++ b/src/tlo/methods/enhanced_lifestyle.py @@ -661,7 +661,7 @@ def update_all_properties(self, df): :param df: The population dataframe """ # get months since last poll now = self.module.sim.date - months_since_last_poll = round((now - self.date_last_run) / np.timedelta64(1, "M")) + months_since_last_poll = round((now - self.date_last_run) / np.timedelta64(1, "W")) # loop through linear models dictionary and initialise each property in the population dataframe for _property_name, _model in self._models.items(): if _model['update'] is not None: diff --git a/src/tlo/methods/hiv.py b/src/tlo/methods/hiv.py index 4eb4908b47..7d733a4626 100644 --- a/src/tlo/methods/hiv.py +++ b/src/tlo/methods/hiv.py @@ -2493,6 +2493,13 @@ def apply(self, person_id, squeeze_factor): if not person["is_alive"]: return + # get confirmatory test + test_result = self.sim.modules["HealthSystem"].dx_manager.run_dx_test( + dx_tests_to_run="hiv_rapid_test", hsi_event=self + ) + df.at[person_id, "hv_number_tests"] += 1 + df.at[person_id, "hv_last_test_date"] = self.sim.date + # if person not circumcised, perform the procedure if not person["li_is_circ"]: # Check/log use of consumables, if materials available, do circumcision and schedule follow-up appts From 73e0ac1f0ae1f12722c86bd86cca2149cb03fe35 Mon Sep 17 00:00:00 2001 From: tdm32 Date: Mon, 9 Dec 2024 12:50:48 +0000 Subject: [PATCH 3/5] add confirmatory test prior to IPT initiation --- src/tlo/methods/tb.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/tlo/methods/tb.py b/src/tlo/methods/tb.py index c067a78929..b0f0cd22f6 100644 --- a/src/tlo/methods/tb.py +++ b/src/tlo/methods/tb.py @@ -2483,6 +2483,7 @@ def apply(self, person_id, squeeze_factor): self.number_of_occurrences += 1 df = self.sim.population.props # shortcut to the dataframe + now = self.sim.date person = df.loc[person_id] @@ -2494,6 +2495,19 @@ def apply(self, person_id, squeeze_factor): ): return + # refer for HIV testing: all ages + # do not run if already HIV diagnosed or had test in last week + if not person["hv_diagnosed"] or (person["hv_last_test_date"] >= (now - DateOffset(days=7))): + self.sim.modules["HealthSystem"].schedule_hsi_event( + hsi_event=hiv.HSI_Hiv_TestAndRefer( + person_id=person_id, + module=self.sim.modules["Hiv"], + referred_from="Tb", + ), + priority=1, + topen=now, + tclose=None, + ) # if currently have symptoms of TB, refer for screening/testing persons_symptoms = self.sim.modules["SymptomManager"].has_what(person_id=person_id) if any(x in self.module.symptom_list for x in persons_symptoms): From 4aeed26056993def95e3185e728d8d780c65ad36 Mon Sep 17 00:00:00 2001 From: tdm32 Date: Mon, 9 Dec 2024 12:51:08 +0000 Subject: [PATCH 4/5] revert unneeded changes --- src/tlo/methods/enhanced_lifestyle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tlo/methods/enhanced_lifestyle.py b/src/tlo/methods/enhanced_lifestyle.py index 74e2492cb9..26c79d9587 100644 --- a/src/tlo/methods/enhanced_lifestyle.py +++ b/src/tlo/methods/enhanced_lifestyle.py @@ -661,7 +661,7 @@ def update_all_properties(self, df): :param df: The population dataframe """ # get months since last poll now = self.module.sim.date - months_since_last_poll = round((now - self.date_last_run) / np.timedelta64(1, "W")) + months_since_last_poll = round((now - self.date_last_run) / np.timedelta64(1, "M")) # loop through linear models dictionary and initialise each property in the population dataframe for _property_name, _model in self._models.items(): if _model['update'] is not None: From c958c0658bb86f302236dab820ccf4aad4471be1 Mon Sep 17 00:00:00 2001 From: tdm32 Date: Mon, 9 Dec 2024 14:20:34 +0000 Subject: [PATCH 5/5] fix syntax error --- src/tlo/methods/hiv.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tlo/methods/hiv.py b/src/tlo/methods/hiv.py index 7d733a4626..e14a6c39fe 100644 --- a/src/tlo/methods/hiv.py +++ b/src/tlo/methods/hiv.py @@ -2497,8 +2497,9 @@ def apply(self, person_id, squeeze_factor): test_result = self.sim.modules["HealthSystem"].dx_manager.run_dx_test( dx_tests_to_run="hiv_rapid_test", hsi_event=self ) - df.at[person_id, "hv_number_tests"] += 1 - df.at[person_id, "hv_last_test_date"] = self.sim.date + if test_result is not None: + df.at[person_id, "hv_number_tests"] += 1 + df.at[person_id, "hv_last_test_date"] = self.sim.date # if person not circumcised, perform the procedure if not person["li_is_circ"]: @@ -2842,8 +2843,9 @@ def do_at_initiation(self, person_id): test_result = self.sim.modules["HealthSystem"].dx_manager.run_dx_test( dx_tests_to_run="hiv_rapid_test", hsi_event=self ) - df.at[person_id, "hv_number_tests"] += 1 - df.at[person_id, "hv_last_test_date"] = self.sim.date + if test_result is not None: + df.at[person_id, "hv_number_tests"] += 1 + df.at[person_id, "hv_last_test_date"] = self.sim.date # Assign person to be suppressed or un-suppressed viral load # (If person is VL suppressed This will prevent the Onset of AIDS, or an AIDS death if AIDS has already