Commit Graph

4 Commits

Author SHA1 Message Date
Elie Habib
2f7fd6421f feat(gpsjam): migrate GPS jamming from gpsjam.org to Wingbits API (#1240)
* feat(gpsjam): migrate GPS jamming from gpsjam.org to Wingbits API

Replace gpsjam.org CSV scraping with Wingbits customer API for GPS/GNSS
interference data. This is a proper API with structured JSON responses
instead of fragile web scraping.

Key changes:
- Rewrite fetch-gpsjam.mjs seeder for Wingbits API (x-api-key auth)
- Delete ~150-line gpsjam seed loop from ais-relay.cjs (now standalone cron)
- Simplify api/gpsjam.js to Redis-only reads with v1→v2 fallback
- Update data shape: pct/good/bad/total → npAvg/sampleCount/aircraftCount
- Redis key: intelligence:gpsjam:v1 → v2 (with dual-write transition)
- Add vite dev plugin for local development
- Update all frontend components (MapPopup, DeckGLMap, GlobeMap, locales)

Zero-downtime: seeder dual-writes both v1 and v2 keys, edge handler
falls back to v1 with shape normalization. Remove v1 code after 24-72h.

* fix(gpsjam): improve v1 fallback normalization and update all locale files

- v1 fallback now derives npAvg from severity thresholds (high: 0.3,
  medium: 0.8) instead of hardcoding 0, uses bad/total for counts
- Update all 20 non-English locale files to use new gpsJamming keys
  (navPerformance, samples, aircraft) with English fallback values

* fix(gpsjam): dual-write v1 in old schema shape and catch Redis errors

- Seeder now converts v2 data back to v1 shape (pct/good/bad/total)
  for the dual-write, so old deployments and rollbacks parse correctly
- Edge handler wraps readFromRedis calls in try-catch so network/timeout
  errors return graceful 503 instead of platform 500s
2026-03-08 02:15:34 +04:00
Elie Habib
7891968bd2 perf(api): increase CDN cache TTLs and add stale-if-error across edge functions (#777)
Reduce Vercel execution costs and Upstash Redis read counts by letting
the CDN absorb more traffic. Addresses the "double dip" where bootstrap.js
hit Redis for 15 keys on every 60s cache miss, and telegram-feed/geo had
no s-maxage at all (every request hit Vercel).

- bootstrap: s-maxage 60→600, add stale-if-error=900
- ais-snapshot: s-maxage 180→300, stale-while-revalidate 300→600
- oref-alerts: s-maxage 5→180, add stale-if-error=600
- telegram-feed: add s-maxage=600, stale-if-error=900 (had none)
- geo: add s-maxage=3600, stale-if-error=3600 (had none)
- gpsjam: add stale-if-error=3600
- opensky: add stale-if-error=300
- version: add stale-if-error=3600
- download: add stale-if-error=600
2026-03-02 18:18:43 +04:00
Elie Habib
88215cb517 feat: add Redis caching for GPS jamming data (#646) 2026-03-01 12:52:57 +04:00
Elie Habib
ff98e3eac7 feat: add GPS/GNSS jamming map layer + CII integration (#570)
* feat: add GPS/GNSS jamming data ingestion from gpsjam.org

- scripts/fetch-gpsjam.mjs: standalone fetcher that downloads daily H3
  hex data, filters medium/high interference, converts to lat/lon via
  h3-js, and writes JSON. Can be run on cron.
- api/gpsjam.js: Vercel Edge Function that proxies gpsjam.org data with
  1hr cache, returns medium/high hexes for frontend consumption.
- src/services/gps-interference.ts: frontend service that fetches from
  the Edge API, converts H3→lat/lon, and classifies by conflict region.
- h3-js added as dependency for hex→coordinate conversion.

* feat: add GPS jamming map layer, CII integration, and country brief signals

Wire gpsjam.org data into map visualization, instability scoring, and
country intelligence. ScatterplotLayer renders high (red) and medium
(orange) interference hexes. CII security score incorporates jamming
counts per country via h3→country geocoding with cache. Country briefs
show jamming zone chip. Full i18n across 18 locales including popup
labels. Data loads with intelligence signals cycle (15min), gated by
1hr client-side cache.
2026-02-28 23:10:15 +04:00