feat(osm-equity): FW_EQUITY_OSM_KINDS Overpass-lite mode#28
Conversation
…scale runs real_fetch_region_osm now honours FW_EQUITY_OSM_KINDS (default 'building,road,poi'); set it to 'poi' to fetch only amenities. This keeps Overpass load sane for national-scale sweeps (POI attribute completeness + diversity are the headline OSM-quality metric; building/road metrics are then omitted). Verified on a 38-city US run (all cities >500k): 11,542 real tracts, 0 fetch failures, one national city-comparison map. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to filter which OSM feature classes (building, road, or poi) are fetched by reading from the FW_EQUITY_OSM_KINDS environment variable. Feedback was provided to make the parsing of this environment variable more robust by adding case-insensitivity and validation for supported kinds.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| def osm_kinds() -> set[str]: | ||
| """Which OSM feature classes to fetch (env FW_EQUITY_OSM_KINDS, default all). | ||
| Set e.g. ``poi`` for a lightweight, Overpass-friendly large-scale run (POI | ||
| attribute completeness + diversity only; building/road metrics omitted).""" | ||
| raw = os.environ.get("FW_EQUITY_OSM_KINDS", "building,road,poi") | ||
| return {k.strip() for k in raw.split(",") if k.strip()} |
There was a problem hiding this comment.
The environment variable FW_EQUITY_OSM_KINDS is parsed without case-insensitivity or validation. If a user inputs mixed-case values (e.g., POI) or invalid/empty values, it can lead to silent failures or a misleading RuntimeError claiming Overpass returned no features.
Adding case-insensitivity and validating that the specified kinds are supported (building, road, poi) will make the configuration much more robust and user-friendly.
| def osm_kinds() -> set[str]: | |
| """Which OSM feature classes to fetch (env FW_EQUITY_OSM_KINDS, default all). | |
| Set e.g. ``poi`` for a lightweight, Overpass-friendly large-scale run (POI | |
| attribute completeness + diversity only; building/road metrics omitted).""" | |
| raw = os.environ.get("FW_EQUITY_OSM_KINDS", "building,road,poi") | |
| return {k.strip() for k in raw.split(",") if k.strip()} | |
| def osm_kinds() -> set[str]: | |
| """Which OSM feature classes to fetch (env FW_EQUITY_OSM_KINDS, default all). | |
| Set e.g. 'poi' for a lightweight, Overpass-friendly large-scale run (POI | |
| attribute completeness + diversity only; building/road metrics omitted).""" | |
| raw = os.environ.get("FW_EQUITY_OSM_KINDS", "building,road,poi") | |
| kinds = {k.strip().lower() for k in raw.split(",") if k.strip()} | |
| valid = {"building", "road", "poi"} | |
| invalid = kinds - valid | |
| if invalid: | |
| raise ValueError(f"Unsupported OSM kinds in FW_EQUITY_OSM_KINDS: {invalid}. Supported: {valid}") | |
| if not kinds: | |
| raise ValueError("FW_EQUITY_OSM_KINDS cannot be empty. Supported: {valid}") | |
| return kinds |
Adds
FW_EQUITY_OSM_KINDS(default all) so real-mode OSM fetches can be restricted topoifor Overpass-friendly large-scale sweeps. Verified on a 38-city national US run (>500k pop): 11,542 real tracts, 0 fetch failures. Offline default unaffected; 13 tests pass; ruff clean.🤖 Generated with Claude Code