Logotipo Hedhog

Get Hedhog updates in your inbox

New releases, fresh recipes, and breaking changes — no spam.

Back to LMS modulesLMS Submodule

LMS Submodule

dashboard-reports

LMS admin dashboard metrics, time-period aggregate reports, and a real-time event cursor/SSE stream for live activity polling.

Source path: libraries/lms/src/dashboard, libraries/lms/src/reports, libraries/lms/src/realtime

Module file: dashboard.module.ts, reports.module.ts, lms-realtime.module.ts

Introduction

The admin Dashboard endpoint (`GET /lms/dashboard`) and the Reports endpoint (`GET /lms/reports`) are both single, heavily-aggregated read-only views rather than collections of granular CRUD resources. The dashboard returns current-state KPIs (active students/courses/classes, issued certificates, completion/approval rates, each with month-over-month deltas), four charts (student growth, weekly engagement, top courses by access, category distribution), a ±14/+30-day calendar of class sessions, and recent enrollment/upcoming-class feeds — everything an admin needs on first login without further navigation. Reports takes a `period` query parameter (7d, 30d, 6m, or 12m) and returns the equivalent metrics compared against the prior period of the same length: enrollment trend, per-course and per-category rankings, a student-status breakdown, a six-axis quality radar (engagement, completion, satisfaction, recommendation, retention, performance), and weekly activity/grade-evolution series. Both read the `Accept-Language` header to localize labels (normalized to `pt-BR` or `en-US`) rather than taking a `locale` query parameter.

Realtime is a separate, much smaller concern: an in-memory ring buffer (last 500 events) backing a cursor-polling endpoint (`GET /realtime/cursor`, so a client can cheaply check "has anything changed since I last looked") and a true push channel (`GET /realtime/activity/stream`, Server-Sent Events) that filters the bus down to `lesson_view` events specifically, with a 25-second heartbeat ping to keep the connection alive through proxies. Unusually for this codebase, neither realtime endpoint carries an explicit `@Role()`/`@NoRole()` decorator in source; the cursor endpoint is nonetheless seeded with roles (`admin`, `admin-lms`, `lms-enterprise-admin`, `lms-instructor`, `lms-student`) in the permission system, while the SSE stream endpoint has no route-permission entry at all.

A "Video Resolution Profiles" feature (FFmpeg encoding presets) previously lived under this area but its controller, service, MCP tools, and admin UI were fully deleted in a later commit that replaced fixed-resolution-profile video conversion with adaptive HLS streaming (now part of the Courses and Platforma submodules). It is intentionally omitted from this documentation since the backing code no longer exists — any references to `/lms/video-resolution-profiles` elsewhere (older docs, stale migration-seeded route/MCP permissions) are orphaned.

HTTP Endpoints

4 endpoints

Aggregated admin dashboard: KPIs, charts, calendar events, latest enrollments, and upcoming classes. Localized via Accept-Language.

Reporting dashboard for the period vs. the prior equivalent period: KPIs, rankings, quality radar, weekly activity.

Query
period? ('7d' | '30d' | '6m' | '12m', default 12m)

Current event-log cursor position, for polling whether new realtime events exist.

SSE stream of lesson_view domain events as they are published, with a 25s heartbeat.

MCP Tools

Named tools callable by AI models via the Model Context Protocol (MCP).

  • lms.dashboard.get

    Returns the LMS admin dashboard data: KPIs, charts, calendar events, latest enrollments, and upcoming classes

  • lms.reports.get

    Returns LMS report data including KPIs, monthly enrollments, course ranking, student status distribution, quality radar, and weekly activity