MediQueue Conversational AI Triage System

Overview: MediQueue is a conversational AI application that helps streamline the hospital triage process from the comfort of a patient’s home.

Process Details:

At-Home Triage Assessment:

Patients use the MediQueue portal on their phone or laptop to answer a series of questions.

The AI determines the severity of their condition and assigns an initial priority level.

Balancing Severity and Wait Time:

The system dynamically balances medical urgency with how long a patient has been waiting.

This ensures fair queue management by giving proportional weight to both factors.

Providing Initial Home Guidance:

MediQueue offers initial advice on what the patient can do at home while waiting, like simple first aid steps.

It also checks in periodically (e.g., every 30 minutes) to ensure the patient’s condition is stable.

Dynamic Queue Management:

The queue updates in real time as patients are added or removed, maintaining a dynamic balance between severity and waiting time.

User-Initiated Queue Position Change:

Users have the option to voluntarily lower their position in the queue if they realize they’ll be running late or if their condition is less urgent.

This allows them to give others a chance and helps keep the queue fair and flexible.

Preventing Queue Misuse:

If a user has previously misrepresented their condition, the AI will note this and confirm with them on future visits to ensure honesty.

Continued misuse may lead to manual triage at the hospital.

Inspiration Emergency rooms face long wait times and inefficient triage. Patients often wait hours without knowing their position or priority. We built MediQueue to let patients get triaged from home using conversational AI, see their real-time queue position, and receive care guidance—all before arriving at the hospital. This reduces wait times, improves prioritization, and gives patients transparency and control. What it does

MediQueue is a conversational AI triage system that enables at-home assessment through natural conversation with Google Gemini. It analyzes symptoms, assigns a severity score (1-10), and places patients in a dynamic queue that balances medical urgency with wait time fairness. Patients see their real-time position, receive periodic check-ins every 30 minutes to monitor condition changes, and get personalized home care guidance. The system automatically detects emergencies, prevents queue misuse through pattern detection, and allows patients to voluntarily lower their position if their condition improves. All updates happen in real time via WebSocket connections. How we built it We built a full-stack application with a Python/FastAPI backend and a React frontend. The backend uses FastAPI for REST endpoints and WebSocket support, SQLAlchemy for database operations, and APScheduler for periodic check-ins. Google Gemini API handles natural conversation and triage analysis, extracting structured JSON data from conversations. The frontend is built with React and Vite, using Axios for API calls and Reconnecting WebSocket for real-time updates. The queue management system uses a priority formula that combines 70% severity score with 30% normalized wait time to balance urgency and fairness. All data is persisted in SQLite, including user sessions, conversation histories, queue entries, and check-in logs. The system features error handling, model fallback mechanisms, and a modular architecture for easy extension. Challenges we ran into One major challenge was implementing real-time WebSocket updates across multiple clients while maintaining queue consistency. We solved this with a broadcast mechanism that updates all connected users simultaneously. Another challenge was extracting structured JSON data from Gemini's natural language responses—we implemented robust parsing that handles markdown code blocks and fallback scenarios. Integrating periodic check-ins with the WebSocket system required careful async handling to prevent blocking. We also faced issues with Gemini model availability and implemented a fallback system that tries multiple model versions. Ensuring the priority algorithm was fair while preventing queue manipulation required balancing multiple factors. Database session management in the scheduler was tricky, requiring proper lifecycle handling to prevent connection issues. Accomplishments that we're proud of We're proud of creating a complete end-to-end solution that works seamlessly from conversation to queue management. The real-time WebSocket implementation provides instant updates to all users. Our misuse detection system successfully identifies suspicious patterns and prevents queue manipulation. The conversational AI integration feels natural and asks relevant follow-up questions. We built a production-ready architecture with proper error handling, database persistence, and scalable design. The dynamic priority algorithm balances medical urgency with fairness effectively. Most importantly, we created a solution that genuinely addresses real healthcare problems and could make a meaningful impact on patient care and hospital efficiency. What we learned We learned how to integrate Google Gemini API effectively for medical triage applications, including prompt engineering for structured data extraction. Building real-time systems with WebSockets taught us about connection management, reconnection strategies, and broadcast patterns. We gained experience with FastAPI's async capabilities and WebSocket support. Working with SQLAlchemy helped us understand ORM relationships and database session management. We learned the importance of error handling and graceful degradation when working with external AI APIs. The project taught us how to balance technical complexity with user experience, ensuring the system remains intuitive despite sophisticated backend logic. We also learned about healthcare system challenges and the importance of patient safety considerations in medical technology. What's next for MediQueue Next steps include deploying to cloud infrastructure (AWS/Azure/GCP) for production readiness. We plan to partner with hospitals for pilot testing with real patients to validate the system and collect feedback. We'll add HIPAA compliance features including data encryption, access controls, and audit logging. Mobile app development for iOS and Android will make the system more accessible. We'll integrate SMS notifications to alert patients when it's their turn. An analytics dashboard for hospital administrators will provide insights into queue metrics and patient patterns. Multi-language support will help serve diverse patient populations. We'll add integration capabilities with existing Electronic Medical Record (EMR) systems. Predictive analytics will forecast wait times based on historical data. Long-term, we envision expanding to multi-facility coordination, wearable device integration for real-time vital signs monitoring, and potentially training a custom machine learning model on hospital-specific data for even more accurate triage assessments.

Built With

Share this project:

Updates