đź’ˇ Sprint Task: Recommendations + Funding Plan Generation
🎯 Goal
Use the district’s profile and funding data to generate an AI-powered Funding Plan (list of recommended grants and strategies), store it in the database, and display it on the Dashboard — with the ability to refresh or regenerate if needed.
🪜 Task Breakdown
1. AI Integration (via n8n)
- [ ] Pass all relevant district data + funding responses from the database into the n8n agent.
- [ ] Ensure clean JSON structure for prompt context (no RAG).
- [ ] Create an n8n workflow that:
- Receives incoming request (webhook).
- Sends data to the AI model with a tailored “grant plan” prompt.
- Returns the structured response (recommendations + plan summary).
2. Funding Plan Generation
- [ ] Define what the “Funding Plan” includes:
- [ ] List of top recommended grants.
- [ ] Suggested next steps or deadlines.
- [ ] Matching scores or reasoning (optional).
- [ ] Format AI response consistently (object with fields:
plan_id, recommendations[], summary, etc.).
- [ ] Handle errors (fallback if AI fails or returns incomplete data).
3. Database Integration
- [ ] Create a
funding_plans table in Supabase (or update existing schema).
- [ ] Save generated plans per district:
- [ ] District ID
- [ ] Plan content (JSON or text)
- [ ] Created_at / Updated_at
- [ ] Support multiple versions (so regenerating doesn’t overwrite old plans).
4. Dashboard Display
- [ ] Add “Funding Plan” widget or tab in the Dashboard.
- [ ] Show:
- [ ] Summary section (“Your current funding plan”).
- [ ] List of recommended grants (with names, amounts, and sources).
- [ ] Button: “🔄 Refresh Recommendations.”