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

HTM Scale-up Not Having The Effect Expected #1411

Open
4 tasks
tbhallett opened this issue Jul 3, 2024 · 18 comments · Fixed by #1413
Open
4 tasks

HTM Scale-up Not Having The Effect Expected #1411

tbhallett opened this issue Jul 3, 2024 · 18 comments · Fixed by #1413
Assignees

Comments

@tbhallett
Copy link
Collaborator

Whereas, the test script and the initial scenario run showed that the HTM scale-up was working as expected, it appears that the in practice they do not (see here).

The test script and the scenario both examine scale-up occurring instantly in year 2012, whereas the scale-up scenarios we want for the final analysis is for scale-up instantly in 2019.

Looking at this, I can see a few reasons why this might be occurring:

  • We write to a parameter that does not exist:

    # prob ART start if dx, this is already 95% at 2020
    p["prob_start_art_after_hiv_test"] = scaled_params["prob_start_art_after_hiv_test"]

  • Updating of the rates of testing does not work as expected, as the values for years after 2020 are set to nan, and note that future years are never read due to this logic.

    p["hiv_testing_rates"]["annual_testing_rate_children"] = scaled_params["annual_testing_rate_children"]
    p["hiv_testing_rates"]["annual_testing_rate_adults"] = scaled_params["annual_testing_rate_adults"]

(I don't think this section suffers from the same issue - but it looks a bit fragile, for similar reasons).

There may be other issues in the Tb and malaria codes of a similar nature.

I would propose doing the following:

  • Update the scenario file so that it reflects a scale-up in 2019, running at scale, and confirming that this also shows there being no epidemiological impact. (If this doesn't confirm it, then I have had some mistakes in my Scenario file and in these observations)
  • Searching for possible issues in hiv.py, tb.py and malaria.py and fixing
  • Re-running the scenario
  • Raising PR with fixes
@tdm32
Copy link
Collaborator

tdm32 commented Jul 3, 2024

Whereas, the test script and the initial scenario run showed that the HTM scale-up was working as expected, it appears that the in practice they do not (see here).

The test script and the scenario both examine scale-up occurring instantly in year 2012, whereas the scale-up scenarios we want for the final analysis is for scale-up instantly in 2019.

Looking at this, I can see a few reasons why this might be occurring:

  • We write to a parameter that does not exist:
    # prob ART start if dx, this is already 95% at 2020
    p["prob_start_art_after_hiv_test"] = scaled_params["prob_start_art_after_hiv_test"]
  • Updating of the rates of testing does not work as expected, as the values for years after 2020 are set to nan, and note that future years are never read due to this logic.
    p["hiv_testing_rates"]["annual_testing_rate_children"] = scaled_params["annual_testing_rate_children"]
    p["hiv_testing_rates"]["annual_testing_rate_adults"] = scaled_params["annual_testing_rate_adults"]

(I don't think this section suffers from the same issue - but it looks a bit fragile, for similar reasons).

There may be other issues in the Tb and malaria codes of a similar nature.

I would propose doing the following:

  • Update the scenario file so that it reflects a scale-up in 2019, running at scale, and confirming that this also shows there being no epidemiological impact. (If this doesn't confirm it, then I have had some mistakes in my Scenario file and in these observations)
  • Searching for possible issues in hiv.py, tb.py and malaria.py and fixing
  • Re-running the scenario
  • Raising PR with fixes

Thanks for digging into this @tbhallett, I'll work on it this afternoon. Just confirming branch [hallett/analysis_for_vertical_and_horizontal_progs] is the most up-to-date one?

@tdm32
Copy link
Collaborator

tdm32 commented Jul 3, 2024

@tbhallett I'm wondering if there is an issue here with constraints on consumables and personnel. From my scale-up paper, there was only a small impact of HIV program scale-up for 2 reasons: 1. the program is already very close to hitting targets and the proposed scale-up is small, 2. the consumables availability limits the amount of scale-up that can occur.

I've tested this quickly on a small population and found that running the scenarios with consumables availability set to 'all' did lead to a reduction in AIDS deaths with HIV program scale-up (around 30% fall in a pop of 5,000).

So when we scale-up programs only (no HSS), the effects will be limited by cons availability. Both the baseline and the scale-up scenario will likely be affected by mode 2, I think in mode 2 even in the baseline scenarios many appts will not be able to run due to personnel shortages.

Could this be explaining why we see no difference between the baseline and scale-up scenarios? I'll set off a larger run with cons availability to 'all' and keep mode 1 throughout just to see. Hopefully will update you Thurs am.

@tbhallett
Copy link
Collaborator Author

@tbhallett I'm wondering if there is an issue here with constraints on consumables and personnel. From my scale-up paper, there was only a small impact of HIV program scale-up for 2 reasons: 1. the program is already very close to hitting targets and the proposed scale-up is small, 2. the consumables availability limits the amount of scale-up that can occur.

I've tested this quickly on a small population and found that running the scenarios with consumables availability set to 'all' did lead to a reduction in AIDS deaths with HIV program scale-up (around 30% fall in a pop of 5,000).

So when we scale-up programs only (no HSS), the effects will be limited by cons availability. Both the baseline and the scale-up scenario will likely be affected by mode 2, I think in mode 2 even in the baseline scenarios many appts will not be able to run due to personnel shortages.

Could this be explaining why we see no difference between the baseline and scale-up scenarios? I'll set off a larger run with cons availability to 'all' and keep mode 1 throughout just to see. Hopefully will update you Thurs am.

That might be a part of it, but not all (I think), because;

  • There is no difference between scenario B (massive healthsystem strengthening) and J (massive health system stqrenghenin plus HTM scale-up)
  • Some of the changes in the scale-up should be "free" of cost for the healthsystem, e.g. changes in beta.

image

@tbhallett
Copy link
Collaborator Author

We made the change whereby the linear models are rebuild following updating the parameters in #1413

The graphs produced were almost the same as the originals above.

@tbhallett
Copy link
Collaborator Author

tbhallett commented Jul 25, 2024

Next job is to run a simplified version of the analysis, but...

  • In Mode 1 (so we can see if it is the "mode 2 constraints" that is hampering the scale-up
  • With the logs from HIV, TB and Malaria modules turned on, so that we can see if the service coverages are increasing as expected.

This is being done on within the branch PR'd at #1288 in file src/scripts/comparison_of_horizontal_and_vertical_programs/mini_analysis_for_testing/mini_version_scenario.py

job-id = htm_with_and_without_hss-2024-07-25T193651Z

UPDATE:

That job failed for mysterious reason. Second attempt is (from current tip of master c147e2b)

mini_htm_with_and_without_hss-2024-07-29T102041Z

tbhallett added a commit that referenced this issue Jul 29, 2024
* updates from paper analyses for HIV, TB and malaria

* remove unused import statements

* fix imports

* update filepath for malaria resource file

* remove test_hiv_tb_scenarios.py

* updated test_healthsystem.py: test_manipulation_of_service_availability 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

* change ipt_coverage in TB logger as conflicts with existing parameter

* updated ResourceFile_Improved_Healthsystem_And_Healthcare_Seeking.xlsx with updated NTP2019 TB data

* remove test code

* remove test code

* delete tmp resourcefiles

* malaria code use person_id consistently instead of individual_id

* use individual_id for demography.do_death()

* style change to avoid conflicts with master

* style change to avoid conflicts with master

* fix conflicts with master

* fix conflicts with master

* merge in master

* check property hv_date_last_ART correctly set

* Manually add PostnatalCare_Comprehensive to policy priorities

* edit fix

* add schisto high infection as conditional predictor for bladder cancer

* fix conditional predictor for active TB - should check presence of CardioMetabolicDisorders

* add 'ss' prefix to properties from schisto module referenced in bladder_cancer.py

* edit praziquantel code in schisto.py to use value from CMST in place of donated

* add parameter rr_depr_hiv for risk of depression with HIV infection

* tidy up linear models in depression, include conditional predictors for hiv infection and add comments

* move hv_inf into conditional predictor for depression in initial population

* convert lm for incident cancer (site_confined) to model with conditional predictors. Include HIV as risk factor.

* add parameter rr_site_confined_hiv to other_adult_cancers.py

* update other_adult_cancers write-up to include HIV as risk factor

* update Depression.docx to include HIV as risk factor for depression

* edit HIV in depression to include only HIV cases not virally suppressed

* update other_adult_cancers.py linear model to include HIV as risk factor only if not virally suppressed

* edit: HIV remains as risk factor for depression independent of treatment status

* include HIV as risk factor for low grade dysplasia (oesophageal cancer). Update ResourceFile_Oesophageal_Cancer.xlsx

* update linear model for low grade dysplasia to include HIV as conditional risk factor

* update OesophagealCancer.docx write-up to include HIV risk

* add condition hiv diagnosed for increased risk of depression

* remove hiv as risk factor for oesophageal cancer

* remove parameter for hiv as risk factor for oesophageal cancer

* update OesophagealCancer.docx to remove hiv as risk factor

* update value for weighted risk of other_adult_cancers with unsuppressed HIV

* add rr_hiv to linear model. update ResourceFile_cmd_condition_onset.xlsx with rr_hiv, leave value=1.0 if no effect of hiv

* update resourcefiles for CMD include rr_hiv for all, no effect of majority of processes

* refactoring:
* put the helper function for switching scenario into same file a ScenarioSwitcher class
* put tests for class and helper function together

(next step will be to rename and mock-up extended functionality)

* add diabetes as risk for active TB and relapse. add params to ResourceFile_TB.xlsx
replace linearmodels dict which was accidentally removed in depression.py

* add diabetes as risk factor for tb death

* add diabetes as risk factor for PLHIV with active TB and on TB treatment

* add diabetes as risk factor for PLHIV with active TB and on TB treatment

* set up run to check calibration of deaths and disability

* add predictor high-intensity S. haematobium infection to risk of bladder cancer in initial population

* add predictor high-intensity S. haematobium infection to risk of HIV acquisition

* fix indenting in HSI_Hiv_StartOrContinueTreatment

* add hv_date_treated abd hv_date_last_ART to baseline_art

* convert linear model in CMD to include conditional predictors

* delete resourcefile created in error

* comment out path-specific changes to analysis_cause_of_death_and_disability_calibrations.py

* fix CMD error if Hiv not registered

* initial sketch of structure

* tidy-up and fix tests

* commments

* remove parameter rr_bcg_inf from tb.py

* edit comment in initialise_simulation

* fix parameter name error

* update parameters

* test runs

* edit and fix flake8 errors

* fix failing test

* update ResourceFile_Improved_Healthsystem_And_Healthcare_Seeking.xlsx

* update ResourceFile_PriorityRanking_ALLPOLICIES.xlsx

* updated ResourceFile_Improved_Healthsystem_And_Healthcare_Seeking.xlsx

* scenario file

* starting work on the scenario file

* design and HR scenarios

* scenario for HRH

* roll back changes to ScenarioSwitcher

* Revert "roll back changes to ScenarioSwitcher"

This reverts commit 49d14e7.

* sketch out of prposed changed for scenario_switcher

* sketch out of prposed changed for scenario_switcher

* sketch out of prposed changed for scenario_switcher

* sketch out of prposed changed for scenario_switcher

* sketch out of prposed changed for scenario_switcher

* Add ResourceFile_Consumables_Item_Designations.csv

* create special scenarios for consumables availability based on the designation of the consumable item

* comment and fix imports

* draft of scenario file

* linting

* increase length of scenarios and reduce reps

* rename

* correct error in specifiction of dynamic scaling scenario

* remove trailing commas that casts return as tuple

* Initially only consider baseline and perfect healthcare seeking scenarios, to get upper limit on RAM requirements

* Submit remaining scenarios

* direct to self.module (rather than self)

* edit check for last ART when new dispensation occurs

* update schisto risk on HIV to only include women

* add scale-up parameter for htm programs
add event to hiv module to switch parameters
include new keywords in hiv module for scale-up separately for hiv, tb and malaria
add new sheet in ResourceFile_HIV.xlsx containing new scale-up parameter values

* add catch for malaria rdt_testing_rates post-2024

* malaria parameters scale-up included

* restore `scenario_comparison_of_horizontal_and_vertical_programs` (removing comments used to select certain scenarios to be run).

* first draft of figures

* set up test for HTM scenario scale-up

* add tests for HTM scale-up

* check resourcefiles updated

* check the usage of '' versus ""

* reset to single quotes to match PR #1273

* remove unneeded resource files

* remove unneeded resource files

* edit filepaths

* isort for imports

* edit ResourceFile_Improved_Healthsystem_And_Healthcare_Seeking.xlsx to remove 2024 missing value in malaria Rate_rdt_testing

* fix filename for test_HTMscaleup.py

* update scenario file

* update scenario file

* include "scale_to_effective_capabilities": True

* linting

* linting

* reduce number of draws

* set scaleup parameters separately in each module
use parameters to select scaleup instead of module arguments
update resourcefiles

* set scaleup parameters separately in each module
use parameters to select scaleup instead of module arguments
update resourcefiles

* update resourcefiles

* update resourcefiles

* set up script to test scenarios - scale-up of HTM programs

* test runs

* add scenario switch to malaria.py

* cherry-pick inadvertently updated files and revert

* isort fixes

* Delete resources/~$ResourceFile_HIV.xlsx

* Delete resources/~$ResourceFile_TB.xlsx

* Delete resources/malaria/~$ResourceFile_malaria.xlsx

* fix failing tests

* rollback changes to calibration_analyses/scenarios/long_run_all_diseases.py

* fix error in filename

* revert timedelta format to 'M'

* add todos

* merge in master

* set up test runs for scale-up

* edit scenario start date

* change parameter scaleup_start_date to an integer value used in DateOffset, as timestamp is not json serializable for analysis runs

* change scale-up event scheduling to use new DateOffset parameter

* test runs

* set up test runs

* set up test runs

* fix failing tests

* Update tests/test_HTMscaleup.py

Co-authored-by: Tim Hallett <39991060+tbhallett@users.noreply.github.com>

* address comments on PR review

* isort fixes

* isort fixes

* change np.timedelta in enhanced_lifestyle.py back to original

* remove json file

* call it 'htm_scenario_analysis' rather than just 'scenario_analysis'

* update comment

* roll back change in test_tb.py

* remove .py extension for clarity

* roll back incidental change

* linting and editing string for clarity

* roll back incidental changes

* defaults for healthsystem ok -- no need to step through each option

* remove inadvertent duplication in code

* remove comment

* use dict for ease of accessing

* parameter to be the YEAR (int) of the change to fit with the convention used in other modules (instead of years since the beginning of the simulation)

* remove comment

* refactor module method for clarity

* refactor to prevent same name being used for events specific to different modules

* specify year for scale-up in analysis file

* rename; add note; remove comments for HTM scenarios

* refacotring

* rename scenario class for hss elements

* new scenario for combinations of vertical and horizontal programs

* minor refactor

* update docstring

* renaming

* add @Property decorator

* plot DALYS averted relative to Baseline - broken down by major cause (HIV, TB, MALARIA)

* remove unused parameter prob_start_art_after_hiv_test

* set up test runs

* update linear models for tb and malaria after changing parameters

* set up test runs

* set up test runs

* remove unused parameter from ResourceFile_HIV.xlsx

* remove annual_testing_rate_children as not used

* add scale-up parameter probability_of_being_retained_on_art_every_3_months, increase to 1

* set cons_availability to all and set off larger runs

* test runs

* change spec. of runs to be smaller pop size and fewer runs

* roll back changes that are not related to this PR

* delete file added by accident

* roll back change (I think this is mistake)

* refactor
* 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

---------

Co-authored-by: tdm32 <t.mangal@imperial.ac.uk>
Co-authored-by: Tara <37845078+tdm32@users.noreply.github.com>
Co-authored-by: Margherita Molaro <48129834+marghe-molaro@users.noreply.github.com>
@tbhallett tbhallett reopened this Jul 29, 2024
@tbhallett
Copy link
Collaborator Author

tbhallett commented Jul 29, 2024

@tdm has done experiments that confirm ---for a scale-up in 2015, to "maximal possible levels", in either Mode 1 or Mode 2, an effect on deaths is had for H, T, M scale-ups individually and collectively.

Therefore, the discrepancy between this success and the lack of an effect not the runs done so far using the Scenario files defined above could be as follows:

  • The scale-up being in 2015 as opposed to 2019
  • The scale-up being "max" in Tara's runs (vs. something slightly short of max) in the Scenario runs.
  • Something to do with the differences in coding between the two runs (The Scenario file including *rescaling to Mode 2, scaling due to absences etc etc.)

Therefore, our action plan is as follows (in some new PRs)

And also,

@tdm32
Copy link
Collaborator

tdm32 commented Jul 29, 2024

Below are test runs which use default settings for all modules and switch the HIV, TB and malaria programmes to minimum or maximum values. All runs are done in both mode 1 and mode 2.

TO DO:

  • create new switch so programmes can be scaled to either programme targets or max values
  • merge new switch and perform test runs with different HS settings to identify any issues potentially mitigating HTM programme impact

with services set to MIN:
image

image

with services set to MAX:
image

image

@tbhallett
Copy link
Collaborator Author

Following merge of #1443 and #1441,

we're now submitting a run using the MAX scenario and with changes occurring in 2015.

This is from branch hallett/test_run_htm_scale_up and the job_id is: htm_with_and_without_hss-2024-07-29T143852Z

@tbhallett
Copy link
Collaborator Author

tbhallett commented Jul 29, 2024

Next steps

  • [x] examine the mini-run that used Mode 1 (but before all the fixes came in) IGNORE: I had set this up wrongly. Trying again!
  • examine the 'full' run (at small scale) (see below)

@tbhallett
Copy link
Collaborator Author

tbhallett commented Aug 1, 2024

Results from the full_run look more promising....

Need to work out is 2019 scale-up can work too and if it's reasonable to use the max scale-ups.

Check that the HTM input is of the same size as Tara expects (from her earlier paper).

Update graphs. (It could be that the effects look small because the HSS package is so strong.)

Also - effect on TB very small. Maybe best to combine HIV and TB for presentation purposes?

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

@tbhallett
Copy link
Collaborator Author

final attempt at running the whole thing in Mode1 : htm_with_and_without_hss_mode1-2024-08-02T160157Z (which is a run of src/scripts/comparison_of_horizontal_and_vertical_programs/scenario_vertical_programs_with_and_without_hss_mode1.py

@tbhallett
Copy link
Collaborator Author

tbhallett commented Aug 2, 2024

next steps:

  • look at the mode 1 results
  • examine the mode2 and mode1 results to see what's happening to the programs, and the HSIs
  • is the muted impact of scale-up (especially TB and malaria) in mode 2 to do with crowding-out of HSI (lots of referrals and false positives, clogging-up everything?)
  • should we say that there is an efficiency boost in HTM appointments, to reduce their footprints?

@tbhallett
Copy link
Collaborator Author

Results from mode1 run (htm_with_and_without_hss_mode1-2024-08-02T160157Z) seem very similar to that for Mode2. This suggests that the 'crowding-out' issues are not behind the weak impact of the HTM scale-up....?

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

@tbhallett
Copy link
Collaborator Author

@tdm's further investigation finds

  1. Diagnosis rate for TB remains low in scale-up scenario (due to low sensivity of Gene Xpert on sputum samples)
  2. That scale-up is frustrated by consumables non-availability to extreme degree
  3. That in TB scale-up scenario, TB treatment rates goes down (not up)
  • She has made a fix for (1) (add TB culture HSI #1453) that means that persons that are suspected to have TB, but have a negative test, are referred for a culture test (with very high sensitivity).
    We're running with that from that branch (add TB culture HSI #1453): job_id is htm_with_and_without_hss-2024-08-06T094337Z

  • To determine if indeed, the limitations largely come from consumables (and that, conversely, most of the HSS package benefits come from removing that constraint), we'll run the whole analysis, forcing consumables to be always available: job_id is htm_with_and_without_hss-2024-08-06T094422Z

  • On (3), @tdm32 is investigating....

@tdm32
Copy link
Collaborator

tdm32 commented Aug 7, 2024

@tbhallett regarding issue 3 above, from plots of run htm_with_and_without_hss_mode1-2024-08-02T160157Z we saw unusual trends in tb proportion diagnosed and proportion treated.

Turns out this was just an anomaly in the final year of the simulation, whereby the proportion dx (and therefore treated) drops. This may just be stochastic noise, or a low proportion of tb cases occurring in PLHIV (who get additional screening compared with general population) 12% in the final year.

To correct this, I have re-plotted the figures using an average over the period 2016-2030. This shows almost identical treatment coverage rates between baseline and TB_no_HSS (both 38%), with increase to 43% with HSS. For diagnosis, TB_no_HSS shows small increase from 38% to 48%, 45% with HSS. No obvious reason why dx rates are slightly lower with HSS, but we do have small tb case numbers for this (80-100 cases per year).

Looks like almost perfect referral between dx and tx for TB+HSS, but some drop-off in TB_no_HSS which is expected due to consumables stockouts.

I'll repeat this with the new runs so we can see the impact of TB Culture HSI and supply chain strengthening alone vs full HSS.

TB
image
image
image
image
image

HIV
image

MALARIA
image
image

@tbhallett
Copy link
Collaborator Author

tbhallett commented Aug 7, 2024

Results from htm_with_and_without_hss-2024-08-06T094337Z (using the TB fix for culture)

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

@tbhallett
Copy link
Collaborator Author

... and from htm_with_and_without_hss-2024-08-06T094422Z (where we also have the consumables always being available):

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

@tdm32
Copy link
Collaborator

tdm32 commented Aug 13, 2024

From run htm_with_and_without_hss-2024-08-06T094422Z where consumables are always available and TB culture used as a backup dx test we do see an improvement in tb diagnosis and treatment rates:

image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Issues
Development

Successfully merging a pull request may close this issue.

2 participants