Skip to content

Conversation

@jzbahrai
Copy link
Collaborator

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.

@jzbahrai jzbahrai requested a review from jimleroyer as a code owner December 15, 2025 21:30
Copilot AI review requested due to automatic review settings December 15, 2025 21:30
Copy link
Contributor

Copilot AI left a 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.

@jzbahrai jzbahrai changed the base branch from main to dev December 16, 2025 21:08
@jzbahrai jzbahrai requested a review from Copilot December 16, 2025 21:08
@cds-snc cds-snc deleted a comment from Copilot AI Dec 16, 2025
Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

@smcmurtry smcmurtry left a 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.

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.

3 participants