Skip to content

Set region from the local authority or country a user enters #2800

Open

Description

@MaxGhenis

What the model does

region (policyengine_uk/variables/household/region.py) has no formula. It defaults to Region.LONDON, and its documentation reads only "Area of the UK". country (policyengine_uk/variables/household/demographic/country.py) derives the nation from region alone and defaults to ENGLAND. local_authority (policyengine_uk/variables/household/demographic/locations.py, line 598) has no formula either and defaults to MAIDSTONE. No formula maps a council to its region or nation, and the system lists brma, local_authority and region as separate basic inputs (policyengine_uk/tax_benefit_system.py, basic_inputs).

So a household keeps the London region whenever its user leaves region unset, whatever council or nation they enter, and the formulas that read region or nation apply London and English rules:

  • The model decides who pays Scottish income tax from country (variables/gov/hmrc/regional/pays_scottish_income_tax.py).
  • It decides liability to SDLT, LBTT and LTT from country (variables/gov/hmrc/sdlt_liable.py, variables/gov/revenue_scotland/lbtt_liable.py, variables/gov/wra/ltt_liable.py).
  • It picks the Scottish and Welsh Council Tax Reduction schemes from country (variables/gov/local_authorities/council_tax_reduction/config.py, is_scotland_scheme and is_wales_scheme).
  • It applies the London benefit cap amounts when region is LONDON (policyengine_uk/utils/benefit_cap.py, in_london).
  • brma places the household in its region's default rental area, Inner South East London for LONDON (variables/household/BRMA.py). It reads region only from values already in memory and never calculates it, so a new region formula would reach brma only when another formula had calculated region first.

For the five councils whose schemes the model holds (Merton, Kingston upon Thames, Newham, Westminster and Oxford), it tests local_authority and country == ENGLAND, so it applies those schemes correctly to an English council with no region.

Example

We ran policyengine-uk 2da212abc for single adults in 2026, each in their own household. The earner, aged 40, earns £50,000 and buys a £300,000 home. The non-earner, aged 30, has no income, does not claim Universal Credit and owes council tax of £1,500 in band H. We ran each case with region unset and with the region that matches what the user entered. We ran the country case in a simulation of its own, because when a user enters a variable for one household, the engine stores its default for the others.

User enters Region unset Matching region entered
Edinburgh council, earner country ENGLAND; income tax £7,486.00; SDLT £5,000; LBTT £0 country SCOTLAND; income tax £8,982.05; SDLT £0; LBTT £4,600
Edinburgh council, non-earner no supported CTR scheme, reduction £0; benefit cap £16,967; rental area Inner South East London; simulated council tax £3,252.10 Scottish scheme, reduction £1,500; cap £14,753; rental area Lothian; simulated council tax £3,983.82
Cardiff council, earner SDLT £5,000; LTT £0 SDLT £0; LTT £4,500
Oxford council, non-earner cap £16,967; rental area Inner South East London; Oxford reduction £1,500 cap £14,753; rental area Southampton; Oxford reduction £1,500
country SCOTLAND, non-earner cap £16,967; rental area Inner South East London cap £14,753; rental area Lothian

For the Edinburgh earner in 2026-27, HMRC charges a taxpayer in the rest of the UK 20% × (50,000 − 12,570) = £7,486.00. It charges a Scottish taxpayer 19% × 3,967 + 20% × 12,989 + 21% × 14,136 + 42% × 6,338 = 753.73 + 2,597.80 + 2,968.56 + 2,661.96 = £8,982.05. On the £300,000 home, SDLT comes to 2% × 125,000 + 5% × 50,000 = £5,000 and LBTT to 2% × 105,000 + 5% × 50,000 = £4,600; in Cardiff LTT comes to 6% × 75,000 = £4,500. DWP caps a single claimant at £16,967 a year in London and £14,753 elsewhere, so for a single claimant outside London whose benefits exceed both caps, the model pays £2,214 a year more than DWP does.

A user who enters none of the three gets LONDON, ENGLAND and MAIDSTONE together: a London region with a Kent council.

What to change

  • When a user enters local_authority but not region, take the region from the council. Build a council-to-region table covering every LocalAuthority member for this, for example from the ONS local authority district to region lookup.
  • When a user enters a devolved country but not region, take the region from the country: SCOTLAND, WALES and NORTHERN_IRELAND each match one Region member. Read only a stored country input here, as brma reads stored values: country's formula reads region, so a region formula that calculates country raises a cycle when the user enters neither.
  • Keep region's carry-over. policyengine-core carries an input forward only when _run_formula returns None (simulations/simulation.py, lines 1795 and 1876), so once region has a formula, a region entered for 2024 no longer reaches 2026 by itself. The formula must read the latest stored region at or before the year first, as brma does (variables/household/BRMA.py, region_in), and a test must cover it. retained_input_variables also classes inputs by having no formula (utils/measurement_branches.py), so check that a supplied region survives drop_calculated_values.
  • Where the entered region, country and local_authority contradict each other, raise an error or a warning.
  • Make brma's fallback read the derived region whatever the calculation order. A region default still puts an Oxford household in Southampton's rental area; if the model takes the rental area from the council (Infer BRMA from Local Authority #298), it places the household in Oxford's own.
  • State the LONDON and MAIDSTONE defaults in the documentation of region and local_authority.
  • Add YAML cases for a Scottish council, a Welsh council and an English council outside London with no region, and a property test that the derived region's nation equals the council's nation.

Related: #298, #2020, #2256, #2021.

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions