feat: AI-powered spending insights
Problem or Need
The application currently displays a user's financial data through lists, and charts. However, this is a reactive approach; it requires the user to manually analyze the data to find trends, anomalies, or areas for improvement. The app does not currently offer proactive advice or automatically highlight important patterns in a user's spending habits.
Proposed Solution
Introduce a new "Financial Insights" feature powered by the Google Gemini API. This feature will analyze a user's recent financial activity (transactions, budgets, etc.) and generate a short list of personalized, human-readable insights and suggestions. This transforms the application from a simple data tracker into an intelligent financial assistant.
Expected Behavior
- On the Dashboard, there is a new card or section titled "Your Weekly Insights" or "AI Financial Coach."
- When the page loads, this section shows a loading state while the AI generates its analysis.
- After a few moments, the section populates with 2-3 concise, bulleted insights, for example:
- "Heads up! Your spending on 'Shopping' this month is 50% higher than your average."
- "Great job! You are on track to stay well under your 'Food' budget for this month."
- "Based on your current income and spending rate, you are projected to save an additional ₹3,500 by the end of the month."
Benefits
- Proactive Guidance: Transforms the app from a passive data viewer into an active assistant that provides actionable advice.
- Deeper Engagement: Provides users with novel, personalized content on their dashboard, encouraging regular use of the application.
- Actionable Advice: Helps users spot trends and anomalies in their spending that they might have missed, helping them to make smarter financial decisions.
Possible Implementation
-
Backend:
- Create a new endpoint:
GET /api/insightsor similar. - The controller for this endpoint will fetch the user's relevant financial data (e.g., transactions from the last 30-60 days, current budget progress).
- It will then construct a detailed prompt for the Gemini API. The prompt should provide the raw financial data as context and instruct the model to act as a "friendly financial coach," identifying the most important trends or anomalies and summarizing them in a few key points.
- The controller will call the Gemini API, parse the text response, and send the generated insights back to the frontend as an array of strings.
- Create a new endpoint:
-
Frontend (
DashboardPage.jsx):- Create a new
InsightsCard.jsxcomponent. - This component will have its own
useEffecthook to call the new/api/insightsendpoint on page load. - It will manage and display a loading state while waiting for the AI to generate the response.
- It will then render the list of text-based insights returned from the API.
- Add the new
<InsightsCard />component to the mainDashboardPagelayout.
- Create a new
Hi @archa8 , Please assign this issue to me!
@Priyanshiunique assigned to you Good luck!
Hey........I would Love to work on this.