Service Layer medium complexity backend
1
Dependencies
1
Dependents
32
Entities
0
Integrations

Description

Backend service that computes and aggregates key performance indicators by querying PostgreSQL with organization-scoped SQL aggregates. Handles metric computation for active peer mentors, activity counts, pending approval queues, reimbursement totals, and Bufdir reporting progress with strict multi-tenant isolation via organization ID filtering.

Feature: Dashboard KPIs

kpi-aggregation-service

Responsibilities

  • Compute aggregate KPI metrics from activities, approvals, expenses, and user data
  • Enforce multi-tenant isolation by scoping all queries to the requesting organization
  • Apply role-based metric visibility for coordinator local-association scope versus org admin full-organization scope
  • Serve aggregated metrics via the REST API endpoint /api/v1/analytics/kpis

Interfaces

getKpis(organizationId, userRole, localAssociationId?)
getActivePeerMentorCount(organizationId, scope)
getTotalActivitiesLogged(organizationId, dateRange)
getPendingApprovalCount(organizationId)
getReimbursementTotals(organizationId, dateRange)
getBufdirReportingProgress(organizationId)
getActivityTrend(organizationId, period)

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component