PolicyEngine / PolicyEngine/policyengine-uk

Mid-year parameter changes are dropped by fiscal year conversion

Open
#1,807 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
50
Forks
33
Avg merge
20h 58m
Merged PRs (30d)
14

Description

Summary

convert_to_fiscal_year_parameters samples every parameter at 30 April and writes that value across the whole year, so any change taking effect later in the fiscal year is dropped. 93 parameters carry 205 values in that window. Each needs a decision on whether its annual value should be a single point or a within-year average; #1806 adds the mechanism and applies it to capital gains only.

Worked example

National Insurance carries the Health and Social Care Levy repeal:

2022-04-01: 0.1325
2022-11-06: 0.12

The model returns 0.1325 for every date in 2022, including 31 December. The repeal is in the parameter file and absent from the results.

The primary threshold has the same problem in the other direction, and here HMRC publishes the answer: the threshold rose from £190 to £241.73 a week on 6 July 2022, and HMRC's annual figure for 2022-23 is £11,908 — a blend. PolicyEngine uses the pre-July value for the whole year, so it is roughly £2,000 of annual threshold short for every employee in 2022-23.

What needs deciding, per parameter

Averaging is right where the parameter applies to a flow spread over the year, such as a rate on annual earnings. It is wrong where the parameter applies at a point in time:

  • Transaction taxes. Stamp duty and land transaction tax thresholds changed on 8 July 2020 and 1 July 2021. A purchase is taxed at the rate in force on its date, so an average would tax every purchase at a rate no purchase faced.
  • Indices and caps. gov.indices.private_rent_index has 72 values in the window and gov.ofgem.energy_price_cap has 8. Whether the annual figure should be an average depends on how each is consumed.
  • Levels with a clear annual equivalent. National Insurance thresholds and rates, and minimum wage rates that changed each October before 2017, have published or derivable annual equivalents.

Suggested approach

  1. Group the 93 parameters by whether a within-year average is the correct annual value.
  2. Set fiscal_year_blend: true where it is, checking against a published annual figure where one exists — the £11,908 NI threshold is a good first test.
  3. For parameters where it is not, leave the flag off and note why in the description, so the behaviour is a choice rather than an accident.
  4. Consider warning at load time when a value lands in the window on a parameter without the flag, so new cases surface rather than being silently dropped.

The full list is reproducible by walking values_list for every Parameter and selecting values dated after 30 April. Related: #1775 Workstream A, which needs historical years to be right for exactly these parameters.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with convert_to_fiscal_year_parameters and walk values_list for each Parameter, using #1806 to understand the existing blending mechanism. Group the 93 affected parameters by annual-value semantics, set fiscal_year_blend where averaging is appropriate, document exceptions, and consider load-time warnings for unflagged changes. Validate the approach against the published £11,908 National Insurance threshold.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.