Inspiration

Healthcare in Pakistan is fragmented — long queues, misrouted patients, zero mental health infrastructure, and paper records that get lost. We wanted to build something that a real clinic could actually deploy: a system where AI does the heavy lifting of triage and emotional support, so doctors can focus on what matters.

We were also inspired by a gap we noticed personally — mental health support in Urdu is almost nonexistent in software. Most therapy apps are English-only, which locks out the majority of Pakistani users. Dr. Aisha was our answer to that.

What it does

MediSync is an end-to-end clinic management platform with four core capabilities:

1. AI-Powered Symptom Triage Patients describe their symptoms, age, and gender. LLaMA 3 analyzes the input and returns a recommended medical specialty, a priority score from 1–10, urgency flags, and red flags — then instantly surfaces matching available doctors from that specialty. No more patients sitting in the wrong queue.

2. Smart Appointment Scheduling Patients book directly from triage results or browse doctor listings independently. The system checks real-time slot availability, prevents double-booking, and sends confirmation notifications. Doctors manage their own schedules through a dedicated schedule manager.

3. Dr. Aisha — Bilingual AI Therapist A persistent, session-aware AI therapist that converses in English, Roman Urdu, or Urdu script — automatically detecting the patient's preferred language. Sessions are saved, mood is tracked across conversations, and a risk level is maintained silently in the background. Voice input (via Web Speech API) is supported for patients who prefer to speak rather than type.

4. Medical Records & AI Discharge Summaries Doctors create and manage structured medical records per patient. For any record, they can request an AI-generated discharge summary and 3 personalised follow-up recommendations in seconds — cutting documentation time significantly.

Role-Based Access The platform serves three distinct roles — Admin, Doctor, and Patient — each with a tailored dashboard: admins manage users and analytics, doctors handle schedules and records, patients book appointments and access therapy.

How we built it

MediSync is a full-stack MERN application split into a React (Vite) frontend and an Express + MongoDB backend.

Challenges we ran into

1. Bilingual AI consistency — Getting LLaMA to reliably mix Urdu phrases into English responses (and fully switch to Roman Urdu when needed) required careful prompt engineering. We built a languageDetect utility on the frontend to detect script and pass language context.

2. Structured JSON from LLM — Triage depends on strict JSON output from the model. LLMs occasionally wrap responses in markdown fences or add preamble text. We handled this with .replace(/json|/gi, '').trim() + a safe fallback object so the system never crashes on a bad AI response.

3. Priority scoring fairness — A flat AI score doesn't account for vulnerable populations. We designed the Priority Engine to automatically escalate priority for patients under 5 or over 70, ensuring children and elderly patients aren't deprioritized by a model that wasn't calibrated on Pakistani demographics.

4. Real-time slot availability — Synchronizing doctor availability slots with appointment creation without double-booking required careful backend logic in appointmentLogic.js, including conflict detection across concurrent requests.

Accomplishments that we're proud of

Bilingual therapy that actually works — Dr. Aisha seamlessly switches between English and Urdu/Roman Urdu mid-conversation, with correct RTL text direction, voice input in ur-PK, and warm culturally-aware phrasing. No existing open-source hackathon project we found has pulled this off at this level.

  • Zero AI crashes in production — Every single LLM call has a typed fallback object. The app has never thrown an unhandled error due to a bad Groq response. That reliability took real engineering discipline under time pressure.

  • Full-stack in one hackathon — We shipped a complete multi-role system: JWT auth, role-based middleware, 7 Mongoose models, 10+ API controllers, a React frontend with animated transitions, form validation, voice input, analytics dashboards, and a test suite — all functioning together.

  • Age-aware priority engine — We didn't just pipe AI scores directly to users. We built a custom priority escalation layer that automatically boosts severity for children under 5 and elderly patients over 70 — a clinically meaningful decision that a naive AI wouldn't make on its own.

  • Mood tracking without the user knowing — Every 6 messages in a therapy session, a background LLaMA call silently analyzes the conversation for primaryEmotion and riskLevel. Doctors can review this data without the patient ever being interrupted or made anxious by a clinical prompt.

What we learned

Prompt engineering for structured output is a discipline — Getting LLaMA to return strict, parseable JSON every single time — no markdown fences, no preamble, no hallucinated fields — required iterative prompt design, output cleaning, and safe fallbacks. It's not plug-and-play.

  • Bilingual UX goes deeper than translation — Supporting Urdu meant handling RTL text direction, script detection, ur-PK voice synthesis, and culturally appropriate tone — not just swapping words. Language is a UX problem as much as a linguistics one.

  • AI fallback design is as important as the happy path — We spent almost as much time designing what happens when the AI fails as what happens when it works. Every endpoint degrades gracefully.

  • Multi-role systems require upfront schema discipline — Having Admin, Doctor, and Patient roles touching the same data means your models and middleware need to be airtight from day one. Retrofitting role logic late is painful.

  • Speed and reliability are a tradeoff you have to make consciously — We chose Groq's LLaMA 3.1 8B Instant over larger models specifically for response latency in a real-time chat context. Bigger isn't always better when a patient is waiting for a reply.

What's next for MediSync — AI-Powered Healthcare Management System

  • Push notifications & email reminders — Nodemailer is already wired into the backend. The next step is scheduling appointment reminders and follow-up nudges via email and SMS using a service like Twilio.

  • Prescription generation — Doctors should be able to generate a signed digital prescription PDF directly from a medical record, with patient-friendly language auto-generated by AI.

  • Expanded crisis protocol for Dr. Aisha — When riskLevel: "high" is detected, the system should do more than mention a helpline number. Next version will alert a designated emergency contact and flag the session for immediate human review.

  • Offline-first mobile app — Patients in rural Pakistan often have intermittent connectivity. A React Native app with offline medical record access and sync-on-reconnect would make MediSync genuinely accessible at scale.

  • Hospital network mode — Right now MediSync is a single-clinic system. The architecture is ready to go multi-tenant — each hospital gets its own isolated data space while sharing the AI infrastructure.

  • Diagnostic image upload — Allow doctors to attach X-rays and lab reports to medical records, with an AI layer that can flag anomalies as a second opinion tool.

Built With

Share this project:

Updates

Submission history