Skip to content

feat: add data aggregation by week option#26

Merged
psincraian merged 2 commits into
mainfrom
claude/add-weekly-aggregation-01JFE2UFfXsf7ZRTkR1SGfXQ
Nov 19, 2025
Merged

feat: add data aggregation by week option#26
psincraian merged 2 commits into
mainfrom
claude/add-weekly-aggregation-01JFE2UFfXsf7ZRTkR1SGfXQ

Conversation

@psincraian

Copy link
Copy Markdown
Owner

No description provided.

Add the ability to aggregate dashboard time-series data by day, week, or month.

Changes:
- Add AggregationPeriod enum to dashboard API with day/week/month options
- Update /api/dashboard/timeseries endpoint to accept aggregation parameter
- Implement weekly and monthly aggregation logic in AnalyticsService
- Add aggregation period selector dropdown to dashboard UI controls
- Update frontend JavaScript to send aggregation parameter with API requests

The aggregation defaults to daily view, and users can switch between
daily, weekly, and monthly views to better understand trends over different
time periods. Weekly aggregation starts on Monday, and monthly aggregation
uses the first day of each month.
Add comprehensive test suite for day/week/month aggregation with SQLite compatibility.

Changes:
- Add test_aggregation.py with 9 test cases covering:
  - Daily, weekly, and monthly aggregation
  - Package filtering with aggregation
  - Invalid aggregation fallback
  - Direct testing of aggregation helper methods
  - Total preservation across aggregation periods
  - Empty data handling

- Fix SQLite compatibility in analytics_service.py:
  - Handle both date objects (PostgreSQL) and strings (SQLite)
  - Add type checking for date values from database queries
  - Ensure consistent date string formatting across database backends

All tests pass (9/9) with full linting and type checking compliance.
@psincraian psincraian merged commit e71c6c1 into main Nov 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants