Skip to content

Add shared GPS filtering and scanner crime context - #98

Merged
ralyodio merged 1 commit into
mainfrom
feat/geographic-filtering-scanner-context
Sep 13, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/geographic-filtering-scanner-context

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Why

Located records already exist across crime, weather, aviation and other collections, but callers cannot query them consistently by GPS. Scanner coverage also needs to be distinguished from receiver location before attaching nearby crime context.

Changes

  • Add shared lat, long, radius, unit, and bbox validation and database filtering before result limits. Support nearest-first sort=distance, distance_m, and offset pagination for distance-sorted item/feed views.
  • Recognize existing coordinate shapes and GeoJSON coverage, backed by a GiST expression index. Existing records become searchable without re-ingestion.
  • Wire geography through collection pages, API search/match/upcoming reads, saved feeds, RSS/JSON feeds, CLI and MCP. Preserve geographic scope in caches, navigation and feed editing. URL filters intersect saved-feed geography; notification scans retain ascending ID order.
  • Add /crimes and /scanners aliases to the existing crime collection.
  • Add an opt-in scanner-directory adapter for permissioned JSON catalogs. Store provider, player URL, declared stream permissions, coverage basis and location provenance. No third-party catalog is scraped or enabled automatically.
  • Add /api/v1/items/:id/nearby-crime and scanner-page context with date filters. Return reported incidents inside coverage, preserving source precision and explicitly separating proximity from verified links to radio transmissions.
  • Document the contract, examples, catalog format, deployment and geographic limitations in docs/geographic-queries.md.

Validation

  • Initial full suite: 1,587 passed, one existing profile-claim test exceeded its 5-second timeout.
  • Isolated profile tests with a 20-second timeout: 10 passed; the previously timed-out test took about 12 seconds.
  • Final targeted geographic/database/interface/matchup tests: 33 passed. A subsequent navigation-only change was checked by rerunning the 6 interface tests, all passing.
  • Existing migration/crime tests: 78 passed.
  • Biome check on all changed JS/JSX/package files passed; git diff --check passed.
  • Web application bundle compiled successfully.

Tests execute actual query functions against PGlite/PostgreSQL, covering mixed collections, limits, distances, miles, invalid coordinates, antimeridian/polar points, polygon holes, index eligibility, saved-feed intersections, notification cursors, CLI/MCP fields, HTML navigation and crime context.

Deployment and limits

  • Migration 0023_geographic_queries.sql needs no PostGIS/container change. Its initial ordinary CREATE INDEX runs inside the migration transaction and blocks writes while building; schedule a maintenance window for a large production table and measure on a production-sized copy first.
  • Polygon edge distances are approximate; coverage bbox filtering is conservative bounding-envelope overlap. Local jurisdiction polygons are supported, not polygons enclosing a pole or most of the globe. These semantics are documented rather than represented as surveyed geometry.
  • Text-only place names are not geocoded. Missing scanner coverage produces no nearby-incident associations.
  • Configure a catalog whose metadata and any enabled audio use are permitted before scanner entries appear. This PR does not purchase API access, import a commercial catalog, or deploy the site.

@ralyodio
ralyodio merged commit 684e652 into main Sep 13, 2026
3 checks passed
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