feat(spatial): Replace custom TIGER/Line downloads with pygris#308
feat(spatial): Replace custom TIGER/Line downloads with pygris#308
Conversation
Use pygris for all shapefile downloads instead of manually constructing Census Bureau URLs. This adds automatic caching, better year/vintage handling, and fixes broken ZCTA/PUMA downloads for pre-2020 years. - Replace _GEO_TO_TIGER URL templates with _GEO_TO_PYGRIS function dispatch - Add GEOID column normalization for vintage variants (GEOID20, GEOID10) - Add CRS assertion to guarantee EPSG:4269 - Enable pygris caching by default - Add pygris>=0.1.7 to spatial optional deps - Update docs to mention pygris and automatic caching Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @chekos's task in 1m 39s —— View job Code Review: feat(spatial): Replace custom TIGER/Line downloads with pygrisTasks
SummaryThis is a clean dependency swap — pygris handles URL construction, vintage logic, and caching instead of hand-rolled string templates. The public API is unchanged, the diff is minimal, and the logic is easy to follow. A few issues are worth addressing before merge. Issues1.
|
- Remove AFFGEOID from GEOID normalization candidates (different format would silently break merges) - Only pass resolution kwarg to pygris functions that accept it (tracts, block_groups, places, zctas, pumas do not) - Add helpful ImportError when pygris function is missing - Add cache parameter to _fetch_tiger_shapes and attach_geometry so users can force fresh downloads - Cap pygris version to <1 to guard against breaking API changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @chekos's task in 1m 10s —— View job Tasks
Follow-up ReviewAll five issues from the initial review have been addressed. Here's a summary of what changed: ✅ Issue 1 —
|
- Include minimum version (>=0.1.7) in pygris ImportError message - Add requires_state validation so tract/block group/place/puma raise a clear ValueError when state is missing, instead of a cryptic pygris error downstream Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @chekos's task in 1m 10s —— View job Tasks
Follow-up Review (3rd pass)All issues and nits from the previous two rounds of review are addressed. Here's a final accounting: ✅ All 5 original issues — resolvedAlready confirmed in the second review. ✅ Remaining nits from second review — also resolved
Current state of the code
This is ready to merge. The implementation is clean, the public API is unchanged, all review feedback was addressed, and the code is easy to understand and extend. |
Comprehensive docs sweep across 13 files: - Replace "TIGER/Line" with "cartographic boundary" or "via pygris" in all guides, migration docs, and getting-started pages - Add 0.3 and 0.3.1 changelog entries with full details - Update installation docs to mention pygris as spatial dependency - Add cache=True to attach_geometry() signature in spatial guide - Add ValueError troubleshooting entry for missing state param - Update caching guide: remove stale geography/ dir, add pygris cache section with OS-specific paths - Fix example version number (0.2 -> 0.3) in installation.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @chekos's task in 1m 44s —— View job Tasks
Follow-up Review (4th pass — docs sync commit)The new commit ( What changed in this commitA comprehensive pass over 13 documentation files:
Accuracy checkAll documentation claims are consistent with the implementation:
One minor observation (non-blocking)
No new issues introduced. This is ready to merge. |
Summary
pypums/spatial.pywith pygris — the Python port of R'stigrispackagegeometry=True,attach_geometry()) is completely unchangedChanges
pypums/spatial.py— Replace_TIGER_BASE+_GEO_TO_TIGERURL templates with_GEO_TO_PYGRISdispatch to pygris functions. Add_normalize_geoid()for vintage column variants. Add CRS assertion (EPSG:4269). Enable caching by default.pyproject.toml— Addpygris>=0.1.7tospatialoptional depsuv.lock— Updateddocs/guides/spatial.md— Updated references to mention pygris, automatic caching, and updated install/troubleshooting sectionsTest plan
_fetch_tiger_shapespreserved)mkdocs build --strictget_acs(geography="county", variables="B01001_001", state="CA", geometry=True)returns a GeoDataFramePost-Deploy Monitoring & Validation
No additional operational monitoring required: this is a library dependency swap with no runtime infrastructure.
🤖 Generated with Claude Code