feat: implement AI medical summary generation using Gemini - #24
feat: implement AI medical summary generation using Gemini#24theadarsh1m wants to merge 7 commits into
Conversation
- Add `aiSummary` field to `Patient` model for caching - Create `/patient/action/generate-summary` endpoint to call Gemini API - Add `AISummaryCard` frontend component to display and trigger summaries - Integrate `AISummaryCard` into the Dashboard UI - Ensure token efficiency by caching and requiring manual generation Co-authored-by: theadarsh1m <150774323+theadarsh1m@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
✅ Deploy Preview for medichainreal ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for medichain1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Move smart alerts generation from frontend to backend. - Create `/patient/action/generate-alerts` endpoint. - Fix Gemini model name to valid `gemini-2.0-flash`. - Update prompt to include diagnostics data. - Ensure API keys are no longer exposed on the frontend. Co-authored-by: theadarsh1m <150774323+theadarsh1m@users.noreply.github.com>
- Verified that the codebase correctly calls Gemini using the new SDK. - The 500 error reported was determined to be a database connection issue on the host machine (`ECONNREFUSED 127.0.0.1:27017`), not an application code issue. Co-authored-by: theadarsh1m <150774323+theadarsh1m@users.noreply.github.com>
- Cache generated smart alerts in the Patient database schema. - Update `/patient/action/generate-alerts` to return cached alerts unless `forceUpdate` is passed. - Modify `AlertsPanel` to stop automatically generating AI alerts on every render. - Add a manual "Refresh Alerts" button to give users control over token usage. Co-authored-by: theadarsh1m <150774323+theadarsh1m@users.noreply.github.com>
d1eea35 to
766370a
Compare
This PR implements the requested AI medical summary feature using Google's Gemini AI. It adds a "Generate AI Summary" section to the Patient Dashboard. To ensure it is token-efficient and production-ready, the summary is only generated when the user requests it, and the result is cached in the database so subsequent views do not consume additional API tokens. Users can manually update the summary when their medical data changes.
PR created automatically by Jules for task 16901609410216372854 started by @theadarsh1m