Ingest the full raw FRS table set and assemble the UK spine as a Frame - #692
Draft
juaristi22 wants to merge 1 commit into
Draft
Ingest the full raw FRS table set and assemble the UK spine as a Frame#692juaristi22 wants to merge 1 commit into
juaristi22 wants to merge 1 commit into
Conversation
Declare the frs_spine stage in uk/source_stages.json: 14 sha+size-pinned FRS 2023-24 tabs, generic operations, and an 82-column load-bearing output surface (direct raw mappings only — the derived layer, stochastic layer, and imputations stay with later WS-E children). New uk_runtime/frs_spine.py ports the incumbent's entity/ID scheme (household sort invariant included), gross4 design weights, and the raw column mappings with WEEKS_IN_YEAR applied uniformly (signed difference at three incumbent *52 call sites). country_stage_plan gains country-agnostic stage_names subsetting so the spine and national pipelines share one manifest; the national driver selects its two stages explicitly. New tools/build_uk_frs_spine.py driver (fail-closed pins, atomic write, Logbook row per attempt, nonzero-shares parity mode, no seed — the build is structurally deterministic). Workstream E2 of the UK migration (#145, #665); stacks on E1 (#690). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Workstream E2 of the UK migration (#145, master epic #665). Closes #678. Stacked on #690 (E1) — review this PR's own diff as the last commit; the base is the E1 branch.
What
Microcosm now assembles the UK spine Frame itself from the 14 raw FRS 2023-24 tables — the future replacement for loading the certified incumbent H5 (
--input-h5). Scope is deliberately fenced to direct raw→column mappings: no derived layer (E3), no stochastic layer (E4), no imputations (E5+), and neither incumbent mid-build Microsimulation call site.uk/source_stages.json— newfrs_spinestage, first in the manifest: 14 sha256+size-pinned licensed tab artifacts (tax-year vintage label2023_24), six operations reusing generic kinds plus three new generic ones (assemble_group_entities,map_coded_amounts,annualize_periodic_amounts), and an 82-column load-bearing output surface (outputs compile intoStagePlan.produces— the E1 licensed-data lesson applied from the start). The two E1 stage declarations are untouched (lockstep test still pins them).country_stage_plan(..., stage_names=...)— country-agnostic subsetting so two pipelines (spine build; national staging) can share one manifest: default keeps all-stage behavior, explicit tuples are validated (non-empty, no duplicates, unknown names refused) and execute in manifest order. The national driver now selects its two stages explicitly.uk_runtime/frs_spine.py— pinned verify-then-open reads, the incumbent's entity/ID scheme (household-ID sort invariant ported as regression armor),gross4→ typed design weights, and the raw mappings: demographics, incomes (pension/accounts/oddjob tables), the full benefit-code table including the JSA/ESA contribution/income splits, expenses, and the household housing surface.WEEKS_IN_YEARapplied uniformly — a signed difference at the three incumbent*52call sites.tools/build_uk_frs_spine.py— fail-closed driver: atomic write through the shared writer,.build.jsonevidence sidecar (aggregates only), a Logbook row per attempt (pipelineuk-frs-spine),--emit-nonzero-sharesparity mode, and no seed (the build is structurally deterministic; documented in--help).UK-specificity note
UK-specific: the stage declaration (FRS/UKDS identities),
frs_spine.py(FRS coded domains, benefit codes, UK entity structure), the driver's pipeline identity, and the domain maps (region/tenure/accommodation/band). General: the subsetting extension, the three new operation kinds (any country can use them), and everything routed through the shared manifest/StagePlan/writer machinery.Licensed-data acceptance (all data stayed local; disclosure-safe evidence only)
compare_uk_h5_payload.pyverdictpayload_identical: true(exit 0).Implementation notes
Codex implemented under
/codex-implement-plan; deviations recorded in review: byte-identical output shas are unattainable through the shared H5 writer (HDF5 metadata timestamps — the known reasoncompare_uk_h5_payload.pyexists), so determinism is asserted at payload level; the vintage-conditional incumbent branches are resolved at 2023-24 and enumerated in the report (post-2021 domestic-rates branch; corrected contiguous 12-region map). One integration fix landed in review: the E1 shim-equivalence test selected manifest stages positionally and broke whenfrs_spinebecame the manifest root — it now selects by name and passes the explicit two-stage subset.🤖 Generated with Claude Code