-
Notifications
You must be signed in to change notification settings - Fork 18
Upsert data into monthly notification status summary #2739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new Celery task to maintain summary statistics in the monthly_notification_stats table. The task aggregates notification data from ft_notification_status and uses PostgreSQL's upsert functionality to efficiently update monthly statistics.
Key Changes:
- Added a scheduled Celery task that runs daily at 01:30 EST to update monthly notification statistics
- Implements PostgreSQL upsert (INSERT ... ON CONFLICT) to efficiently maintain the summary table for the current and previous month
- Processes only the last 2 months of data to optimize performance
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| app/config.py | Adds the scheduled task configuration to run daily at 06:30 UTC (01:30 EST) on the REPORTING queue |
| app/celery/reporting_tasks.py | Implements the core task logic including data aggregation query, upsert statement, and error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
smcmurtry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, the real test will be looking at the generated data to see if it matches the /activity page.
Summary | Résumé
We need a celery task that upserts data into the monthly_notification_stats_summary table. We run this function AFTER the data for ft_notification_status has been created for the day.