Skip to content

add aggregation columns args#622

Merged
tomjemmett merged 3 commits into
mainfrom
add_aggregation_columns_args
Jun 18, 2026
Merged

add aggregation columns args#622
tomjemmett merged 3 commits into
mainfrom
add_aggregation_columns_args

Conversation

@tomjemmett

Copy link
Copy Markdown
Member
  • make sure uv is copying, not hardlinking
  • removes unused build arg
  • removes step thats not needed any more
  • adds extra model argument: aggregation_columns

@tomjemmett tomjemmett marked this pull request as ready for review June 16, 2026 15:17
@tomjemmett tomjemmett requested a review from a team as a code owner June 16, 2026 15:17
Copilot AI review requested due to automatic review settings June 16, 2026 15:17
@tomjemmett tomjemmett force-pushed the add_aggregation_columns_args branch from 729cb2f to 04de007 Compare June 16, 2026 15:18
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (842132c) to head (ee56672).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

✅ 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_columns parameter plumbing through run_all / run_single_model_run and the concrete model constructors, and use it in Model.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 uv to copy instead of hardlink; remove unused build arg / obsolete step) and loosen Ruff pylint max-args to 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.

Comment thread src/nhp/model/model.py
Comment thread src/nhp/model/model.py
Comment thread src/nhp/model/model.py
Comment thread src/nhp/model/run.py
Comment thread src/nhp/model/run.py Outdated
Comment thread src/nhp/model/outpatients.py Outdated
Comment thread src/nhp/model/outpatients.py
Comment thread src/nhp/model/aae.py Outdated
Comment thread src/nhp/model/aae.py
Comment thread tests/unit/nhp/model/test_model.py
@tomjemmett tomjemmett linked an issue Jun 16, 2026 that may be closed by this pull request
@yiwen-h

yiwen-h commented Jun 17, 2026

Copy link
Copy Markdown
Member

Thanks Tom! I'll review after copilot comments are addressed - ping me when done

@yiwen-h yiwen-h left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@tomjemmett

Copy link
Copy Markdown
Member Author

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
@tomjemmett tomjemmett force-pushed the add_aggregation_columns_args branch from 51f9c55 to ee56672 Compare June 18, 2026 09:24

@yiwen-h yiwen-h left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@tomjemmett tomjemmett merged commit f90a5d6 into main Jun 18, 2026
8 checks passed
@tomjemmett tomjemmett deleted the add_aggregation_columns_args branch June 18, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

default aggregation columns

3 participants