Repository navigation
Describe the Microcosm UK pipeline and calibration targets, and update UK validation and capital gains copy - #56
Conversation
scripts/extract_uk_calibration_targets.py builds src/data/ukCalibrationTargets.json from the national and local-area releases that policyengine.py serves. Their diagnostics are licensed, so the script runs locally and only the JSON is committed. It checks the national diagnostics' sha256 against the bundle manifest, and the local-area diagnostics' against that release's manifest, whose H5 must match the bundle's. Each target is reduced to whitelisted fields (value, period, citation, geography, unit, filter variable names, transformation notes) before grouping, and assert_clean() refuses forbidden keys in the output. Rows key on measure concept and filter variable names; a row without an entry in the LABELS table stops the extraction. This JSON comes from the pair policyengine.py 6.11.1 serves (national a6299504, local area c9df4b86): 24,303 targets in 152 rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UK page said calibration targets were available for the US only. It now renders src/data/ukCalibrationTargets.json with the US page's table, search and level badges, using UK levels: UK, GB, England and Wales, nation, region, constituency, local authority and Scottish BRMA. It shows target values only. CalibrationPage.tsx changes only its non-US branch, so the US page is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UK pipeline page described the Enhanced FRS build (FRS 2023-24, WAS round 7, constituency and local-authority weight matrices). It now follows the Microcosm UK build at microcosm 90ff43f (policyengine-uk 2.162.8): the 49-stage spine, then the national file and the 150,000-household local-area file, their calibration and gates, publication, and how policyengine.py serves national and area results. Steps new at 90ff43f are marked as such. DataPipeline.tsx gets the UK intro and branch labels, and a UK-only ScrollBox so the wider UK flow and the stage tables scroll inside their box on phones. The US renders as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UK calibration page renders every JSON row, with header counts, level badges and values from the JSON and no fit figures. The UK pipeline page has none of the Enhanced FRS pipeline's stale phrases, and names the Enhanced FRS only as the previous default or a reference. The US pages are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PolicyEngine certifies both files of a Microcosm UK release together, the national file and the local-area file. The pipeline page said the certificate covered the national file only and that constituency and local-authority results were not certified. The UK overview now keeps imputation (what gives records their characteristics) apart from calibration (how many households each record represents). The high-income and size-selection stages link Microcosm's imputation and L0 working papers instead of explaining the methods at length, and the national calibration stage notes that the calibration paper is in preparation. A stage link may now point to an external page; the US stages' links are internal and render as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From María's review of the preview: - The intro says the UK model runs on Microcosm UK and links microcosm.institute, without the version history. - The commit and policyengine-uk version move to a small footer linked to GitHub. The page no longer separates this build from the pair policyengine.py serves, so the "new at 90ff43f" markers go. - The working-paper links leave the stages, since the intro links the institute. So do the FRS block's sentence on pooling, the publication-tag sentences and the release_certification.json detail. - The national branch gets a National gates stage with the National dataset below it, as the local branch has. PipelineStage gains national-sub-1 and national-sub-2 rows, drawn in the left half of the local sub-rows with the same number. For the US those halves stay the empty spacer they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first sub-row was pulled up 25px, which the US layout needs because its national row ends in a taller final-dataset box. On the UK page that left the national gates and the joint solve almost touching the boxes above them. The pull-up now applies only when the national row holds a final dataset. The national dataset shared a row with size selection and refit, and its taller box pushed the local gates down. It now sits in the bottom row beside the local-area dataset, and the national line runs straight down to it. National rows can sit beside any of the four local sub-rows. For the US those halves stay the empty spacer they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ital gains response The UK validation page described TAXSIM validation of federal and state income tax, which covers US taxes only. It now says PolicyEngine compares its UK estimates with published figures, and links the UK view of the PolicyEngine scorecard. The behavioural responses page showed the CBO's US capital gains elasticities for the UK too. The UK section now describes the response PolicyEngine applies by default: realised gains scale with the retention rate at an elasticity of 1.0 (Advani, Lonsdale and Summers, 2024), with 0.5 and 2.0 as sensitivities, and an optional separate 1.4 for Business Asset Disposal Relief gains. The US pages are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UK page showed the CBO's US labour supply presets, including a substitution table by income decile, which policyengine-uk does not have. It also described an elasticity of taxable income framework and linked the US methodology post. The UK page now says the UK model is static on labour supply by default (both elasticities 0). When users set them, a reform changes employment income by the substitution elasticity times the change in the net-of-tax marginal wage, plus the income elasticity times the change in household net income, each change capped at 100%. It notes that policyengine-uk's OBR labour supply model runs only when an analysis calls it, and that policyengine.py uses the two elasticities. The illustrative chart is labelled with the values it uses, and the UK copy spells "labour". The US page is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UK cards showed the policyengine-uk defaults, which are 0. They now show the values PolicyEngine uses when it turns the response on: an income elasticity of -0.05 and a substitution elasticity of 0.25. These are the CBO's central estimates, as in PolicyEngine's UK behavioural responses report, which the source line links. The text says the model is static unless a reform turns the response on, and the illustrative chart uses the same values. The OBR note now gives that model's ranges by demographic group and says it currently models hours worked only. The US page is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@juaristi22 round 1, at Verdict: the pipeline description matches microcosm closely, and the targets I checked match. Two must items before this leaves draft: the page says "certified" about a build that has no certified release, and it doesn't say the datasets are licensed and not public. I checked against microcosm Findings
What matchedPipeline parameters checked against microcosm at
Targets spot-checked against
I did not check the values themselves against the source tables. The extractor reads them from the release diagnostics, which I can't open. Prose is neutral and quantitative, in British English and sentence case. The labour supply defaults match policyengine-uk (both elasticities 0 unless turned on). The capital gains text matches What I ran
Skimmed only: 🤖 Generated with Claude Code |
…ow copy The UK pipeline intro now says both files are built from survey microdata licensed through the UK Data Service, the SPI Public Use Tape included, so they are available only to licensed users and are not public downloads. Every study label names the UK Data Service. The national calibration detail says a few targets bind to one year's figure instead of the calendar-2025 window, such as the Winter Fuel Payment. The release-cut summary adds the constant and negative column checks. The incumbent comparison is described as a lower calibration loss than the pinned Enhanced FRS on the targets both can be scored on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The extractor reads ukPipelineSource.modelVersion from src/data/ukPipelineStages.ts and stops when the releases were built with another policyengine-uk version, so a regeneration cannot pair the table with a different engine version from the page's. The release files do not record the Microcosm commit, so matching ukPipelineSource.commit stays a manual check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… every release-cut check Most OBR forecasts and HMRC Income Tax liabilities figures take the 3/12 + 9/12 window. Other fiscal-year figures are held at one year, such as the OBR alcohol, tobacco and gambling duties at 2024-25 and the Winter Fuel Payment at 2025-26, so "a few" understated them. Those duties are also measured at 2024, so the detail now says most targets are measured at 2025. The release-cut summary now covers all 19 gates. It adds stage coverage, parity of the compiled targets with a signed reference, administrative totals and Universal Credit's coherence with capital. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@vahid-ahmadi thanks. Round 1 is in 8badda5 and e5a7c64 (page copy) and 56c003a (extractor).
Checks: vitest on the two UK test files passes (24 tests), and the extractor tests pass (61 passed, 1 skipped: the test that needs the licensed files). eslint and 🤖 Generated with Claude Code |
|
@juaristi22 round 2, at Verdict: round 1 must 2 and both shoulds are fixed. Must 1 is only half fixed: waiting for a certified pair deals with the build, but "certified together" stays wrong even then, because policyengine.py certifies only the national file. Please keep this in draft. Round 1 items
New findingsNone besides the reframed must 1. What I ranFresh clone at 🤖 Generated with Claude Code |
Summary
/uk/model/data/pipeline) for the Microcosm UK build at microcosm90ff43f(policyengine-uk 2.162.8). It described the Enhanced FRS build (FRS 2023-24, WAS round 7, constituency and local-authority weight matrices)./uk/model/data/calibration), which said target details were available for the US model only. It uses the US page's table, search and level badges, with UK levels.scripts/extract_uk_calibration_targets.py, which buildssrc/data/ukCalibrationTargets.jsonfrom the two UK releases policyengine.py serves.This is a draft until both pages describe one certified build: the next pair, being built on
90ff43fwith policyengine-uk 2.162.12 and one unreleased engine change. Once policyengine.py certifies it:Sources
90ff43f9575fb5ae5c0c4389ba4790ab4ade5722(the merge of microcosm#1373), which locks policyengine-uk 2.162.8. The files read at that commit:uk/source_stages.json(49 stages);uk/gates.json(81 gates: 79 release-blocking, 2 diagnostic) and the gate scopes inuk_runtime/calibration_run.py;uk_runtime/national_doctrine.py,uk_runtime/local_doctrine.pyanduk_runtime/graph_calibration.py(solver settings);uk/uk_atomic_area_supports.provenance.json(small areas).b14ee554):src/policyengine/data/bundle/manifest.jsonandcountries/uk/regions.py.67ee2ddf3with policyengine-uk 2.151.0:microcosm-uk-2024-25-national-20261025T091414Z-a6299504: itscalibration_diagnostics.jsonsha256 (e61a60a1…) matches the bundle manifest;microcosm-uk-2024-25-dense-20261026T105309Z-c9df4b86: its diagnostics sha256 (44ab1c29…) matches that release's manifest, whose H5 matches the bundle.What changed, by page
Pipeline (
src/data/ukPipelineStages.ts,src/components/data/DataPipeline.tsx)DataPipeline.tsxgets the UK intro and branch labels. A UK-onlyScrollBoxmakes the wider UK flow and the stage tables scroll inside their own box on phones. For the US it renders its children unwrapped, so US output is unchanged.PipelineStagegainsnational-sub-1tonational-sub-4rows. The UK uses row 1 (national gates, beside the joint solve) and row 4 (national dataset, beside the local-area dataset), and the national line runs straight through rows 2 and 3. Rows are evenly spaced: the 25px pull-up of the first sub-row, which the US needs for its taller final-dataset box, applies only when the national row holds a final dataset. For the US the national halves stay empty, as before.Calibration (
src/views/data/UkCalibrationPage.tsx,src/views/data/CalibrationPage.tsx,src/data/ukCalibrationTargets.json)90ff43fthe constituency energy split, read "Microcosm derivation from open data".CalibrationPage.tsxchanges only its non-US branch, so the US page is unchanged.Validation (
src/views/data/ValidationPage.tsx)policyengine.org/scorecard?country=uk). The US page is unchanged.Behavioural responses (
src/components/theory/BehavioralResponses.tsx,src/data/elasticities.ts)Extractor (
scripts/extract_uk_calibration_targets.py,scripts/test_extract_uk_calibration_targets.py)assert_clean()refuses forbidden keys in the output.90ff43frelease are already in place; the script lists labels that no row used.ukPipelineSourceinsrc/data/ukPipelineStages.ts), so a regeneration can't pair the table with a different engine version from the page's. The release files don't record the Microcosm commit, so matching that is a manual step.Disclosure control
Verification
bun run test: all 16 files passed at7b9c449(178 tests, in Vahid's round-1 run). The touched test files re-ran after each later change.bun run lint: clean.bun run build: passes. eslint andtsc --noEmitre-ran on the files changed after those runs.uv run --no-project --with pytest pytest scripts/test_extract_uk_calibration_targets.pypasses 61 tests. One more test, which needs the licensed files, confirms the committed JSON is exactly what the script extracts from them.next devin headless Chromium at 375 px and 1440 px (re-run after the review changes, including validation and behavioural responses):Merge order
DataPipeline.tsx,CalibrationPage.tsxandpipelineStages.ts.CalibrationPage.tsxandpipelineStages.tsmerge cleanly.DataPipeline.tsxhas one conflict hunk, in the intro-text ternary: keep Rewrite the US data pipeline and calibration pages for the Microcosm default release #49's US line and this PR's UK line.Follow-ups
src/data/ukCalibrationTargets.jsonfrom it, re-check the pipeline page against the code it was built from, and move the footer to the commit on main that carries that code and to its engine version.programs.yaml) and uses UK terms on the Rules overview.data/comparisons/artifacts.yamlandtransparency.yaml) still name the Enhanced FRS (policyengine-uk-data) as the UK dataset, as the US entries still name the Enhanced CPS.🤖 Generated with Claude Code