Transform scattered medical documents into intelligent, searchable health insights using Google's Gemini AI
MediVault is a cutting-edge healthcare platform that leverages Google ADK (Agentic Development Kit) with Gemini 2.0 Flash to provide intelligent medical document processing, semantic search, and AI-powered health insights.
MediVault implements a sophisticated multi-agent architecture with two main workflows:
Upload β OCR Agent β Medical NER β Prescription Parser
β 7-Layer Anomaly Detection β Normalizer β Embedding β Vector DB
Query β Embedding β Semantic Search β Top K Results
β AI Analyser β Evidence-Based Response
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React) β
β Dashboard | Upload | Search | Timeline β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β REST API
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β Backend (Flask + Agents) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Agent Orchestrator (Coordinator) β β
β βββββββ¬βββββββββββββββββββββββββββββββββββββββββ¬ββββββββ β
β β β β
β βββββββΌββββββ ββββββββββ βββββββββββ ββββββΌβββββββ β
β βOCR Agent β βNER β βAnomaly β βSearch β β
β β ββ βAgent ββ βDetector β βAgent β β
β βββββββββββββ ββββββββββ βββββββββββ βββββββββββββ β
β β
β βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
β βPrescription β βNormalizer β βAI Analyser β β
β βParser ββ βAgent ββ βAgent β β
β βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
ββββββββββββββββ¬ββββββββββββββββββββββββββββββ¬βββββββββββββββ
β β
βββββββΌβββββββ ββββββββΌβββββββ
β Supabase β β ChromaDB β
β(PostgreSQL)β β (Vectors) β
ββββββββββββββ βββββββββββββββ
# 1. Clone repository
git clone https://github.com/yourusername/medivault.git
cd medivault
# 2. Install backend dependencies
pip install -r backend/requirements.txt
# 3. Install frontend dependencies
cd frontend && npm install && cd ..
# 4. Configure environment
cp config/.env.example .env
# Edit .env with your API keys
# 5. Run backend
python backend/app.py
# 6. Run frontend (in another terminal)
cd frontend && npm run dev
# β
Access at http://localhost:5173
# Navigate to backend
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Download spaCy model
python -m spacy download en_core_web_sm
# Navigate to frontend
cd frontend
# Install dependencies
npm install
# Build for production (optional)
npm run build
# AI pipelines are automatically loaded by backend
# Ensure dependencies are installed
pip install -r ai_pipelines/requirements.txt
Create .env file in root directory:
# Google Gemini Configuration (Required)
GOOGLE_API_KEY=your-google-api-key-here
GEMINI_MODEL=gemini-2.0-flash-exp
EMBEDDING_MODEL=text-embedding-004
# Supabase Configuration (Required)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-supabase-anon-key
SUPABASE_SERVICE_KEY=your-supabase-service-key
# Vector Database
VECTOR_DB_PATH=./data/chroma_db
VECTOR_DB_COLLECTION=medical_records
# Server Configuration
FLASK_PORT=5000
FRONTEND_PORT=5173
FLASK_DEBUG=False
# File Upload
UPLOAD_FOLDER=./data/uploads
MAX_FILE_SIZE_MB=16
# Security
JWT_SECRET_KEY=your-secure-random-string-here
JWT_ALGORITHM=HS256
JWT_EXPIRY_HOURS=24
# Logging
LOG_LEVEL=INFO
LOG_FILE=./data/logs/medivault.log
.env filecd backend
python scripts/setup_database.py
curl -X POST http://localhost:5000/api/agents/upload \
-F "file=@lab_report.pdf" \
-F "patient_id=patient-123" \
-F "patient_metadata={\"age\":45,\"gender\":\"M\"}"
curl -X POST http://localhost:5000/api/agents/ask \
-H "Content-Type: application/json" \
-d '{
"query": "What is my current HbA1c level?",
"patient_id": "patient-123"
}'
from ai_pipelines.orchestrator import AgentOrchestrator
# Initialize
orchestrator = AgentOrchestrator()
# Upload document
result = orchestrator.process_patient_document(
file_path='lab_report.pdf',
patient_id='patient-123',
patient_metadata={'age': 45, 'gender': 'M'}
)
print(f"Severity: {result['overall_severity']}/100")
print(f"Critical Alerts: {result['has_critical_alerts']}")
# Smart search
search_result = orchestrator.smart_search(
query='What is my HbA1c?',
patient_id='patient-123'
)
print(f"Answer: {search_result['response']}")
POST /api/agents/upload
Content-Type: multipart/form-data
Parameters:
- file: Medical document (PDF/Image)
- patient_id: Patient identifier
- patient_metadata: JSON with patient info (optional)
Response:
{
"success": true,
"record_id": "REC_20240115_123456",
"document_type": "lab_report",
"has_critical_alerts": false,
"overall_severity": 25,
"clinical_summary": {...}
}
POST /api/agents/search
Content-Type: application/json
Body:
{
"query": "diabetes medications",
"patient_id": "patient-123",
"top_k": 5
}
Response:
{
"success": true,
"ranked_results": [...]
}
POST /api/agents/ask
Content-Type: application/json
Body:
{
"query": "What is my HbA1c?",
"patient_id": "patient-123"
}
Response:
{
"success": true,
"response": "Your most recent HbA1c is 7.2%...",
"evidence": [...],
"recommendations": [...],
"confidence_score": 0.92
}
GET /api/agents/patient/{patient_id}/summary
Response:
{
"success": true,
"answer": "Comprehensive health summary...",
"key_findings": [...],
"areas_of_concern": [...]
}
GET /api/agents/patient/{patient_id}/alerts
GET /api/agents/alerts # All patients
Response:
{
"success": true,
"total_alerts": 3,
"alerts": [...]
}
See API_REFERENCE.md for complete documentation.
MediVault uses 8 specialized AI agents for medical intelligence:
| Agent | Purpose | Input | Output |
|---|---|---|---|
| OCR Agent | Text extraction | Document image | Extracted text + metadata |
| Medical NER | Entity extraction | Text | Diseases, meds, biomarkers |
| Prescription Parser | Parse Rx formats | Prescription text | Structured medication data |
| Anomaly Detector | 7-layer detection | Medical data | Severity score + alerts |
| Normalizer | Standardization | Raw entities | ICD-10, LOINC codes |
| Embedding Agent | Vector creation | Text | 768-d embeddings |
| Search Agent | Hybrid search | Query | Ranked results |
| AI Analyser | Response generation | Search results | Evidence-based answer |
Edit agent prompts in ai_pipelines/:
# ai_pipelines/ocr_agent.py
class OCRAgent(BaseAgent):
def get_system_prompt(self) -> str:
return """
You are an expert Medical OCR Agent...
[Customize instructions here]
"""
See AI_PIPELINES.md for detailed documentation.
frontend/
βββ src/
β βββ components/ # React components
β β βββ Dashboard.tsx
β β βββ UploadPage.tsx
β β βββ SearchPage.tsx
β β βββ ui/ # ShadCN UI components
β βββ contexts/ # React contexts
β βββ services/ # API clients
β βββ hooks/ # Custom hooks
β βββ lib/ # Utilities
βββ public/
βββ package.json
cd frontend
# Development
npm run dev
# Production build
npm run build
npm run preview
// src/components/Dashboard.tsx
import { Card } from './ui/card';
export function Dashboard() {
// Customize dashboard layout
}
See FRONTEND.md for detailed guide.
# Build and run with Docker Compose
docker-compose up -d
# Access at http://localhost:5000
# Use production WSGI server
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 backend.app:app
cd frontend
npm run build
# Deploy dist/ folder to Vercel/Netlify
See DEPLOYMENT.md for detailed instructions.
# Backend tests
cd backend
pytest tests/
# Frontend tests
cd frontend
npm test
# E2E tests
npm run test:e2e
# Agent tests
python ai_pipelines/tests/test_agents.py
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
# Fork and clone
git clone https://github.com/yourusername/medivault.git
cd medivault
# Create branch
git checkout -b feature/my-feature
# Make changes and test
python -m pytest
# Commit and push
git commit -m "Add my feature"
git push origin feature/my-feature
# Create Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
Built with β€οΈ by the MediVault team




