Skip to content

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


MedHive AI

πŸ₯ MedHive AI β€” Multi-Agent Healthcare Copilot

An intelligent, agentic AI healthcare assistant powered by AG2, Groq (LLaMA 3.3 70B), FastAPI, and Next.js.
Analyze symptoms Β· Decode lab reports Β· Check drug interactions Β· Get voice-guided health insights β€” all in real time.


FastAPI Next.js Groq AG2 ChromaDB License Python



πŸ“Έ Screenshots

🏠 Dashboard πŸ’¬ AI Chat Assistant
Dashboard Chat
🩺 AI Chat with Assessment Output πŸŽ™οΈ Voice Health Assistant β€” Idle
Chat Demo Voice 1
πŸŽ™οΈ Voice Assistant β€” AI Response πŸ§ͺ Lab Reports β€” Overview
Voice 2 Lab Reports
🧬 Lab Report β€” Biomarker Detail πŸ“Š Lab Report β€” AI Analysis
Lab Detail Lab Analysis
πŸ—“οΈ Health Timeline πŸ’Š Medication Check
Timeline Medications

✨ What is MedHive AI?

MedHive AI is a full-stack, production-grade AI healthcare copilot that combines a multi-agent orchestration framework with retrieval-augmented generation (RAG), real-time voice interaction, and a premium Next.js 15 frontend to deliver a seamless personal health management experience.

Unlike single-model chatbots, MedHive coordinates 10 specialized AI agents β€” each expert in a different medical domain β€” through a Healthcare Coordinator that routes queries, aggregates results, and returns structured, verified health assessments.

⚠️ Disclaimer: MedHive AI is for educational and informational purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare provider.


πŸš€ Key Features

Feature Description
🧠 Multi-Agent AI 10 specialized agents coordinated by AG2 β€” each an expert in their domain
🩺 Symptom Analysis Triage, risk scoring, and condition matching with confidence indicators
🚨 Emergency Detection Automatic escalation for critical symptoms with immediate action guidance
🧬 Lab Report AI Upload PDF/image lab reports and get plain-language biomarker explanations
πŸ’Š Drug Interaction Check Identifies dangerous medication combinations from your health profile
πŸ” Verified Medical Search Real-time web search grounded in trusted medical sources
πŸ“š RAG Knowledge Base ChromaDB vector store with curated medical literature
πŸŽ™οΈ Voice Health Assistant Whisper STT + Groq TTS β€” speak your symptoms, hear your analysis
πŸ‘€ Patient Memory SQLite-backed patient profiles with full health history
πŸ“Š Health Timeline Visual longitudinal tracking of symptoms, vitals, and reports
πŸ“± Responsive UI Premium Next.js 15 interface with Framer Motion animations
πŸ”’ Privacy First All data stays local β€” no cloud storage without explicit consent

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Next.js 15 Frontend                     β”‚
β”‚  Dashboard Β· Chat Β· Voice Β· Lab Reports Β· Medications Β·     β”‚
β”‚  Health Timeline Β· Patients Β· Settings                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚ HTTP / REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   FastAPI Backend (Python)                  β”‚
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  /analyze   β”‚  β”‚/analyze-reportβ”‚  β”‚/voice/voice-assistβ”‚  β”‚
β”‚  β”‚  (Chat AI)  β”‚  β”‚  (Lab PDF)    β”‚  β”‚   (Whisper+TTS)   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚         β”‚                β”‚                     β”‚            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚            Healthcare Coordinator (AG2)               β”‚  β”‚
β”‚  β”‚   Routes Β· Orchestrates Β· Aggregates Β· Verifies       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                              β”‚                              β”‚
β”‚                              β–Ό                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                      Agent Pool                       β”‚  β”‚
β”‚  β”‚  🧠 Medical      🚨 Emergency    πŸ“Š Risk Assessment  β”‚  β”‚
β”‚  β”‚  πŸ” Web Search   πŸ’Š Drug Inter.  🧬 Lab Report       β”‚  β”‚
β”‚  β”‚  βœ… Verification πŸ“ Summary      πŸ’ͺ Coach 🩺Symptom β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                              β”‚                              β”‚
β”‚                              β–Ό                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                Services & Storage                     β”‚  β”‚
β”‚  β”‚  ChromaDB (RAG) Β· SQLite (Patients) Β· Groq API        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ€– Agent Roster

Agent Role
MedicalAgent Primary symptom triage and medical knowledge base queries
EmergencyAgent Detects life-threatening conditions, triggers emergency protocol
RiskAgent Calculates composite risk scores (Low / Medium / High / Critical)
SymptomAgent Extracts, classifies, and tracks symptom patterns
WebSearchAgent Fetches real-time data from trusted medical sources (Mayo Clinic, NIH, etc.)
LabReportAgent Parses and explains lab report biomarkers in plain language
DrugInteractionAgent Analyzes medication combinations for dangerous interactions
VerificationAgent Cross-validates AI output against evidence sources
SummaryAgent Synthesizes multi-agent findings into a structured health assessment
CoachAgent Provides actionable wellness recommendations and lifestyle guidance

πŸ› οΈ Tech Stack

Backend

Technology Purpose
FastAPI High-performance async REST API
AG2 (AutoGen v2) Multi-agent orchestration framework
Groq API Ultra-fast LLaMA 3.3 70B inference
ChromaDB Vector database for RAG
Whisper Speech-to-text transcription
SQLite + SQLAlchemy Patient data persistence
LangChain Document loading and text splitting
Uvicorn ASGI server

Frontend

Technology Purpose
Next.js 15 React framework with App Router
TypeScript Type-safe development
Tailwind CSS v4 Utility-first styling
Framer Motion Fluid animations and transitions
Material Symbols Google's icon system
Inter Premium typography

πŸ“ Project Structure

medhive-ai/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ agents/                  # 10 specialized AI agents
β”‚   β”‚   β”œβ”€β”€ medical_agent.py
β”‚   β”‚   β”œβ”€β”€ emergency_agent.py
β”‚   β”‚   β”œβ”€β”€ risk_agent.py
β”‚   β”‚   β”œβ”€β”€ symptom_agent.py
β”‚   β”‚   β”œβ”€β”€ web_search_agent.py
β”‚   β”‚   β”œβ”€β”€ lab_report_agent.py
β”‚   β”‚   β”œβ”€β”€ drug_interaction_agent.py
β”‚   β”‚   β”œβ”€β”€ verification_agent.py
β”‚   β”‚   β”œβ”€β”€ summary_agent.py
β”‚   β”‚   └── coach_agent.py
β”‚   β”œβ”€β”€ workflows/
β”‚   β”‚   └── healthcare_coordinator.py   # Agent orchestration
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ routes.py                   # /analyze endpoint
β”‚   β”‚   β”œβ”€β”€ report_routes.py            # /analyze-report
β”‚   β”‚   └── patient_routes.py           # /patients CRUD
β”‚   β”œβ”€β”€ voice/
β”‚   β”‚   β”œβ”€β”€ voice_routes.py             # /voice/voice-assistant
β”‚   β”‚   β”œβ”€β”€ stt.py                      # Whisper STT
β”‚   β”‚   β”œβ”€β”€ tts.py                      # Text-to-Speech
β”‚   β”‚   └── whisperflow_service.py
β”‚   β”œβ”€β”€ rag/
β”‚   β”‚   β”œβ”€β”€ ingestion.py                # Document ingestion
β”‚   β”‚   └── retriever.py                # Vector search
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ lab_report_service.py
β”‚   β”‚   └── report_parser.py
β”‚   β”œβ”€β”€ models/                         # SQLAlchemy ORM models
β”‚   β”œβ”€β”€ schemas/                        # Pydantic request/response schemas
β”‚   β”œβ”€β”€ repositories/                   # Database access layer
β”‚   β”œβ”€β”€ config/settings.py              # App configuration
β”‚   β”œβ”€β”€ db/init_db.py                   # Database initialization
β”‚   β”œβ”€β”€ data/medical_docs/              # Medical knowledge base
β”‚   β”œβ”€β”€ chroma_db/                      # ChromaDB vector store
β”‚   β”œβ”€β”€ outputs/                        # Generated TTS audio files
β”‚   β”œβ”€β”€ uploads/                        # Uploaded lab reports
β”‚   β”œβ”€β”€ main.py                         # FastAPI app entry point
β”‚   └── .env.example
β”‚
β”œβ”€β”€ frontend/
β”‚   └── src/
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ dashboard/              # Health dashboard
β”‚       β”‚   β”œβ”€β”€ chat/                   # AI chat interface
β”‚       β”‚   β”œβ”€β”€ voice/                  # Voice assistant
β”‚       β”‚   β”œβ”€β”€ lab-reports/            # Lab report analyzer
β”‚       β”‚   β”œβ”€β”€ medications/            # Drug interaction checker
β”‚       β”‚   β”œβ”€β”€ health-timeline/        # Health history
β”‚       β”‚   β”œβ”€β”€ patients/               # Patient management
β”‚       β”‚   └── settings/               # App settings
β”‚       └── components/
β”‚           β”œβ”€β”€ Sidebar.tsx             # Navigation sidebar
β”‚           └── ui/                     # Reusable UI components
β”‚
β”œβ”€β”€ img/                                # Screenshots
└── README.md

⚑ Quick Start

Prerequisites

1. Clone the Repository

git clone https://github.com/Dakshin10/medhive-ai.git
cd medhive-ai

2. Backend Setup

cd backend

# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\activate          # Windows
# source .venv/bin/activate     # macOS/Linux

# Install dependencies
pip install -r requirements.txt

# Configure environment
copy .env.example .env          # Windows
# cp .env.example .env          # macOS/Linux

# Edit .env and add your Groq API key
# GROQ_API_KEY=your_key_here
# MODEL_NAME=llama-3.3-70b-versatile

# Initialize the database
python -c "from db.init_db import init_db; init_db()"

# Start the backend server
uvicorn main:app --reload

The API will be running at http://localhost:8000 Interactive API docs: http://localhost:8000/docs

3. Frontend Setup

cd frontend

# Install dependencies
npm install

# Start the development server
npm run dev

The frontend will be running at http://localhost:3000


πŸ”‘ Environment Variables

Create backend/.env from the example:

# Required
GROQ_API_KEY=your_groq_api_key_here

# Model Selection (default: llama-3.3-70b-versatile)
MODEL_NAME=llama-3.3-70b-versatile

Get your free Groq API key at console.groq.com β€” inference is blazing fast (700+ tokens/sec) and free to start.


🌐 API Endpoints

Method Endpoint Description
POST /analyze Main health query β€” routes through all agents
POST /analyze-report Upload & analyze lab report PDF
POST /voice/voice-assistant Voice query: audio in β†’ transcript + AI response + audio out
GET /patients List all patients
POST /patients Create patient profile
GET /patients/{id} Get patient details
PUT /patients/{id} Update patient record
DELETE /patients/{id} Delete patient
GET /health API health check
GET /docs Interactive Swagger UI

πŸ§ͺ Sample API Usage

Symptom Analysis

curl -X POST http://localhost:8000/analyze \
  -H "Content-Type: application/json" \
  -d '{"message": "I have been having chest tightness, shortness of breath, and fatigue for 3 days"}'

Response:

{
  "status": "SUCCESS",
  "assessment": {
    "symptoms": ["chest tightness", "shortness of breath", "fatigue"],
    "risk_level": "HIGH",
    "possible_conditions": ["Cardiac event", "Pulmonary embolism", "Severe anemia"],
    "recommendations": ["Seek immediate medical attention", "Avoid strenuous activity"],
    "confidence_score": 87,
    "evidence_sources": ["https://www.mayoclinic.org/..."]
  }
}

Lab Report Upload

curl -X POST http://localhost:8000/analyze-report \
  -F "file=@CBC_report.pdf"

πŸŽ™οΈ Voice Assistant Flow

User speaks β†’ Whisper STT β†’ Text transcript
     ↓
Healthcare Coordinator (10 agents)
     ↓
Structured JSON assessment
     ↓
Groq TTS β†’ Audio response file
     ↓
Frontend plays audio + displays rich assessment card

πŸ₯ Supported Medical Domains

  • Cardiology β€” Heart rate, blood pressure, cardiac symptoms
  • Endocrinology β€” Diabetes (HbA1c, glucose), thyroid function
  • Hematology β€” CBC, hemoglobin, platelets, anemia indicators
  • Lipidology β€” LDL, HDL, triglycerides, cardiovascular risk
  • Hepatology β€” Liver enzymes (ALT, AST), metabolic panel
  • Nephrology β€” Kidney function (creatinine, BUN, GFR)
  • Pulmonology β€” Respiratory symptoms, oxygen saturation
  • Pharmacology β€” Drug-drug interactions, supplement safety
  • Emergency Medicine β€” Triage and critical condition detection
  • Preventive Medicine β€” Wellness coaching and lifestyle optimization

πŸ”’ Privacy & Security

  • βœ… All data processed locally β€” nothing sent to external servers except LLM inference
  • βœ… No patient data stored in the cloud
  • βœ… .env secrets are never committed to version control
  • βœ… CORS configured for local development
  • βœ… SQLite database stays on your machine
  • ⚠️ For production use, add authentication, HTTPS, and proper secrets management

πŸ›£οΈ Roadmap

  • πŸ” User authentication (JWT / OAuth2)
  • 🌍 Multi-language support (Hindi, Spanish, French)
  • πŸ“± React Native mobile app
  • 🩺 FHIR / HL7 integration for EHR import
  • πŸ“ˆ Advanced analytics dashboard with charts
  • πŸ”” Push notification for medication reminders
  • 🀝 Doctor-patient secure messaging
  • 🧬 Genomics data integration
  • ☁️ Optional cloud sync with end-to-end encryption

🀝 Contributing

Contributions are welcome! Here's how to get started:

# Fork the repo and clone it
git clone https://github.com/your-username/medhive-ai.git

# Create a feature branch
git checkout -b feature/your-amazing-feature

# Make your changes, then commit
git commit -m "feat: add amazing feature"

# Push and open a Pull Request
git push origin feature/your-amazing-feature

Please follow Conventional Commits and ensure all new agents include proper error handling.


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ™ Acknowledgements

Tool Purpose
AG2 (AutoGen) Multi-agent orchestration
Groq Ultra-fast LLM inference
Meta LLaMA 3.3 Foundation language model
OpenAI Whisper Speech recognition
ChromaDB Vector database
FastAPI Python web framework
Next.js React meta-framework
Framer Motion UI animations

Built with ❀️ by Dakshin


Β 



If this project helped you, please ⭐ star the repository!

About

MedHive AI is a multi-agent healthcare copilot powered by AG2, Groq, FastAPI, RAG, Voice AI, and medical verification workflows. Analyze symptoms, understand lab reports, check medication interactions, and receive evidence-based healthcare guidance.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages