A comprehensive healthcare consultation platform that combines a modern ChatGPT-style interface with intelligent AI agents for medical information collection, symptom analysis, hospital search, appointment processing, and patient support throughout their healthcare journey.
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Chat Agent โ โ Reasoning Agent โ โ Extraction Agent โ
โ (Info Collect) โ -> โ (Symptom Analys) โ -> โ (Data Structure) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ Gemini 2.5 Flash โ
โ (Google AI API) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
User Input -> Chat Agent -> Basic Info Complete?
โ
โโ No: Continue Collection
โ
โโ Yes: Hospital Search (Exa.ai)
โ
โโ Background: Appointment Processing
โ
โโ Reasoning Agent -> Comfort Guidance
git clone <repository-url>
cd PatientHero
# Install frontend dependencies
npm install
# Setup Python environment
cd crewai_agents
chmod +x setup.sh
./setup.sh
# Install Playwright browsers
conda activate patienthero-crewai
playwright install
Create .env files with your API keys:
Root .env:
GEMINI_API_KEY=your_gemini_api_key
WANDB_API_KEY=your_wandb_api_key
WANDB_PROJECT=patienthero-crewai
WANDB_ENTITY=your_wandb_entity
EXA_API_KEY=your_exa_api_key
crewai_agents/.env:
GEMINI_API_KEY=your_gemini_api_key
WANDB_API_KEY=your_wandb_api_key
WANDB_PROJECT=patienthero-crewai
WANDB_ENTITY=your_wandb_entity
EXA_API_KEY=your_exa_api_key
# Terminal 1: Start the API server
python api_server.py
# Terminal 2: Start the frontend
npm run dev
PatientHero/
โโโ app/ # Next.js 14 app directory
โ โโโ globals.css # Global styles and themes
โ โโโ layout.tsx # Root layout with providers
โ โโโ page.tsx # Main chat interface
โโโ components/ # React components
โ โโโ ui/ # Reusable UI primitives
โ โโโ providers/ # Context providers
โ โโโ medical-consultation.tsx # Main chat component
โ โโโ appointment-flow.tsx # Appointment processing UI
โ โโโ sidebar.tsx # Navigation sidebar
โ โโโ theme-toggle.tsx # Dark/light mode toggle
โโโ lib/ # Utility functions and services
โ โโโ ai-service.ts # API communication layer
โ โโโ utils.ts # Helper functions
โ โโโ hooks.ts # Custom React hooks
โโโ crewai_agents/ # AI agent system
โ โโโ main.py # Core CrewAI implementation
โ โโโ exa_helper.py # Hospital search integration
โ โโโ requirements.txt # Python dependencies
โ โโโ environment.yml # Conda environment
โ โโโ setup.sh # Automated setup script
โโโ api_server.py # FastAPI backend server
โโโ process_clinics_parallel.py # Appointment processing
โโโ docs/ # Documentation
โ โโโ DEPLOYMENT_GUIDE.md
โ โโโ PROMPT_SYSTEM.md
โ โโโ WANDB_SUMMARY.md
โโโ scripts/ # Utility scripts
POST /api/chat - Process user input through AI agentsGET /api/status/{session_id} - Get session status and patient dataPOST /api/complete-flow/{session_id} - Full medical flow processingGET /api/appointments/{session_id} - Get processed appointment dataPOST /api/appointments/process - Manual appointment processingGET /api/comfort-guidance/{session_id} - Comfort guidance roundsPOST /api/sessions/{session_id}/end - End patient sessionGET /api/sessions - List active sessions (debug)GET / - API health checkinterface PatientData {
session_id: string;
timestamp: string;
medical_condition?: string;
zip_code?: string;
phone_number?: string;
insurance?: string;
symptoms?: string[];
reasoning_analysis?: string;
conversation_history: ConversationEntry[];
}
interface AppointmentData {
hospital_name: string;
website: string;
institution_type: string;
accepts_user_insurance: string;
appointment_availability: {
available_slots: AppointmentSlot[];
total_slots_found: number;
next_available: string;
booking_method: string;
};
}
# Start both services locally
python api_server.py &
npm run dev
# Build and run with Docker
docker build -t patienthero .
docker run -p 3000:3000 -p 8000:8000 patienthero
npm run test # Run test suite
npm run test:watch # Watch mode
npm run lint # Code quality check
cd crewai_agents
python test_complete_flow.py # Test complete AI flow
python -m pytest tests/ # Run unit tests
# Test core endpoints
curl -X POST http://localhost:8000/api/chat \
-H "Content-Type: application/json" \
-d '{"user_input": "Hi, I have a fever", "session_id": "test-123"}'
curl -X POST http://localhost:8000/api/complete-flow/test-123
Important: This application is designed for educational and demonstration purposes. It should not be used as a substitute for professional medical advice, diagnosis, or treatment. Always consult with qualified healthcare providers for medical concerns.
This project is licensed under the MIT License - see the LICENSE file for details.
For technical support, bug reports, or feature requests:
Built with โค๏ธ for better healthcare accessibility โ โโโ ui/ # Reusable UI components โ โโโ providers/ # Context providers โ โโโ sidebar.tsx # Chat sidebar โ โโโ theme-toggle.tsx # Theme switcher โโโ lib/ # Utility functions โ โโโ utils.ts # Helper functions โโโ public/ # Static assets โ โโโ manifest.json # PWA manifest โโโ types/ # TypeScript type definitions
## Key Components
### Chat Interface
- **Message Display**: Shows user and AI messages with timestamps
- **Real-time Input**: Send messages with Enter key or button click
- **Typing Indicators**: Visual feedback when AI is responding
- **Message History**: Persistent chat history across sessions
### Sidebar Navigation
- **Chat List**: Organized by date (Today, Yesterday, Previous 7 days, Older)
- **New Chat**: Create new conversations
- **Search**: Filter chats by title
- **Responsive**: Collapsible on mobile devices
### Theme System
- **Dark/Light Mode**: Toggle between themes
- **System Preference**: Respects user's system theme
- **Persistent**: Theme preference saved locally
## Customization
### Styling
The app uses Tailwind CSS with a custom color system. You can modify the theme in:
- `tailwind.config.js` - Tailwind configuration
- `app/globals.css` - CSS custom properties for colors
### AI Integration
To connect to actual AI services, modify the `sendMessage` function in `app/page.tsx`:
```typescript
// Replace the simulation with actual AI API calls
const sendMessage = async () => {
// Your AI API integration here
}
All UI components are in the components/ui/ directory and are built with Radix UI primitives for accessibility and customization.
This project is licensed under the MIT License - see the LICENSE file for details.
This application is designed for educational and demonstration purposes. It should not be used as a substitute for professional medical advice, diagnosis, or treatment. Always consult with qualified healthcare providers for medical concerns.
cd fly-llm-server && ./deploy.sh for cloud deploymentThe application is production-ready with complete AI integration!
Production Deployment (Recommended)
cd fly-llm-server && ./deploy.sh # Deploy Med42-8B to Fly.io
npm run dev # Start the frontend
| Feature | Med42-8B on Fly.io | Local Setup |
|---|---|---|
| Cost | $50-150/month (scales to $0) | Free |
| Setup Time | 15 minutes | N/A |
| Performance | Very Fast (A10 GPU) | N/A |
| Privacy | Secure Cloud | N/A |
| Maintenance | Managed | N/A |
fly-llm-server/DEPLOYMENT.md.env.local with your Fly.io URLThe UI is production-ready and follows modern design patterns. All core components are implemented and the application is responsive across all device sizes.
Python
71.2%
TypeScript
20.0%
Shell
6.9%
A comprehensive healthcare consultation platform that combines a modern ChatGPT-style interface with intelligent AI agents for medical information collection, symptom analysis, hospital search, appointment processing, and patient support throughout their healthcare journey.
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Chat Agent โ โ Reasoning Agent โ โ Extraction Agent โ
โ (Info Collect) โ -> โ (Symptom Analys) โ -> โ (Data Structure) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ Gemini 2.5 Flash โ
โ (Google AI API) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
User Input -> Chat Agent -> Basic Info Complete?
โ
โโ No: Continue Collection
โ
โโ Yes: Hospital Search (Exa.ai)
โ
โโ Background: Appointment Processing
โ
โโ Reasoning Agent -> Comfort Guidance
git clone <repository-url>
cd PatientHero
# Install frontend dependencies
npm install
# Setup Python environment
cd crewai_agents
chmod +x setup.sh
./setup.sh
# Install Playwright browsers
conda activate patienthero-crewai
playwright install
Create .env files with your API keys:
Root .env:
GEMINI_API_KEY=your_gemini_api_key
WANDB_API_KEY=your_wandb_api_key
WANDB_PROJECT=patienthero-crewai
WANDB_ENTITY=your_wandb_entity
EXA_API_KEY=your_exa_api_key
crewai_agents/.env:
GEMINI_API_KEY=your_gemini_api_key
WANDB_API_KEY=your_wandb_api_key
WANDB_PROJECT=patienthero-crewai
WANDB_ENTITY=your_wandb_entity
EXA_API_KEY=your_exa_api_key
# Terminal 1: Start the API server
python api_server.py
# Terminal 2: Start the frontend
npm run dev
PatientHero/
โโโ app/ # Next.js 14 app directory
โ โโโ globals.css # Global styles and themes
โ โโโ layout.tsx # Root layout with providers
โ โโโ page.tsx # Main chat interface
โโโ components/ # React components
โ โโโ ui/ # Reusable UI primitives
โ โโโ providers/ # Context providers
โ โโโ medical-consultation.tsx # Main chat component
โ โโโ appointment-flow.tsx # Appointment processing UI
โ โโโ sidebar.tsx # Navigation sidebar
โ โโโ theme-toggle.tsx # Dark/light mode toggle
โโโ lib/ # Utility functions and services
โ โโโ ai-service.ts # API communication layer
โ โโโ utils.ts # Helper functions
โ โโโ hooks.ts # Custom React hooks
โโโ crewai_agents/ # AI agent system
โ โโโ main.py # Core CrewAI implementation
โ โโโ exa_helper.py # Hospital search integration
โ โโโ requirements.txt # Python dependencies
โ โโโ environment.yml # Conda environment
โ โโโ setup.sh # Automated setup script
โโโ api_server.py # FastAPI backend server
โโโ process_clinics_parallel.py # Appointment processing
โโโ docs/ # Documentation
โ โโโ DEPLOYMENT_GUIDE.md
โ โโโ PROMPT_SYSTEM.md
โ โโโ WANDB_SUMMARY.md
โโโ scripts/ # Utility scripts
POST /api/chat - Process user input through AI agentsGET /api/status/{session_id} - Get session status and patient dataPOST /api/complete-flow/{session_id} - Full medical flow processingGET /api/appointments/{session_id} - Get processed appointment dataPOST /api/appointments/process - Manual appointment processingGET /api/comfort-guidance/{session_id} - Comfort guidance roundsPOST /api/sessions/{session_id}/end - End patient sessionGET /api/sessions - List active sessions (debug)GET / - API health checkinterface PatientData {
session_id: string;
timestamp: string;
medical_condition?: string;
zip_code?: string;
phone_number?: string;
insurance?: string;
symptoms?: string[];
reasoning_analysis?: string;
conversation_history: ConversationEntry[];
}
interface AppointmentData {
hospital_name: string;
website: string;
institution_type: string;
accepts_user_insurance: string;
appointment_availability: {
available_slots: AppointmentSlot[];
total_slots_found: number;
next_available: string;
booking_method: string;
};
}
# Start both services locally
python api_server.py &
npm run dev
# Build and run with Docker
docker build -t patienthero .
docker run -p 3000:3000 -p 8000:8000 patienthero
npm run test # Run test suite
npm run test:watch # Watch mode
npm run lint # Code quality check
cd crewai_agents
python test_complete_flow.py # Test complete AI flow
python -m pytest tests/ # Run unit tests
# Test core endpoints
curl -X POST http://localhost:8000/api/chat \
-H "Content-Type: application/json" \
-d '{"user_input": "Hi, I have a fever", "session_id": "test-123"}'
curl -X POST http://localhost:8000/api/complete-flow/test-123
Important: This application is designed for educational and demonstration purposes. It should not be used as a substitute for professional medical advice, diagnosis, or treatment. Always consult with qualified healthcare providers for medical concerns.
This project is licensed under the MIT License - see the LICENSE file for details.
For technical support, bug reports, or feature requests:
Built with โค๏ธ for better healthcare accessibility โ โโโ ui/ # Reusable UI components โ โโโ providers/ # Context providers โ โโโ sidebar.tsx # Chat sidebar โ โโโ theme-toggle.tsx # Theme switcher โโโ lib/ # Utility functions โ โโโ utils.ts # Helper functions โโโ public/ # Static assets โ โโโ manifest.json # PWA manifest โโโ types/ # TypeScript type definitions
## Key Components
### Chat Interface
- **Message Display**: Shows user and AI messages with timestamps
- **Real-time Input**: Send messages with Enter key or button click
- **Typing Indicators**: Visual feedback when AI is responding
- **Message History**: Persistent chat history across sessions
### Sidebar Navigation
- **Chat List**: Organized by date (Today, Yesterday, Previous 7 days, Older)
- **New Chat**: Create new conversations
- **Search**: Filter chats by title
- **Responsive**: Collapsible on mobile devices
### Theme System
- **Dark/Light Mode**: Toggle between themes
- **System Preference**: Respects user's system theme
- **Persistent**: Theme preference saved locally
## Customization
### Styling
The app uses Tailwind CSS with a custom color system. You can modify the theme in:
- `tailwind.config.js` - Tailwind configuration
- `app/globals.css` - CSS custom properties for colors
### AI Integration
To connect to actual AI services, modify the `sendMessage` function in `app/page.tsx`:
```typescript
// Replace the simulation with actual AI API calls
const sendMessage = async () => {
// Your AI API integration here
}
All UI components are in the components/ui/ directory and are built with Radix UI primitives for accessibility and customization.
This project is licensed under the MIT License - see the LICENSE file for details.
This application is designed for educational and demonstration purposes. It should not be used as a substitute for professional medical advice, diagnosis, or treatment. Always consult with qualified healthcare providers for medical concerns.
cd fly-llm-server && ./deploy.sh for cloud deploymentThe application is production-ready with complete AI integration!
Production Deployment (Recommended)
cd fly-llm-server && ./deploy.sh # Deploy Med42-8B to Fly.io
npm run dev # Start the frontend
| Feature | Med42-8B on Fly.io | Local Setup |
|---|---|---|
| Cost | $50-150/month (scales to $0) | Free |
| Setup Time | 15 minutes | N/A |
| Performance | Very Fast (A10 GPU) | N/A |
| Privacy | Secure Cloud | N/A |
| Maintenance | Managed | N/A |
fly-llm-server/DEPLOYMENT.md.env.local with your Fly.io URLThe UI is production-ready and follows modern design patterns. All core components are implemented and the application is responsive across all device sizes.
Python
71.2%
TypeScript
20.0%
Shell
6.9%