VaultMind Pro - Project Overview
๐ฏ What is VaultMind Pro?
VaultMind Pro is an intelligent medical record processing system that combines privacy-first data protection with AI-powered clinical analysis. It automatically processes patient medical documents, protects sensitive information (PII), and generates AI-powered clinical summaries while continuously learning and improving from doctor feedback.
Core Value Proposition
- ๐ Privacy-First: Patient PII (names, SSNs, DOBs) is tokenized and stored securely in Skyflow Vault
- ๐ค AI-Powered: Uses Anthropic's Claude AI to generate professional clinical summaries
- ๐ Self-Learning: Continuously improves by learning from doctor feedback and optimizing prompts
- โก Real-Time: Live updates via WebSocket connections for instant patient processing status
๐๏ธ System Architecture
โโโโโโโโโโโโโโโโโโโ
โ Frontend โ React + TypeScript + Tailwind CSS
โ (React App) โ Real-time UI with Socket.IO
โโโโโโโโโโฌโโโโโโโโโ
โ HTTP/WebSocket
โ
โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend API (FastAPI) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ API Routes โ โ
โ โ - /api/patients (CRUD operations) โ โ
โ โ - /api/feedback (Doctor feedback) โ โ
โ โ - /api/webhooks (External events) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Services Layer โ โ
โ โ - AgentService (AI Processing) โ โ
โ โ - SkyflowService (PII Protection) โ โ
โ โ - SanityService (Data Storage) โ โ
โ โ - PromptService (AI Optimization) โ โ
โ โ - MetricsService (Performance) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโดโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ
โ โ โ โ
โโโโโผโโโโ โโโโผโโโโโโโ โโโโโโผโโโโโโ โโโโโผโโโโโ
โSkyflowโ โ Sanity โ โAnthropic โ โ Redis โ
โ Vault โ โ CMS โ โ Claude โ โ(Celery)โ
โ โ โ โ โ AI โ โ โ
โโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโ
๐ง Component Breakdown
1. Frontend (React + TypeScript)
Location: frontend/
What it does:
- Provides a modern, responsive web interface for doctors and medical staff
- Displays patient records with encrypted PII (tokens)
- Allows document uploads (TXT, PDF, DOCX)
- Shows real-time processing status via WebSocket
- Enables doctors to provide feedback on AI summaries
Key Components:
Dashboard.tsx: Main interface showing patient list and statisticsPatientList.tsx: Scrollable list of all patientsTokenViewer.tsx: Displays patient details with decrypt functionalityDocumentUpload.tsx: Drag-and-drop file upload interfaceFeedbackDialog.tsx: Allows doctors to rate AI summaries
Technologies:
- React 19.2
- TypeScript
- Tailwind CSS
- Socket.IO Client (real-time updates)
- Vite (build tool)
2. Backend API (FastAPI)
Location: backend/
What it does:
- RESTful API server handling all backend operations
- WebSocket server for real-time updates
- Routes HTTP requests to appropriate services
- Manages CORS and authentication
Key Endpoints:
POST /api/patients/upload-document: Upload medical documentsGET /api/patients: List all patientsPOST /api/patients/{id}/decrypt: Decrypt PII tokens (with auth)POST /api/feedback: Submit doctor feedbackGET /api/feedback/stats: Get performance metrics
Technologies:
- FastAPI (Python web framework)
- Socket.IO (WebSocket support)
- Uvicorn (ASGI server)
3. Skyflow Service ๐
Location: backend/services/skyflow_service.py
What it does:
- PII Protection: Tokenizes sensitive patient data (names, SSNs, DOBs)
- PII Detection: Automatically finds PII in unstructured documents
- Detokenization: Securely retrieves original PII when needed (with proper auth)
- Vault Management: Stores encrypted PII in Skyflow's secure vault
Key Functions:
tokenize(): Converts PII โ secure tokensdetokenize(): Converts tokens โ original PII (requires auth)detect_pii(): Finds PII in text using pattern matching or MCP serverinvoke_function(): Calls Skyflow Functions for vault-confined AI processing
How it works:
- When a document is uploaded, Skyflow detects PII (names, SSNs, etc.)
- PII is sent to Skyflow Vault and replaced with tokens (e.g.,
sky_n_abc123) - Only tokens are stored in the database
- Original PII never leaves Skyflow's secure vault
Example:
Input: "Patient Name: John Smith, SSN: 123-45-6789"
Output: "Patient Name: sky_n_abc123, SSN: sky_s_def456"
4. Sanity Service ๐
Location: backend/services/sanity_service.py
What it does:
- Data Storage: Stores patient records in Sanity CMS (headless CMS)
- Query Interface: Provides flexible querying of patient data
- Schema Management: Manages patient, feedback, and prompt template schemas
What gets stored:
- Patient tokens (not actual PII)
- Medical condition, department, priority
- Lab results (non-PII data)
- AI summaries
- Processing metadata (cost, tokens used, duration)
- Doctor feedback
Why Sanity?:
- Headless CMS allows flexible data modeling
- Real-time updates
- Easy to query and filter
- Good for structured medical data
Schema Types:
patient: Patient records with tokensfeedback: Doctor feedback on AI summariesprompt_template: AI prompt versions for A/B testingperformance_metrics: System performance tracking
5. Agent Service ๐ค
Location: backend/services/agent_service.py
What it does:
- AI Processing: Orchestrates AI clinical summary generation
- Multi-Strategy: Tries Skyflow Functions first, falls back to direct Claude API
- Smart Fallback: Detokenizes data if needed for AI processing
- Document Processing: Uses original document text when available
Processing Flow:
- Receives patient data (with tokens)
- Selects optimal prompt template (based on performance)
- Primary: Tries Skyflow Function (vault-confined AI processing)
- Fallback: Calls Anthropic Claude API directly
- Uses original document text if available
- Or detokenizes patient name for context
- Generates clinical summary
- Stores results in Sanity
- Emits real-time update via WebSocket
AI Models Used:
- Claude 3.5 Sonnet (default)
- Configurable via prompt templates
Output:
- Professional clinical summary
- Processing metrics (tokens, cost, duration)
- Model version used
6. Prompt Service ๐
Location: backend/services/prompt_service.py
What it does:
- Prompt Management: Manages multiple prompt template versions
- A/B Testing: Tests different prompts to find best performers
- Self-Learning: Automatically selects best-performing prompts based on feedback
- Optimization: Tracks which prompts get best ratings from doctors
Prompt Versions:
v1.0: Original baseline promptv2.0: Enhanced with structured analysisv3.0: SOAP format (Subjective, Objective, Assessment, Plan)v4.0: XML-structured with few-shot examples
Selection Strategy:
best_performing: Uses highest-rated prompt (default)ab_test: Randomly selects for A/B testinglatest: Uses newest version
How it learns:
- Doctor rates AI summary (1-5 stars)
- System tracks which prompt version was used
- Calculates average rating per prompt
- Automatically switches to best-performing prompt
7. Metrics Service ๐
Location: backend/services/metrics_service.py
What it does:
- Feedback Tracking: Stores doctor feedback on AI summaries
- Performance Analysis: Calculates success rates, average ratings
- Trend Analysis: Tracks improvement over time
- Optimization Recommendations: Suggests improvements based on data
Metrics Tracked:
- Average accuracy rating (1-5 scale)
- Summary quality distribution
- Processing speed trends
- Cost efficiency improvements
- Prompt version performance
Use Cases:
- Dashboard statistics
- System improvement tracking
- Cost optimization insights
8. Celery Workers โ๏ธ
Location: backend/workers/tasks.py
What it does:
- Background Processing: Handles AI processing asynchronously
- Queue Management: Uses Redis to queue patient processing tasks
- Scalability: Allows multiple workers to process patients in parallel
Why Celery?:
- AI processing can take 5-30 seconds
- Prevents blocking the API
- Allows horizontal scaling
- Falls back to synchronous processing if Redis unavailable
Task Flow:
- Patient uploaded โ Task queued
- Celery worker picks up task
- Processes patient with AI
- Updates Sanity
- Emits WebSocket event
๐ Complete Data Flow
Document Upload Flow
1. Doctor uploads document (TXT/PDF/DOCX)
โ
2. Backend receives file
โ
3. Skyflow detects PII (name, SSN, DOB)
โ
4. PII tokenized โ stored in Skyflow Vault
โ
5. Patient record created in Sanity (with tokens only)
โ
6. Processing task queued (Celery) or processed immediately
โ
7. Agent Service:
a. Selects best prompt template
b. Tries Skyflow Function (vault-confined)
c. Falls back to Claude API if needed
โ
8. AI generates clinical summary
โ
9. Summary stored in Sanity
โ
10. WebSocket event โ Frontend updates in real-time
Decryption Flow (Viewing PII)
1. Doctor clicks "Decrypt PII" button
โ
2. Frontend calls /api/patients/{id}/decrypt
โ
3. Backend retrieves tokens from Sanity
โ
4. Skyflow detokenizes (requires auth)
โ
5. Original PII returned to frontend
โ
6. Displayed in red-highlighted box (visual indicator)
Feedback Loop (Self-Learning)
1. Doctor reviews AI summary
โ
2. Doctor rates summary (1-5 stars) + optional corrections
โ
3. Feedback stored in Sanity
โ
4. Metrics Service updates prompt performance
โ
5. Prompt Service recalculates best performer
โ
6. Future patients use improved prompt automatically
๐ Security Architecture
PII Protection Strategy
- Tokenization: All PII replaced with tokens before storage
- Vault Isolation: Original PII only exists in Skyflow Vault
- Access Control: Detokenization requires proper authentication
- Audit Trail: All access logged (via Skyflow)
Data Storage Layers
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Sanity CMS (Public Database) โ
โ - Stores: Tokens only โ
โ - No PII โ
โ - Queryable, searchable โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Skyflow Vault (Secure Vault) โ
โ - Stores: Original PII โ
โ - Encrypted at rest โ
โ - Access-controlled โ
โ - Compliant (HIPAA-ready) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Key Features
1. Automatic PII Detection
- Finds names, SSNs, DOBs in any document format
- No manual field mapping required
- Uses pattern matching + optional MCP server
2. Intelligent AI Processing
- Multiple prompt strategies
- Automatic optimization
- Fallback mechanisms for reliability
3. Real-Time Updates
- WebSocket connections
- Live processing status
- Instant UI updates
4. Self-Learning System
- Learns from doctor feedback
- Automatically improves prompts
- Tracks performance metrics
5. Cost Optimization
- Tracks token usage
- Calculates processing costs
- Optimizes prompts for efficiency
๐ฆ Technology Stack
Frontend
- React 19.2 -** UI framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Vite - Build tool
- Socket.IO Client - Real-time updates
Backend
- FastAPI - Web framework
- Python 3.x - Programming language
- Socket.IO - WebSocket server
- Celery - Task queue
- Redis - Message broker
External Services
- Skyflow - PII vault & tokenization
- Sanity CMS - Data storage
- Anthropic Claude - AI processing
Infrastructure
- Uvicorn - ASGI server
- Redis - Celery broker
- Docker (optional) - Containerization
๐ฏ Use Cases
1. Hospital Admins
- Upload patient documents in bulk
- Monitor processing status
- View system performance metrics
2. Doctors
- Review AI-generated clinical summaries
- Provide feedback to improve system
- Access patient records securely
3. Medical Staff
- Upload individual patient documents
- View patient records (with encrypted PII)
- Track processing status
๐ฎ Future Enhancements
- Multi-language Support: Process documents in multiple languages
- Advanced PII Detection: ML-based detection improvements
- Custom Prompt Templates: Allow doctors to create custom prompts
- Batch Processing: Process multiple documents simultaneously
- Export Features: PDF/CSV export of patient records
- Analytics Dashboard: Advanced performance analytics
๐ Configuration
All configuration is done via .env file in project root:
# Skyflow (PII Protection)
SKYFLOW_VAULT_ID=your_vault_id
SKYFLOW_VAULT_URL=https://your-vault.skyflowapis.com
SKYFLOW_BEARER_TOKEN=your_token
# Anthropic (AI Processing)
ANTHROPIC_API_KEY=your_api_key
# Sanity (Data Storage)
SANITY_PROJECT_ID=your_project_id
SANITY_API_TOKEN=your_token
# Redis (Optional - for background processing)
REDIS_URL=redis://localhost:6379/0
๐ Getting Started
- Install Dependencies ```bash # Backend pip install -r backend/requirements.txt
# Frontend cd frontend && npm install
2. **Configure Environment**
- Copy `.env.example` to `.env`
- Fill in all API keys
3. **Start Services**
```bash
./run.sh
- Access Application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
๐ System Metrics
The system tracks:
- Processing Speed: Average time to generate summaries
- AI Accuracy: Average doctor ratings (1-5)
- Cost Efficiency: Token usage and cost per patient
- Improvement Trends: Performance over time
๐ค Contributing
This is a production-ready system designed for healthcare environments. All contributions should maintain:
- HIPAA compliance considerations
- Security best practices
- Performance optimization
- Code quality standards
๐ License
[Add license information here]
Built with โค๏ธ for secure, intelligent medical record processing
Built With
- anthropic
- redis
- sanity
- skyflow


Log in or sign up for Devpost to join the conversation.