Skip to main content

Welcome to MedMitra

MedMitra is an AI-powered medical case management system that helps healthcare professionals analyze patient data, process medical documents, and generate comprehensive clinical insights. This quickstart guide will get you from zero to your first working case in minutes.

What You’ll Build

By the end of this guide, you’ll have:
  • A running MedMitra backend and frontend
  • A configured Supabase database
  • Your first medical case with AI-powered analysis

Prerequisites

Before you begin, ensure you have:

Node.js

Version 18.x or 20.x LTS

Python

Version 3.9 or higher

Supabase Account

Free account at supabase.com

API Keys

Groq, LlamaParse, and Gladia

Quick Setup

1

Clone the Repository

Get the MedMitra source code:
git clone https://github.com/yourusername/medmitra.git
cd medmitra
2

Set Up the Backend

Navigate to the backend directory and install dependencies:
cd backend
python3 -m venv venv
source venv/bin/activate  # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
Create a .env file in the backend/ directory:
backend/.env
SUPABASE_URL="your_supabase_project_url"
SUPABASE_SERVICE_ROLE_KEY="your_supabase_service_role_key"
GROQ_API_KEY="your_groq_api_key"
LLAMAPARSE_API_KEY="your_llamaparse_api_key"
Get your Supabase URL and keys from Project Settings → API in your Supabase dashboard.
3

Set Up the Frontend

In a new terminal, navigate to the frontend directory:
cd frontend
npm install
Create a .env.local file in the frontend/ directory:
frontend/.env.local
NEXT_PUBLIC_SUPABASE_URL="your_supabase_project_url"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your_supabase_anon_key"
NEXT_PUBLIC_FASTAPI_BACKEND_URL="http://localhost:8000"
NEXT_PUBLIC_GLADIA_API_KEY="your_gladia_api_key"
4

Configure Supabase Database

Create the following tables in your Supabase project:Cases Table:
CREATE TABLE cases (
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  user_id UUID NOT NULL,
  patient_name TEXT NOT NULL,
  patient_age INTEGER NOT NULL,
  patient_gender TEXT NOT NULL,
  case_summary TEXT,
  status TEXT DEFAULT 'pending',
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
Case Files Table:
CREATE TABLE case_files (
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  case_id UUID REFERENCES cases(id) ON DELETE CASCADE,
  file_name TEXT NOT NULL,
  file_type TEXT NOT NULL,
  file_url TEXT NOT NULL,
  file_category TEXT NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
AI Insights Table:
CREATE TABLE ai_insights (
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  case_id UUID REFERENCES cases(id) ON DELETE CASCADE,
  case_summary JSONB,
  soap_note JSONB,
  primary_diagnosis JSONB,
  confidence_score FLOAT,
  status TEXT DEFAULT 'pending',
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
You can run these queries in the SQL Editor in your Supabase dashboard.
5

Start the Servers

Backend: In the backend directory with the virtual environment activated:
uvicorn app:app --host 0.0.0.0 --port 8000 --reload
The backend API will be available at http://localhost:8000Frontend: In a new terminal, from the frontend directory:
npm run dev
The frontend will be available at http://localhost:3000
6

Create Your First Case

  1. Open your browser and navigate to http://localhost:3000
  2. Sign up or log in using the Supabase authentication
  3. Click “New Case” to create your first patient case
  4. Fill in patient information:
    • Patient Name
    • Age
    • Gender
    • Initial case notes
  5. Upload medical documents:
    • Lab reports (PDF format)
    • Radiology images (JPG, PNG)
  6. Click “Create Case” and watch the AI analyze the documents

Verify Your Setup

Once both servers are running, verify your setup:
Visit http://localhost:8000 in your browser. You should see:
{
  "message": "MedMitra Backend API is running!"
}
FastAPI provides automatic interactive documentation:
  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc
Visit http://localhost:3000. You should see the MedMitra login page with:
  • Supabase authentication form
  • Modern, responsive UI
  • Dark/light mode toggle

What Happens During AI Analysis?

When you create a case with documents, MedMitra’s AI workflow:
  1. Parses PDF Lab Reports using LlamaParse to extract structured data
  2. Analyzes Radiology Images using Groq’s Vision AI (LLaVA model)
  3. Generates Case Summary by synthesizing all medical information
  4. Creates SOAP Note with Subjective, Objective, Assessment, and Plan sections
  5. Suggests Primary Diagnosis with ICD-10 codes and confidence scores
The AI analysis typically takes 30-60 seconds depending on the number and size of documents uploaded.

Next Steps

Full Installation Guide

Detailed setup instructions for production environments

Configuration Reference

Complete guide to all environment variables and settings

API Reference

Explore all available API endpoints

AI Workflow

Learn about MedMitra’s AI-powered workflow

Troubleshooting

  • Verify Python version: python3 --version (should be 3.9+)
  • Check if port 8000 is available: lsof -i :8000
  • Ensure all environment variables are set in .env
  • Verify virtual environment is activated
  • Verify Node.js version: node --version (should be 18.x or 20.x)
  • Clear node_modules and reinstall: rm -rf node_modules package-lock.json && npm install
  • Check if .env.local file exists and has correct values
  • Verify Supabase URL format: https://your-project.supabase.co
  • Check that API keys are copied correctly (no extra spaces)
  • Ensure database tables are created with the exact schema
  • Verify RLS (Row Level Security) policies if authentication fails
  • Verify Groq API key is valid and has available credits
  • Check LlamaParse API key is active
  • Review backend logs for error messages: check terminal output
  • Ensure uploaded files are in supported formats (PDF for labs, JPG/PNG for radiology)

Getting Help

If you encounter issues:
  • Check the Installation Guide for detailed setup steps
  • Review Configuration for environment variable reference
  • Visit the GitHub repository for issue tracking and discussions
  • Check API logs in the terminal for detailed error messages

Build docs developers (and LLMs) love