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 → UI Sync (isMicActive) → LangGraph Processing
Raw Symptoms → GPT-4 Normalization → DuckDuckGo (Prognosis) → 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 and multi-step agent flow
- Automated Prognosis: Real-time web search (DuckDuckGo) on reputable sites like WebMD and Mayo Clinic
- Intelligent specialist mapping and recommendations with medical disclaimers
- Comprehensive doctor database covering Family Medicine, Cardiology, Psychiatry, Gastroenterology, Orthopedics, and more
- PostgreSQL-powered efficient data retrieval via stored procedures
- Automated appointment scheduling system with real-time slot selection
- 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 and SPA server
│ ├── langgraph_llm_agents.py # LangGraph AI orchestration
│ ├── db.py # Database connection pool
│ ├── models.py # Pydantic data models
│ └── config.py # Configuration management
│
├── src/ # React frontend application (Vite)
│ ├── components/ # UI Components (Assistant, Dashboard, etc.)
│ ├── context/ # UserContext for Voice/AI state
│ ├── App.jsx # Login/Landing page
│ └── main.jsx # Application entry
│
├── sql/ # Database schema and functions
│ ├── schema.sql # Table definitions & Seed data
│ └── functions/ # PostgreSQL stored procedures
│ ├── sp_login_user.sql
│ ├── sp_get_specialists.sql
│ ├── sp_create_appointment.sql
│ └── sp_get_doctors_by_specialists.sql
│
├── Dockerfile # Multi-stage build (Node + Python)
├── docker-compose.yml # Container orchestration
├── host_local.sh # One-click automation script
└── README.md # Project documentation
The easiest way to run the application is using the provided automation script which handles environment setup, API key prompts, and Docker orchestration.
- Docker and Docker Compose
- Bash environment (Linux, macOS, or WSL)
- API Keys: OpenAI and Google Gemini
Run the following command in your terminal:
chmod +x host_local.sh
./host_local.shWhat this script does:
- Checks for Docker/Compose installation.
- Prompts for missing API keys (OpenAI, Gemini).
- Creates necessary
.envand.env.localfiles. - Builds the multi-stage Docker image (React build + Python server).
- Starts PostgreSQL and the Application containers.
- Initializes the database schema and stored procedures automatically.
Once the containers are running:
- Frontend & Backend:
http://localhost:8080 - Database:
localhost:5432
If you prefer to run the components separately without Docker:
- Install PostgreSQL.
- Run
sql/schema.sqland all scripts insql/functions/.
cd backendpip install -r requirements.txt- Set environment variables in
.env. uvicorn main:app --reload --port 8800
npm install- Set
VITE_BACKEND_URL=http://localhost:8800in.env.local. npm run dev(Runs onhttp://localhost:5173)
- 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
- Execute:
./host_local.sh - Login: Use test credentials
john@google.com/user2(or checksql/schema.sqlfor others). - Voice Interaction: Ensure you use Chrome or Edge for the best Web Speech API support. Give microphone permissions when prompted.
- Analysis: Speak your symptoms, then click Disconnect & Analyze to see the AI agent's specialist recommendations and prognosis.
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
The project includes an end-to-end test suite using Playwright that mocks the Web Speech API to test the full logic flow.
- Ensure the app is running:
./host_local.sh - Run the tests:
Note: On the first run, you may need to install Playwright browsers:
npm testnpx playwright install
- 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






