PolicyEngine / PolicyEngine/policyengine-uk
Explore on-the-fly fiscal year parameter conversion
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 50
- Forks
- 33
- Avg merge
- 20h 58m
- Merged PRs (30d)
- 14
Description
Context
PR #1435 fixes the fiscal year parameter conversion range by extending it from 2015-2025 to 2015-2040. This is a simple fix but requires pre-computing values for all 26 years at startup.
Proposed Enhancement
Explore converting fiscal year parameters on-the-fly rather than pre-computing them. This would:
- Remove the year range limit entirely - No need to extend the range for future projections
- Potentially improve startup time - No pre-computation needed for all years
- Simplify the code - Just convert January 1 queries to April 30 dynamically
Attempted Implementation
An initial attempt at this approach was made in PR #1434 by:
- Adding
convert_instant_to_fiscal_year()function - Overriding
get_parameters_at_instant()inCountryTaxBenefitSystem - Making
convert_to_fiscal_year_parameters()a no-op
However, this broke 24 existing tests because it changed parameter lookup behavior for ALL dates, not just annual queries.
PR #1434 contains the work-in-progress on-the-fly implementation - it can be used as a starting point.
Investigation Needed
- Understand why the on-the-fly approach broke existing tests
- Determine if on-the-fly conversion can be safely implemented
- Consider performance implications
- Evaluate backward compatibility concerns
References
- PR #1435: Simple fix (extend range to 2040) ✅
- PR #1434: On-the-fly approach (work-in-progress implementation for this issue)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the on-the-fly implementation in PR #1434 and inspect convert_instant_to_fiscal_year(), CountryTaxBenefitSystem.get_parameters_at_instant(), and convert_to_fiscal_year_parameters(). Run the existing test suite to reproduce the 24 failures, then determine whether conversion can remove the year range without changing non-annual parameter lookups; done means preserving existing behavior while supporting future fiscal years.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100