Skip to content

candpixie/MedShare-NexHacks

Repository files navigation

MedShare

Turn Hospital Pharmacy Waste Into Savings

AI-powered pharmacy analytics that transforms spreadsheets into actionable intelligence — helping hospitals save thousands monthly on expired medications.

Built at NexHacks 2026


The Problem

Hospital pharmacies are hemorrhaging money on expired medications.

  • $2.8 billion — wasted annually on expired medications in US hospitals
  • 20-50% — of prepared anesthesia drugs discarded unused
  • 72% — of all drug returns are expired inventory
  • 4x increase — in drug shortages over the past 5 years

The root cause?

Pharmacy directors manage millions in inventory using spreadsheets and gut instinct.

  • No visibility into what's expiring until it's too late
  • No demand forecasting — just over-ordering "to be safe"
  • No FIFO compliance tracking — newer lots get used first, older lots expire
  • No analytics layer between inventory systems and decisions

"I manage 2,000+ medications in Excel. I don't know what's expiring until it's too late." — Hospital Pharmacist


The Solution

MedShare transforms pharmacy spreadsheets into actionable intelligence.

Upload CSV → See What's At Risk → Get AI Recommendations → Save Money

  1. Upload your existing inventory export (CSV/Excel) — takes 5 seconds
  2. Instantly see expiring medications ranked by dollars at risk
  3. AI analyzes your usage patterns and forecasts 30-day demand
  4. Get specific recommendations: "Reduce Propofol order by 15%"

One hospital. One upload. $4,200/month saved.


Key Features

Dashboard & Analytics

  • Real-time inventory overview with 4 key stat cards
  • Usage trend charts with 8-week historical data
  • Department breakdown showing medication usage by OR, ICU, ER
  • AI-powered insights with specific recommendations
  • 30-day demand forecasting with confidence intervals

Expiration Alerts

  • Smart prioritization by urgency (High/Medium/Low)
  • Dollar impact calculation showing value at risk
  • FIFO violation detection preventing waste
  • CSV export for pharmacy directors and compliance
  • Real-time notifications panel with alert counts

Voice Alerts (Accessibility)

  • Dynamic voice announcements using Web Speech API
  • Live transcript display with word-by-word animation
  • Medicine-specific alerts with quantities and expiration dates
  • Customizable messages based on actual inventory data

AI Drug Scanner ✨ NEW!

  • 🤖 Gemini AI Vision — 90%+ accuracy drug label recognition
  • Real-time webcam feed with LiveKit streaming
  • Smart multi-layer recognition:
    1. Gemini Vision (most accurate)
    2. Gemini Text + OCR (fallback)
    3. OpenFDA API validation
  • Automatic extraction: Drug names, NDC codes, lot numbers, expiry dates
  • Confidence scoring and error handling
  • Voice alerts for urgent medications
  • See docs/GEMINI_AI_INTEGRATION.md for full details

Multi-Hospital Support

  • Hospital selector with 3 demo locations:
    • Metro General Hospital (Urban, Downtown)
    • St. Mary's Medical Center (Suburban, 12 miles)
    • County Medical Center (Rural, 25 miles)
  • Distance-based matching for hospital transfers
  • Location tracking and facility management

Reports & Exports

  • 5 report types: Inventory, Expiration, FIFO, Forecast, Insights
  • PDF generation with professional formatting
  • CSV exports for expiration alerts
  • Download tracking and report history

Support Chatbot

  • Interactive help with common questions
  • Feature guidance for onboarding
  • Contextual assistance based on current view
  • Beautiful chat UI with animations

Modern UI/UX

  • Glassmorphism design with aurora gradients
  • Dark mode support with proper contrast
  • Responsive layout for desktop and tablet
  • Smooth animations using Framer Motion
  • Professional color palette appropriate for healthcare

Architecture

┌─────────────────┐     ┌─────────────────┐
│   Frontend      │────▶│    Backend      │
│   React + Vite  │     │  Express + TS   │
│   Port: 5173    │     │  Port: 3001     │
└─────────────────┘     └─────────────────┘
        │                        │
        │                        │
    ┌───▼────────────────────────▼───┐
    │     Features & Integrations    │
    │  • Web Speech API (Voice)      │
    │  • CSV Parsing (PapaParse)     │
    │  • PDF Generation (PDFKit)     │
    │  • AI Ready (Gemini/Vision)    │
    └────────────────────────────────┘

Tech Stack

Frontend