Website β’ Documentation β’ API Reference β’ Blog
Made with β€οΈ using Google Gemini 2.0 Flash
Transform scattered medical documents into intelligent, searchable health insights using Google's Gemini AI
MediVault is a cutting-edge healthcare platform that leverages Google ADK (Agentic Development Kit) with Gemini 2.0 Flash to provide intelligent medical document processing, semantic search, and AI-powered health insights.
MediVault implements a sophisticated multi-agent architecture with two main workflows:
Upload β OCR Agent β Medical NER β Prescription Parser
β 7-Layer Anomaly Detection β Normalizer β Embedding β Vector DB
Query β Embedding β Semantic Search β Top K Results
β AI Analyser β Evidence-Based Response
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React) β
β Dashboard | Upload | Search | Timeline β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β REST API
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β Backend (Flask + Agents) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Agent Orchestrator (Coordinator) β β
β βββββββ¬βββββββββββββββββββββββββββββββββββββββββ¬ββββββββ β
β β β β
β βββββββΌββββββ ββββββββββ βββββββββββ ββββββΌβββββββ β
β βOCR Agent β βNER β βAnomaly β βSearch β β
β β ββ βAgent ββ βDetector β βAgent β β
β βββββββββββββ ββββββββββ βββββββββββ βββββββββββββ β
β β
β βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
β βPrescription β βNormalizer β βAI Analyser β β
β βParser ββ βAgent ββ βAgent β β
β βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
ββββββββββββββββ¬ββββββββββββββββββββββββββββββ¬βββββββββββββββ
β β
βββββββΌβββββββ ββββββββΌβββββββ
β Supabase β β ChromaDB β
β(PostgreSQL)β β (Vectors) β
ββββββββββββββ βββββββββββββββ
# 1. Clone repository
git clone https://github.com/yourusername/medivault.git
cd medivault
# 2. Install backend dependencies
pip install -r backend/requirements.txt
# 3. Install frontend dependencies
cd frontend && npm install && cd ..
# 4. Configure environment
cp config/.env.example .env
# Edit .env with your API keys
# 5. Run backend
python backend/app.py
# 6. Run frontend (in another terminal)
cd frontend && npm run dev
# β
Access at http://localhost:5173
# Navigate to backend
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Download spaCy model
python -m spacy download en_core_web_sm
# Navigate to frontend
cd frontend
# Install dependencies
npm install
# Build for production (optional)
npm run build
# AI pipelines are automatically loaded by backend
# Ensure dependencies are installed
pip install -r ai_pipelines/requirements.txt
Create .env file in root directory:
# Google Gemini Configuration (Required)
GOOGLE_API_KEY=your-google-api-key-here
GEMINI_MODEL=gemini-2.0-flash-exp
EMBEDDING_MODEL=text-embedding-004
# Supabase Configuration (Required)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-supabase-anon-key
SUPABASE_SERVICE_KEY=your-supabase-service-key
# Vector Database
VECTOR_DB_PATH=./data/chroma_db
VECTOR_DB_COLLECTION=medical_records
# Server Configuration
FLASK_PORT=5000
FRONTEND_PORT=5173
FLASK_DEBUG=False
# File Upload
UPLOAD_FOLDER=./data/uploads
MAX_FILE_SIZE_MB=16
# Security
JWT_SECRET_KEY=your-secure-random-string-here
JWT_ALGORITHM=HS256
JWT_EXPIRY_HOURS=24
# Logging
LOG_LEVEL=INFO
LOG_FILE=./data/logs/medivault.log
.env filecd backend
python scripts/setup_database.py
curl -X POST http://localhost:5000/api/agents/upload \
-F "file=@lab_report.pdf" \
-F "patient_id=patient-123" \
-F "patient_metadata={\"age\":45,\"gender\":\"M\"}"
curl -X POST http://localhost:5000/api/agents/ask \
-H "Content-Type: application/json" \
-d '{
"query": "What is my current HbA1c level?",
"patient_id": "patient-123"
}'
from ai_pipelines.orchestrator import AgentOrchestrator
# Initialize
orchestrator = AgentOrchestrator()
# Upload document
result = orchestrator.process_patient_document(
file_path='lab_report.pdf',
patient_id='patient-123',
patient_metadata={'age': 45, 'gender': 'M'}
)
print(f"Severity: {result['overall_severity']}/100")
print(f"Critical Alerts: {result['has_critical_alerts']}")
# Smart search
search_result = orchestrator.smart_search(
query='What is my HbA1c?',
patient_id='patient-123'
)
print(f"Answer: {search_result['response']}")
POST /api/agents/upload
Content-Type: multipart/form-data
Parameters:
- file: Medical document (PDF/Image)
- patient_id: Patient identifier
- patient_metadata: JSON with patient info (optional)
Response:
{
"success": true,
"record_id": "REC_20240115_123456",
"document_type": "lab_report",
"has_critical_alerts": false,
"overall_severity": 25,
"clinical_summary": {...}
}
POST /api/agents/search
Content-Type: application/json
Body:
{
"query": "diabetes medications",
"patient_id": "patient-123",
"top_k": 5
}
Response:
{
"success": true,
"ranked_results": [...]
}
POST /api/agents/ask
Content-Type: application/json
Body:
{
"query": "What is my HbA1c?",
"patient_id": "patient-123"
}
Response:
{
"success": true,
"response": "Your most recent HbA1c is 7.2%...",
"evidence": [...],
"recommendations": [...],
"confidence_score": 0.92
}
GET /api/agents/patient/{patient_id}/summary
Response:
{
"success": true,
"answer": "Comprehensive health summary...",
"key_findings": [...],
"areas_of_concern": [...]
}
GET /api/agents/patient/{patient_id}/alerts
GET /api/agents/alerts # All patients
Response:
{
"success": true,
"total_alerts": 3,
"alerts": [...]
}
See API_REFERENCE.md for complete documentation.
MediVault uses 8 specialized AI agents for medical intelligence:
| Agent | Purpose | Input | Output |
|---|---|---|---|
| OCR Agent | Text extraction | Document image | Extracted text + metadata |
| Medical NER | Entity extraction | Text | Diseases, meds, biomarkers |
| Prescription Parser | Parse Rx formats | Prescription text | Structured medication data |
| Anomaly Detector | 7-layer detection | Medical data | Severity score + alerts |
| Normalizer | Standardization | Raw entities | ICD-10, LOINC codes |
| Embedding Agent | Vector creation | Text | 768-d embeddings |
| Search Agent | Hybrid search | Query | Ranked results |
| AI Analyser | Response generation | Search results | Evidence-based answer |
Edit agent prompts in ai_pipelines/:
# ai_pipelines/ocr_agent.py
class OCRAgent(BaseAgent):
def get_system_prompt(self) -> str:
return """
You are an expert Medical OCR Agent...
[Customize instructions here]
"""
See AI_PIPELINES.md for detailed documentation.
frontend/
βββ src/
β βββ components/ # React components
β β βββ Dashboard.tsx
β β βββ UploadPage.tsx
β β βββ SearchPage.tsx
β β βββ ui/ # ShadCN UI components
β βββ contexts/ # React contexts
β βββ services/ # API clients
β βββ hooks/ # Custom hooks
β βββ lib/ # Utilities
βββ public/
βββ package.json
cd frontend
# Development
npm run dev
# Production build
npm run build
npm run preview
// src/components/Dashboard.tsx
import { Card } from './ui/card';
export function Dashboard() {
// Customize dashboard layout
}
See FRONTEND.md for detailed guide.
# Build and run with Docker Compose
docker-compose up -d
# Access at http://localhost:5000
# Use production WSGI server
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 backend.app:app
cd frontend
npm run build
# Deploy dist/ folder to Vercel/Netlify
See DEPLOYMENT.md for detailed instructions.
# Backend tests
cd backend
pytest tests/
# Frontend tests
cd frontend
npm test
# E2E tests
npm run test:e2e
# Agent tests
python ai_pipelines/tests/test_agents.py
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
# Fork and clone
git clone https://github.com/yourusername/medivault.git
cd medivault
# Create branch
git checkout -b feature/my-feature
# Make changes and test
python -m pytest
# Commit and push
git commit -m "Add my feature"
git push origin feature/my-feature
# Create Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
Built with β€οΈ by the MediVault team




Website β’ Documentation β’ API Reference β’ Blog
Made with β€οΈ using Google Gemini 2.0 Flash