Inspiration

Clinical notes contain a lot of medication information, but finding a drug name is only the first step. A medication can be active, newly prescribed, discontinued, historical, or simply mentioned in passing. I wanted to build a practical prototype that helps identify which medications actually need safety review.

That led to MedSafe Discharge, a medication safety workflow that turns an unstructured clinical note into medication-status and drug-interaction reviews.

How It Works

The user can provide a clinical note in three ways:

  1. Enter a note manually
  2. Select a sample clinical note from the Hugging Face argilla/medical-domain dataset
  3. Record the note as audio, which is transcribed locally using Faster-Whisper

The note can then be reviewed and edited before analysis.

The current sample-note dataset is simply an input source for the prototype and can be replaced with another dataset or a production clinical data source depending on the intended deployment.

The pipeline is:

Clinical Note → Medication Extraction → Status Classification → RxNorm → DDInter → Safety Review

Google Gemini extracts explicitly mentioned medications, their documented status, and the exact evidence from the note supporting each extraction.

Only medications documented as currently taking or newly prescribed move into the drug-interaction workflow. Medications with unclear status are separated for review rather than automatically being treated as active.

Active medications are normalized through RxNorm and checked against DDInter for potential drug-drug interactions.

What I Learned

My biggest takeaway was that medication extraction and medication safety are not the same problem. Context matters. A medication mentioned in a note does not necessarily mean the patient is currently taking it.

I also learned how important traceability is for a healthcare AI workflow. For every extracted medication, the system preserves an exact text span from the clinical note so the result can be traced back to its source.

For audio input, I found that speech recognition can misrecognize medication names. Using local Faster-Whisper and allowing the user to edit the transcript before analysis keeps that step under human review.

Challenges

One of the main challenges was handling external AI model availability. During development, the Gemini API intermittently returned 503 UNAVAILABLE or Resource Exhausted errors during periods of high demand. I tested multiple Gemini Flash models and kept audio transcription local so that the entire application would not depend on a single cloud model.

Another challenge was handling cases where medication status or interaction information was incomplete. Instead of assuming that an unclear medication is active or that a missing DDInter record means there is no interaction, the application places those cases into separate review categories.

Data Privacy

The sample clinical notes used in the current prototype are intended to be de-identified/demo clinical text, and the application was developed around that type of input rather than real patient records.

For a production deployment, the input source, data-handling architecture, access controls, and privacy safeguards would need to be evaluated against applicable healthcare privacy requirements, including HIPAA where applicable. The current prototype should not be treated as a HIPAA-compliant clinical system.

Built for the Hackathon

I built MedSafe Discharge as a working prototype connecting speech recognition, clinical NLP, medication normalization, and drug-interaction data into one review workflow.

The goal was to make medication safety review more structured and traceable while keeping the clinician in the loop.

What's Next

The next step for MedSafe Discharge would be moving from a hackathon prototype toward a more robust clinical workflow. Some of the areas I would explore next are:

  1. Add stronger clinical validation with curated test cases and feedback from healthcare professionals.

  2. Improve medication extraction with additional validation and better handling of medication names, dosages, and clinical context.

  3. Expand interaction coverage by integrating additional drug-interaction sources such as DrugBank alongside DDInter, providing broader interaction coverage and additional clinical information.

  4. Strengthen privacy and security by exploring a private, controlled deployment architecture where sensitive clinical data remains within the organization’s environment rather than being sent to public AI services. This could include de-identification before AI processing and potentially using privately hosted models or an internal MCP-based architecture to control access to clinical data and AI services.

  5. Connect to clinical data sources by developing the step before MedSafe Discharge: automatically identifying and removing Protected Health Information (PHI) from clinical documentation before the note enters the medication-safety workflow. This would allow real discharge documentation to be prepared for analysis while keeping sensitive identifiers out of the downstream system.

The goal would be to keep the clinician in the loop while making medication safety review more structured, traceable, and efficient.

Built With

Share this project:

Updates

Submission history