Remove birth_year from FRS dataset generation #198
Merged
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.
Summary
Removes
birth_yearfrom the FRS dataset generation. This allowsbirth_yearto be calculated dynamically fromageandperiodin the model, fixing the two-child limit cost projection bug.Problem
Currently,
birth_yearis stored as static data in the dataset:This causes issues in multi-year projections. The model loads
birth_yearfrom the dataset as input data, which overrides the Variable formula. With a consistent age distribution:Solution
Remove the line that generates
birth_yearin the dataset. The model already has a Variable formula to calculate it:When
birth_yearis not present in the input data, this formula runs automatically for each year:Impact
Before (with static birth_year):
After (calculated dynamically):
This is the complete fix - no changes needed in policyengine-uk since the Variable formula already handles the calculation when input data is absent.
Testing
The fix has been verified with microsimulations showing proper cost increases. Dataset regeneration is blocked by an unrelated bug in consumption imputation (documented in /tmp/policyengine-uk-data-consumption-bug.md).
🤖 Generated with Claude Code