Inspiration

Night shifts in medical clinics are uniquely challenging: limited staff, high-pressure decisions, and unpredictable patient inflow. Doctors often juggle multiple urgent cases without enough real-time support.

I wanted to build something that reduces cognitive load, organizes chaos, and gives doctors a fast, reliable triage system especially during the hours when help is scarce.

NightShift MD was inspired by real-world experiences where a single decision delayed by minutes could change patient outcomes. I imagined: “What if AI could pre-triage patients while the doctor is busy?”

That idea became the foundation of this project.

What NightShift MD Does

NightShift MD is an AI-assisted triage and workflow system designed specifically for night-shift medical clinics, where staff numbers are low and decisions must be fast.

Here’s the seamless, end-to-end workflow:

  1. Patient Input: Patients submit their symptoms through a simple mobile-friendly form.
  2. AI Triage Engine: The system instantly analyzes the symptoms and automatically generates a structured assessment:
    • Symptom Category
    • Urgency Level
    • Priority Score (using weighted logic)
    • Recommended Next Action
  3. Real-Time Alert: The triage result is stored in the database and instantly appears on the doctor’s real-time dashboard.
  4. Doctor Dashboard: The doctor sees an organized, live overview providing:
    • Current case list
    • Severity color codes
    • Patient notes
    • Status indicators
  5. Workflow Completion: Doctors can review, accept, or dismiss cases, completing the workflow loop and closing the case.

The result? The whole process ensures faster decision-making, significantly lower cognitive load, and safer patient handling during critical night shifts.

How I Built It

NightShift MD is built as a tightly integrated system of multiple technologies:

Tech Stack

  • Next.js 14 (App Router) – frontend + server actions
  • Supabase – database, auth, and real-time channels
  • Postgres – structured patient + case data
  • AI Triage Engine – symptom → category → priority scoring
  • TailwindCSS + ShadCN – clean, responsive UI
  • Vercel – deployment

System Architecture

  1. Patients submit symptoms through a minimal mobile-first form.
  2. The system analyzes symptoms using an AI-driven triage model:
    • Pattern recognition
    • Urgency scoring
    • Recommended category
  3. The backend writes the triage result instantly into the Supabase DB.
  4. Real-time subscriptions update the doctor’s dashboard automatically.
  5. Doctors can view: Current cases, Severity color codes, Patient notes, and Status changes.
  6. The doctor updates the action (reviewed, accepted, dismissed), closing the loop.

This stitches AI + database + real-time communication into one powerful workflow.

Challenges I Faced

  1. Designing a safe triage workflow
    • AI-generated triage is helpful, but it must never override medical judgement. I had to design prompts and UI flows that keep the doctor fully in control.
  2. Real-time updates without lag
    • Night-shift situations rely on speed. I experimented with Supabase channels, optimized queries, and minimized re-renders.
  3. Creating a calm, non-overwhelming UI
    • The UI required: clear hierarchy, high contrast for urgency, readable typography, and zero visual clutter.
  4. Managing authentication flows quickly
    • Doctors and patients interact differently, so routing and roles needed careful Supabase Auth setup.
  5. Balancing speed with data accuracy
    • I focused on keeping triage results fast but still meaningful using structured outputs.

Math + Logic Behind AI Triage

The urgency level is influenced by weighted scoring:

$$U = w_s S + w_d D + w_p P$$

Where:

  • $S$ = symptom severity
  • $D$ = duration
  • $P$ = pain level
  • $w_s, w_d, w_p$ = calibrated weights

This helps normalize triage output for consistent categorization.

Accomplishments that we're proud of

  • Real-Time Triage System: Built a fully functional system that connects patients and doctors instantly with live, bi-directional updates powered by Supabase Real-Time Channels.

  • AI-Assisted Pipeline: Designed an AI-assisted triage pipeline that safely converts natural language symptoms into structured urgency levels and medical categories without overriding human judgment.

  • Production Quality UI/UX: Created a calm, fast, and reliable healthcare UI that works especially well for high-stress, night-shift environments by focusing on clarity and zero clutter.

  • Seamless Integration: Integrated multiple complex technologies (Next.js, Supabase, AI Triage Engine, Postgres) into one cohesive and seamless workflow.

  • Secure Data Handling: Implemented secure medical data handling using Supabase Row-Level Security (RLS) and structured database design principles.

  • Optimized Deployment: Achieved end-to-end deployment with optimized performance and serverless functionality on Vercel.

  • Cognitive Load Reduction: Reduced doctor cognitive load by auto-sorting cases based on a calculated severity score:

    $$\text{PriorityScore} = w_1 \cdot \text{Urgency} + w_2 \cdot \text{SymptomSeverity} + w_3 \cdot \text{RiskFactors}$$

  • Prototype to Product: Successfully turned a complex hackathon idea into a polished, production-quality prototype within a short time frame.

