Skip to content

Repository files navigation

MeroDaktar

MeroDaktar — AI Telemedicine, reimagined

Talk to an AI medical assistant by voice or text, book verified doctors, and manage your entire health record — in one calm, secure place.

React TypeScript FastAPI PostgreSQL Redis Docker

Tests Coverage API AI Contributors

MeroDaktar demo — Nepali voice/text AI consultation, appointments, EHR and doctor portal
Live walkthrough: sign-in · patient dashboard · AI consultation (Nepali) · appointments · health records · doctor portal

✦ What is MeroDaktar?

MeroDaktar ( “My Doctor” ) is a full-stack telemedicine platform that brings primary-care triage to anyone with a phone. A patient describes how they feel — by voice or by typing — and a medical-grade AI assistant runs a structured symptom interview, flags urgency, remembers the conversation, and can hand off to a real, verified doctor for an appointment. Every interaction is captured in a proper Electronic Health Record (EHR).

It is not a chatbot demo. It is a layered, tested, production-shaped system: 65 REST endpoints, a clean routes → services → repositories → models backend, a pluggable AI engine, Redis-backed conversation memory with semantic search, and a complete doctor portal.


✦ Why it stands out

🎙️ Voice-first triage 🧠 Medical-grade AI 🔁 It remembers
Speak your symptoms in Nepali or English — Gemini transcribes, the AI replies in your language, and reads answers aloud. Pluggable engine via one env var — Gemini, MedGemma, or OpenAI — same prompts, swappable backend. Redis session memory + semantic vector search mean no repeated questions across a consultation.
🩺 Real doctor handoff 📋 Full EHR 🛡️ Built to last
Live availability, time-slot booking, and a complete doctor dashboard with encounter notes. Vitals, allergies, medications and a chronological encounter timeline per patient. 49 automated tests · 91% coverage, JWT auth, Dockerised infra.

📊 By the numbers

Metric Value
REST API endpoints 65 (27 POST · 24 GET · 8 PUT · 5 DELETE · 1 PATCH)
Backend Python 7,630 lines across 68 modules
Frontend TypeScript / React 6,536 lines — 9 screens + a shared design system
Feature modules 11 (auth, chat, appointments, EHR, schedules, reports, doctors, dashboard, voice ASR, users, admin)
Data models 8 (User, Doctor, Appointment, Schedule, Encounter, Consultation, EHR, Report)
Automated tests 49 — 31 unit · 15 integration · 3 end-to-end
Test coverage 91%
AI engines 3 — MedGemma · Gemini 2.0 Flash (ASR) · OpenAI (gpt-4o-mini + embeddings)
Contributors 3
Total codebase ~15,500 lines

✦ Demo — the patient journey

Patient dashboard
🏠 Patient dashboard — health hub with quick actions, recent consultations & upcoming visits
AI consultation
💬 AI consultation — voice + text symptom triage with conversation history
Appointments
📅 Appointments — browse doctors, pick a slot, book & manage
Health records (EHR)
📋 Health records (EHR) — vitals, allergies, medications & encounter timeline
Doctor portal
🩺 Doctor portal — overview, appointments, patients & schedule management
Doctor sign-in
🔐 Separate doctor portal — dedicated, JWT-secured sign-in

The flows below are live in the app today.

  Sign up / Log in ─▶ Dashboard ─▶ "AI Consultation"
        │                              │
        │            ┌─────────────────┴─────────────────┐
        │         🎙️ Speak symptoms              ⌨️  Type symptoms
        │            └─────────────────┬─────────────────┘
        │                              ▼
        │              AI triages → asks follow-ups → flags urgency 🟢🟡🔴
        │                              ▼
        │              "This looks moderate — let's book a doctor."
        ▼                              ▼
   Health Records (EHR)  ◀──  Book Appointment ─▶  Doctor reviews & adds encounter notes

1. Voice or text consultation. The patient opens AI Consultation, taps the mic (or types), and describes their symptoms. Gemini transcribes speech in real time; the AI assistant conducts a guided symptom interview and classifies urgency as routine / moderate / emergency.

2. Memory that follows the conversation. Redis stores the session and a semantic index of prior turns, so the assistant never asks the same question twice and keeps full patient context (demographics, history, EHR) in every prompt.

3. Seamless doctor handoff. When the patient needs a clinician, they book a real appointment against a doctor's live availability. Doctors get a full dashboard — appointments, patient records, and per-visit encounter notes that flow back into the EHR.

4. One health record. Vitals, allergies, medications and a chronological encounter timeline live in the patient's EHR, viewable any time.


✦ Architecture

flowchart TB
    subgraph Client["🖥️  Frontend — React 18 · TypeScript · Vite · Tailwind"]
        UI["Patient & Doctor SPA<br/>voice recorder · chat · EHR · scheduling"]
    end

    subgraph API["⚙️  FastAPI — layered backend (65 endpoints)"]
        direction TB
        R["Routes /api/v1<br/>auth · chat · appointments · ehr · schedules · reports · doctors · admin"]
        S["Services<br/>business logic · AI orchestration"]
        Repo["Repositories<br/>data access"]
        M["SQLAlchemy Models"]
        R --> S --> Repo --> M
    end

    subgraph AI["🧠  AI Engine (pluggable via AI_BACKEND)"]
        MG["MedGemma<br/>medical LLM"]
        OAI["OpenAI<br/>gpt-4o-mini + embeddings"]
        ASR["Gemini 2.0 Flash<br/>speech → text"]
    end

    subgraph Data["💾  Data layer"]
        PG[("PostgreSQL<br/>system of record")]
        RD[("Redis<br/>session memory + vector search")]
    end

    UI -->|JWT REST| R
    UI -->|🎙️ audio| ASR
    S --> MG
    S --> OAI
    S --> RD
    M --> PG
    ASR --> S
Loading

Voice consultation flow

sequenceDiagram
    actor P as Patient
    participant FE as Frontend (SPA)
    participant API as FastAPI
    participant G as Gemini ASR
    participant LLM as MedGemma / OpenAI
    participant R as Redis

    P->>FE: 🎙️ Records symptoms (MediaRecorder)
    FE->>API: POST /api/v1/speech/transcribe (audio)
    API->>G: transcribe
    G-->>API: transcript
    API-->>FE: text
    FE->>API: POST /api/v1/chat/session/{id}/message
    API->>R: load session memory + semantic context
    API->>LLM: prompt (symptoms + full patient context)
    LLM-->>API: triage + follow-up + urgency
    API->>R: persist turn + embeddings
    API-->>FE: response
    FE-->>P: 🔊 reads answer aloud (TTS) + urgency badge
Loading

✦ Feature matrix

Area Patient Doctor
AI consultation Voice + text symptom triage, urgency flags, conversation history —
Memory & context Redis session memory, semantic search, full EHR context in prompts —
Appointments Browse doctors, live slots, book / cancel Manage availability, confirm / complete, cancel
EHR Vitals, allergies, medications, encounter timeline Read patient records, write encounter notes
Reports AI-generated symptom-assessment reports Patient-linked reports
Auth & security JWT login / registration Separate doctor portal & JWT
Dashboards Health summary, recent consultations, upcoming visits Stats, schedule, patient & appointment management

✦ Tech stack

Frontend · React 18 · TypeScript · Vite · Tailwind CSS · React Router · Axios · Heroicons Backend · FastAPI · Uvicorn · SQLAlchemy · Pydantic v2 · python-jose (JWT) · passlib + bcrypt Data · PostgreSQL · Redis (caching, session memory, vector search) AI · Google MedGemma · Gemini 2.0 Flash (ASR) · OpenAI gpt-4o-mini & text-embedding-3-small · google-genai Tooling · Docker Compose (postgres · pgadmin · redis) · pytest · pytest-asyncio · pytest-cov


✦ Design system

The frontend was rebuilt on a bespoke “Health-Tech Gradient” design system — deep-navy surfaces, violet→cyan gradients, glassmorphism and soft glow, with Space Grotesk display type over Inter. Everything renders from shared primitives so the whole product feels cohesive:

  • src/lib/ui.tsx — Button, Card, Input, Select, Field, Badge, StatCard, Spinner, Avatar, PageHeader, EmptyState
  • src/components/layout/AppLayout.tsx — responsive sidebar + top-bar shell for patient & doctor portals
  • src/components/layout/AuthLayout.tsx — split hero + form for sign-in / sign-up
  • tailwind.config.js + src/index.css — design tokens, animations and glass utilities

✦ Project structure

merodaktar/
├── app/                      # FastAPI backend (7,630 LOC · 68 modules)
│   ├── api/v1/               # 11 route modules · 65 endpoints
│   ├── services/             # business logic + AI orchestration
│   ├── repositories/         # data-access layer
│   ├── models/               # 8 SQLAlchemy models
│   ├── schemas/              # Pydantic request/response models
│   ├── core/                 # security, middleware, exceptions
│   ├── config/               # settings + database
│   └── migrations/           # schema migrations
├── frontend/                 # React + TypeScript SPA (6,536 LOC)
│   └── src/
│       ├── components/        # 9 feature screens
│       ├── components/layout/ # AppLayout (sidebar shell) + AuthLayout
│       └── lib/ui.tsx         # shared design-system primitives
├── tests/                    # 49 tests — unit · integration · e2e
├── docker-compose.yaml       # postgres + pgadmin + redis
└── requirements.txt

✦ Quick start

1. Infrastructure (Docker)

docker compose up -d        # starts postgres, pgadmin, redis

2. Backend

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp app/.env.example app/.env     # add your DB url + AI keys (MEDGEMMA / OPENAI / GEMINI)
uvicorn app.main:app --reload    # http://localhost:8000  ·  docs at /docs

Switch AI engines with a single env var: AI_BACKEND=gemini (chat + embeddings + voice on one key), AI_BACKEND=openai, or AI_BACKEND=medgemma.

3. Frontend

cd frontend
npm install
npm run dev                  # http://localhost:5176

4. Tests

pytest                       # 49 tests
pytest --cov=app             # with coverage (~91%)

✦ Built by

MeroDaktar is the work of three engineers. Every contributor's original commits are preserved in this branch's history.

Contributor Focus
🧱 Utshav Paudel Project lead & architecture — core platform, layered backend refactor, EHR, appointments, doctor portal, MedGemma integration, test suite, full UI redesign
🎙️ Sumit Thokar Voice AI — Gemini speech transcription (ASR) and in-chat voice-input recording
🧠 Shishir Bhattarai Chat memory & medical-chat API, appointment management and dashboard UX
# every contributor's work is in the history of this branch:
git shortlog -sne

✦ License

Released for educational and portfolio purposes. © 2025 the MeroDaktar team.

MeroDaktar — your health, one tap away.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages