properly counts op/a&e activity for HSA GAMs#248
Merged
tomjemmett merged 2 commits intomainfrom May 1, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect activity aggregation when generating Health Status Adjustment (HSA) GAM inputs by using the appropriate “volume” fields for OP and A&E (instead of counting rows), aligning with issue #247.
Changes:
- Update OP aggregation to sum
attendances(aliased tocount) rather than row-counting. - Update A&E aggregation to sum
arrivals(aliased tocount) rather than row-counting. - Apply the same fix consistently across provider-, ICB-, and national-level GAM data generation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/nhp/data/model_data/health_status_adjustment/generate_provider_gams.py |
Uses sum(attendances) for OP and sum(arrivals) for A&E in the provider-level activity summary feeding GAMs. |
src/nhp/data/model_data/health_status_adjustment/generate_national_gams.py |
Uses correct OP/A&E volume summations in the national-level activity summary feeding GAMs. |
src/nhp/data/model_data/health_status_adjustment/generate_icb_gams.py |
Uses correct OP/A&E volume summations in the ICB-level activity summary feeding GAMs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f6a3b4b to
5372435
Compare
yiwen-h
approved these changes
May 1, 2026
Member
yiwen-h
left a comment
There was a problem hiding this comment.
Of course - sorry I didn't spot this earlier!
I would also note in the PR title that this also makes the years for HSA GAMs variable rather than fixed to 202324 - I assume this is to accommodate other baseline years?
This was
linked to
issues
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #247 - outpatient and A&E gams are now using the correct sum of activity
resolves #221 - make sure we only generate GAMs where there is some data (there could be cases where a provider didn't have any activity at all for some of the
hsagrps). also excludes paeds hospitals because they should never have gams generated (filter for age >= 18)resolves #204 - allows us to generate gams for multiple years