
MediAI
An AI-powered healthcare platform for disease prediction, symptom analysis, and patient-doctor communication.
Timeline
3 Weeks
Role
Full Stack Developer
Team
Solo
Status
completed
Technology Stack
Challenges
- ML Model Integration
- Real-time Chat
- Role-based Access Control
- AI Prompt Design
Key Learnings
- Healthcare System Architecture
- OpenAI API Integration
- Socket.IO
- Secure Data Handling
Overview
MediAI is a healthcare platform that brings AI into the patient experience. Patients enter their symptoms and receive a preliminary risk assessment from a machine learning model. An AI chatbot powered by OpenAI provides plain-language guidance. A doctor recommendation system connects patients with relevant specialists. A centralized records system keeps medical history accessible to both patients and doctors from a single place.
The goal was not to replace doctors, but to reduce the friction between noticing a symptom and getting meaningful guidance on what to do next.
Problem
Patients often delay seeking care because they are unsure whether their symptoms are serious. When they do reach a clinic, intake is slow and doctors rarely have access to history from previous visits at different providers. The time between feeling unwell and receiving a diagnosis is filled with uncertainty and waiting.
Solution
MediAI breaks that gap into smaller steps. A symptom checker gives patients an initial risk signal so they can decide whether to book urgent care or monitor at home. The AI chatbot answers follow-up questions in plain terms. Doctor profiles list specializations and ratings so patients can find the right provider. All records from past interactions are stored in one place and accessible to whatever doctor the patient sees next.
Key Features
- Symptom checker with AI-based disease risk prediction
- AI chatbot for patient guidance powered by OpenAI
- Doctor recommendation and booking system
- Digital medical records with role-based access
- Real-time chat between patients and doctors via Socket.IO
- Admin dashboard for managing users, doctors, and records
- Secure authentication with JWT
Problems Faced
Integrating the ML model with the Node.js backend
The disease prediction model was written in Python using scikit-learn. Calling a Python process directly from Node.js is unreliable. The solution was wrapping the model in a lightweight Flask API and calling it as an internal HTTP service from Express. This kept the machine learning layer independent and easy to update without touching the main API.
Real-time chat between patients and doctors
HTTP polling for chat messages was adding noticeable latency. Patients and doctors needed to see replies as they arrived without refreshing the page. Socket.IO was added alongside Express to handle WebSocket connections. Each conversation gets its own room so messages only reach the two people involved.
Securing patient data by role
Medical records should not be visible to every authenticated user. A doctor should see only their patients. A patient should see only their own records. An admin should be able to manage the system without casually reading individual records.
Role-based middleware was added to every protected route. JWT tokens carry the user role, and each controller validates the role before touching the database. Any request that does not match the expected role gets a 403 before any data is returned.
Making the AI chatbot genuinely useful
The default OpenAI behavior for medical prompts leans heavily on disclaimers and redirects almost every question to "consult a doctor." While the caution is appropriate, a response that is entirely a disclaimer does not help the patient at all.
The system prompt was tuned to make the chatbot explain symptoms in plain language, confirm when something sounds minor, and only escalate when the symptom combination suggested urgency. Several iterations were needed to find the right balance between being helpful and being appropriately cautious.
Conclusion
MediAI showed how a focused MERN stack application can tackle a meaningful domain when the feature scope stays deliberate. The technical side was straightforward. The harder part was making the AI layer behave in a way that felt genuinely useful rather than defensive, which required more iteration on the prompt design than on any part of the code.