Data Layer medium complexity backend
0
Dependencies
1
Dependents
19
Entities
0
Integrations

Description

Data access layer that encapsulates PostgreSQL queries for KPI aggregation, using indexed columns on activities.created_at, activity_approvals.status, and expenses.status for performant metric computation. Provides organization-scoped read operations across multiple tables to supply the aggregation service with raw metric data.

Feature: Dashboard KPIs

analytics-store

Responsibilities

  • Execute optimized SQL aggregate queries across activities, approvals, expenses, and user tables
  • Maintain proper database indexes for KPI query performance
  • Provide organization-scoped data access methods for each metric category
  • Support date-range filtering for time-based KPI calculations

Interfaces

queryActivePeerMentors(organizationId, scope?)
queryActivityCounts(organizationId, dateRange)
queryPendingApprovals(organizationId)
queryExpenseTotals(organizationId, dateRange)
queryReimbursementSummary(organizationId)
queryBufdirProgress(organizationId)
queryActivityTrend(organizationId, period, granularity)

Relationships

Dependents (1)

Components that depend on this component