Inspiration

Hospital discharge documents often contain some of the most important instructions a patient receives: medications, follow-up appointments, warning signs, activity restrictions, and recovery steps.

But these documents can also be dense, clinical, and difficult to understand, especially when a patient has just returned home from a hospital visit.

DischargeLens AI was built around a simple question:

What if AI could help patients understand their discharge paperwork without replacing the original medical instructions or inventing medical advice?

The goal is not to diagnose, prescribe, or replace healthcare professionals. Instead, DischargeLens AI acts as a comprehension layer between complex discharge paperwork and the patient who needs to understand it.

What it does

DischargeLens AI allows a user to upload a hospital discharge document in PDF, JPG, or PNG format.

Gemini AI extracts structured information such as:

  • patient and document details
  • medications and schedules
  • follow-up appointments
  • care instructions
  • warning signs and red flags
  • activity, driving, diet, and work restrictions
  • other document-stated instructions

The extracted information is not automatically trusted.

Before viewing the final report, the user is shown a Human Review & Verification screen where extracted fields can be reviewed and edited against the original discharge document.

After confirmation, DischargeLens AI creates a structured recovery report containing the confirmed information.

Users can also generate AI-assisted explanations in:

  • Simple English
  • conversational Hindi

The original reviewed instruction always remains visible alongside the AI-assisted explanation.

How we built it

DischargeLens AI is built with Next.js, React, TypeScript, Tailwind CSS, Google Gemini, Vitest, and Vercel.

The system is divided into several safety-focused layers.

Gemini Document Extraction

Uploaded discharge documents are processed through a server-side Gemini integration.

Gemini extracts structured facts from the document but is instructed not to diagnose conditions, modify prescriptions, or create new treatment recommendations.

Uploaded document content is treated as untrusted data to reduce prompt-injection risk.

Human Review Layer

Before extracted information becomes part of the recovery report, the user must review the extracted fields.

The confirmation button remains disabled until the user explicitly confirms that they reviewed the information against the discharge document.

Human-edited fields are tracked separately so that the application can preserve the distinction between AI extraction and user-confirmed information.

Source Evidence

Where a verbatim source excerpt is available, extracted information is linked back to the corresponding text from the discharge paperwork.

This helps users compare the structured result with the original source instead of relying only on generated output.

AI-Assisted Explanation Layer

After review, users can ask Gemini to generate easier explanations in Simple English or Hindi.

The original instruction remains visible and the generated explanation is treated only as an assistance layer.

Post-generation deterministic validators check important safety-sensitive details including:

  • numbers
  • medical units
  • medication names
  • negative instructions and restrictions
  • professional-role terminology

If an AI explanation cannot be safely verified, the application falls back to the original reviewed instruction.

Deterministic Recovery Timeline

DischargeLens AI also organizes confirmed recovery actions into timing groups.

The timeline is generated using deterministic TypeScript logic rather than Gemini.

It separates concepts such as:

  • start timing
  • frequency
  • duration
  • follow-up windows
  • unspecified timing

This prevents the system from inventing medical priorities or artificial schedules.

Emergency warning signs are intentionally excluded from the normal recovery timeline and remain in their own clearly visible warning section.

Recovery Checklist

Confirmed instructions are also converted into an interactive recovery checklist.

Users can mark tasks as complete and filter between all, pending, and completed items.

Warning signs are never turned into normal checklist tasks.

Challenges we ran into

One of the biggest challenges was deciding where AI should and should not be trusted.

A normal AI application could simply summarize a medical document, but healthcare information requires much stricter grounding.

We therefore designed DischargeLens AI so that Gemini performs extraction and language assistance while deterministic logic handles validation, timeline classification, state management, and safety rules.

Another challenge was translation fidelity.

During testing, we found that an AI explanation could sometimes make a broad professional term such as "clinician" more specific, for example changing it to "doctor."

Although that may sound harmless, it changes the meaning of the original document.

We added deterministic role-preservation validation so broad healthcare roles cannot silently become more specific roles.

We also separated duration from start timing to prevent phrases such as "for the first 48 hours" from incorrectly being interpreted as an instruction that begins within the first 24 hours.

Accomplishments that we're proud of

DischargeLens AI is a working end-to-end application rather than only a UI concept.

The completed system includes:

  • real Gemini-powered discharge document extraction
  • editable human-review workflow
  • mandatory confirmation gating
  • source evidence and document grounding
  • Simple English explanations
  • conversational Hindi explanations
  • medication, unit, numeric, negation, and role-preservation validators
  • deterministic recovery timeline
  • interactive recovery checklist
  • isolated emergency warning signs
  • in-memory application state without application-managed medical-record persistence
  • server-side API credential handling
  • responsive interface
  • automated safety and regression testing

The project currently passes 118 automated tests across 10 test suites, has a clean ESLint result, and successfully builds for production.

What we learned

DischargeLens AI taught us that healthcare AI should not simply focus on generating more intelligent responses.

It must also clearly define what the AI is allowed to do.

A major design principle became:

AI extracts and explains. Human review confirms. Deterministic code protects important boundaries.

We also learned about structured LLM outputs, prompt-injection resistance, human-in-the-loop interfaces, translation fidelity, deterministic post-generation validation, source attribution, and safety-oriented UX.

What's next for DischargeLens AI

DischargeLens AI is currently a demonstration prototype for educational and document-comprehension purposes, not a medical device.

Future improvements could include:

  • support for more languages
  • improved document-layout understanding
  • accessibility improvements for older users
  • optional caregiver-friendly views
  • better handling of low-quality scanned documents
  • downloadable reviewed recovery summaries
  • broader evaluation across different discharge-document formats
  • stronger clinically reviewed terminology datasets
  • additional testing with synthetic and properly authorized healthcare documents

The long-term vision is to help patients leave the hospital with not only a document, but a clearer understanding of what that document actually says.

Built With

Share this project:

Updates

Submission history