mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-21 18:14:44 +02:00
feat(2-D): add NOAA SWPC space weather adapters (alerts, kindex, protons)
Three independent adapters sharing src/central/adapters/swpc_common.py, mirroring the WFIGS two-adapter pattern. Each adapter has its own row in config.adapters (ships disabled), its own cadence, and its own dedup state, so operators can independently enable/disable and so a broken upstream endpoint does not silently mask a healthy one. Subjects: swpc_alerts -> central.space.alert.<product_id_lower> swpc_kindex -> central.space.kindex swpc_protons -> central.space.proton_flux Dedup keys: alerts: product_id + issue_datetime kindex: time_tag protons: time_tag + energy Severity: G-scale on product_id for K0[5-9][AW] alerts (G1-G5 -> 1-4), G-scale on Kp for kindex, 0 for protons (raw flux carried in event.data). No geo on any SWPC events (centroid=None, regions=[], primary_region=None). No fall-off detection for alerts -- a single 115-row sample cannot confirm whether alerts disappear from the upstream JSON when expired; deferred to a later pass after 24h of observation. CENTRAL_SPACE stream seeded with 7-day retention / 1 GiB max_bytes, mirroring CENTRAL_FIRE / CENTRAL_QUAKE. STREAM_SUBJECTS, archive STREAMS, and DASHBOARD_STREAMS each pick up the new stream. Tests: 16 new cases in tests/test_swpc.py using real-shape frozen JSON fixtures (alerts product_ids EF3A/K05A/K07A; kindex Kp boundaries; protons composite dedup). Two existing tests updated for the new stream count (test_archive_multi_stream.test_streams_list_has_three_entries renamed to _has_four_entries; test_dashboard expects 5 streams not 4); added a test_streams_contains_central_space companion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0675a4214f
commit
72ec498365
12 changed files with 1007 additions and 5 deletions
|
|
@ -205,7 +205,7 @@ class TestDashboardStreamsIsolation:
|
|||
call_args = mock_templates.TemplateResponse.call_args
|
||||
context = call_args.kwargs.get("context", call_args[1].get("context"))
|
||||
streams = context["streams"]
|
||||
assert len(streams) == 4
|
||||
assert len(streams) == 5
|
||||
fire_stream = next(s for s in streams if s["name"] == "CENTRAL_FIRE")
|
||||
assert fire_stream.get("error") == "unavailable"
|
||||
wx_stream = next(s for s in streams if s["name"] == "CENTRAL_WX")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue