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
11
sql/migrations/018_add_swpc_adapters.sql
Normal file
11
sql/migrations/018_add_swpc_adapters.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- Migration: 018_add_swpc_adapters
|
||||
-- Add NOAA SWPC space weather adapters to config.adapters.
|
||||
-- All three ship disabled; operator enables individually via GUI.
|
||||
-- Idempotent: uses ON CONFLICT DO NOTHING.
|
||||
|
||||
INSERT INTO config.adapters (name, enabled, cadence_s, settings)
|
||||
VALUES
|
||||
('swpc_alerts', false, 300, '{}'::jsonb),
|
||||
('swpc_kindex', false, 600, '{}'::jsonb),
|
||||
('swpc_protons', false, 600, '{}'::jsonb)
|
||||
ON CONFLICT (name) DO NOTHING;
|
||||
8
sql/migrations/019_add_central_space_stream.sql
Normal file
8
sql/migrations/019_add_central_space_stream.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- Migration: 019_add_central_space_stream
|
||||
-- Seeds the CENTRAL_SPACE JetStream stream row for central.space.> subjects.
|
||||
-- 7-day retention, 1 GiB max_bytes (clamped by supervisor recompute) -- mirrors CENTRAL_FIRE / CENTRAL_QUAKE.
|
||||
-- Idempotent: uses ON CONFLICT DO NOTHING.
|
||||
|
||||
INSERT INTO config.streams (name, max_age_s, max_bytes)
|
||||
VALUES ('CENTRAL_SPACE', 604800, 1073741824)
|
||||
ON CONFLICT (name) DO NOTHING;
|
||||
Loading…
Add table
Add a link
Reference in a new issue