A comprehensive full-stack healthcare application that leverages AI-powered voice interactions for patient triage, symptom analysis, specialist mapping, and appointment booking. Built with modern technologies including FastAPI, PostgreSQL, React, and integrated with leading AI models.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค VOICE-ENABLED USER INTERFACE โ
โ (React Frontend) โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ USER AUTHENTICATION โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ User Login โโโโโถโ FastAPI Backend โโโโโถโ PostgreSQL Database โ โ
โ โ (Email/Password)โ โ sp_login_user โ โ (users table) โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐๏ธ VOICE SYMPTOM COLLECTION โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Web Speech API โโโโโถโ Speech-to-Text โโโโโถโ Symptom Phrases Array โ โ
โ โ (Microphone) โ โ Conversion โ โ ["headache", "fever", ...] โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค AI-POWERED SYMPTOM ANALYSIS โ
โ (LangGraph Workflow) โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Raw Symptoms โโโโโถโ Gemini/GPT-4 โโโโโถโ Normalized Symptoms โ โ
โ โ Processing โ โ AI Analysis โ โ ["migraine", "pyrexia", ...] โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Specialist โโโโโโ AI Mapping โโโโโโ Symptom Analysis โ โ
โ โ Recommendation โ โ Algorithm โ โ & Classification โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฅ DOCTOR MATCHING & RETRIEVAL โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Specialist โโโโโถโ FastAPI โโโโโถโ PostgreSQL Query โ โ
โ โ Types โ โsp_get_doctors_by โ โ (doctors table filter) โ โ
โ โ ["cardiology", โ โ _specialist โ โ โ โ
โ โ "neurology"] โ โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Available โโโโโโ Doctor List โโโโโโ Available Time Slots โ โ
โ โ Doctors โ โ with Slots โ โ & Schedules โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐
APPOINTMENT BOOKING โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ User Selects โโโโโถโ Patient โโโโโถโ Appointment โ โ
โ โ Doctor & Slot โ โ Information โ โ Confirmation โ โ
โ โ โ โsp_get_patient_ โ โ sp_create_appointment โ โ
โ โ โ โ details โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ณ PAYMENT PROCESSING โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Razorpay โโโโโถโ Secure Payment โโโโโถโ Booking Confirmation โ โ
โ โ Gateway โ โ Processing โ โ & Notification โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
COMPLETE HEALTHCARE JOURNEY โ
โ โ
โ ๐ค Voice Input โ ๐ค AI Analysis โ ๐ฅ Doctor Match โ ๐
Booking โ ๐ณ Payment โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
User Input (Email/Password) โ FastAPI Login Endpoint โ PostgreSQL sp_login_user โ JWT Token/Session
Microphone โ Web Speech API โ Text Conversion โ Phrase Array โ LangGraph Processing
Raw Symptoms โ Gemini/GPT-4 โ Normalized Symptoms โ Specialist Mapping โ Doctor Recommendations
FastAPI Endpoints โ PostgreSQL Stored Procedures โ Data Retrieval โ JSON Response โ Frontend Display
Doctor Selection โ Patient Details Fetch โ Slot Validation โ Appointment Creation โ Payment Processing
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ โ โ โ โ โ
โ FRONTEND โโโโโถโ BACKEND โโโโโถโ DATABASE โโโโโถโ EXTERNAL โ
โ โ โ โ โ โ โ SERVICES โ
โ โข React โ โ โข FastAPI โ โ โข PostgreSQL โ โ โข Gemini API โ
โ โข Web Speech โ โ โข LangGraph โ โ โข Stored Procs โ โ โข OpenAI API โ
โ โข JavaScript โ โ โข Python โ โ โข Functions โ โ โข Razorpay โ
โ โ โ โ โ โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
HTTP/REST API SQL Queries
(JSON Data Exchange) (Stored Procedures)
This healthcare AI assistant streamlines the patient care journey by providing:
- Intelligent Voice Triage: Natural language symptom collection and analysis
- AI-Powered Diagnosis: Advanced symptom normalization and specialist recommendation
- Smart Doctor Matching: Automated healthcare provider lookup based on specialization
- Seamless Booking: Integrated appointment scheduling with payment processing
- Conversational Interface: Intuitive voice-enabled user experience
- Real-time speech-to-text conversion using Web Speech API
- Natural language processing for symptom collection
- Voice-guided patient triage workflow
- Integration with Gemini and GPT-4 for symptom analysis
- LangGraph-based symptom normalization
- Intelligent specialist mapping and recommendations
- Comprehensive doctor database with specialization filtering
- PostgreSQL-powered efficient data retrieval
- Automated appointment scheduling system
- Secure payment processing via Razorpay
- Test mode support for development
- Transaction management and tracking
Component | Technology | Purpose |
---|---|---|
Frontend | React, CSS, JavaScript | User interface and voice interactions |
Backend | FastAPI, Python | API services and business logic |
AI/ML | Gemini, GPT-4, LangGraph | Natural language processing and AI agents |
Database | PostgreSQL | Data persistence and stored procedures |
Voice | Web Speech API | Speech recognition and synthesis |
Payments | Razorpay | Payment processing and gateway |
Deployment | Uvicorn, Vite | Development and production servers |
healthcare-ai-assistant/
โโโ backend/ # FastAPI backend services
โ โโโ main.py # Application entry point
โ โโโ agents/ # LangGraph AI agents
โ โโโ db/ # Database connections and queries
โ โโโ models.py # Data models and schemas
โ โโโ config.py # Configuration management
โ โโโ .env # Environment variables (excluded from git)
โ
โโโ frontend/ # React frontend application
โ โโโ components/ # Reusable UI components
โ โโโ pages/ # Application pages/views
โ โโโ .env.local # Frontend environment variables
โ
โโโ sql/ # Database schema and functions
โ โโโ schema.sql # Database table definitions
โ โโโ functions/ # PostgreSQL stored procedures
โ โโโ create_login_function.sql
โ โโโ create_appointment_function.sql
โ โโโ get_patient_details.sql
โ โโโ get_doctors_by_specialist.sql
โ
โโโ requirements.txt # Python dependencies
โโโ package.json # Node.js dependencies
โโโ .gitignore # Git ignore rules
โโโ README.md # Project documentation
- Python 3.8+
- Node.js 16+
- PostgreSQL 12+
- Git
psql -U postgres
CREATE DATABASE healthcare;
CREATE USER fastapi_user WITH PASSWORD 'your_secure_password';
GRANT ALL PRIVILEGES ON DATABASE healthcare TO fastapi_user;
\q
psql -U fastapi_user -d healthcare -f sql/schema.sql
psql -U fastapi_user -d healthcare -f sql/functions/create_login_function.sql
psql -U fastapi_user -d healthcare -f sql/functions/create_appointment_function.sql
psql -U fastapi_user -d healthcare -f sql/functions/get_patient_details.sql
psql -U fastapi_user -d healthcare -f sql/functions/get_doctors_by_specialist.sql
cd backend
python -m venv venv
Windows:
venv\Scripts\activate
macOS/Linux:
source venv/bin/activate
pip install -r requirements.txt
Create .env
file in the backend/
directory:
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=fastapi_user
DB_PASSWORD=your_secure_password
DB_NAME=healthcare
# CORS Configuration
FRONTEND_ORIGIN=http://localhost:5173
# AI API Keys
OPENAI_API_KEY=your_openai_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here
uvicorn main:app --reload --host 0.0.0.0 --port 8000
npm install
Create .env.local
file in the root directory:
# API Configuration
VITE_BACKEND_URL=http://localhost:8000
VITE_GEMINI_API_KEY=your_gemini_api_key_here
# Payment Configuration
VITE_RAZORPAY_KEY_ID=your_razorpay_key_id_here
npm run dev
- Create a Razorpay account
- Navigate to API Keys section in dashboard
- Copy the Key ID and Key Secret
- Update the payment configuration in
frontend/components/Recommendation.jsx
- Visit OpenAI Platform
- Create an account and navigate to API Keys
- Generate a new secret key
- Add to backend
.env
file
- Go to Google AI Studio
- Create a new project or select existing
- Generate API key
- Add to both backend
.env
and frontend.env.local
- Sign up at Razorpay Dashboard
- Switch to Test Mode for development
- Copy API keys from Settings > API Keys
- Configure in frontend environment
- Start PostgreSQL service
- Launch Backend:
uvicorn main:app --reload
(frombackend/
directory) - Launch Frontend:
npm run dev
(from root directory) - Access Application: Navigate to
http://localhost:5173
curl http://localhost:8000/health
python -c "from backend.db.connection import get_db_connection; print('DB Connected!' if get_db_connection() else 'DB Connection Failed!')"
- Configure production database credentials
- Set up environment variables on hosting platform
- Deploy using platforms like Heroku, Railway, or DigitalOcean
- Build production bundle:
npm run build
- Deploy to Vercel, Netlify, or similar platforms
- Update CORS settings in backend for production domain
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit changes:
git commit -m 'Add amazing feature'
- Push to branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the GitHub repository
- Check existing documentation and FAQs
- Review the troubleshooting section below
Database Connection Error
- Verify PostgreSQL is running
- Check database credentials in
.env
- Ensure database and user exist
Voice Recognition Not Working
- Use HTTPS or localhost only
- Check browser microphone permissions
- Verify Web Speech API support
API Key Errors
- Validate API keys are correctly set
- Check for trailing spaces or quotes
- Verify API key permissions and quotas
- Multi-language support
- Mobile application development
- Advanced AI model integration
- Telemedicine video consultation
- Electronic health records integration
- Real-time chat support
- Advanced analytics dashboard
Built with โค๏ธ for better healthcare accessibility