Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/hb-accommodation-dates.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Applied Housing Benefit accommodation earnings disregards from their statutory commencement within the first fiscal year, calculating awards before combining date segments.
1 change: 1 addition & 0 deletions changelog.d/rebuilt-population-records.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed `Simulation.build_from_populations` with another simulation's populations: the simulation, its clones and its branches now treat the values that simulation supplied as supplied and the values the model set itself as the model's, record inputs set afterwards, and calculate again the values that simulation calculated or this one cached for the replaced populations.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ values:
# Schedule 4 paragraph 18 (NI: Schedule 5 paragraph 18) has effect from 5
# October 2026: SI 2026/753 reg. 2(4), as substituted by SI 2026/978 reg.
# 2(2), and NI SR 2026/157 reg. 2(4). There was no such disregard before.
# Neither instrument uprates the sums. The model reads each fiscal year at
# 30 April, so 2026 (2026-27) has no paragraph 18 disregard although it
# applied from 5 October 2026 (183 of the year's 365 days); 2027 onwards
# has the full amounts. fiscal_year_blend is not used: half of an amount
# for the whole year is not the full amount for half the year, because
# the disregard is capped at net earnings and counts in the £17.10 test.
# Neither instrument uprates the sums. Preserve the legal date so awards
# can be calculated separately before/after commencement, including the
# earnings cap and additional-disregard test, then combined over the year.
2006-03-06: 0
2026-10-05: 97.33
metadata:
preserve_calendar_dates: true
period: week
unit: currency-GBP
label: Housing benefit specified or temporary accommodation earnings disregard, couple both under 18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ values:
# Schedule 4 paragraph 18 (NI: Schedule 5 paragraph 18) has effect from 5
# October 2026: SI 2026/753 reg. 2(4), as substituted by SI 2026/978 reg.
# 2(2), and NI SR 2026/157 reg. 2(4). There was no such disregard before.
# Neither instrument uprates the sums. The model reads each fiscal year at
# 30 April, so 2026 (2026-27) has no paragraph 18 disregard although it
# applied from 5 October 2026 (183 of the year's 365 days); 2027 onwards
# has the full amounts. fiscal_year_blend is not used: half of an amount
# for the whole year is not the full amount for half the year, because
# the disregard is capped at net earnings and counts in the £17.10 test.
# Neither instrument uprates the sums. Preserve the legal date so awards
# can be calculated separately before/after commencement, including the
# earnings cap and additional-disregard test, then combined over the year.
2006-03-06: 0
2026-10-05: 119.7
metadata:
preserve_calendar_dates: true
period: week
unit: currency-GBP
label: Housing benefit specified or temporary accommodation earnings disregard, couple with one member 25 or over
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ values:
# Schedule 4 paragraph 18 (NI: Schedule 5 paragraph 18) has effect from 5
# October 2026: SI 2026/753 reg. 2(4), as substituted by SI 2026/978 reg.
# 2(2), and NI SR 2026/157 reg. 2(4). There was no such disregard before.
# Neither instrument uprates the sums. The model reads each fiscal year at
# 30 April, so 2026 (2026-27) has no paragraph 18 disregard although it
# applied from 5 October 2026 (183 of the year's 365 days); 2027 onwards
# has the full amounts. fiscal_year_blend is not used: half of an amount
# for the whole year is not the full amount for half the year, because
# the disregard is capped at net earnings and counts in the £17.10 test.
# Neither instrument uprates the sums. Preserve the legal date so awards
# can be calculated separately before/after commencement, including the
# earnings cap and additional-disregard test, then combined over the year.
2006-03-06: 0
2026-10-05: 61.53
metadata:
preserve_calendar_dates: true
period: week
unit: currency-GBP
label: Housing benefit specified or temporary accommodation earnings disregard, couple both under 25, one 18 or over
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ values:
# Schedule 4 paragraph 18 (NI: Schedule 5 paragraph 18) has effect from 5
# October 2026: SI 2026/753 reg. 2(4), as substituted by SI 2026/978 reg.
# 2(2), and NI SR 2026/157 reg. 2(4). There was no such disregard before.
# Neither instrument uprates the sums. The model reads each fiscal year at
# 30 April, so 2026 (2026-27) has no paragraph 18 disregard although it
# applied from 5 October 2026 (183 of the year's 365 days); 2027 onwards
# has the full amounts. fiscal_year_blend is not used: half of an amount
# for the whole year is not the full amount for half the year, because
# the disregard is capped at net earnings and counts in the £17.10 test.
# Neither instrument uprates the sums. Preserve the legal date so awards
# can be calculated separately before/after commencement, including the
# earnings cap and additional-disregard test, then combined over the year.
2006-03-06: 0
2026-10-05: 77.73
metadata:
preserve_calendar_dates: true
period: week
unit: currency-GBP
label: Housing benefit specified or temporary accommodation earnings disregard, lone parent aged 25 or over
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ values:
# Schedule 4 paragraph 18 (NI: Schedule 5 paragraph 18) has effect from 5
# October 2026: SI 2026/753 reg. 2(4), as substituted by SI 2026/978 reg.
# 2(2), and NI SR 2026/157 reg. 2(4). There was no such disregard before.
# Neither instrument uprates the sums. The model reads each fiscal year at
# 30 April, so 2026 (2026-27) has no paragraph 18 disregard although it
# applied from 5 October 2026 (183 of the year's 365 days); 2027 onwards
# has the full amounts. fiscal_year_blend is not used: half of an amount
# for the whole year is not the full amount for half the year, because
# the disregard is capped at net earnings and counts in the £17.10 test.
# Neither instrument uprates the sums. Preserve the legal date so awards
# can be calculated separately before/after commencement, including the
# earnings cap and additional-disregard test, then combined over the year.
2006-03-06: 0
2026-10-05: 61.41
metadata:
preserve_calendar_dates: true
period: week
unit: currency-GBP
label: Housing benefit specified or temporary accommodation earnings disregard, lone parent under 25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ values:
# Schedule 4 paragraph 18 (NI: Schedule 5 paragraph 18) has effect from 5
# October 2026: SI 2026/753 reg. 2(4), as substituted by SI 2026/978 reg.
# 2(2), and NI SR 2026/157 reg. 2(4). There was no such disregard before.
# Neither instrument uprates the sums. The model reads each fiscal year at
# 30 April, so 2026 (2026-27) has no paragraph 18 disregard although it
# applied from 5 October 2026 (183 of the year's 365 days); 2027 onwards
# has the full amounts. fiscal_year_blend is not used: half of an amount
# for the whole year is not the full amount for half the year, because
# the disregard is capped at net earnings and counts in the £17.10 test.
# Neither instrument uprates the sums. Preserve the legal date so awards
# can be calculated separately before/after commencement, including the
# earnings cap and additional-disregard test, then combined over the year.
2006-03-06: 0
2026-10-05: 77.73
metadata:
preserve_calendar_dates: true
period: week
unit: currency-GBP
label: Housing benefit specified or temporary accommodation earnings disregard, single claimant aged 25 or over
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ values:
# Schedule 4 paragraph 18 (NI: Schedule 5 paragraph 18) has effect from 5
# October 2026: SI 2026/753 reg. 2(4), as substituted by SI 2026/978 reg.
# 2(2), and NI SR 2026/157 reg. 2(4). There was no such disregard before.
# Neither instrument uprates the sums. The model reads each fiscal year at
# 30 April, so 2026 (2026-27) has no paragraph 18 disregard although it
# applied from 5 October 2026 (183 of the year's 365 days); 2027 onwards
# has the full amounts. fiscal_year_blend is not used: half of an amount
# for the whole year is not the full amount for half the year, because
# the disregard is capped at net earnings and counts in the £17.10 test.
# Neither instrument uprates the sums. Preserve the legal date so awards
# can be calculated separately before/after commencement, including the
# earnings cap and additional-disregard test, then combined over the year.
2006-03-06: 0
2026-10-05: 61.41
metadata:
preserve_calendar_dates: true
period: week
unit: currency-GBP
label: Housing benefit specified or temporary accommodation earnings disregard, single claimant under 25
Expand Down
18 changes: 13 additions & 5 deletions policyengine_uk/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@
from policyengine_uk.utils.supplied_inputs import (
SUPPLIED_INPUT_VARIABLES,
copy_model_values,
copy_other_populations,
drop_missing_model_values,
drop_missing_supplied_inputs,
forget_model_values,
forget_replaced_model_values,
keep_population_records,
model_value_input_records,
)
from policyengine_uk.reforms import create_structural_reforms_from_parameters
Expand Down Expand Up @@ -591,11 +592,18 @@ def delete_arrays(self, variable: str, period: Period = None) -> None:
del records[recorded_period]

def build_from_populations(self, populations) -> None:
# Take a copy of what another simulation made, so that neither changes
# the other's values or records.
populations, adopted = copy_other_populations(self, populations)
super().build_from_populations(populations)
# The new populations hold none of the values set_model_value stored,
# so an equal value a rebuild stores (from a situation or a frame) is
# supplied.
forget_model_values(self)
# Formulas read the fast cache, so drop what it holds for the replaced
# populations, as _start_new_population does.
if getattr(self, "_fast_cache", None) is not None:
self._fast_cache = {}
# Keep the records of inputs and model values (set_model_value) of
# the values the new populations hold, and only those: an equal value
# a rebuild stores later (from a situation or a frame) is supplied.
keep_population_records(self, adopted)

def set_input(self, variable_name: str, period: Period, value) -> None:
# What is set here is supplied, even a value equal to the model's own,
Expand Down
Loading
Loading