Technology Purpose
React 18 UI framework
TypeScript Type safety
Vite Build tool & dev server
Tailwind CSS Utility-first styling
Framer Motion Animations
Recharts Data visualization
shadcn/ui Component library
Lucide React Icon system
Sonner Toast notifications

Backend

Technology Purpose
Node.js Runtime
Express Web framework
TypeScript Type safety
PDFKit PDF generation
CORS Cross-origin support
tsx TS execution & watch mode

AI & ML

Technology Purpose
Google Gemini Pro Vision Advanced drug label recognition (90%+ accuracy)
Tesseract.js OCR text extraction (fallback)
OpenFDA API Drug data validation & enrichment
LiveKit Real-time video streaming & data channels
Web Speech API Voice alerts for critical notifications

NEW! 🚀 Gemini AI Integration

  • Vision-based drug label analysis
  • Context-aware pharmaceutical recognition
  • Smart fallback to OCR + FDA validation
  • See docs/GEMINI_AI_INTEGRATION.md for details

Installation & Setup

Prerequisites

  • Node.js 18+ and npm
  • Git

Quick Start

# Clone the repository
git clone https://github.com/candpixie/MedShare-NexHacks.git
cd MedShare-NexHacks-1

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

Running the Application

Terminal 1 — Backend:

cd backend
npm run dev

Backend runs on http://localhost:3001

Terminal 2 — Frontend:

cd frontend
npm run dev

Frontend runs on http://localhost:5173

Open your browser: http://localhost:5173


Project Structure

MedShare-NexHacks-1/
├── frontend/
│   ├── src/
│   │   ├── app/
│   │   │   ├── App.tsx                    # Main application
│   │   │   └── components/
│   │   │       ├── Header.tsx             # Top navigation
│   │   │       ├── StatCard.tsx           # Dashboard metrics
│   │   │       ├── AlertCard.tsx          # Expiration alerts
│   │   │       ├── VoiceAlert.tsx         # Voice announcement
│   │   │       ├── SupportChatbot.tsx     # Support assistant
│   │   │       ├── InventoryView.tsx      # Full inventory list
│   │   │       ├── ReportsView.tsx        # PDF reports
│   │   │       ├── SettingsView.tsx       # User & hospital settings
│   │   │       ├── MatchCard.tsx          # Hospital matching
│   │   │       ├── NetworkRequest.tsx     # Transfer requests
│   │   │       ├── TransferModal.tsx      # Transfer UI
│   │   │       └── ui/                    # shadcn components
│   │   └── styles/
│   │       ├── index.css
│   │       ├── theme.css                  # Design tokens
│   │       └── tailwind.css
│   ├── public/
│   │   ├── medshare-logo.svg
│   │   └── favicon.svg
│   └── package.json
│
├── backend/
│   ├── src/
│   │   ├── server.ts                      # Express server
│   │   ├── routes/
│   │   │   ├── inventory.ts               # Inventory endpoints
│   │   │   ├── reports.ts                 # PDF report generation
│   │   │   └── settings.ts                # User/hospital settings
│   │   ├── data/
│   │   │   └── mockData.ts                # Demo inventory data
│   │   └── types/
│   │       └── index.ts                   # TypeScript types
│   └── package.json
│
├── README.md
├── docs/QUICKSTART.md
└── .gitignore

API Endpoints

Inventory Management

Endpoint Method Description
/api/inventory GET Get all medications with alerts
/api/inventory/:id GET Get single medication details
/api/inventory/stats/summary GET Get dashboard statistics

Reports & Downloads

Endpoint Method Description
/api/reports GET List available reports
/api/reports/download/:type GET Download PDF report

Report Types: inventory, expiration, fifo, forecast, insights

Settings

Endpoint Method Description
/api/settings/profile GET Get user profile
/api/settings/profile PUT Update user profile
/api/settings/hospital GET Get hospital information

Demo Data

3 Medications Included

  1. Propofol 200mg/20mL

    • Stock: 70 vials
    • 2 lots (expiring Feb 7 & Mar 15, 2026)
    • Unit cost: $60-62
    • Alerts: Expiring soon
  2. Atropine 0.4mg/mL

    • Stock: 30 vials
    • 1 lot (expiring Jan 31, 2026)
    • Unit cost: $20
    • Alerts: Expiring soon, FIFO risk
  3. Succinylcholine 20mg/mL

    • Stock: 40 vials
    • 1 lot (expiring Feb 21, 2026)
    • Unit cost: $30
    • Alerts: Expiring soon

