Skip to content

feat(osm-equity): FW_EQUITY_OSM_KINDS Overpass-lite mode#28

Merged
rlemke merged 1 commit into
mainfrom
feat/osm-equity-osm-lite
Jul 14, 2026
Merged

feat(osm-equity): FW_EQUITY_OSM_KINDS Overpass-lite mode#28
rlemke merged 1 commit into
mainfrom
feat/osm-equity-osm-lite

Conversation

@rlemke

@rlemke rlemke commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Adds FW_EQUITY_OSM_KINDS (default all) so real-mode OSM fetches can be restricted to poi for 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

…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>
@rlemke rlemke merged commit af9168c into main Jul 14, 2026
17 of 20 checks passed
@rlemke rlemke deleted the feat/osm-equity-osm-lite branch July 14, 2026 01:52

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +237 to +242
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()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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

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