Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to HTM Swtiching Method to Fix Issue #1411 #1413

Open
wants to merge 216 commits into
base: master
Choose a base branch
from

Conversation

tbhallett
Copy link
Collaborator

@tbhallett tbhallett commented Jul 4, 2024

This fixes a problem with the implementation of the scale-up of HIV, TB and Malaria programs whereby the LinearModels were not rebuilt following parameter updates during the simulation. Now we rebuild the models after updating the model parameters.

We hoped that would fix #1411 but it doesn't quite do that (see below).

But, we do want it merged in anyway, as these are important fixes.

…ty as small population size over 7 days will not schedule VMMC through HIV module. Remove HIV_Prevention_Circumcision in assert statement for HIV services delivered in one week
# Conflicts:
#	resources/malaria/ResourceFile_malaria.xlsx
#	src/tlo/methods/hiv.py
#	src/tlo/methods/malaria.py
# Conflicts:
#	resources/ResourceFile_Improved_Healthsystem_And_Healthcare_Seeking.xlsx
#	resources/healthsystem/priority_policies/ResourceFile_PriorityRanking_ALLPOLICIES.xlsx
#	src/tlo/methods/malaria.py
#	tests/test_malaria.py
# Conflicts:
#	resources/ResourceFile_HIV.xlsx
#	src/tlo/methods/hiv.py
@tbhallett tbhallett added this to In progress in PR priorities via automation Jul 4, 2024
@tbhallett tbhallett moved this from In progress to Ready to merge in PR priorities Jul 4, 2024
@tbhallett tbhallett moved this from Ready to merge to Ready for EM review in PR priorities Jul 4, 2024
@@ -660,7 +660,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, "m"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is that right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

rolled back. Coding for month is "M", which is what we want and what was there originally. ("m" is the the code for minutes".

https://numpy.org/doc/stable/reference/arrays.datetime.html

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know why but this causes errors on my machine! It won't run with "M"... I'll check out why this is happening when I'm back.

# viral suppression rates
# adults already at 95% by 2020
# change all column values
p["prob_start_art_or_vs"]["virally_suppressed_on_art"] = scaled_params["virally_suppressed_on_art"]

# update exising linear models to use new scaled-up paramters
self.pre_initialise_population()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good logic. I think I'll factor it out into self.build_lms() (that is called from self.pre_initialise_population in case there are other things that need to go into self.pre_initialise_population that we don't want run at this point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've refactored this

@tbhallett
Copy link
Collaborator Author

job_id = htm_with_and_without_hss-2024-07-04T164311Z

@tbhallett
Copy link
Collaborator Author

tbhallett commented Jul 8, 2024

Results from running analysis script show much the same results as found previously (per #1411)

Additional_Deaths_Averted_vs_Baseline_2020-2030
All_programs
All_Scenarios:_DALYs_2020-2030
DALYs_Averted_vs_Baseline_2020-2030
Deaths_2020-2030
HIV_programs
Malaria_programs
TB_programs

* remove clause `if p["do_scale_up"]` as not neccessary
* make "_build_linear_models" function, called from initialise_population and update_parameter_for_program_scaleup
@tbhallett tbhallett moved this from Ready for EM review to Ready to merge in PR priorities Jul 8, 2024
@tbhallett tbhallett requested a review from tdm32 July 8, 2024 11:39
@tbhallett
Copy link
Collaborator Author

@tdm32 -- I've made some cleaning-up changes on here, and I think is ready to go in following your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
PR priorities
Ready to merge
Development

Successfully merging this pull request may close these issues.

HTM Scale-up Not Having The Effect Expected
3 participants