central/sql/migrations/029_add_state_511_atis_cameras_adapter.sql

19 lines
824 B
MySQL
Raw Normal View History

feat(state_511_atis_cameras): Castle Rock 511 traffic cameras telemetry (v0.9.6) New CENTRAL_TRAFFIC_CAMERAS stream + state_511_atis_cameras adapter. Telemetry half of Castle Rock (events shipped in v0.9.2). Each Idaho camera -> one telemetry event on /telemetry; detail drawer renders <img> direct from the source (no blob storage / proxy in Central -- URL only). supervisor + gui + ARCHIVE restart (NEW event-bearing stream central.traffic_cameras.>). Ships disabled; public-unauth (no api key). Idaho only. - Full camera list via POST /List/GetData/Cameras (DataTables), PAGINATED at 100/page (Idaho ~455 = 5 pages). GetUserCameras was a red herring (4 default cams). The 100-row page cap also means v0.9.2 state_511_atis silently truncates its 114-row Construction layer -> separate v0.9.7 fix. - Subject central.traffic_cameras.{state}.{camera_id}; category camera.state_511_atis_cameras -> GUI event_type "camera". data_class=telemetry. - Per-UTC-day dedup {state}:cam:{id}:{YYYY-MM-DD}: one event per camera per day -- always shows today's cameras, no per-poll flooding, no retention coordination. Inherits the v0.9.1 dedup mixin. - All sources included (Idaho511/ITDNET/RWIS/UDOT/ODOT/WYDOT/MTD border cameras); source surfaced in data + the drawer for provenance. WKT POINT (lon lat) -> geo. - No upstream image-capture timestamp (lastUpdated is config-edit time); drawer shows no false "Captured" line. Cadence 600s. Severity 1 (telemetry). Full suite: 829 passed, 1 skipped (central and unprivileged zvx, 3x each). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 01:33:21 +00:00
-- Migration: 029_add_state_511_atis_cameras_adapter
-- Adds the CENTRAL_TRAFFIC_CAMERAS JetStream stream (telemetry; central.traffic_cameras.>)
-- AND the state_511_atis_cameras adapter row. NEW event-bearing stream ->
-- central-archive restart required at deploy (feedback_new_stream_needs_archive_restart).
-- 7-day retention. Ships disabled; public-unauth (no api key). Idaho only.
-- Additive-only: idempotent via ON CONFLICT DO NOTHING.
INSERT INTO config.streams (name, max_age_s, max_bytes)
VALUES ('CENTRAL_TRAFFIC_CAMERAS', 604800, 1073741824)
ON CONFLICT (name) DO NOTHING;
INSERT INTO config.adapters (name, enabled, cadence_s, settings)
VALUES (
'state_511_atis_cameras',
false,
600,
'{"states": [{"code": "ID", "base_url": "https://511.idaho.gov"}]}'::jsonb
)
ON CONFLICT (name) DO NOTHING;