Aggregate Report Service
Component Detail
Service Layer
medium complexity
backend
2
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Computes rolled-up statistics for a given organization by aggregating data from all descendant organizations using nightly-refreshed PostgreSQL materialized views. Provides the data layer behind the rollup KPIs displayed on the hierarchy management page.
aggregate-report-service
Responsibilities
- Query materialized views for pre-aggregated descendant statistics
- Combine activity, user, and expense counts per org subtree
- Trigger manual materialized view refresh for admin-requested recalculations
- Format rollup results for consumption by the Hierarchy Management Page
Interfaces
getRollupStats(orgId): AggregateStats
refreshMaterializedViews(orgId?): void
getDescendantActivityCount(orgId): number
getDescendantUserCount(orgId): number
getDescendantExpenseTotal(orgId): number
getLastRefreshTimestamp(): Date
Relationships
Dependencies (2)
Components this component depends on