Skip to content

Feature/events api#478

Open
mudhoney wants to merge 52 commits intoHelioviewer-Project:mainfrom
mudhoney:feature/events-api
Open

Feature/events api#478
mudhoney wants to merge 52 commits intoHelioviewer-Project:mainfrom
mudhoney:feature/events-api

Conversation

@mudhoney
Copy link
Copy Markdown
Contributor

@mudhoney mudhoney commented Apr 7, 2026

Migrate event data to standalone Events API service

Summary

Replaces the in-process HEK adapter and direct DB event queries with a remote
Events API client (events.helioviewer.org). Adds an event coverage timeline,
rewrites composite-image polygon rendering from raster PNGs to vector
footprints, cleans up the module system to PSR-4, and adds ~1,500 lines of
new unit tests.

Why

The legacy event pipeline pulled HEK events from MySQL via HEKAdapter,
applied solar-rotation in PHP, and emitted pre-baked polygon PNGs at ingest
time. That model was tightly coupled to a single HEK schema, did per-frame
queries when generating movies, and could not style polygons per type.
A dedicated Events API service lets the backend issue a single batched query
for all frames and receive events with already-rotated coordinates and
vector footprints.

What changed

  • Events API client -- new src/Event/Api/{EventsApi,LegacyEvents,...}
    with four endpoints (legacy, range, distributions, batch). Configurable
    URL + timeout via new ini keys; defaults to production.
  • Event timeline -- new src/Event/Timeline/ (Timeline, Resolution,
    MinuteCoverage + SwimLaner, AggregatedCoverage, TimeRange).
    getDataCoverage auto-routes to it when eventLayers is present;
    endpoint contract preserved.
  • EventSelections -- parses legacy [AR,all,1],[FL,...] strings into
    canonical HEK>>Active Region paths.
  • Composite image polygon rewrite -- replaces raster hv_poly_* PNG
    loading with ImagickDraw::polygon from event['footprint']. Per-type
    fill colors from new EVENT_COLORS const, black stroke, matches
    frontend SVG style. Marker PNGs cached by type. Drops dead
    hpc_boundcc branch, $maxPixelScale, _sortByLayeringOrder.
  • Module refactor -- interface.Module.php -> ModuleInterface.php
    (PSR-4), new AbstractModule base class. No public dispatch case names
    changed; &$params -> $params everywhere.
  • Movies -- single getEventsBatch call pre-fetches all frame
    timestamps before frame generation. __destruct added to close mysqli
    handles. Movie layer limit raised 3 -> 5.
  • Sentry -- per-request context on Events API errors; fixes a
    double-capture bug.

Configuration

New ini keys in settings/Config.Example.ini:

events_api_url     = "https://events.helioviewer.org"
events_api_timeout = 10

Existing installations pick up the defaults automatically.

Risk

  • HTTP API contract: unchanged. URLs, params, validation, response shapes
    match main for all existing endpoints.
  • Visual output: screenshots/movies show per-type colored polygons with
    black outlines instead of uniform yellow. Pixel-diff regressions need
    rebaselining.
  • Upstream dependency: composite images now depend on
    events.helioviewer.org for footprints. If unreachable, screenshots
    still render -- just no polygons. Silent degradation, not a hard fail.
  • HEKAdapter legacy path: still alive for Module/SolarEvents.php
    endpoints (getEvents, getEventGlossary, etc.). Third-party clients on
    those endpoints are unaffected.

Test plan

  • composer test passes locally
  • composer test-integration passes locally
  • CI passes
  • Take a screenshot at a date with several event types -- confirm
    polygons render with the right per-type color and the marker is positioned
    over the polygon
  • Build a short movie spanning multiple HEK event timestamps -- confirm
    events appear on each frame and rotation moves them correctly
  • Hit getDataCoverage?eventLayers=[AR,all,1]&startDate=...&endDate=...
    at a minute-level range; confirm timeline JSON contains the event series
  • Same endpoint at a multi-month range -- confirm AggregatedCoverage
    path returns aggregated buckets
  • Hit getDataCoverage?imageLayers=[SDO,AIA,171,1,100]&startDate=...&endDate=...
    -- confirm image-layer path is unchanged
  • Verify getEvents still returns the legacy HEK shape (used by older
    clients / JHelioviewer)

mudhoney added 30 commits March 27, 2026 17:32
…pointer array, just use array to use copy value instead of reference
…tion timeout to php test client, makes connection url unbearable
… rotated events for all frames, only 1 requst to calculate all points
Comment thread docroot/resources/images/eventMarkers/C3.png
Comment thread docroot/resources/images/eventMarkers/SR@2x.png
Comment thread src/Event/Api/LegacyEvents.php
Comment thread src/Event/Timeline/AggregatedCoverage.php Outdated
Comment thread src/Event/Timeline/AggregatedCoverage.php
Comment thread src/Module/BaseModule.php
Comment thread src/Module/SolarEvents.php
Comment thread src/Config.php Outdated
@mudhoney mudhoney force-pushed the feature/events-api branch from 8dc602f to fdc7546 Compare April 28, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants