Implement support for NWS weather stories

This commit is contained in:
2026-05-30 07:47:49 -05:00
parent 9ff90d33fc
commit 63749a9572
14 changed files with 214 additions and 37 deletions

View File

@@ -53,7 +53,8 @@ The adapter sends these query parameters:
- `tz`: from `weather_api.timezone` on hourly forecast, narrative forecast, and
discussion requests
Alerts do not receive `precision` or `tz`.
Alerts do not receive `precision` or `tz`. Weather story requests receive only
`format=json`.
## Endpoints Used
@@ -65,6 +66,7 @@ The adapter fetches these endpoints once per bundle:
- `/forecast/narrative`
- `/alerts/active`
- `/discussion`
- `/weatherstories/latest`
`weatherreporter` does not call day-slice forecast endpoints or discussion
subsection endpoints. Report-period selection and daypart summarization happen
@@ -86,10 +88,11 @@ source-specific `missing_source.sources` policy:
- `narrative` for `/forecast/narrative`
- `alerts` for `/alerts/active`
- `discussion` for `/discussion`
- `weather_story` for `/weatherstories/latest`
The adapter also creates missing stub source records for `daily` and
`weather_story` because those source slots exist in the internal bundle but are
not fetched from the Weather API.
The adapter also creates a missing stub source record for `daily` because that
source slot exists in the internal bundle but is not fetched from the Weather
API.
Policy behavior:
@@ -126,6 +129,8 @@ types in `internal/forecast/bundle.go`, including:
- forecast run metadata and `periods`
- active alert run data
- discussion metadata, key messages, and short/long-term section text
- latest weather story title, description, timing, priority, order, alt text,
and download URL
The adapter intentionally keeps upstream transport and envelope details inside
`internal/adapters/weatherapi`; downstream packages consume the normalized