Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/us-cd-crosswalk-north-carolina-117th.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build the packaged 117th->119th congressional-district crosswalk from the CD plan registry, so North Carolina's SOI districts map through its 2019 plan (the 117th Congress's) instead of the 2016 plan in the 2020 BAF layer. Only North Carolina's rows change; the crosswalk sha256 is now a347303f.
12 changes: 6 additions & 6 deletions docs/evidence/spec-engine/us-f0-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,7 @@
"alpha",
"zeta"
],
"sha256": "b7a336af7cb300905d09ad9a33aa1a624f878c2471352d4e252fa69db55aee17"
"sha256": "3db095ce2d1ef89028d3862f0edc827d704f099c5b3323f9b115642a3c27e007"
},
"failures": [],
"observed": {
Expand All @@ -1911,7 +1911,7 @@
"alpha",
"zeta"
],
"sha256": "b7a336af7cb300905d09ad9a33aa1a624f878c2471352d4e252fa69db55aee17"
"sha256": "3db095ce2d1ef89028d3862f0edc827d704f099c5b3323f9b115642a3c27e007"
},
"status": "covered"
},
Expand Down Expand Up @@ -2045,7 +2045,7 @@
"congressional_district_vintage_crosswalk",
"puma_ladder"
],
"sha256": "f49425ca8734ac559c73cf44f6458d86d3162a48956b98a27e6e758959361585",
"sha256": "44e7f5f6cd7ceeef85d532c3d46306d03de4f4ee811376e6d29920742746b65c",
"target_vintage": "119th_congress"
},
"failures": [],
Expand All @@ -2054,7 +2054,7 @@
"congressional_district_vintage_crosswalk",
"puma_ladder"
],
"sha256": "f49425ca8734ac559c73cf44f6458d86d3162a48956b98a27e6e758959361585",
"sha256": "44e7f5f6cd7ceeef85d532c3d46306d03de4f4ee811376e6d29920742746b65c",
"target_vintage": "119th_congress"
},
"status": "covered"
Expand Down Expand Up @@ -2599,7 +2599,7 @@
"country": "us",
"schema_id": "country_spec",
"schema_version": 1,
"spec_sha256": "1cf1f44d9a11458f59ea7d75dce68303816cab3e66668a6c6f6ecfe62d56f8dc"
"spec_sha256": "ffbb93ed5ae22a95536ae475d6912a42628568609b442360dc1cd3bcf26772cd"
}
},
"report_schema_version": 3,
Expand All @@ -2609,7 +2609,7 @@
"country": "us",
"schema_id": "country_spec",
"schema_version": 1,
"spec_sha256": "1cf1f44d9a11458f59ea7d75dce68303816cab3e66668a6c6f6ecfe62d56f8dc"
"spec_sha256": "ffbb93ed5ae22a95536ae475d6912a42628568609b442360dc1cd3bcf26772cd"
},
"status": "pass"
}
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@
"acs_person_predictors": "878c788a6f037d7aca12b3586ea034eff04f3034ffa11935a736493042551f25",
"authority": "9d4a9672a0f03039b1fe874b9fe21ed575be0d29f14afc396d03cdf5c809bdd2",
"early_families": "4aa9f736fd76e83955477ad1667e58f48f264783f05bdc7f0102cd32d61323bd",
"full_checkpoint": "b7a336af7cb300905d09ad9a33aa1a624f878c2471352d4e252fa69db55aee17",
"full_checkpoint": "3db095ce2d1ef89028d3862f0edc827d704f099c5b3323f9b115642a3c27e007",
"gap_fill_schedule": "1c31f9868f7884347cc19cf1ff65da43f950b9114941a715bab168246db414a7",
"graph_nodes": "40cd51ffdfe2e9d9d08d48c08e8ded9de1e4b134783bab05c4abc6ad5c72ca1e",
"geography_assignment": "f49425ca8734ac559c73cf44f6458d86d3162a48956b98a27e6e758959361585",
"geography_assignment": "44e7f5f6cd7ceeef85d532c3d46306d03de4f4ee811376e6d29920742746b65c",
"late_families": "d91f9ff0eb52f43e7b6eed3d5c58c37abe1620c3a11021da15dae9c10e16d382",
"late_resource_semantics": "cc34ba11288d01145fc2dc1a669df3f7c4ef2019d73afb02dd8eeee852b16d20",
"late_schedule": "e59c019d3d454eac99ac0ac209b6c5b6faaf9bdfcaeee18c36a25be19bf7da2f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ sources:
value: 2020_puma
- id: us_congressional_district_vintage_crosswalk_117_to_119
role: congressional_district_vintage_crosswalk
sha256: c7cb040b1f57ca2ea2adcbfe60cc2b250ca23acbc4b640cd421e766fa54c1aec
byte_size: 77935
sha256: a347303fff3fea145f758488c43cb94355df5a8cb5e512552b2ee3791d2aa233
byte_size: 78202
loader: kernel:load_congressional_district_vintage_crosswalk
vintages:
- vintage:cd_117
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ def load_default_congressional_district_vintage_crosswalk() -> pd.DataFrame:
"""Load the packaged Census-built default 117th->119th CD crosswalk.

This is the canonical, versioned crosswalk built by
``tools/build_us_congressional_district_vintage_crosswalk.py`` from Census
Block Assignment Files, the 119th BEF, and 2020 P.L. 94-171 block
populations. Builds may still pass an explicit crosswalk path to override it.
``tools/build_us_congressional_district_vintage_crosswalk.py`` from the
block -> congressional-district plan registry (117th and 119th plans on
2020 blocks, weighted by 2020 P.L. 94-171 block populations). Builds may
still pass an explicit crosswalk path to override it.
"""

return load_congressional_district_vintage_crosswalk(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
"""Build the 117th->119th congressional-district vintage crosswalk from Census.
"""Build the 117th->119th congressional-district vintage crosswalk.

Microcosm calibrates congressional-district (CD) fiscal targets from the IRS SOI
CD table, whose district geography is the **117th Congress** (the pre-2020-
apportionment plan, drawn on 2010 geography). The current Microcosm CD surface
that ``policyengine.py`` consumes is the **119th Congress** (the post-2020-
apportionment plan). ``congressional_district_vintage`` translates SOI CD facts
from the old vintage onto the current one through a proportional crosswalk; this
module *builds that crosswalk* from primary Census sources, so the weights are
reproducible and cited rather than an opaque artifact.

Method — a single-vintage block overlay, so no 2010<->2020 block bridge is
needed:

- **Old (117th) district of each 2020 block**: the 2020 Block Assignment File
``CD`` layer (``BlockAssign_ST{fips}_{usps}_CD.txt``, ``BLOCKID|DISTRICT``).
The 2020 BAFs were published with the 2020 P.L. 94-171 release and carry the
116th-Congress plan (identical district geography to the 117th) expressed on
**2020** tabulation blocks.
- **Current (119th) district of each 2020 block**: the 119th Congressional
District Block Equivalency File (``NationalCD119.txt``, ``GEOID,CDFP``) — the
same source ``build_us_block_ladder_artifact`` already uses for the current
CD surface.
- **Weight**: 2020 P.L. 94-171 ``POP100`` per block (the block ladder's
module *builds that crosswalk* from the block -> congressional-district plan
registry (``cd_plan_registry``), so the weights are reproducible and cited
rather than an opaque artifact.

Method — a block overlay of two plans on the same 2020 blocks:

- **Old (117th) district of each 2020 block**: the registry's
``117th_congress`` plan. That is the 2020 Block Assignment File ``CD`` layer,
which carries the 116th-Congress plans on 2020 blocks, except North
Carolina: Census reports it as the only state whose districts changed
between the 116th and 117th Congress, and the registry carries its 2019
remedial plan onto 2020 blocks (``US_CD_PLAN_REGISTRY.md``). The parsers
below read the BAF and BEF layouts directly and remain for callers that
need them.
- **Current (119th) district of each 2020 block**: the registry's
``119th_congress`` plan, the 119th Congressional District Block Equivalency
File (``NationalCD119.txt``), which agrees exactly with the block ladder.
- **Weight**: 2020 P.L. 94-171 ``POP100`` per block, as recorded in the
registry (the block ladder's
:func:`~microcosm.build.us_runtime.block_ladder_sources.parse_pl_geo_blocks`
convention), because congressional apportionment and equal-population
redistricting are population operations. Population is the correct default
Expand All @@ -39,7 +42,7 @@
DC non-voting delegate normalize to district ``00`` (the repo-wide convention;
see ``block_ladder_sources``).

This module is pure and unit-testable. Download orchestration lives in
This module is pure and unit-testable. The build lives in
``tools/build_us_congressional_district_vintage_crosswalk.py``; the derived
crosswalk is a regenerable build artifact, not a Ledger fact (the fact-vs-
computed boundary of PolicyEngine/ledger#71).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,43 +37,44 @@ Regenerate with:
```
uv run --python 3.13 --package microcosm-build --group dev python \
tools/build_us_congressional_district_vintage_crosswalk.py \
--out packages/microcosm-build/src/microcosm/build/us_runtime/data/congressional_district_vintage_crosswalk.csv \
--cache-dir ~/.cache/populace-us-geography
--cd-plan-registry build/us/us_cd_plan_registry_2020.npz \
--out packages/microcosm-build/src/microcosm/build/us_runtime/data/congressional_district_vintage_crosswalk.csv
```

The method is a **single-vintage block overlay** — both district assignments are
read on the same 2020 census blocks, so no 2010↔2020 block bridge is needed:
The builder reads the pinned US block -> congressional-district plan registry
(`../US_CD_PLAN_REGISTRY.md`) and refuses any other file. The method is a
**block overlay** of two of its plans on the same 2020 census blocks:

| Role | Source | Format |
| Role | Registry plan | Underlying source |
|---|---|---|
| Old (117th) district of each 2020 block | 2020 Block Assignment Files, `CD` layer (`BlockAssign_ST{fips}_{usps}_CD.txt`) | `BLOCKID\|DISTRICT` |
| Current (119th) district of each 2020 block | 119th Congressional District BEF (`NationalCD119.txt`) | `GEOID,CDFP` |
| Weight | 2020 P.L. 94-171 `POP100` per block (`{usps}geo2020.pl`, summary level 750) | pipe-delimited |

The 2020 Block Assignment Files were published with the 2020 P.L. 94-171 release
and carry the **116th-Congress plan** — whose district geography is identical to
the 117th — expressed on **2020** tabulation blocks. Joining that old assignment
and the current 119th BEF on the same 2020 blocks, weighted by 2020 block
population, redistributes each old district's population across the current
districts it overlaps.
| Old (117th) district of each 2020 block | `117th_congress` | 2020 Block Assignment Files, `CD` layer; North Carolina carried from its 2019 plan |
| Current (119th) district of each 2020 block | `119th_congress` | 119th Congressional District BEF (`NationalCD119.txt`) |
| Weight | the registry's `population` | 2020 P.L. 94-171 `POP100` per block |

The 2020 Block Assignment Files carry the **116th-Congress plans** on 2020
tabulation blocks. Census reports North Carolina as the only state whose
districts changed between the 116th and 117th Congress. Its 117th districts
are the 2019 remedial plan, which the registry carries onto 2020 blocks from
the General Assembly's block file. On 2020 blocks the 2016 and 2019 North
Carolina plans put only 55% of the state's population in the same district.
An earlier build read the BAF layer directly and so mapped North Carolina's SOI
districts through the 2016 plan; only North Carolina's rows changed when the
builder moved to the registry. Joining the 117th and 119th assignments on the
same 2020 blocks, weighted by 2020 block population, redistributes each old
district's population across the current districts it overlaps.

**Population is the correct default basis**: congressional apportionment and
one-person-one-vote redistricting are population operations, and equal-population
districts make an at-large state split ≈ evenly (e.g. Montana's old at-large
district splits 50/50 into MT-01/MT-02). ACS income/tax proxy weights for
*fiscal* targets are a documented future refinement (#205).

Source URLs and their SHA-256s, plus the crosswalk SHA-256 and full per-state
population conservation, are recorded in
The registry's SHA-256 and its 117th-plan known deviations, plus the crosswalk
SHA-256 and full per-state population conservation, are recorded in
`congressional_district_vintage_crosswalk.csv.provenance.json` (written by the
builder). Base source pages:

- 119th CD BEF: `https://www2.census.gov/programs-surveys/decennial/rdo/mapping-files/2025/119-congressional-district-befs/cd119.zip`
- 2020 Block Assignment Files: `https://www2.census.gov/geo/docs/maps-data/data/baf2020/BlockAssign_ST{fips}_{usps}.zip`
- 2020 P.L. 94-171 Redistricting Data: `https://www2.census.gov/programs-surveys/decennial/2020/data/01-Redistricting_File--PL_94-171/{state}/{usps}2020.pl.zip`

The exact per-file URLs and their SHA-256s are in the provenance sidecar; these
are the templates the builder resolves.
builder). Every underlying Census and General Assembly source file, with its
URL and SHA-256, is in the registry's receipt,
`../us_cd_plan_registry.provenance.json`.

## Geoid conventions

Expand All @@ -84,7 +85,7 @@ with `block_ladder_sources`), so DC is `…US1100` on both sides.

## Conservation and coverage (current build)

- 1,444 rows; **436 source districts → 436 current districts** (the full 119th
- 1,449 rows; **436 source districts → 436 current districts** (the full 119th
Congress set, including one-district states and DC).
- Every populated 2020 block in all 50 states + DC is covered:
**331,449,281 people**, with **zero** unmatched or cross-state population.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,51 +949,56 @@ source_geography_id,target_geography_id,pair_population,weight
5001700US3627,5001900US3624,337457,0.468630397227021
5001700US3627,5001900US3625,43930,0.06100609366580937
5001700US3627,5001900US3626,34520,0.04793831899257317
5001700US3701,5001900US3701,323902,0.43804103955327933
5001700US3701,5001900US3703,78733,0.10647753075667438
5001700US3701,5001900US3704,286624,0.38762673562040106
5001700US3701,5001900US3713,50174,0.06785469406964525
5001700US3702,5001900US3701,119881,0.13153875357427358
5001700US3702,5001900US3702,162205,0.1779785247329856
5001700US3702,5001900US3704,126509,0.1388112893279817
5001700US3702,5001900US3713,502779,0.5516714323647591
5001700US3703,5001900US3701,184554,0.24390933721007071
5001700US3703,5001900US3703,572096,0.7560906627899293
5001700US3704,5001900US3702,583465,0.6665406237183888
5001700US3704,5001900US3704,291898,0.33345937628161115
5001700US3705,5001900US3705,309843,0.4089197596445083
5001700US3705,5001900US3706,108247,0.1428605365370174
5001700US3705,5001900US3710,321815,0.4247199789893508
5001700US3705,5001900US3711,17806,0.023499724829123506
5001700US3706,5001900US3704,40640,0.05110541875885762
5001700US3706,5001900US3705,216290,0.2719879680943237
5001700US3706,5001900US3709,413171,0.5195688231795267
5001700US3706,5001900US3713,125118,0.15733778996729203
5001700US3707,5001900US3701,117333,0.15170592068516106
5001700US3707,5001900US3703,94842,0.12262614038354124
5001700US3707,5001900US3707,493650,0.6382656860919754
5001700US3707,5001900US3713,67599,0.08740225283932229
5001700US3708,5001900US3706,194142,0.2394999346174628
5001700US3708,5001900US3707,108801,0.13422047978445967
5001700US3708,5001900US3708,212801,0.26251828860592097
5001700US3708,5001900US3709,294870,0.36376129699215654
5001700US3709,5001900US3707,143220,0.1862619762601165
5001700US3709,5001900US3708,526847,0.685180585160687
5001700US3709,5001900US3712,77291,0.10051930182321368
5001700US3709,5001900US3714,21559,0.028038136755982764
5001700US3710,5001900US3710,243711,0.31378115621270236
5001700US3710,5001900US3711,127525,0.16419013481551867
5001700US3710,5001900US3714,405455,0.522028708971779
5001700US3711,5001900US3705,80652,0.10493897036149376
5001700US3711,5001900US3711,600339,0.7811208218996281
5001700US3711,5001900US3714,87570,0.11394020773887824
5001700US3712,5001900US3708,6023,0.006651654520375179
5001700US3712,5001900US3712,668379,0.7381414903991104
5001700US3712,5001900US3714,231087,0.2552068550805145
5001700US3713,5001900US3705,138886,0.17362008745634058
5001700US3713,5001900US3706,443282,0.5541426753439624
5001700US3713,5001900US3709,37630,0.047040910466008785
5001700US3713,5001900US3710,180144,0.2251963267336882
5001700US3701,5001900US3701,569642,0.8285954916441084
5001700US3701,5001900US3703,117837,0.1714045083558916
5001700US3702,5001900US3702,583238,0.6389975666647311
5001700US3702,5001900US3704,231906,0.25407701434911845
5001700US3702,5001900US3713,97595,0.10692541898615048
5001700US3703,5001900US3701,164131,0.22005869805095118
5001700US3703,5001900US3703,581711,0.7799292351957696
5001700US3703,5001900US3707,9,1.2066753279140203e-05
5001700US3704,5001900US3701,11897,0.013558051068621037
5001700US3704,5001900US3702,162432,0.18511064563993043
5001700US3704,5001900US3704,513723,0.5854486567307057
5001700US3704,5001900US3709,15887,0.018105132161652722
5001700US3704,5001900US3713,173547,0.19777751439909014
5001700US3705,5001900US3705,274695,0.36731050805303167
5001700US3705,5001900US3710,16703,0.022334543460965025
5001700US3705,5001900US3711,21,2.8080309685701107e-05
5001700US3705,5001900US3714,456436,0.6103268681763176
5001700US3706,5001900US3705,264080,0.3271187217496541
5001700US3706,5001900US3706,256002,0.31711241671218926
5001700US3706,5001900US3709,99558,0.12332355990590753
5001700US3706,5001900US3710,187651,0.23244530163224908
5001700US3707,5001900US3703,46123,0.05599177416339503
5001700US3707,5001900US3707,515727,0.6260752707752147
5001700US3707,5001900US3713,261896,0.3179329550613903
5001700US3708,5001900US3706,101330,0.12341769453846557
5001700US3708,5001900US3707,191522,0.23326955189377285
5001700US3708,5001900US3708,212774,0.25915401695181556
5001700US3708,5001900US3709,178189,0.21703025335157053
5001700US3708,5001900US3713,137218,0.1671284832643755
5001700US3709,5001900US3707,38413,0.04884453113675146
5001700US3709,5001900US3708,494838,0.6292174549930446
5001700US3709,5001900US3709,116681,0.14836718656619627
5001700US3709,5001900US3712,77576,0.09864273416459614
5001700US3709,5001900US3714,58926,0.07492809313941157
5001700US3710,5001900US3705,206892,0.2667416167822936
5001700US3710,5001900US3706,29960,0.03862681417743322
5001700US3710,5001900US3709,27,3.48105468221194e-05
5001700US3710,5001900US3710,538723,0.6945645265056528
5001700US3710,5001900US3714,25,3.22319877982587e-05
5001700US3711,5001900US3705,4,5.113670503197962e-06
5001700US3711,5001900US3711,745649,0.9532508242597643
5001700US3711,5001900US3714,36564,0.04674406206973257
5001700US3712,5001900US3708,38059,0.04229374589525411
5001700US3712,5001900US3712,668094,0.7424314319909587
5001700US3712,5001900US3714,193720,0.21527482211378718
5001700US3713,5001900US3704,42,5.442127509047537e-05
5001700US3713,5001900US3706,358379,0.46436767013451125
5001700US3713,5001900US3709,335329,0.43450075606700034
5001700US3713,5001900US3710,2593,0.0033598658645143486
5001700US3713,5001900US3713,75414,0.09771728665888356
5001700US3800,5001900US3800,779094,1.0
5001700US3901,5001900US3901,546669,0.7112991997918158
5001700US3901,5001900US3908,221881,0.2887008002081842
Expand Down
Loading
Loading