central/tests/fixtures/itd_511_cameras_sample.json

90 lines
1.9 KiB
JSON
Raw Normal View History

v0.10.0: ITD 511 official API adapter (events + advisories + cameras) (#85) First official-state-DOT-API pattern landing. Two adapters in one PR: - itd_511 (event-class): polls Events (60s) + Advisories (300s) from https://511.idaho.gov/api/v2/get/{event,alerts}. Decodes EncodedPolyline to LineString via the polyline lib (bookend LineString or Point fallback); ITD Severity string mapped None->1 / Minor->2 / Major->3 with IsFullClosure=true forcing 3 regardless; RecurrenceSchedules / Restrictions / DetourPolyline pass through unmodified. Advisories ship as structural pass-through under data.advisory since the upstream /alerts endpoint currently returns []; per-record try/except keeps a surprise shape from sinking the cycle when ITD posts its first one. - itd_511_cameras (telemetry-class): polls Cameras (600s). One event per camera per UTC day; image URL passes straight through to <img src>. Region uniform US-ID with data.source_jurisdiction preserving the raw upstream Source field for the ~1.2% cross-DOT border-region mirrors (UDOT / ODOT / WYDOT / WSDOT / NDot / MTD / DriveBC / Lemhi County). Subject convention (v0.9.20 forward): central.traffic.<event_type>.us.id and central.traffic_cameras.us.id.<camera_id>. Castle Rock state_511_atis keeps its bare-state subject; consumers stay on central.traffic.> wildcards during the A/B comparison window. Retry predicate tightened from the Castle Rock / TomTom precedent: 5xx + connection / timeout retry; 4xx other than 429 skip-with-warn (don't burn quota on permanent errors); 429 honors Retry-After once then retries. API key (alias 'idaho_511') travels in the ?key= query string, so every error log path runs through self._redact() to scrub the URL. Both adapters ship disabled; operator enables via GUI after registering the API key with 'python -m set_api_key idaho_511'. Reuses existing CENTRAL_TRAFFIC and CENTRAL_TRAFFIC_CAMERAS streams -- no archive restart needed. Scope-cap exception: this PR is ~1.5k lines vs. the standard 500-line cap, authorized as a one-time exception for the first official-state-DOT-API pattern landing. Two adapters + their tests + real-API fixtures naturally exceed the v0.9.x adapter-cap budget. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 22:36:26 -06:00
[
{
"Id": 3,
"Source": "ITDNET",
"SourceId": "1000",
"Roadway": "SH-55 Eagle",
"Direction": "Southbound",
"Latitude": 43.619167,
"Longitude": -116.35478,
"Location": "SH-55 Eagle Fairview",
"SortOrder": 0,
"Views": [
{
"Id": 1039,
"Url": "https://511.idaho.gov/map/Cctv/1039",
"Status": "Disabled",
"Description": "D3 SH-55 37.9 Eagle Fairview 526"
}
]
},
{
"Id": 436,
"Source": "ACHD",
"SourceId": "4001",
"Roadway": "Local Boise",
"Direction": "Unknown",
"Latitude": 43.60304,
"Longitude": -116.18841,
"Location": "Park Parkcenter Front Clearwater",
"SortOrder": 0,
"Views": [
{
"Id": 631,
"Url": "https://511.idaho.gov/map/Cctv/631",
"Status": "Enabled",
"Description": ""
}
]
},
{
"Id": 1,
"Source": "UDOT",
"SourceId": "10.C1",
"Roadway": "I-15",
"Direction": "Unknown",
"Latitude": 42.0011,
"Longitude": -112.198,
"Location": "I-15 UT/ID State Line UT",
"SortOrder": 1,
"Views": [
{
"Id": 1,
"Url": "https://511.idaho.gov/map/Cctv/1",
"Status": "Enabled",
"Description": "N/A"
}
]
},
{
"Id": 2,
"Source": "RWIS",
"SourceId": "100.C1",
"Roadway": "SH-75",
"Direction": "Unknown",
"Latitude": 43.5946,
"Longitude": -114.345,
"Location": "SH-75 Wood River",
"SortOrder": 325,
"Views": [
{
"Id": 2,
"Url": "https://511.idaho.gov/map/Cctv/2",
"Status": "Enabled",
"Description": ""
},
{
"Id": 3,
"Url": "https://511.idaho.gov/map/Cctv/3",
"Status": "Enabled",
"Description": ""
},
{
"Id": 4,
"Url": "https://511.idaho.gov/map/Cctv/4",
"Status": "Enabled",
"Description": ""
}
]
}
]