Skip to content

feat: implement AI medical summary generation using Gemini - #24

Open
theadarsh1m wants to merge 7 commits into
mainfrom
feature/ai-medical-summary-16901609410216372854
Open

feat: implement AI medical summary generation using Gemini#24
theadarsh1m wants to merge 7 commits into
mainfrom
feature/ai-medical-summary-16901609410216372854

Conversation

@theadarsh1m

Copy link
Copy Markdown
Owner

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

theadarsh1m and others added 4 commits March 26, 2026 21:44
- 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>
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@netlify

netlify Bot commented Mar 28, 2026

Copy link
Copy Markdown

Deploy Preview for medichainreal ready!

Name Link
🔨 Latest commit d8e2fef
🔍 Latest deploy log https://app.netlify.com/projects/medichainreal/deploys/69c82adb02d5e70008f63507
😎 Deploy Preview https://deploy-preview-24--medichainreal.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 28, 2026

Copy link
Copy Markdown

Deploy Preview for medichain1 ready!

Name Link
🔨 Latest commit d8e2fef
🔍 Latest deploy log https://app.netlify.com/projects/medichain1/deploys/69c82adb06b36f0008afd4ee
😎 Deploy Preview https://deploy-preview-24--medichain1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

google-labs-jules Bot and others added 3 commits March 28, 2026 18:44
- 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>
@theadarsh1m
theadarsh1m force-pushed the main branch 3 times, most recently from d1eea35 to 766370a Compare April 25, 2026 08:22
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.

1 participant