PolicyEngine / PolicyEngine/policyengine-uk

UKSingleYearDataset silently ignores fiscal_year with file_path, and defaults it to a hardcoded 2025

Open
#1,845 0 comments 0 reactions 1 assignee View on GitHub

@juaristi22 is already working on this.

Since Sep 3, 2026.

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

Description

UKSingleYearDataset.__init__ (policyengine_uk/data/dataset_schema.py:42-67) takes fiscal_year: int = 2025, but the argument is only used on the DataFrame branch:

if file_path is not None:
    ...
    self.time_period = str(f["time_period"].iloc[0])   # line 58
else:
    ...
    self.time_period = str(fiscal_year)                # line 67

Two problems.

fiscal_year is silently ignored when file_path is given. Passing a conflicting value has no effect and produces no warning:

frs_2024_25.h5                        -> time_period = 2024
  same file with fiscal_year=2030     -> time_period = 2024   (argument ignored)

The default is a hardcoded year that drifts. Building from DataFrames without passing fiscal_year silently labels the data 2025:

UKSingleYearDataset(person=..., benunit=..., household=...)  -> time_period = 2025

The latest FRS release is 2024/25, which on our convention is label 2024 (CURRENT_FRS_RELEASE.survey_year = 2024), so the default is already a year ahead of the newest data available, and it will be wrong differently every year. An external collaborator raised exactly this.

Nothing we ship is affected — create_frs passes fiscal_year=year at all three construction sites — but the failure mode for anyone assembling a dataset by hand is a silently mislabelled time_period, which then feeds the wrong policy year into every calculation.

Suggested fix: warn when fiscal_year is passed alongside file_path (where it cannot take effect), and make fiscal_year required on the DataFrame branch rather than defaulting to a hardcoded year.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.