Skip to content

Data flow

The local_ssea plugin tracks activity (JS + PHP observers) and runs sync tasks (users, courses, enrollments, grades). Payloads are sent to the ingest worker with tenant credentials.

ssea-ingest validates the tenant and enqueues messages. ssea-processor consumes the queue, deduplicates, and upserts into D1 (events, dimensions, light aggregates).

D1 holds the relational model: events, users, courses, enrollments, grades, alerts, etc. Every API query is scoped by tenant_id and, depending on role, by moodle_user_id or teacher course_ids from the JWT (typically derived from teaching enrollments in D1).

A scheduled job enqueues report types (retention_cohort, activity_funnel, …). The worker writes JSON/CSV rows to R2 and publishes a KV snapshot (snap:v1:{tenant}:{type}) for fast reads.

  • Dashboard: GET .../reports/:type/latest (KV → R2 fallback), exports role-gated.
  • Plugin: embedded views calling the same API with scoped JWTs.