Skip to content

story 10 3 division boundary crosswalk - #132

Merged
cbwinslow merged 8 commits into
mainfrom
story-10-3-division-boundary-crosswalk
Oct 10, 2026
Merged

cbwinslow merged 8 commits into
mainfrom
story-10-3-division-boundary-crosswalk

Conversation

@cbwinslow

Copy link
Copy Markdown
Owner
  • docs: add state campaign finance to the source catalog
  • Add division_boundary and geography_crosswalk tables (Story 10.3)
  • Link divisions to CD119 and SLD 2024 boundaries by identifier (Story 10.3)
  • Add Census relationship and block equivalency crosswalk loaders (Story 10.3)
  • docs: record Story 10.3 status and open items
  • Link letter-suffixed state districts by rule; record 10.3 relationship load
  • Link the remaining state districts through a reviewed OCD crosswalk (Story 10.3)

Expand-only migration a1d4c8e6f372 per ADR-0006: link political divisions to
dated boundary vintages and record cross-geography relationships with explicit
weight types, so a relationship overlap never masquerades as a population weight.
Downgrade refuses to drop populated tables.
…10.3)

State FIPS from the OCD state code plus the district code equals the TIGER GEOID; no
name comparison. Numeric-coded state legislative districts are seeded as OCD divisions
from the loaded boundaries; letter-coded districts are reported unlinked for a reviewed
mapping. A link to a wrong vintage or boundary family fails the run.
…y 10.3)

Plan, size preview, approve, resumable download, stage, load and validate for the
119th-Congress and 2024 state legislative relationship files (weight_type none, areas
kept as evidence) and block equivalency files (whole-block assignment, weight 1).
Registers both datasets and their field checklists; stage tables ship in the same
expand-only revision.
…p load

Census codes Alaska senate and MD/MN/ND/SD house seats with letters (01A); OpenStates writes
the same seat as sldl:1a. The rule is code-to-code and verified against the now-readable
opencivicdata_division. Vermont and Massachusetts senate stay unlinked pending a reviewed mapping.
…Story 10.3)

Massachusetts, New Hampshire House, Vermont, DC wards and Puerto Rico share no code with
OpenStates. scripts/build_ocd_sld_crosswalk.py derives each OCD id from the official Census
district name and refuses to write unless every id is in the pinned official OCD list, is
unique, and exists in OpenStates. The linker reads the 545 reviewed pairs by identifier and
retires the 380 numeric-seeded divisions that matched nothing in OpenStates.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown

Review in Change Stack →Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ea464e6e-4b59-43d3-b992-619f76ff1fa4

📥 Commits

Reviewing files that changed from the base of the PR and between 3623742 and 5d1e34b.


⛔ Files ignored due to path filters (1)
  • inventory/geography/ocd-sld-crosswalk-2024.csv is excluded by !**/*.csv

📒 Files selected for processing (35)
  • _bmad-output/planning-artifacts/briefs/brief-OpenDiscourse-2026-10-10/addendum.md
  • docs/PROJECT-STATE.md
  • docs/openstates-integration.md
  • inventory/fields/census.redistricting_bef.yaml
  • inventory/fields/census.redistricting_relationship.yaml
  • inventory/sources.yaml
  • migrations/versions/a1d4c8e6f372_division_boundary_and_crosswalk.py
  • scripts/build_ocd_sld_crosswalk.py
  • sql/query/geography/create_crosswalk_divisions.sql
  • sql/query/geography/crosswalk_block_assignment.sql
  • sql/query/geography/crosswalk_block_geographies.sql
  • sql/query/geography/crosswalk_reconcile.sql
  • sql/query/geography/crosswalk_relationship.sql
  • sql/query/geography/crosswalk_relationship_geographies.sql
  • sql/query/geography/crosswalk_unmatched_codes.sql
  • sql/query/geography/link_crosswalk_divisions.sql
  • sql/query/geography/link_divisions.sql
  • sql/query/geography/link_report.sql
  • sql/query/geography/retire_phantom_divisions.sql
  • sql/query/geography/seed_sld_divisions.sql
  • sql/query/geography/unlinked_divisions.sql
  • sql/query/geography/wrong_vintage_links.sql
  • src/opendiscourse_research/cli.py
  • src/opendiscourse_research/ingestion/census_crosswalk.py
  • src/opendiscourse_research/ingestion/division_boundary.py
  • src/opendiscourse_research/models/__init__.py
  • src/opendiscourse_research/models/core.py
  • src/opendiscourse_research/models/stage.py
  • tests/test_census_crosswalk.py
  • tests/test_division_boundary_link.py
  • tests/test_division_boundary_schema.py
  • tests/test_name_resolution.py
  • tests/test_ocd_sld_crosswalk.py
  • tests/test_persistence_foundation.py
  • tests/test_voteview_connector.py

 ___________________________________________________________
< Patience, young padawan. The bugs will reveal themselves. >
 -----------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Four downgrade-refusal tests hard-coded the previous head revision, so adding a migration
broke them. They now ask Alembic for the head.
@cbwinslow
cbwinslow merged commit 461b246 into main Oct 10, 2026
6 checks passed
@cbwinslow
cbwinslow deleted the story-10-3-division-boundary-crosswalk branch October 10, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant