DashboardKpiService
Component Detail
Description
Backend service responsible for aggregating KPI data from multiple domain sources into a single dashboard response. It queries activity logs, peer mentor records, approval queues, and expense entries, then computes summary metrics and returns them in a normalized shape. Caches results with a short TTL to reduce repeated aggregation load on high-traffic dashboard refreshes.
dashboard-kpi-service
Sources & reasoning
Line 195 explicitly names dashboards and KPIs as a core Admin Web Portal capability. Line 158 classifies the admin panel as MUST HAVE in Fase 1 (MVP). Line 326 confirms activity overview and basic statistics are in the MVP admin scope, directly motivating a KPI-centric landing screen for immediate operational visibility without manual navigation.
-
docs/source/likeperson.md · line 158Admingrensesnitt for org (Admin Panel - Next.js) | ✓ | ✓ | ✓ | ✓ | ✓ | MUST HAVE | 1
-
docs/source/likeperson.md · line 195Coordinator and organization-level dashboards and KPIs
-
docs/source/likeperson.md · line 326Aktivitetsoversikt og grunnleggende statistikk
Responsibilities
- Aggregate total activities logged across all organizational units
- Count currently active peer mentors from the mentor registry
- Calculate the size of the pending approval queue
- Sum expense totals from the expense ledger within the current period
- Return a unified KpiSummary object with all metrics and a cache timestamp
Interfaces
getKpiSummary(orgId: string): Promise<KpiSummary>
getActivityCount(orgId: string): Promise<number>
getActiveMentorCount(orgId: string): Promise<number>
getPendingApprovalCount(orgId: string): Promise<number>
getExpenseTotal(orgId: string, period: DateRange): Promise<number>
Related Data Entities (6)
Data entities managed by this component