Skip to content

Backend: Geocoding step + geocode cache (Nominatim) #12

Description

@Jose-Gael-Cruz-Lopez

Context

Locations in listings.json are plain strings — "Cambridge, MA", "Toronto, ON, Canada", "Online". The globe (#16) needs lat/lng. This issue turns those strings into coordinates and caches them so we only geocode each place once.

What to build

New script .github/scripts/geocode.py:

  1. Read listings.json; collect the unique location strings.
  2. For each location not already in .github/scripts/geocode_cache.json, call free Nominatim:
    https://nominatim.openstreetmap.org/search?q=<loc>&format=json&limit=1
    • Set header User-Agent: hackhq-geocoder (github.com/Jose-Gael-Cruz-Lopez/hackhq)
    • Sleep ≥ 1s between requests (Nominatim rate limit)
    • Store { "<location>": {"lat": .., "lng": ..} } in the cache; commit the cache file.
  3. Treat Online / Virtual / Remote / empty (case-insensitive) as no locationgeo_status = "virtual".
  4. For a listing with multiple locations, geocode the first physical one; if all are virtual → virtual.
  5. Unresolvable place → geo_status = "failed" (log it; don't crash).
  6. Output an enriched dataset (e.g. geocoded_listings.json, or return in-memory) with lat, lng, geo_status added — consumed by the sync step (Backend: Sync GitHub Action (listings.json → geocode → Supabase upsert) #13).

Acceptance

  • geocode.py geocodes unique locations via Nominatim with proper UA + rate limiting
  • Results cached in committed geocode_cache.json (re-runs hit the cache, no re-fetch)
  • Online/Virtual/Remotegeo_status = virtual, no coords
  • Failures logged as geo_status = failed, script still exits 0
  • Produces enriched records with lat/lng/geo_status for Backend: Sync GitHub Action (listings.json → geocode → Supabase upsert) #13

Part of #10 · Design spec · Repo data lives in .github/scripts/listings.json

Metadata

Metadata

Assignees

Labels

backendServer / data / Supabase

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions