Files
openrouter-watcher/export
Luca Sacchi Ricciardi b075ae47fe feat(services): T31 implement statistics aggregation service
Add statistics aggregation service with 4 core functions:
- get_summary(): Aggregates total requests, cost, tokens with avg cost
- get_by_model(): Groups stats by model with percentage calculations
- get_by_date(): Groups stats by date for time series data
- get_dashboard_data(): Combines all stats for dashboard view

Features:
- SQLAlchemy queries with ApiKey join for user filtering
- Decimal precision for all monetary values
- Period calculation and percentage breakdowns
- Top models extraction

Test: 11 unit tests covering all aggregation functions
2026-04-07 15:16:22 +02:00
..