Weather backend: NWS active alerts + nearest-METAR wind, cached (Refs #237)

GET /weather/alerts — api.weather.gov/alerts/active for settings.nws_area,
sent with the NWS-required User-Agent, cached weather_alerts_ttl_s (90 s)
with single-flight refresh. Zone-based alerts (geometry null) get their
polygons from affectedZones (24 h zone cache, api.weather.gov/zones/ only);
any still unresolved are returned in zone_only, never dropped. Failed
refresh keeps last-good data + error + fetched_at; a payload where no
feature parses is a schema-change error. Optional bbox filter.

GET /weather/wind — nearest METAR (aviationweather.gov /api/data/metar,
bbox query) within 75 km, cached 5 min per 0.5-degree cell; VRB wind and
stale reports flagged; available:false with a reason otherwise.

Both behind require_service_or_firebase_token like /traffic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Logan Cusano
2026-10-05 02:54:33 -04:00
co-authored by Claude Opus 5.5
parent 7bee87b147
commit fb1b6956c2
6 changed files with 681 additions and 1 deletions
+4
View File
@@ -31,6 +31,10 @@ NY511_API_KEY=
NY511_API_BASE=
# Ontario 511 developer key (camera provider "ontario511"; providers default OFF)
ONTARIO511_API_KEY=
# NWS weather alerts / METAR wind (server-26#237). NWS requires app name + contact in the User-Agent
NWS_USER_AGENT=DRB (you@example.com)
# Comma list of NWS state/marine area codes served
NWS_AREA=NY
# OpenAI — for transcription (Whisper), intelligence extraction, embeddings, and summaries
OPENAI_API_KEY=