Use disclosure-controlled UK geography outputs for constituency and local authority impacts
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start with simulation_output_geographic.py, especially build_uk_constituency_impact and build_uk_local_authority_impact, and inspect how Stage 12 retains household identifiers. Read the compute_uk_geography_disclosure API in the pinned policyengine.py 6.7.5 and its tests. Done means both geography breakdowns use one nested release, blocking findings withhold suggested cells while references remain published, and backward compatible output includes optional tier and interval fields; keep source_household_id and region_code_oa in the retained frame.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
UK constituency and local-authority results in the economy output are not disclosure-controlled, and some of them are wrong in a way readers can see.
The executor builds them with policyengine.py's deprecated compute_uk_constituency_impacts and compute_longwise_uk_geography_impacts (simulation_output_geographic.py, build_uk_constituency_impact and build_uk_local_authority_impact). Per area, these compute:
average_household_income_change= Σ(change × w) / Σwrelative_household_income_change= Σ(reform × w) / Σ(baseline × w) − 1
There is no minimum sample. A small cell with a few negative-income households has a baseline total near zero or below zero, so the relative change explodes or changes sign.
Examples from production output
Reform: gov.hmrc.income_tax.rates.uk[0].rate 0.20 → 0.21, 2026.
- App report 4684, region
country/wales. Cardiff West:average_household_income_change≈ −192, butrelative_household_income_change≈ +13.72 (the app shows +1372%). A tax rise that loses £192 shows a large gain. Both values imply a baseline mean household income of about −£14. Caerphilly shows −5.6%, while neighbouring seats show −0.1% to −2.3%. - App report 4693, UK-wide. Pendle and Clitheroe shows +1.8%, while every other English constituency loses.
First reported, in the wrong issue, at https://github.com/PolicyEngine/policyengine-sim-api/issues/858#issuecomment-6301724245.
Licensing risk
The UK datasets derive from UK Data Service licensed survey microdata (FRS and others). The End User Licence binds every published number, and a local result that rests on a handful of survey households can breach it. policyengine.py deprecated the two functions above for this reason: their output "is not disclosure-controlled, so it must not be published when the data is licensed survey microdata". The executor still publishes it in every UK economy result, through the API and the app.
Fix
policyengine.py already has the replacement: compute_uk_geography_disclosure (PolicyEngine/policyengine.py#605, closing PolicyEngine/policyengine.py#589), available in the pinned 6.7.5. It applies a count floor of 10 distinct survey households (by source_household_id), a dominance rule, a check on what subtraction between published areas recovers, a bootstrap 90% interval and precision-adaptive rounding. Each cell is reported, approximate or withheld.
Switch both breakdowns to it:
- Build constituencies and local authorities in one release, nested in regions and the nation, so the check sees both levels.
- Resolve blocking findings by withholding the suggested cells; never withhold a reference (region or national) cell, because those numbers are public elsewhere.
- Keep the output contract backward compatible: existing fields keep their types. A withheld area is left out of the list. Published areas gain optional fields for the tier and the 90% interval.
- Keep
source_household_id(andregion_code_oa) in the Stage 12 retained household frame.
Known limits
- The enhanced FRS 1.58.1 in the current bundle sets
source_household_idafter its SPI and capital-gains copies are stacked, so copies of one survey household count separately (PolicyEngine/policyengine-uk-data#591, fixed in #597 for later releases). Support is overstated on that release until the bundle moves to a rebuilt eFRS or to Microcosm (PolicyEngine/policyengine.py#685). - The check covers one run. It does not compare results across runs, such as a UK run against a Wales run.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 1
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 60
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine-sim-api
-
Update policyengine to 6.7.3Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 70/100
PolicyEngine/policyengine-sim-api#823 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Integration tests fail due to missing UV virtual environment setupCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
PolicyEngine/policyengine-sim-api#314 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Staging deployments do not promote their tested Simulation Entrypoint revisionCó thể đã có người làm @anth-volk đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
PolicyEngine/policyengine-sim-api#893 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Daily dependency update fails: merging main into the update branch produces a uv.lock that uv cannot parseCó thể đã có người làm @anth-volk đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
PolicyEngine/policyengine-sim-api#889 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
PolicyEngine/policyengine-sim-api#884 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PolicyEngine/policyengine-sim-api
Issue tương tự
-
infrastructure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
khuisman/mcp-gee-sweet#1152 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
backroom bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ditto-assistant/ditto-subnet#3069 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
open-webui/open-webui#32901 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
0.3.3 bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày