DEV Community

Cover image for MediScan : Your Medical Co-Pilot
Megh Deb
Megh Deb

Posted on AI-assisted

MediScan : Your Medical Co-Pilot

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission đź’¸

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle

What I Built

Every single year, millions of patients walk out of clinics and pathology laboratories holding crumpled pieces of paper that hold the key to their recovery, yet are completely indecipherable to them. Illegible medical penmanship, hurried physician notations, cryptic prescription abbreviations like OD, BD, TDS, AC, and HS, and dense diagnostic lab jargon—such as elevated transaminases, altered creatinine clearance, or fluctuating lipid fractions—frequently lead to severe medication administration errors, delayed clinical interventions, and profound patient anxiety. For elderly individuals, chronic patients managing polypharmacy, and anxious family caregivers, navigating physical prescriptions and laboratory slips is an agonizing ordeal that leaves them completely uninformed about what active chemical salt is entering their body, why a medicine was prescribed, how it interacts with food, whether their blood markers are within safe demographic boundaries for their age and gender, or what warning signs necessitate immediate medical attention.

To eliminate this diagnostic opacity once and for all, I built an executive-grade clinical intelligence platform named MediScan. MediScan transforms chaotic, illegible paper prescriptions and complex pathological laboratory reports into an empowering, highly legible, and structured digital healthcare companion that bridges the communication divide between doctors, pathologists, pharmacists, and everyday patients. Below is the dedicated breakdown of every core platform feature, detailing its specific healthcare requirement, functionality, and clinical advantages:

Prescription Handwriting OCR & Profile Extraction

  • Requirement: Physician handwriting is notoriously hurried and illegible, creating diagnostic ambiguities, patient misinterpretation, and a severe lack of structured digital records at the critical moment of discharge.
  • Description: MediScan utilizes frontier multimodal vision intelligence to process raw photos of handwritten or printed prescription slips, instantly isolating the prescribing physician's name, medical registration number, academic credentials, and clinic affiliation, alongside patient demographic details, physiological vitals (blood pressure, pulse rate, temperature, SpO2), and formal clinical diagnoses.
  • Advantages: Eliminates dangerous misreadings of medication names and clinical orders, creates an auditable electronic healthcare record, and ensures that all subsequent schedules are anchored to verified patient vitals.

Latin Shorthand Decoding into Daily Routine Timetables

  • Requirement: Cryptic Latin medical abbreviations such as OD, BD, TDS, QID, AC, PC, and HS routinely baffle patients, resulting in missed doses, improper food relationships, or accidental double-dosing that leads to hospitalization.
  • Description: This feature systematically translates obtuse medical shorthand into an intuitive, everyday Daily Medication Schedule cleanly separated into Morning (Breakfast), Afternoon (Lunch), and Night (Dinner/Bedtime) routines, detailing exact dose quantities and explicit food requirements (such as take 30 minutes before breakfast or take immediately after meals).
  • Advantages: Drastically reduces medication non-compliance, eliminates accidental overmedication, and allows elderly patients and non-medical caregivers to manage complex polypharmacy regimens with total autonomy and clarity.

Active Pharmacological Composition, Salt Strength & Patient Safety Rules

  • Requirement: Commercial brand names obscure the underlying active chemical molecules, making it easy for patients to unintentionally consume duplicate medications from different manufacturers, causing severe toxicity or missing critical contraindications.
  • Description: For every identified drug, MediScan cross-references clinical pharmacological knowledge to extract the authentic active chemical salts, exact salt strengths, primary therapeutic indications, and essential patient safety precautions (such as avoiding alcohol, not crushing delayed-release tablets, or drinking extra fluids).
  • Advantages: Prevents accidental drug overdoses and hazardous drug-drug interactions, demystifies why each medication is necessary, and promotes informed patient agency during medical therapy.

Geolocation-Aware Localized Pharmacy Availability & Live Pricing (SerpApi)

  • Requirement: Prescription drug pricing and retail availability are notoriously fragmented and non-transparent, forcing stressed patients or family members to visit multiple physical pharmacies during emergencies to find stock or overpay.
  • Description: Capturing browser geolocation coordinates with automated server-side reverse geocoding into canonical local cities and districts, MediScan queries SerpApi's Google Shopping engine in parallel across all detected medications to surface verified local online retailers, live stock availability, and genuine localized pricing in local currency with direct purchasing links.
  • Advantages: Delivers immediate financial transparency, eliminates unnecessary physical travel during acute illness, and establishes a seamless, frictionless bridge from clinical diagnosis to affordable medicine procurement.

Ordered Diagnostic Investigations & Preparation Guidelines

  • Requirement: Diagnostic tests ordered on prescriptions often lack preparation instructions, causing patients to arrive at diagnostic laboratories unprepared (such as failing to fast for blood glucose or lipid testing), leading to canceled appointments or inaccurate test results.
  • Description: The system automatically identifies all recommended blood tests, urine screenings, and radiological investigations from the prescription, explicitly outlining their clinical diagnostic purpose and mandatory pre-test preparation rules (including fasting durations and hydration guidelines).
  • Advantages: Eliminates wasted laboratory visits, guarantees test specimen accuracy, and accelerates the diagnostic timeline for ongoing patient monitoring.

Pathological Lab Report Layman Translation Engine

  • Requirement: Standard pathology laboratory sheets are filled with dense medical jargon and esoteric acronyms (such as SGOT, SGPT, Bilirubin Direct, Mean Corpuscular Volume) that provide no understandable context to everyday patients regarding what is actually occurring within their body.
  • Description: MediScan decodes complex medical test parameters into two accessible layman breakdowns: What This Test Actually Measures (explaining the underlying biological mechanism in simple words) and What This Portrays About Your Health (explaining whether the reading suggests normal organ function, cellular strain, systemic inflammation, or nutritional deficiency).
  • Advantages: Replaces medical anxiety with genuine comprehension, helps patients understand the functional health of their organs, and facilitates informed, confident dialogues between patients and doctors during follow-up visits.

Personalized Average Health Score Index (0–100) & Categorical Metric Tally

  • Requirement: Patients receiving multipage diagnostic lab slips often face dozens of discrete values and struggle to grasp their holistic health condition or determine which specific parameters require urgent medical intervention.
  • Description: The engine computes an intelligent, personalized Average Health Score (0 to 100) with intuitive clinical rating tiers (Optimal, Good, Needs Attention, Critical Attention), supported by a high-contrast metric counter tallying Total Parameters, Normal readings, Mild Deviations, and Priority Attention alerts.
  • Advantages: Provides an instant, understandable snapshot of overall health status, immediately highlights clinical priorities that warrant physician discussion, and motivates patients toward proactive lifestyle management.

Interactive Parameter Carousel Showcase

  • Requirement: Displaying dozens of dense pathology test cards on a single screen causes severe cognitive overload, visual exhaustion, and frustrating page scrolling for patients and caregivers.
  • Description: MediScan organizes all extracted parameters into an interactive, high-contrast, large-font Parameter Carousel. Patients navigate through tests one-by-one using Previous/Next action buttons, keyboard arrow shortcuts, a direct parameter selector dropdown, or compact numbered jump chips with color-coded status dots—with zero horizontal scrolling.
  • Advantages: Ensures optimal legibility for elderly users and visually impaired patients, provides dedicated focus on each test without clutter, and enables instant 1-click navigation to any parameter.

Demographic Reference Standards Comparison (Age & Gender Breakdown)

  • Requirement: Standard clinical reference ranges vary substantially based on biological sex (hormonal profiles, muscle mass) and age cohorts (pediatric, adult, geriatric), but physical lab slips frequently display only a single generalized adult standard.
  • Description: Every parameter is compared side-by-side against demographic benchmarks, featuring dedicated male vs. female standard ranges and comprehensive age bracket tables (e.g., children, adults, seniors), supplemented by regional reference standards notes.
  • Advantages: Empowers every reader to tally their personal findings against their exact age and sex cohort, preventing unwarranted panic over false alarms while ensuring genuine demographic deviations are promptly detected.

Evidence-Based Lifestyle Guidance & Physician Discussion Questions

  • Requirement: After receiving abnormal laboratory results, patients frequently feel abandoned between appointments, unsure of what daily nutritional habits to adopt or what specific questions to ask their physician.
  • Description: MediScan analyzes the aggregated pathological findings to synthesize actionable everyday dietary, hydration, and physical activity guidance, alongside targeted, high-yield questions tailored for the patient to bring directly to their doctor.
  • Advantages: Empowers patients with immediate, safe self-care habits, optimizes consultation efficiency during clinic visits, and deepens collaborative decision-making between patient and practitioner.

Executive Monochromatic Vector A4 PDF Export

  • Requirement: Mobile web interfaces are often inaccessible during physical doctor consultations or in hospital areas with limited network connectivity, while standard browser printouts suffer from broken page breaks and lack legal disclaimers.
  • Description: MediScan features an integrated document compiler utilizing jsPDF and jspdf-autotable that generates formal, hospital-grade monospace vector A4 PDF Clinical Transcripts for both prescriptions and pathology reports. Every cell border is explicitly drawn with grid lines, running headers/footers indicate confidentiality and page counts (PAGE X OF Y), and mandatory AI verification disclaimers are appended.
  • Advantages: Delivers an authoritative, archival-quality physical document that patients can print or share directly with their physician, fostering seamless clinical cross-verification while upholding legal safety standards.

Secure Credentials Authentication & Edge Route Defense (NextAuth & MongoDB Atlas)

  • Requirement: Personal medical prescriptions and pathological test reports constitute highly sensitive personal data that requires enterprise-grade access control and robust perimeter protection.
  • Description: Full user authentication is implemented with NextAuth.js backed by MongoDB Atlas, employing salted bcryptjs password encryption, real-time password visibility controls, and Edge middleware route defense that strictly enforces 24-hour authenticated JWT sessions across scanner views and analytical API routes.
  • Advantages: Safeguards patient confidentiality, prevents unauthorized data exposure, and provides a frictionless, reliable user authentication experience across all devices.

Demo

Experience the live application and test both prescription deciphering and pathology lab report analysis in real time:

Live Application Demo: https://mediscan-xi-seven.vercel.app

Code

The complete source code, architectural documentation, and environment configuration are available in the public repository:

Official GitHub Repository: https://github.com/Megh2005/dev-challange-2

How I Built It

The application is engineered from the ground up to adhere to strict production standards, prioritizing reliability, deterministic output, and exceptional user experience across all age demographics:

  • Next.js 14 App Router & TypeScript: Built on Next.js 14 with App Router, enforcing end-to-end type safety across all clinical data contracts. The interface is styled with solid-token Tailwind CSS featuring Roboto Slab typography on an intentional 80vw centered layout, eliminating distracting gradients, frivolous animations, and emojis in favor of a clean, high-contrast, accessible healthcare presentation.

  • Authentication & Secure Access (NextAuth & MongoDB Atlas): Full user authentication is implemented with NextAuth.js utilizing a credentials-based provider backed by MongoDB Atlas. Passwords are encrypted using salted bcryptjs hashing. Protected routes (including /scan, /reports, and analytical endpoints) are guarded via Next.js Edge middleware with 24-hour JWT session token verification, protocol-aware cookie handling, and registration flows with real-time password visibility toggling.

  • Multimodal AI Intelligence Layer: The clinical analysis pipelines utilize Google's frontier multimodal Gemini engines (@google/generative-ai). Files are ingested as native binary multipart form data directly into temporary disk streams via GoogleAIFileManager rather than degrading performance with base64 payloads. The models operate under strict JSON schema constraints, executing simultaneous handwriting deciphering, optical character recognition, abbreviation normalization, pathological metric extraction, and layman medical translation without relying on fragile local lookup tables.

  • Parameter Carousel & Demographic Standards Engine: Rather than overwhelming patients with dense grids of medical parameters, the pathology analyzer renders parameters in a focused, high-contrast Carousel Showcase. Users navigate with Previous/Next controls, keyboard arrow shortcuts, a direct parameter selector dropdown, or compact numbered jump chips with status indicator dots. Every parameter details what the test measures, what it portrays about the user's health, and explicit demographic comparisons (male vs. female standards and age bracket tables).

  • Localized Online Pharmacy Pricing (SerpApi): To address medication availability and price transparency, the platform integrates SerpApi's Google Shopping Engine. Browser geolocation coordinates are reverse-geocoded on the server into canonical local city and country parameters. The backend queries SerpApi in parallel across all identified medications, extracting verified local online retailers, product titles, delivery details, and authentic localized pricing in rupees or local currency, rendering direct purchasing links for immediate patient convenience.

  • Full-Stack Observability & Tracing (Sentry): System reliability, AI pipeline tracking, and exception telemetry are monitored with @sentry/nextjs. Dedicated Sentry instrumentation across client, server, and edge runtimes traces API response latencies, catches OCR parsing anomalies, and monitors AI agent lifecycles through comprehensive distributed spans and error boundaries.

  • Cloud Data Persistence (MongoDB Atlas): MongoDB Atlas serves as the primary document store, securely managing user accounts, authentication credentials, patient consultation histories, and clinical transcripts with enterprise-grade encryption at rest and in transit.

  • Monochromatic Vector A4 PDF Export: Client-side document generation is powered by jsPDF and jspdf-autotable, which compile both prescription decipher transcripts and pathology lab analyses into strictly monospace, monochromatic vector A4 PDFs. Every cell border is explicitly drawn with grid lines, text overflows are eliminated through dynamic line-wrapping calculations, and running page borders, page counts, and comprehensive AI verification disclaimers are automatically appended.

Why Does Open Innovation Matter?

Healthcare is fundamentally human, and open innovation is the only mechanism that prevents critical clinical technologies from becoming guarded, walled-garden monopolies accessible only to elite institutions. When intelligent diagnostic and transcription tools are built openly, developers across the globe can inspect the reasoning pipelines, identify biases, verify clinical safety constraints, and adapt tools for rural clinics, underserved languages, and overburdened public health systems. Open-weight innovation and transparent API architectures democratize medical comprehension, turning what was once an impenetrable scribble on a physician's pad or an intimidating laboratory sheet into accessible, actionable, life-saving knowledge for every patient regardless of socioeconomic background.

Prize Categories

This project is entered into the following partner prize categories:

  • Best Use of Sentry Agent Tracing

    • Implements end-to-end full-stack observability with @sentry/nextjs across client components, API routes, and edge runtimes, tracking multimodal OCR pipeline durations, monitoring external API latencies, and providing robust exception capture across all prescription deciphering and pathology analysis operations.
  • Best Use of SerpApi

    • Leverages SerpApi's Google Shopping API with automatic latitude and longitude coordinate resolution to fetch localized online pharmacy pricing, retailer availability, and direct purchasing links for every deciphered medication.
  • Best Use of MongoDB Atlas

    • Utilizes MongoDB Atlas as the foundational cloud document database for persisting user authentication credentials with salted bcrypt encryption, managing user accounts, and storing clinical consultation records, transcribed prescription histories, and routine timetables with high availability and scalability.

Top comments (0)