Expense Summary Repository
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
3
Dependents
2
Entities
0
Integrations
Description
Data access layer that reads from the materialized expense_summary_snapshots table for pre-aggregated figures and executes ad-hoc queries against expense_claims and expense_items for real-time deltas and drill-down results. Uses composite indexes on submitter_id, expense_type, and created_at to keep on-demand queries performant.
expense-summary-repository
Responsibilities
- Read nightly aggregate snapshots from expense_summary_snapshots keyed by org and period
- Execute real-time aggregation on expense_claims for the current calendar day
- Execute parameterized drill-down queries with index-aware filtering
- Return rolling average and standard deviation baseline data per organization for anomaly detection
Interfaces
getSnapshot(orgId: string, period: TimePeriod): Promise<ExpenseSummarySnapshot>
getRealTimeDelta(orgId: string): Promise<ExpenseDelta>
queryDrillDown(orgId: string, filters: ExpenseFilters): Promise<ExpenseRecord[]>
getRollingBaseline(orgId: string, windowDays: number): Promise<AnomalyBaseline>
Relationships
Dependents (3)
Components that depend on this component
Related Data Entities (2)
Data entities managed by this component