Consolidate the shared target code so it serves the UK and the US
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 32/100
Hướng nghiên cứu
Start with the four work items and the named UK and US modules, then inspect the branch for #1755 and the related tests and parity fixtures listed in the rules. Work through each item as its own commit, preserving both countries’ target choices and behavior. Done means both countries call one shared module for each job and all UK and US pins remain unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Part of #1728.
Problem
#1755 moved US target code into four shared modules that hold no country code. Only the US calls them. The UK uses other shared modules for some of the same jobs, and UK-only code for others. So the repository now has two target selectors, two styles of reviewed register and two hold-out paths. A change to one of these jobs must be made twice, and the two countries can drift apart.
Today
| Job | UK | US (after #1755) |
|---|---|---|
| Which compiled targets a product keeps | Shared microcosm.calibrate.target_selection.select_targets, which keeps targets by geography level through a UK resolver (uk_runtime/graph_targets.py). Plus UK-only calibration lines (uk_runtime/ledger_targets.uk_registry_on_calibration_line). |
Shared microcosm.calibrate.target_sets, with us/target_sets.json |
| Reviewed registers (exclusions and similar) | JSON files, each read by its own UK loader: uk/calibration_measure_exclusions.json (uk_runtime/measure_simulation.py), uk/local_small_cell_rule.json (uk_runtime/ledger_targets.py), uk/target_fit_reviewed_exclusions.json, uk/local_target_fit_reviewed_exclusions.json and uk/local_area_support_exclusions.json (uk_runtime/weighted_integrity.py) |
Shared microcosm.build.declared_registers, with us/fiscal_target_registers.json |
| Hold-outs | Shared microcosm.build.holdout.rotated_folds; the training target set is UK code (uk_runtime/local_rowwise.py) |
Shared microcosm.build.target_holdouts: hashed blocks, the training target set and the pro-rata scoring. It calls holdout.hash_holdout_unit. |
| Cells that no record supports | UK-only uk_runtime/support_floor.py and uk_runtime/off_surface_cells.py |
The county minimum support, still tool code (tools/us_acs_local_county_surface.py) |
| Population rows from a geography ladder | Not used: UK populations compile from Chronicle facts | Shared microcosm.build.ladder_population_targets |
| Loss weights, area support, weight bound | Shared (#1735) | Shared (#1735) |
Work
Each item is its own commit with its own proof. The work builds on the branch of #1755.
- One selector. Declare the UK products' target sets in
uk/target_sets.json, read bymicrocosm.calibrate.target_sets: the geography levels that the UK resolver keeps, and the calibration lines as clauses. Then decide whethertarget_selection.select_targetsstays for other callers. - One register reader. Give
declared_registersper-register fields (for exampleapproved_by,approved_on,expires_onandtracking) and the UK checks (the approval window, the refusal of stale entries). Read the UK review files with it. - One training set and one scoring for hold-outs. Keep both designs: rotated folds over UK areas, and hashed blocks over US targets. Share the training target set and the scoring of held rows (
target_holdouts.training_target_setandscore_holdout) with the UK rowwise path. - One support floor. Move
uk_runtime/support_floor.pyto a shared module with declared parameters: the lineage column, the weight entity, the units and currency, and the target-id key. Check whether the US county minimum support fits it.
Not in this issue: one nesting rule across geography levels, for the district SOI shares of state_cd, the county rung, and the district rows of #1731. That is the geographic level consolidation, and it runs in parallel with this work.
Rules
- No target change and no output change in either country.
- UK proof, byte for byte before and after: the registry versions on the UK pinned feed, the parity fixtures (
uk/registry_parity_fixture_2025.jsonanduk/local_registry_parity_fixture_2025.json), and the measure-exclusion and support-floor receipts. - US proof: the pins of #1755 (
test_us_acs_local_surface_bytes.py,test_us_target_sets.pyandtest_us_fiscal_target_registers.py).
- UK proof, byte for byte before and after: the registry versions on the UK pinned feed, the parity fixtures (
- UK graph nodes that hash a changed module compute again on their next run. That is accepted; their outputs must not change.
- Each country keeps its choices as data in its own package, with a small country adapter only where data cannot express a rule.
Done when
- Each job above has one shared module that both countries call.
- The UK and US pins hold unchanged.
Related: #1728, #1755, #1729, #1735, #1731, #1730.
Drafted with AI assistance.
- Ngôn ngữ chính
- Python
- Star
- 0
- Fork
- 6
- Merge trung bình
- 1 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 190
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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/microcosm
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
PolicyEngine/microcosm#1766 ·
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
PolicyEngine/microcosm#1721 ·
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 74/100
PolicyEngine/microcosm#1701 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
County rung: a malformed-geography refusal leaves an old county_surface.json success receiptĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PolicyEngine/microcosm#1638 ·
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 85/100
PolicyEngine/microcosm#1431 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PolicyEngine/microcosm
Issue tương tự
-
claude-subscription-directsdk: tool calls with raw control characters in string values are droppedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NousResearch/hermes-official-plugins#538 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug(qdiffusion): EnergyModel.score_visible_logits computes biased visible/hidden on-ratios when solver returns variable solution counts per candidateCó thể đã có người làm @houzhongyu đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
qboson/kaiwu-pytorch-plugin#2133 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MakazhanAlpamys/Soup#3415 ·
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 78/100
Maintainer thường phản hồi trong vòng 2 ngày