feat: add data aggregation by week option#26
Merged
psincraian merged 2 commits intoNov 19, 2025
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.