Skip to content

switches demog/births adjustment to use demog_type column#633

Merged
tomjemmett merged 4 commits into
mainfrom
alter_demog_adjustment
Jun 19, 2026
Merged

switches demog/births adjustment to use demog_type column#633
tomjemmett merged 4 commits into
mainfrom
alter_demog_adjustment

Conversation

@tomjemmett

@tomjemmett tomjemmett commented Jun 17, 2026

Copy link
Copy Markdown
Member

needs The-Strategy-Unit/nhp_data#261 to be merged and data to be generated first.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (71ce0d7) to head (3fb6bee).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #633   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines         1131      1129    -2     
  Branches        58        58           
=========================================
- Hits          1131      1129    -2     

☔ 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 17, 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-633

@tomjemmett tomjemmett marked this pull request as ready for review June 18, 2026 09:23
@tomjemmett tomjemmett requested a review from a team as a code owner June 18, 2026 09:23
Copilot AI review requested due to automatic review settings June 18, 2026 09:23

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 updates the activity resampling demographic and birth adjustment factors to key off a demog_type index level (instead of expanding factors across activity group values), aligning factor application with the new demog_type column coming from the data pipeline.

Changes:

  • Update ActivityResampling.demographic_adjustment() and .birth_adjustment() to create factors with a demog_type outer index level.
  • Update unit tests to reflect the new factor indexing (including correct MultiIndex shapes/names).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/nhp/model/activity_resampling.py Switches demographic/birth factor series construction to use a demog_type index level for merging into model data.
tests/unit/nhp/model/test_activity_resampling.py Updates assertions/fixtures for the new factor indexing and expected merge keys.

Comment thread src/nhp/model/activity_resampling.py
Comment thread tests/unit/nhp/model/test_activity_resampling.py
Comment thread tests/unit/nhp/model/test_activity_resampling.py Outdated
@yiwen-h

yiwen-h commented Jun 18, 2026

Copy link
Copy Markdown
Member

awaiting copilot comments to be addressed

@tomjemmett tomjemmett force-pushed the alter_demog_adjustment branch from 5b49120 to 9f793ce Compare June 18, 2026 10:35
@tomjemmett

Copy link
Copy Markdown
Member Author

@yiwen-h I've noticed a few data issues, so working through those to ensure this code does actually work :-)

@tomjemmett

Copy link
Copy Markdown
Member Author

@yiwen-h tested, model is running with the new column added after resolving issues with data

@tomjemmett

Copy link
Copy Markdown
Member Author

should rebase after merging #634

@tomjemmett tomjemmett force-pushed the alter_demog_adjustment branch from 85f4e70 to 3fb6bee Compare June 19, 2026 13:00
@tomjemmett

Copy link
Copy Markdown
Member Author

@yiwen-h updates tests after merging #634

@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 - looks from the test snapshots that it's having the expected impact

@tomjemmett tomjemmett merged commit 923414e into main Jun 19, 2026
8 checks passed
@tomjemmett tomjemmett deleted the alter_demog_adjustment branch June 19, 2026 13:57
@tomjemmett tomjemmett linked an issue Jun 22, 2026 that may be closed by this pull request
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.

Change OP maternity demographic growth to follow births like IP does

3 participants