Summary
Currently, each country package (e.g., policyengine-us) needs to implement its own logic for extending uprating factors beyond the last year of official projections. This is a common pattern that would benefit from being standardized in policyengine-core.
Proposed Feature
Add a utility function to policyengine-core that can programmatically extend parameter values based on a growth rate calculated from the last years of available data. This would:
- Calculate growth rate from the last N years of projections
- Apply that growth rate to extend values through a specified end year
- Handle different period types (monthly, yearly, etc.)
Example Usage
from policyengine_core.parameters import extend_parameter_values
# Extend a parameter through 2100 using growth from last 2 years
extend_parameter_values(
parameter=parameters.gov.some.uprating,
last_projected_year=2034,
end_year=2100,
period_month=10, # For October values
period_day=1,
)
Benefits
- Consistent approach across country packages
- Easier maintenance when projection years change
- Reduced code duplication
- More robust than hardcoding future values in YAML files
Current Implementation
A working implementation can be found in this PR: PolicyEngine/policyengine-us#6384
The implementation includes:
- A generic
extend_parameter_values function
- Support for different period types
- Calculation of growth rates from existing data
Related Discussion
This came up during the review of extending US uprating factors through 2100 for long-term policy simulations.
Summary
Currently, each country package (e.g., policyengine-us) needs to implement its own logic for extending uprating factors beyond the last year of official projections. This is a common pattern that would benefit from being standardized in policyengine-core.
Proposed Feature
Add a utility function to policyengine-core that can programmatically extend parameter values based on a growth rate calculated from the last years of available data. This would:
Example Usage
Benefits
Current Implementation
A working implementation can be found in this PR: PolicyEngine/policyengine-us#6384
The implementation includes:
extend_parameter_valuesfunctionRelated Discussion
This came up during the review of extending US uprating factors through 2100 for long-term policy simulations.