feat(api/globe): GET /globe/data with bbox PostGIS + Redis caching + ETag#47
Merged
gracefullight merged 2 commits intomainfrom Mar 21, 2026
Merged
feat(api/globe): GET /globe/data with bbox PostGIS + Redis caching + ETag#47gracefullight merged 2 commits intomainfrom
gracefullight merged 2 commits intomainfrom
Conversation
…ETag Add globe data aggregation API endpoint that returns contacts, relationships (via shared organizations), and clusters within a geographic bounding box using PostGIS ST_Within queries. - Add geoalchemy2 dependency for PostGIS integration - Migration 0004: add location geometry(Point, 4326) column to contact table with GIST spatial index - New globe module with repository (PostGIS queries), service (Redis per-user caching with 5min TTL, ETag support), and router - Contacts clustered via ST_SnapToGrid, relationships derived from shared organization experiences - ETag-based conditional responses (304 Not Modified) - Cache invalidation helper for mutation endpoints Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # apps/api/src/contacts/models.py # apps/api/src/globe/repository.py # apps/api/src/globe/router.py # apps/api/src/globe/schemas.py # apps/api/src/globe/service.py # apps/api/src/main.py # apps/api/uv.lock
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.
Summary
GET /globe/data?bbox=west,south,east,northendpoint with PostGISST_Withinspatial queriescontacts[](within bbox),relationships[](shared-org edges),clusters[](grid-snapped groups)SCAN-based invalidation helper for mutation endpointsIf-None-Matchsupport returning 304 Not ModifiedChanges
locationgeometry(Point, 4326) column + GIST index tocontacttablegeoalchemy2dependency added for PostGIS integrationsrc/globe/module: schemas, repository (PostGIS queries), service (cache + ETag), routerTest plan
alembic upgrade headto apply migration 0004GET /globe/data?bbox=-180,-90,180,90returns contacts/relationships/clustersIf-None-MatchGlobeService.invalidate_user_cache()🤖 Generated with Claude Code