add aggregation columns args#622
Conversation
tomjemmett
commented
May 28, 2026
- make sure uv is copying, not hardlinking
- removes unused build arg
- removes step thats not needed any more
- adds extra model argument: aggregation_columns
729cb2f to
04de007
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #622 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 20 20
Lines 1131 1131
Branches 58 58
=========================================
Hits 1131 1131 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
✅ A new build is available.You can use the following to use pull the image into your local environment: docker pull ghcr.io/the-strategy-unit/nhp_model:pr-622 |
There was a problem hiding this comment.
Pull request overview
This PR extends the NHP demand model run pipeline to support configurable aggregation keys by introducing an aggregation_columns argument that influences how results are grouped, while also simplifying the Docker build and adjusting lint configuration to accommodate the updated function signatures.
Changes:
- Add
aggregation_columnsparameter plumbing throughrun_all/run_single_model_runand the concrete model constructors, and use it inModel.get_agg. - Update unit tests to reflect the new argument being passed through, and adjust test fixtures for the new model state.
- Docker build tweaks (force
uvto copy instead of hardlink; remove unused build arg / obsolete step) and loosen Ruff pylintmax-argsto 8.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
src/nhp/model/model.py |
Stores aggregation column configuration and uses it in get_agg groupby logic. |
src/nhp/model/run.py |
Threads aggregation_columns through run helpers; updates timeit to accept kwargs. |
src/nhp/model/inpatients.py |
Passes aggregation_columns into base Model initialisation. |
src/nhp/model/outpatients.py |
Passes aggregation_columns into base Model initialisation. |
src/nhp/model/aae.py |
Passes aggregation_columns into base Model initialisation. |
tests/unit/nhp/model/test_run.py |
Updates expectations for new argument propagation through run helpers. |
tests/unit/nhp/model/test_model.py |
Adjusts fixture patching to tolerate the updated Model.__init__ signature and aggregation state. |
pyproject.toml |
Increases Ruff pylint max-args to accommodate the new argument. |
Dockerfile |
Ensures uv links by copy, removes unused build arg and obsolete patch step. |
|
Thanks Tom! I'll review after copilot comments are addressed - ping me when done |
yiwen-h
left a comment
There was a problem hiding this comment.
I can see how this would make things more flexible. Do we need to change code in nhp_model_databricks as well, as a result of these changes? Some concerns around whether or not this would break viewing of model results from ICB/national models in the outputs app
|
We don't need to, but it would simplify things in that repo. Currently we have to insert some false values for some fields. This would allow us to not require them (e.g. sitetret) |
closes #468 - adds an extra argument to allow users to change which columns to aggregate on. defaults to sitetret and pod
51f9c55 to
ee56672
Compare