An intelligent clinical decision support system powered by RAG (Retrieval-Augmented Generation) and GPT-4, designed to assist healthcare professionals with comprehensive clinical analysis, diagnosis, and treatment planning.
- π€ Voice Transcription: Convert clinical conversations into structured data using Heidi API
- π§ RAG-Powered Analysis: Intelligent retrieval of similar clinical cases from knowledge base
- π SOAP Note Generation: Automatic generation of comprehensive clinical notes
- π Differential Diagnosis: AI-generated differential diagnoses with risk stratification
- π ICD-10 Coding: Automated medical coding with descriptions
- β Treatment Recommendations: Categorized action items (immediate, urgent, routine)
- π Appointment Management: Calendar system for scheduling patient appointments
β οΈ Safety Checks: Automatic allergy checking and contraindication warnings
- Vector Similarity Search: FAISS-powered semantic search for relevant clinical patterns
- Context-Aware Recommendations: Personalized suggestions based on patient history and demographics
- Real-time Analysis: Fast response times with caching and batch processing
- Comprehensive Dashboard: Intuitive UI for clinical workflow management
- FastAPI: High-performance Python web framework
- OpenAI GPT-4: Advanced language model for clinical analysis
- FAISS: Facebook AI Similarity Search for vector retrieval
- Pydantic: Data validation and settings management
- Uvicorn: ASGI server implementation
- Python 3.11+: Core programming language
- React 18: Modern UI library
- Vite: Next-generation frontend tooling
- Axios: HTTP client for API communication
- Tailwind CSS: Utility-first CSS framework
- Date Helpers: Custom utilities for appointment management
- OpenAI Embeddings:
text-embedding-3-smallfor semantic search - GPT-4: Clinical analysis and generation
- RAG Architecture: Knowledge retrieval with generation
heidihack/
βββ Heidihack/ # Main application directory
β βββ backend/ # Backend API server
β β βββ main.py # FastAPI application entry point
β β βββ rag_engine.py # RAG system implementation
β β βββ models.py # Pydantic data models
β β βββ patients-data.json # Clinical knowledge base
β β βββ test_rag.py # RAG testing script
β β βββ RAG_SYSTEM.md # RAG documentation
β β βββ requirements.txt # Python dependencies
β β βββ venv/ # Python virtual environment
β βββ frontend/ # React frontend application
β βββ src/
β β βββ App.jsx # Main application component
β β βββ components/ # React components
β β βββ utils/ # Utility functions
β βββ package.json # Node dependencies
βββ backend/ # Pulled backend code
βββ frontend/ # Pulled frontend code
βββ clinical-patient-system/ # Dashboard system
βββ README.md # This file
- Python 3.11+
- Node.js 16+
- OpenAI API Key
- Heidi API Key (optional, for transcription)
git clone https://github.com/SenayYakut/Heidihack.git
cd Heidihack/Heidihack# Navigate to backend directory
cd backend
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
# Install dependencies
pip install -r requirements.txt
# Create .env file
cp .env.example .envConfigure .env file:
HEIDI_API_KEY=your_heidi_api_key_here
HEIDI_API_URL=https://api.heidi.health
OPENAI_API_KEY=your_openai_api_key_here
DEVELOPMENT_MODE=true# Navigate to frontend directory (from project root)
cd ../frontend
# Install dependencies
npm install# From Heidihack/backend directory with venv activated
uvicorn main:app --reload --port 8000Backend will be available at: http://localhost:8000
# From Heidihack/frontend directory
npm run devFrontend will be available at: http://localhost:5173
GET /health
Returns server status and configuration.
GET /api/patient
Retrieves mock patient data for testing.
POST /api/analyze
Request Body:
{
"form_data": {
"chief_complaint": "Chest pain",
"hpi": {
"location": ["chest", "substernal"],
"quality": ["sharp", "pressure"],
"severity": 8,
"duration": "2 hours"
},
"associated_symptoms": ["shortness of breath", "sweating"],
"physical_exam": {
"vitals": {
"bp": "150/90",
"hr": 105,
"temp": 98.6
}
}
},
"patient_context": {
"name": "John Doe",
"age": 55,
"gender": "Male",
"medical_history": ["Hypertension", "Diabetes"],
"allergies": ["Penicillin"]
}
}Response:
{
"clinical_note": {
"subjective": "...",
"objective": "...",
"assessment": "...",
"plan": "..."
},
"icd10_codes": [
{
"code": "I20.0",
"description": "Unstable angina"
}
],
"differential_diagnoses": [
{
"name": "Acute Coronary Syndrome",
"risk": "HIGH",
"supporting_factors": ["..."],
"opposing_factors": ["..."]
}
],
"recommended_actions": {
"immediate": [...],
"urgent": [...],
"routine": [...]
}
}GET /api/appointments
POST /api/appointments
Manage patient appointments and calendar events.
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Run the RAG test script to verify the system is working:
cd Heidihack/backend
source venv/bin/activate
python test_rag.pyThis will:
- Load the clinical knowledge base
- Test query retrieval with sample data
- Generate a full clinical analysis
- Display results
- Allergy Checking: Automatic cross-referencing of patient allergies before medication recommendations
- Data Validation: Pydantic models ensure data integrity
- Error Handling: Comprehensive error handling with user-friendly messages
- API Key Protection: Environment variables for sensitive credentials
- Clinical Documentation: Automatically generate SOAP notes from patient encounters
- Decision Support: Get AI-assisted differential diagnoses based on symptoms
- Medical Coding: Automatic ICD-10 code suggestions
- Treatment Planning: Receive prioritized action items for patient care
- Appointment Management: Schedule and track patient appointments
- RAG System Documentation: Detailed explanation of the RAG architecture
- API Documentation: Interactive API documentation (when server is running)
- Senay Yakut - RAG enhancement, documentation, appointments API, testing
- Yogita Senthil - Initial development, RAG engine, frontend, dashboard, calendar system
- Pull latest changes:
git pull origin master - Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test thoroughly
- Commit:
git commit -m "Description of changes" - Push:
git push origin feature/your-feature - Create a Pull Request
- Backend uses absolute imports (not relative) for direct execution
- HEIDI_API_KEY may need to be configured for transcription features
- In-memory appointment storage (resets on server restart)
- Persistent database for appointments (PostgreSQL/MongoDB)
- User authentication and authorization
- Multi-tenant support for different healthcare facilities
- Export clinical notes to PDF/FHIR format
- Integration with EHR systems
- Real-time collaboration features
- Mobile application
- Advanced analytics and reporting
- HIPAA compliance features
This project was developed during a hackathon. Please contact the authors for licensing information.
- OpenAI for GPT-4 and embeddings API
- Heidi Health for transcription API
- Facebook Research for FAISS
- FastAPI and React communities
For questions or issues:
- Create an issue on GitHub
- Contact: senaykt@gmail.com
Built with β€οΈ for better healthcare