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.
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
The technical architecture is visualized through the comprehensive diagrams above, showing the integration between Frontend (React), Backend (FastAPI), Database (PostgreSQL), and External Services (AI APIs, Payment Gateway).
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 postgresCREATE DATABASE healthcare;
CREATE USER fastapi_user WITH PASSWORD 'your_secure_password';
GRANT ALL PRIVILEGES ON DATABASE healthcare TO fastapi_user;
\qpsql -U fastapi_user -d healthcare -f sql/schema.sqlpsql -U fastapi_user -d healthcare -f sql/functions/create_login_function.sqlpsql -U fastapi_user -d healthcare -f sql/functions/create_appointment_function.sqlpsql -U fastapi_user -d healthcare -f sql/functions/get_patient_details.sqlpsql -U fastapi_user -d healthcare -f sql/functions/get_doctors_by_specialist.sqlcd backendpython -m venv venvWindows:
venv\Scripts\activatemacOS/Linux:
source venv/bin/activatepip install -r requirements.txtCreate .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_hereuvicorn main:app --reload --host 0.0.0.0 --port 8000npm installCreate .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_herenpm 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
.envfile
- Go to Google AI Studio
- Create a new project or select existing
- Generate API key
- Add to both backend
.envand 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/healthpython -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