What I Learned

This project challenged me across technical architecture, AI design, and real-world usability. Here are the key things I learned:

  • AI-assisted triage design: How to build a safe, structured triage pipeline using prompt engineering, system constraints, and rule-based verification. I also explored how to express clinical thresholds using math, e.g. [ \text{TriageScore} = \alpha \cdot \text{VitalSigns} + \beta \cdot \text{SymptomSeverity} ]

  • Next.js Server Actions + real-time backend: Implementing instant data flows across clients, understanding server-side mutations, and maintaining consistent state.

  • Supabase fundamentals: Deep understanding of Auth, schema design, RLS rules, and how secure real-time tables can power healthcare dashboards.

  • Building real-time medical dashboards: Ensuring reliability, low latency, and clarity for night-shift clinicians who have minimal time to think.

  • Healthcare UI/UX principles: Designing a calm, clean interface with a focus on clarity under stress, predictable interaction patterns, and error-proof workflows.

  • Medical decision-flow architecture: Learning how to structure diagnostic paths so that automation assists but never overrides human judgement.

  • Balancing automation with human oversight: Creating flows where AI handles pattern recognition, but doctors always verify or adjust outcomes.

  • Full-stack deployment: Deploying the complete system (Next.js + Supabase) end-to-end, optimizing for speed, safety, and reliability.

What's next for NightShift MD

NightShift MD is just the beginning. Our roadmap focuses on expanding AI sophistication, clinical utility, and platform robustness to create a true enterprise solution.

1. Smarter AI Triage Models

We plan to evolve the core AI engine into a sophisticated decision support system:

  • Condition-Specific Models: Developing specialized models for common night-shift emergencies (e.g., cardiac, respiratory).
  • Risk-Aware Scoring: Utilizing medical datasets to improve symptom clustering and factor in complex risk profiles.
  • Safety & Uncertainty Detection: Implementing safety guardrails and actively detecting and flagging cases where the AI's confidence score is low, prioritizing doctor review.

2. Doctor Insights & Analytics

Adding a powerful analytics dashboard to drive operational efficiency:

  • Operational Metrics: Tracking peak case times, common symptom patterns, and average case response times.
  • Workload Management: Analyzing workload distribution across shifts and staff to optimize scheduling and reduce burnout.

3. Enterprise & Multi-Clinic Support

Scaling the platform to handle larger hospital systems:

  • Multi-Facility Management: Allowing hospitals to manage multiple satellite clinics or departments from a single platform.
  • Intelligent Routing: Implementing logic to automatically assign cases to different specialists or route patients based on geographic location.

4. Enhanced Communication & Follow-Up

Extending the platform's utility beyond the initial triage:

  • Automated Patient Follow-Up: Sending automated prompts or reminders to patients to track symptom progression or medication responses.
  • Urgent Warning Signs: Developing smart alerts that trigger if a patient reports escalating symptoms after initial treatment.

5. More Patient Tools

Improving the patient experience and data quality:

  • Symptom History: Giving patients a record of their past triage history for better longitudinal care.
  • Visual Diagnosis: Introducing secure photo uploads for rashes, cuts, or other visual symptoms to enrich the triage data.

6. Advanced Security & Compliance

Prioritizing the necessary regulatory framework for healthcare:

  • HIPAA/GDPR-Ready Safeguards: Moving toward full compliance, including encrypted audit logs and advanced data retention policies.
  • Deeper Role-Based Access: Implementing granular session-based and role-based permissions for staff access.

7. Offline-First Mode

Ensuring resilience in all clinical environments:

  • Connection Resilience: Enabling clinics with unstable internet to continue collecting cases locally.
  • Automatic Sync: Automatically syncing all data securely when the connection is restored, ensuring no data loss.

8. Integration with Medical Devices

Incorporating objective data into the triage process:

  • Vital Sign Import: Connecting with pulse oximeters, temperature sensors, and heart rate monitors to auto-import objective vital signs directly into the triage scoring for more accurate assessment.

Final Thoughts

NightShift MD is my attempt to turn night-shift chaos into structured clarity.

It combines AI, real-time systems, and modern UX into one unified tool designed to help doctors focus on what matters most: patients, not paperwork.

Built With

  • auth
  • backend-api-routes
  • kiro
  • kiromcp
  • next.js
  • postgresql
  • server-actions-typescript-?-full-typing-across-ui-+-logic-tailwindcss-?-fast
  • supabase
  • tailwindcss
  • typescript
  • utility-based-styling-supabase-?-postgres-database
  • vercel
Share this project:

Updates