feat(wzdx): WZDx adapter + CENTRAL_TRAFFIC family bootstrap (v0.9.0)

Opens Phase 4 transportation aggregation (Design B, Central-direct). New
registry-driven wzdx adapter polls the FHWA WZDx Feed Registry, fetches each
eligible v4.x GeoJSON feed concurrently, and emits work_zone events into the new
CENTRAL_TRAFFIC stream. Production code; central-supervisor AND central-gui
restart (new adapter class + stream + ADAPTER_GROUPS). Ships disabled.

First adapter to use the category/subject split: category="work_zone.wzdx" (GUI
event_type "work_zone" via split_part) while the NATS subject is
central.traffic.work_zone.{state}. Subject state from the registry row, geocoder
state as fallback. Severity from vehicle_impact (all-lanes-closed=3,
some-lanes-closed=2, all-lanes-open=1, unknown/missing=1). Feed filter
geojson + active + needapikey=false + version 4.x (21 of 39 feeds). 600s cadence.
Dedup composite <data_source_id>:<feature_id> in the shared cursors.db; stateless
discovery (no conftest isolation entry). enrichment_locations uses the canonical
("latitude","longitude") paths.

Full suite: 739 passed, 1 skipped (central and unprivileged zvx, 3x each).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Johnson 2026-05-25 20:35:08 +00:00
commit 7eab5fc1b1
12 changed files with 571 additions and 1 deletions

View file

@ -131,6 +131,7 @@ Central's archive.
| `CENTRAL_SPACE` | `central.space.>` | 7 | 1 GiB | ✓ | ✓ |
| `CENTRAL_DISASTER` | `central.disaster.>` | 7 | 1 GiB | ✓ | ✓ |
| `CENTRAL_HYDRO` | `central.hydro.>` | 7 | 1 GiB | ✓ | ✓ |
| `CENTRAL_TRAFFIC` | `central.traffic.>` | 7 | 1 GiB | ✓ | ✓ |
| `CENTRAL_META` | `central.meta.>` | 1 | 1 GiB | — | ✓ |
Retention and storage caps are migration-seeded defaults visible in `config.streams`;
@ -1475,6 +1476,48 @@ already running can disable those overlap categories via `EONETSettings.category
}
```
### wzdx — FHWA Work Zone Data Exchange (state-DOT work zones)
Active road work zones discovered from the federal WZDx Feed Registry and each
eligible state-DOT GeoJSON feed. One event per WZDx RoadEventFeature.
- **Stream:** `CENTRAL_TRAFFIC`
- **Subject pattern:** `central.traffic.work_zone.<state>`
- `<state>` is the lowercased 2-letter code from the registry row (geocoder
state as fallback), else `unknown`
- **GUI event_type:** `work_zone` — from `category = "work_zone.wzdx"`; the GUI
derives event_type as the first dotted segment of the category
- **Cadence default:** 600s (10 min)
- **Feed filter:** registry rows with `format=geojson`, `active=true`,
`needapikey=false`, `version` 4.x (~21 feeds at author time)
- **Dedup key shape:** composite `<data_source_id>:<feature_id>`
(e.g. `UDOT-Construction:2365_eastbound`); reused as the inner `Event.id`
- **Event.data fields:**
| key | type | nullable | description |
|---|---|---|---|
| `road_names` | list[str] | no | Affected road name(s); may be empty |
| `direction` | str | yes | Travel direction of the work zone |
| `description` | str | yes | Operator-readable narrative |
| `vehicle_impact` | str | yes | `all-lanes-open` / `some-lanes-closed` / `all-lanes-closed` / `unknown`; drives severity |
| `event_status` | str | yes | e.g. `active` (Utah carries it; Iowa omits it) |
| `start_date` | str (ISO 8601) | yes | Work-zone start |
| `end_date` | str (ISO 8601) | yes | Work-zone end; also sets `Event.expires` |
| `data_source_id` | str | no | WZDx `core_details.data_source_id` |
| `feed_name` | str | yes | Registry feed identifier |
| `feed_state` | str | yes | Registry state name |
| `feed_state_code` | str | yes | 2-letter code used for the subject |
| `latitude` | float | yes | First geometry coordinate (enrichment input) |
| `longitude` | float | yes | First geometry coordinate (enrichment input) |
- **Severity:** derived from `vehicle_impact` (`all-lanes-closed`=3,
`some-lanes-closed`=2, `all-lanes-open`=1, `unknown`/missing=1) — WZDx has no
normalcy class.
- **Decipherable as-is:** mostly. Road + direction + impact + description are
user-ready; city/county/state come from geocoder enrichment.
- **Removal semantics:** none in v1. Work zones age out of upstream feeds; the
14-day dedup sweep expires stale ids. Watch `end_date` / `Event.expires`.
### nwis — USGS NWIS streamflow / gage height / water-temperature gauges
Real-time water-data observations via the USGS NWIS OGC API v0 `latest-continuous`

View file

@ -349,7 +349,7 @@ central.<domain>.<subtype>[.<dimensions>...]
```
- `<domain>` is one of `wx`, `fire`, `quake`, `space`, `disaster`, `hydro`,
`meta` (the current set — see [§8](#8-the-streamentry-registry) for adding
`traffic`, `meta` (the current set — see [§8](#8-the-streamentry-registry) for adding
one). Operators MUST be able to subscribe to all of one domain with
`central.<domain>.>`.
- `<subtype>` is adapter-driven and identifies the event category within the
@ -537,6 +537,7 @@ STREAMS: list[StreamEntry] = [
StreamEntry("CENTRAL_SPACE", "central.space.>"),
StreamEntry("CENTRAL_DISASTER", "central.disaster.>"),
StreamEntry("CENTRAL_HYDRO", "central.hydro.>"),
StreamEntry("CENTRAL_TRAFFIC", "central.traffic.>"),
StreamEntry("CENTRAL_META", "central.meta.>", event_bearing=False),
]
```