Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Check the UK nation filters against policyengine-uk's country formula

Aperta
#569 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@MaxGhenis ci sta già lavorando.

Dal 8/10/2026.

  • #568 di @MaxGhenis — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Start with the nation mapping in countries/uk/regions.py (ENGLISH_REGIONS and the Scotland, Wales and Northern Ireland entries), then compare it with the country formula in policyengine-uk's variables/household/demographic/country.py. Done means a test computes policyengine-uk's country for every Region value, including UNKNOWN, and each nation filter keeps exactly the matching regions. Linked PR #568 is already open, so check it before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What is missing

Since #565 (6.2.3), the UK nation regions filter the stored household region column, and countries/uk/regions.py lists which regions make up each nation (ENGLISH_REGIONS; one region each for Scotland, Wales and Northern Ireland). policyengine-uk keeps its own copy of that mapping in the country formula (variables/household/demographic/country.py), which derives country from region.

No test checks that the two agree. If policyengine-uk changed its Region enum or its country formula, the nation filters would keep households that policyengine-uk places in another nation, and nothing would fail.

Check on the certified data (2026-10-08, main at 07bae75, policyengine-uk 2.102.3)

On enhanced_frs_2024_25_year_2026.h5 (52,846 households), each nation filter keeps exactly the households that policyengine-uk's country assigns to that nation:

region households weighted households
country/england 37,961 26,354,698.47
country/scotland 5,405 2,729,247.77
country/wales 3,821 1,590,754.53
country/northern_ireland 5,659 783,847.56

The four sets are disjoint and cover the file (31,458,548.32 weighted households). Simulation(..., scoping_strategy=country/scotland).run() returns the same 5,405 households and leaves the caller's tables unchanged. #565 noted that the certified artifact was unvalidated, so this closes that gap.

Proposed

Tests that compute policyengine-uk's country for every value of its Region enum (UNKNOWN included) and require each registry nation filter to keep exactly the regions policyengine-uk places in that nation. Add a property over random region-only datasets and an end-to-end Simulation.run() for each nation. Scoping itself stays as #565 made it: stored region, no model calculation.

Lingua principale
Python
Stelle
8
Fork
10
Merge medio
18h 24m
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PolicyEngine/policyengine.py

Tutte le issue di PolicyEngine/policyengine.py

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.