Skip to content

Commit 3b1180f

Browse files
MaxGhenisclaudebaogorek
authored
Add census block-level geographic assignment with comprehensive lookups (#484)
* Add census block-level geographic assignment with comprehensive lookups - Assign census blocks using P(block|CD) from Census population data - Look up all geography from block GEOID for consistency: - County, tract, state (from GEOID structure) - CBSA/metro area (via NBER county crosswalk) - SLDU/SLDL (state legislative districts) - Place/City FIPS (via Census BAF) - PUMA (via tract crosswalk) - VTD (voting tabulation district) - Add block_crosswalk.csv.gz (8.1M blocks) with BAF data - Add make_block_crosswalk.py to generate crosswalk from Census BAFs - Add comprehensive tests for all geography lookups Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add changelog entry Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix black formatting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Trigger CI Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix black formatting (26.1.0) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Save all geography variables to CD-stacked datasets Updates stacked_dataset_builder.py to: - Set all geography variables from block assignment (block_geoid, tract_geoid, cbsa_code, sldu, sldl, place_fips, vtd, puma) - Include these variables in the saved h5 files These variables enable granular geographic analysis at multiple levels: state legislative districts, census tracts, metro areas, cities, etc. Requires policyengine-us#7249 for the variable definitions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add ZCTA (ZIP code) lookup from census block - Add ZCTA column to block_crosswalk.csv.gz from Census relationship file - Add get_zcta_from_block() function and include zcta in assign_geography_for_cd() - Save zcta to CD-stacked dataset output - Add tests for ZCTA lookup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update policyengine-us to v1.524.1 for geography variables Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: baogorek@gmail.com <baogorek@gmail.com>
1 parent ee06502 commit 3b1180f

9 files changed

Lines changed: 1411 additions & 12 deletions

File tree

changelog_entry.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- bump: minor
2+
changes:
3+
added:
4+
- Census block-level geographic assignment for households in CD-stacked datasets
5+
- Comprehensive geography variables in output (block_geoid, tract_geoid, cbsa_code, sldu, sldl, place_fips, vtd, puma, zcta)
6+
- Block crosswalk file mapping 8.1M blocks to all Census geographies
7+
- Block-to-CD distribution file for population-weighted assignment
8+
- ZCTA (ZIP Code Tabulation Area) lookup from census block

0 commit comments

Comments
 (0)