Skip to content

properly counts op/a&e activity for HSA GAMs#248

Merged
tomjemmett merged 2 commits intomainfrom
fix_gams
May 1, 2026
Merged

properly counts op/a&e activity for HSA GAMs#248
tomjemmett merged 2 commits intomainfrom
fix_gams

Conversation

@tomjemmett
Copy link
Copy Markdown
Member

@tomjemmett tomjemmett commented Apr 29, 2026

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

@tomjemmett tomjemmett requested a review from a team as a code owner April 29, 2026 14:25
Copilot AI review requested due to automatic review settings April 29, 2026 14:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 to count) rather than row-counting.
  • Update A&E aggregation to sum arrivals (aliased to count) 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.

@tomjemmett tomjemmett force-pushed the fix_gams branch 2 times, most recently from f6a3b4b to 5372435 Compare April 30, 2026 12:31
Copy link
Copy Markdown
Member

@yiwen-h yiwen-h left a comment

Choose a reason for hiding this comment

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

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?

@tomjemmett tomjemmett merged commit 2d9d183 into main May 1, 2026
3 checks passed
@tomjemmett tomjemmett deleted the fix_gams branch May 1, 2026 12:12
@tomjemmett tomjemmett self-assigned this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants