Skip to content

Update zip code/congressional district relationships (fixes #29) - #30

Open
awallender wants to merge 1 commit into
gavinrozzi:masterfrom
awallender:update-cd
Open

Update zip code/congressional district relationships (fixes #29)#30
awallender wants to merge 1 commit into
gavinrozzi:masterfrom
awallender:update-cd

Conversation

@awallender

Copy link
Copy Markdown

Updated congressional districts using the Census' "National 2020 118th Congressional District to 2020 Zip Code Tabulation Area (ZCTA) Relationship File" (https://www2.census.gov/geo/docs/maps-data/data/rel2020/cd-sld/tab20_cd11820_zcta520_natl.txt) accessed on Sept. 19, 2023.

I obtained the updated listing using the following code to convert the downloaded relationship file to have the same structure as the existing zip_to_cd.rda file:

library(tidyverse)

zip_to_cd <- read_delim("./tab20_cd11820_zcta520_natl.txt") %>% 
  select(GEOID_ZCTA5_20, GEOID_CD118_20) %>% 
  rename(ZIP = GEOID_ZCTA5_20, CD = GEOID_CD118_20) %>% 
  filter(!is.na(ZIP))

This update fixes Issue #29 by utilizing updated congressional district mappings.

Updated congressional districts using the Census' "National 2020 118th Congressional District to 2020 Zip Code Tabulation Area (ZCTA) Relationship File" (https://www2.census.gov/geo/docs/maps-data/data/rel2020/cd-sld/tab20_cd11820_zcta520_natl.txt) accessed on Sept. 19, 2023.
gavinrozzi added a commit that referenced this pull request Aug 24, 2026
Validation gate: all checks passed (see data-raw/refresh_summary.md).

- zip_code_db: 41,877 -> 42,725 rows; 0 removed. Every 2020 Census ZCTA
  now present (fixes #25 97003 and the territory ZCTAs behind #19), 787
  Military ZIPs added (new zipcode_type value), curated USPS-only ZIPs
  incl. 91230 (#26). Coordinates/areas refreshed from the Census 2024
  Gazetteer, demographics from ACS 5-year vintage 2023.
- zcta_crosswalk: rebuilt on the 2020 ZCTA/tract vintage (168,212 rows).
- zip_to_cd: rebuilt on the 119th-Congress relationship file (#29),
  following the method of PR #30 by @awallender.

Tests updated where they pinned exact 2-decimal legacy coordinates, and
extended with schema-contract and regression-ZIP checks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WEHekDvK7kMM6rVT1vDsxg
gavinrozzi added a commit that referenced this pull request Aug 24, 2026
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.

Outdated congressional districts in "data/zip_to_cd.rda"

1 participant