mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-21 18:14:44 +02:00
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>
11 lines
451 B
SQL
11 lines
451 B
SQL
-- 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;
|