Skip to content

Conversation

@sakshimohan
Copy link
Collaborator

@sakshimohan sakshimohan commented Jun 19, 2025

This PR adds the following -

  1. Costing utility functions (cost_estimation.py) and related resource files (~/resources/costing/)
  2. Analysis scripts for two manuscripts - 1. Method for costing a health system using a Health Systems Model - updated version submitted in May 2025; 2. System-Wide Investments Enhance HIV, TB and Malaria Control in Malawi and Deliver Greater Health Impact - updated version submitted in May 2025.

For more information, see ~src/scripts/costing/README.md.

Note that these files were extracted from a previous [PR #1279], which was closed due to conflicts with master.

Possible future improvements to the costing module are listed under Issue #1635

@sakshimohan sakshimohan self-assigned this Jun 23, 2025
@sakshimohan sakshimohan requested a review from tbhallett June 23, 2025 17:31
@sakshimohan sakshimohan mentioned this pull request Jun 23, 2025
@sakshimohan
Copy link
Collaborator Author

sakshimohan commented Jun 23, 2025

Hi @tbhallett. I've now closed the old costing PR (PR #1279) and moved the relevant scripts and resource files here. This PR is now ready for review.

I have added a README.md file to describe the utility functions for costing. Happy to move this to a Wiki if that's preferable.

One test is failing. It seems to be related to the test files (not part of the costing scripts):

(TLOmodel) sm2511@UOY25M013 TLOmodel % ruff check tests --show-fixes
tests/bitset_handler/conftest.py:10:1: I001 [*] Import block is un-sorted or un-formatted
tests/bitset_handler/test_bitset_pandas_dtype.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tests/bitset_handler/test_bitset_set_like_interactions.py:4:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_alri.py:2:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_analysis.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_antenatal_interventions.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_basic_sims.py:1:1: I001 [*] Import block is un-sorted or un-formatted
.....

@sakshimohan sakshimohan marked this pull request as ready for review June 23, 2025 17:37
@sakshimohan sakshimohan added the health-econ Economic analysis related issues label Jun 23, 2025
@tbhallett
Copy link
Collaborator

Hi @tbhallett. I've now closed the old costing PR (PR #1279) and moved the relevant scripts and resource files here. This PR is now ready for review.

I have added a README.md file to describe the utility functions for costing. Happy to move this to a Wiki if that's preferable.

One test is failing. It seems to be related to the test files (not part of the costing scripts):

(TLOmodel) sm2511@UOY25M013 TLOmodel % ruff check tests --show-fixes
tests/bitset_handler/conftest.py:10:1: I001 [*] Import block is un-sorted or un-formatted
tests/bitset_handler/test_bitset_pandas_dtype.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tests/bitset_handler/test_bitset_set_like_interactions.py:4:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_alri.py:2:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_analysis.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_antenatal_interventions.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tests/test_basic_sims.py:1:1: I001 [*] Import block is un-sorted or un-formatted
.....

Thanks @sakshimohan -- will review this very soon

@sakshimohan
Copy link
Collaborator Author

I've now updated ResourceFile_Consumables_Inflow_Outflow_Ratio.csv to match with that in PR #1367. (Commit ec89299)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the key file containing all the functions that we expect to be re-used and which we want to make sure always works.

Given this, I propose moving this file to src\tlo\analysis\

Comment on lines +119 to +121
_discount_rate: Union[float, dict[int, float]] = 0,
_initial_year: Optional[int] = None,
_column_for_discounting: str = 'cost') -> pd.DataFrame:
Copy link
Collaborator

Choose a reason for hiding this comment

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

here, and elsewhere, arguments are named with the leading underscore.

Whilst this all works perfectly, the convention is for "_" to be used for private members, and so it's unusual to have them as argument names.

https://betterstack.com/community/questions/what-does-underscores-before-object-name-mean-in-python/

So, to improve future readability, I would propose a refactor to just rename the arguments to be without the leading underscore.

@tbhallett
Copy link
Collaborator

tbhallett commented Jun 30, 2025

Noting here that this change does cause a fail on test_simulation (comparing logs between interrupted and non-interrupted simulations). Since this PR does not touch any methods files, I do not know what is causing this. It also seems to pass sometimes when running locally: in particular, when running that one test stand-alone. This makes me thing its do with the 'simulation 'factory'.

@tamuri
Copy link
Collaborator

tamuri commented Jun 30, 2025

Looks like it's test_continuous_and_interrupted_simulations_equal. Something has slipped through... 😰

@tamuri
Copy link
Collaborator

tamuri commented Jul 8, 2025

Some unresolved comments above - are you happy to merge and deal with those in a later PR?

@tbhallett
Copy link
Collaborator

Some unresolved comments above - are you happy to merge and deal with those in a later PR?

yes, we've agreed that those points can be recorded as an issue for future consideration.

@tamuri tamuri merged commit b2d5872 into master Jul 8, 2025
120 of 121 checks passed
@tamuri tamuri deleted the sakshi/cost_and_roi_analysis branch July 8, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

health-econ Economic analysis related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants