Hybrid MediDesk upgrade: public symptom intake (safety + triage + booking), doctor RAG dashboard, admin analytics — while keeping Clerk auth and Vapi voice consultations.
DEMONSTRATION ONLY — Not for real medical use.
- Public intake chat — safety layer (regex + LLM), streamed chat, background triage
- Emergency escalation — full-screen takeover with 108 / mental-health helplines
- NL appointment booking — tool calling against real DB slots (no hallucinated times)
- Voice consultations — existing Vapi flow, with pre-call safety check
- Intake → voice bridge — continue from triage into a specialist voice session
- Doctor queue + RAG — urgency-sorted queue; patient-scoped Upstash Vector namespaces
- SOAP note drafting — AI draft, doctor must approve
- Admin — analytics, safety events, immutable audit log
- Clerk roles —
publicMetadata.role:patient|doctor|admin
npm install
cp .env.example .env # fill keys
npm run db:push
npm run seed
npm run seed:vector # optional — needs Upstash Vector
npm run devOpen http://localhost:3000.
- Patient intake:
/intake - Voice dashboard:
/dashboard(Clerk sign-in) - Doctor:
/doctor/dashboard(set ClerkpublicMetadata.role="doctor") - Admin:
/admin/analytics(role ="admin")
See .env.example. Key vars:
| Variable | Purpose |
|---|---|
DATABASE_URL |
Neon Postgres |
| Clerk keys | Auth + roles |
GEMINI_API_KEY / GOOGLE_GENERATIVE_AI_API_KEY |
Intake / triage / RAG |
NEXT_PUBLIC_VAPI_API_KEY |
Voice |
| Upstash Vector / Redis | RAG + rate limiting |
NEXT_PUBLIC_DEMO_MODE |
Demo banner (default on) |
| Command | Description |
|---|---|
npm run db:push |
Push Drizzle schema (additive) |
npm run seed |
Seed doctors, 12 synthetic patients, slots |
npm run seed:vector |
Embed patient notes into namespaces |
npm test |
Safety + mapping unit tests |
Intake message → rate limit → injection check → regex safety → LLM safety
→ if emergency: escalate (no chat)
→ else streamText chat (+ booking tools)
→ parallel: triage extract → DB
Voice: existing Vapi; pre-call POST /api/intake/safety-check
Doctor RAG: Upstash namespace patient_{uuid} only
MIT — portfolio/demo. Do not ship for real medical care.