Hospital Network

  • Metro General Hospital (Your hospital) — Urban, Downtown
  • St. Mary's Medical Center — 12 miles, Bronx area
  • County Medical Center — 25 miles, Suffern, NY

Key Workflows

1. Upload & Analyze Inventory

1. Click "Upload Data" in header
2. Select CSV file with columns:
   - ndc_code, drug_name, form_type, quantity
   - lot_number, expiration_date, unit_cost
   - par_level, daily_usage
3. App parses and displays medications
4. Dashboard updates with new data

2. Review Expiration Alerts

1. Dashboard shows alerts ranked by urgency
2. Each card displays:
   - Drug name & expiry days
   - Stock/Need/Excess quantities
   - Dollar value at risk
3. Click "Export CSV" to download
4. Click "Mark Reviewed" to acknowledge

3. Generate Reports

1. Navigate to Reports tab
2. Choose from 5 report types
3. Click "Download PDF"
4. Professional PDF opens/downloads

4. Switch Hospitals

1. Click hospital selector in header
2. Modal shows 3 hospitals with:
   - Type (Urban/Suburban/Rural)
   - Distance from your location
   - City/area
3. Select to switch context

5. Scan Drug Labels

1. Click "Scan Drug Label" in Quick Actions
2. Modal opens with webcam interface
3. Click "Start Camera" (demo mode)
4. Position drug label in frame
5. AI detects: Name, NDC, Lot, Expiry
6. Data added to inventory

Design System

Color Palette

/* Light Mode */
--navy-ink: #0F172A;        /* Primary text */
--med-blue: #0284C7;        /* Primary actions */
--aurora-cyan: #06B6D4;     /* Accents */
--aurora-violet: #7C3AED;   /* Special features */
--soft-ice: #F8FAFC;        /* Background */
--success-mint: #059669;    /* Positive states */
--warning-amber: #D97706;   /* Warnings */
--danger-rose: #E11D48;     /* Errors */

/* Dark Mode */
--text-primary: #F1F5F9;    /* High contrast text */
--text-muted: #94A3B8;      /* Secondary text */
--med-blue: #0EA5E9;        /* Brighter blue */

Typography

  • Headings: System font stack with semibold weight
  • Body: Base 16px, line-height 1.5
  • Code/Numbers: Tabular nums for alignment

Deployment

Option 1: Vercel (Frontend + Backend)

# Install Vercel CLI
npm i -g vercel

# Deploy from root
vercel

# Set environment variables in Vercel dashboard

Option 2: Separate Hosting

Frontend: Vercel, Netlify, or Cloudflare Pages
Backend: Railway, Render, or Fly.io


What's Next

Near-term (30 days)

  • Gemini AI Vision integration ✅ (90%+ accuracy drug scanning!)
  • LiveKit webcam streaming ✅ (Real-time video with data channels)
  • Real OCR + OpenFDA validation ✅ (Multi-layer recognition)
  • ElevenLabs voice synthesis (currently using Web Speech API)
  • User authentication system
  • MongoDB Atlas integration

Medium-term (90 days)

  • Hospital-to-hospital transfer workflow
  • Multi-facility dashboards
  • Automated reorder suggestions
  • Mobile app (React Native)

Long-term (12 months)

  • EHR integrations (Epic, Cerner)
  • Predictive shortage alerts
  • GPO contract optimization
  • National hospital network

Built With

React TypeScript Tailwind Express Node

Core Technologies:

  • react • typescript • vite • tailwind • framer-motion
  • express • node.js • pdfkit • tsx
  • recharts • shadcn/ui • lucide-react • sonner

AI/ML Ready:

  • gemini-api • elevenlabs • computer-vision • ocr

Team

Built at NexHacks 2026


License

All Rights Reserved - Built for educational purposes at NexHacks 2026.


Acknowledgments

  • ASHP Guidelines on Drug Shortages
  • Published research on anesthesia drug waste
  • NexHacks 2026 organizers and sponsors
  • Hospital pharmacists who shared their challenges

Support

Questions or feedback? Open an issue or contact the team.

Every expired vial is money wasted. MedShare turns spreadsheets into savings.

© 2026 MedShare Team. All rights reserved.


🤖 AI/ML Integration

For detailed information about our Wood Wide AI integration, including:

  • AutoML model training and deployment
  • Demand prediction and forecasting
  • Drug clustering algorithms
  • Anomaly detection systems
  • API integration guide and best practices

👉 See our complete guide: backend/wood_wide_models/README.md


Star this repo if you found it helpful!

About

pharmacy analytics for medications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors