feat(okw): network map endpoint — local facilities ∪ Maps of Making#227
Merged
Conversation
Backend for the dashboard geographic map (web-ui review #1). Rather than a local-only map (79 facilities), union local OKW with Maps of Making's ~3,200 geolocated spaces, reusing the existing MoM SPARQL bridge. - mom_bridge: fetch_all_mom_spaces() (all spaces with geo, not process-filtered) + MoMSpacesCache — a 24h TTL cache that degrades gracefully (keeps stale data on a failed refresh; reports mom_available=false only when nothing was ever fetched) and serializes concurrent refreshes. refresh()/invalidate() are the cache-refresh hooks other events can trigger. - OKWService.get_map_points(): source-labeled union {id, name, lat, lon, source} of local facilities (via the new Location.coordinates() accessor) and MoM spaces; local facilities without coordinates are counted, not plotted. - GET /api/okw/map (include_mom, force_refresh) — registered before /{id} so it isn't captured as an id. Returns points + counts + mom_available. - CLI: ohm okw map (--no-mom, --refresh), HTTP with direct-service fallback. - Docs: OKW model doc — network-map section + CLI/endpoint tables. - Tests: fetch parsing, cache (TTL/refresh/invalidate/stale-on-failure/ unavailable), union (unit); endpoint local-only path (TestClient integration). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Backend for the dashboard geographic map (review note #1). The map's whole point is showing the network — but local data is only 79 facilities. Maps of Making (MoM) has ~3,200 geolocated spaces, already integrated with matching via SPARQL, so this unions the two into one source-agnostic point set and serves it to the map.
Approach
Built on the existing
mom_bridgeSPARQL work rather than reinventing it. The union is server-side (keeps SPARQL off the browser, cacheable, source-agnostic), MoM loads by default, and the map degrades gracefully when MoM is unreachable.Changes
mom_bridge:fetch_all_mom_spaces()(all spaces with geo — a non-process-filtered variant of the existing query) +MoMSpacesCache, a 24h TTL cache that:mom_available: falsewhen nothing was ever fetched;refresh()/invalidate()as the cache-refresh hooks other events can trigger (plusforce_refreshon the endpoint /--refreshon the CLI).OKWService.get_map_points(): source-labeled union{id, name, lat, lon, source}of local facilities (via theLocation.coordinates()accessor from feat(okw): typed coordinate accessor + structured lat/lon in API #226) + MoM spaces. Local facilities without coordinates are counted (dropped_no_coords), not plotted.GET /api/okw/map(include_mom,force_refresh) — registered before/{id}somapisn't captured as a facility id. Returnspoints+ counts +mom_available.ohm okw map(--no-mom,--refresh), HTTP with direct-service fallback — parity.Verification
make ready— all gates green (563 passed, parity 4/4, docs ✓). MoM endpoint confirmed reachable during design (3,193 spaces with geo).Scope
This is the read/display slice of the documented "External network integration" epic. Admin enable/disable config for networks stays deferred to that epic. The frontend map (react-leaflet + clustering) consuming
/api/okw/maplands next onfrontend-dev.🤖 Generated with Claude Code