feat: Smart weekly financial digest with trends & insights (bounty #121)#939
Open
alexanderxfgl-bit wants to merge 1 commit intorohitdash08:mainfrom
Open
feat: Smart weekly financial digest with trends & insights (bounty #121)#939alexanderxfgl-bit wants to merge 1 commit intorohitdash08:mainfrom
alexanderxfgl-bit wants to merge 1 commit intorohitdash08:mainfrom
Conversation
Implements a production-ready smart digest system that generates weekly/monthly financial summaries with trend analysis and insights. - WeeklyDigest model with category breakdowns, trends, and insights (JSON) - DigestService: period aggregation, trend detection (>15% = significant), auto-generated human-readable insights, upsert logic for digest records - REST API: GET /digest, GET /digest/history, POST /digest/generate - PostgreSQL schema with unique index on user+period - 11 tests covering CRUD, validation, trend detection, force generation Closes rohitdash08#121
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.
Bounty Claim: $500 — Issue #121
Implementation
Production-ready smart digest system with weekly/monthly financial summaries, trend detection, and auto-generated insights.
Backend Changes
Model (
app/models.py):WeeklyDigest: user_id, period_start, period_end, period_type, total_spent, category_breakdown (JSON), trends (JSON), insights (JSON), generated_atService (
app/services/digest.py):generate_digest()— aggregate expenses by category for current/previous period_category_breakdown()— convert query results to {category: total} dict_detect_trends()— compare current vs previous, flag >15% changes as significant_generate_insights()— produce human-readable insights: top category, spending spikes, overall change_period_bounds()— compute week/month date ranges (Monday-based weeks, 1st-based months)get_digest_history()— paginated historical digest listing with period filterRoutes (
app/routes/digest.py):GET /digest?period=weekly|monthly— generate/retrieve current period digestGET /digest/history?limit=10&period=weekly— list historical digestsPOST /digest/generate— force generate for specific period/dateSchema (
app/db/schema.sql):weekly_digeststable with JSONB columns for breakdown/trends/insightsTests
11 tests covering:
Closes #121