PolicyEngine / PolicyEngine/microcosm

UK dataset build: full migration from policyengine-uk-data (master epic)

Open
#665 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
0
Forks
4
Avg merge
1d 3h
Merged PRs (30d)
94

Description

Goal

Migrate the UK dataset build fully from policyengine-uk-data into microcosm, at parity, then archive policyengine-uk-data (the policyengine-us-data precedent). End state: policyengine-uk consumes only microcosm-built datasets — national default, sparse default, and the local variant — calibrated exclusively from chronicle facts.

This epic supersedes #144, which tracked the same goal as a flat backlog.

Architecture invariants

  • Frame is the carrier through every stage; calibration is rowwise via the microcosm.calibrate front door.
  • Country package = pure JSON specs (build/uk/), executed by shared runtimes; Python in uk_runtime/ migrates toward specs (#159).
  • Target values come only from pinned chronicle consumer artifacts; computed targets (uprating, rate×count, splits) are explicit microcosm-side declarations.
  • Scope ruling carried from #144 (2026-07-24): the build is based solely on raw microdata, ledger facts, and the rules engine (plus inflation/aging updates) — no inheritance of processed artifacts whose generating code stays behind in uk-data.
  • No stage ships degraded: fail-closed plan, closed-world gate entries, evidence_absent over invented passes.
  • Every build attempt — including failed rungs and discarded candidates — appends a hash-chained Logbook row (#628), so the migration's intermediate-build history stays reconstructible.
  • Never import policyengine_uk_data — port definitions, don't wrap them.

Phases

Phase Contents Milestone
P0 Unblockers (A) Fresh national rebuild passes armed gates; schema-4 verification lands
P1 Facts wave 2 (B) + target references (C) + calibration seam (D) First microcosm-calibrated national release, on the certified spine, from chronicle facts only
P2 Raw ingest + imputations (E) + uprating (F) Spine built in microcosm from raw FRS 2024-25 sources (#723 retarget; 2023 build deferred to #687)
P3 Facts wave 3 (B) + local areas (G) UK local variant published (constituency + LA weights)
P4 Sparse default (H) + downstream integration (I) ~50k L0 national default; policyengine-uk consumes microcosm datasets
P5 Decommission (J) policyengine-uk-data archived

Workstreams

  • A — Unblockers: #663, #630, #609, #654, #636, #666 (UK Logbook adoption), UK CI lane (to be filed)
  • B — Facts to chronicle: PolicyEngine/chronicle#133, PolicyEngine/chronicle#134, PolicyEngine/chronicle#135
  • C — National targets from facts: #622
  • D — National calibration seam: #623, #736
  • E — Raw-source ingest + imputations: #145 (children #677–#688 + #723 vintage retarget; E1–E4+E7 landed; vintage decision 2026-08-19: parity vs enhanced_frs_2024_25)
  • F — Uprating / multi-year: #148
  • G — Local areas (rowwise): #495 (children: #146, #147)
  • H — Sparse national default: #355
  • I — Release + downstream integration: tracking issue to be filed when the workstream spins up (includes a policyengine-uk child issue for loader consumption)
  • J — Decommission: tracking issue to be filed when the workstream spins up

Related, non-blocking: #365, #31, #552/#364/#467, #180, #325, Logbook epics #637/#641 (workstream H publication surface), #661 (diagnostics carry chronicle package IDs — workstream D), naming cleanups #639/#640/#737.

Carried-over uk-data backlog

policyengine-uk-data stayed active after #144's June bookkeeping and accumulates new issues — 5 open as of 2026-08-12: PolicyEngine/policyengine-uk-data#438 (stale public-transfer feed, state pension ≡ £0 → workstream F/#148), PolicyEngine/policyengine-uk-data#448 (Scottish/Welsh council tax +20–30%, WAS owned_land instability → E and C/D), PolicyEngine/policyengine-uk-data#450 (UC deduction attributes imputation → E, new stage), PolicyEngine/policyengine-uk-data#452 (UC caseload ~40% below admin counts → D/E), PolicyEngine/policyengine-uk-data#453 (unsourced mortgage target → B, already a recorded chronicle blocked source). Dispositions live in the roadmap doc's Appendix B; workstream J re-sweeps the live list at decommission time.

Sequencing notes

  • C/D deliberately run on the existing certified spine first: prove facts→targets→calibration→gates at parity before any ingest work, then E swaps the spine underneath a fixed harness.
  • E (microcosm-side) and wave 3 (chronicle-side) parallelize; G needs both.
  • H needs only D + schema-4 verification — the exact-k machinery is country-agnostic.
  • The incumbent keeps releasing until I completes; every incumbent refresh widens the parity bar.

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

Read build/uk/ and uk_runtime/ first, then trace the microcosm.calibrate front door and the certified-spine and gate workflow. Review the pinned chronicle consumer artifacts and Logbook requirements before choosing a phase or workstream. Done means policyengine-uk consumes only microcosm-built national and local datasets at parity, with failed builds recorded and policyengine-uk-data ready for archival.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.