central/sql/migrations/041_add_sat_orbits_adapter.sql

37 lines
1.4 KiB
MySQL
Raw Normal View History

v0.13.0: sat_orbits adapter (forward-orbit-track per satellite) + antimeridian splitter New SourceAdapter publishes one forward-orbit-track LineString per tracked satellite per poll (5min cadence, 90min horizon, 60s vertex resolution). Drives the "each sat's path" map view Matt asked for after enabling the satellite family and seeing overlapping orange visibility-footprint circles + a polar-orbit ground track wrapping the wrong way across the antimeridian. Companion to v0.12.0 sat_positions: one publishes the current sub-sat POINT per minute, sat_orbits publishes the LINE of where it's going. Complement, not replacement. data_class=telemetry (continuous trajectory state, surfaces on /telemetry). Geo carries both centroid (current sub-sat point for the "here it is" dot) and geometry (the forward track LineString or MultiLineString). Antimeridian splitter is the key new sat_common primitive: walks the vertex list, splits at +/-180 crossings, interpolates lat at the crossing point for crisp dateline termination. ALSO fixes the v0.11.2 satpass_predict "wrong-way wrap" bug by rewiring _build_pass_geometry's ground_track through the same splitter (sibling concern, documented in the PR body as intentional scope-coupling). CENTRAL_SAT stream STREAM_CATEGORY_DOMAINS extends from ('tle', 'pass', 'position') to ('tle', 'pass', 'position', 'orbit'). No max_bytes bump needed; 6 sats x 12 polls/hour x 24 hours x ~5KB = ~8.5 MB/day, negligible against the 5 GiB cap. GUI events_list.html adds a small per-NORAD-ID color helper using golden-angle HSL hue distribution. sat_orbits events render with per-satellite colors; other adapters keep their existing per-adapter palette color (additive). Phase A sanity verified: ISS TLE at 2026-06-09T07:00 UTC propagates to 91 vertices over 90min, first vertex matches v0.11.1's known sub-sat point (170.66 lon, -17.15 lat, 417.4 km alt), one antimeridian crossing splits the track into a 2-segment MultiLineString. 44/44 satpass_predict regression-guard tests pass after the _build_pass_geometry rewire. One new test specifically exercises the splitter inside _build_pass_geometry for a synthesized polar-orbit ground_track. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-09 18:44:14 -06:00
-- Migration 041: register sat_orbits adapter (v0.13.0)
--
-- Forward-orbit-track publisher. One LineString telemetry event per tracked
-- satellite per poll, projecting the next 90 minutes of sub-satellite
-- ground track. Line counterpart to sat_positions (which publishes the
-- current sub-sat POINT per minute). Drives the "each sat's path" map
-- view Matt asked for after enabling the satellite family.
--
-- Subject: central.sat.orbit.<norad_id>. Stream: existing CENTRAL_SAT.
-- The supervisor's STREAM_CATEGORY_DOMAINS["CENTRAL_SAT"] extends from
-- ("tle", "pass", "position") to ("tle", "pass", "position", "orbit")
-- in code (not migration) so the retention sweep covers orbit events.
--
-- No max_bytes bump needed on CENTRAL_SAT. Volume estimate: 6 sats x 12
-- polls/hour (300s cadence) x 24 hours = 1728 events/day at ~5 KB each
-- (~90 vertices) = ~8.5 MB/day. Negligible against the 5 GiB cap from
-- v0.12.0.
--
-- Ships disabled (enabled=false). celestrak_tle must be enabled and
-- polling before sat_orbits has TLE data to propagate; missing-TLE path
-- is graceful (INFO log + zero events).
--
-- Idempotent: ON CONFLICT preserves operator-tuned state.
INSERT INTO config.adapters (name, enabled, cadence_s, settings)
VALUES (
'sat_orbits',
false,
300,
'{
"track_only_norad_ids": [],
"forward_minutes": 90,
"sample_seconds": 60,
"max_tle_age_days": 14
}'::jsonb
)
ON CONFLICT (name) DO NOTHING;