switches demog/births adjustment to use demog_type column#633
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 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-633 |
There was a problem hiding this comment.
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 ademog_typeouter 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. |
|
awaiting copilot comments to be addressed |
5b49120 to
9f793ce
Compare
|
@yiwen-h I've noticed a few data issues, so working through those to ensure this code does actually work :-) |
|
@yiwen-h tested, model is running with the new column added after resolving issues with data |
|
should rebase after merging #634 |
85f4e70 to
3fb6bee
Compare
yiwen-h
left a comment
There was a problem hiding this comment.
Thank you - looks from the test snapshots that it's having the expected impact
needs The-Strategy-Unit/nhp_data#261 to be merged and data to be generated first.