Skip to content

malakazlan/DOC_CALL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

123 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🩺 MedVoice AI

The AI front desk that never sleeps β€” for medical practices.

MedVoice AI answers your clinic's phone, talks naturally with patients, understands what they need, and routes every call correctly β€” appointments, refills, urgent triage, or a human transfer. Every call is recorded, transcribed, and surfaced in a clean dashboard for your staff.


Next.js FastAPI PostgreSQL Twilio OpenAI Redis


HIPAA Β· E911 Β· TCPA aware β€” compliance enforced at the infrastructure level.


✨ Why MedVoice AI

Think of it as a 24/7 front-desk helper for medical offices. When a patient calls:

  • πŸ“ž Answers automatically β€” no missed calls, no hold music limbo
  • πŸ—£οΈ Talks in natural voice β€” real-time speech, not a rigid IVR menu
  • 🧠 Understands intent β€” appointment, refill, billing, urgent issue, or a question
  • πŸ”€ Routes correctly β€” AI response, human transfer, or voicemail
  • 🚨 Triages urgency β€” critical calls jump straight to a human with a 911 disclaimer
  • πŸ“Š Logs everything β€” recordings, transcripts, and analytics in one dashboard

Built for: clinics Β· family medicine Β· specialty practices Β· small-to-medium healthcare teams.


πŸ–₯️ Product Tour

Dashboard β€” today's call activity at a glance

Live counters for inbound calls, active calls, average handle time, and resolution rate, plus a 30-day urgency breakdown (Critical / Urgent / Routine).

MedVoice AI Dashboard


Call Log β€” searchable history with audio + transcripts

Filter by date range, disposition, and urgency. Export to CSV. Play S3-hosted recordings and read the full transcript for any call.

MedVoice AI Call Log


Phone Tree Builder β€” design the call flow visually

A drag-and-drop node editor (React Flow). Compose Greeting, Menu, AI Agent, Triage, Transfer, Voicemail, and After-Hours nodes, then configure each one in the side panel and save a new version.

MedVoice AI Phone Tree Builder


Analytics β€” performance metrics and trends

Resolution rate, average handle time, call volume by hour, and intent distribution across a selectable 7 / 14 / 30-day window.

MedVoice AI Analytics


πŸ› οΈ Tech Stack

Layer Technology Role
Frontend Next.js 14 (App Router) Β· React Flow Β· Recharts Dashboard, visual phone-tree builder, analytics charts
Backend FastAPI (async) Β· Uvicorn REST API + Twilio webhooks + media-stream WebSocket
Database PostgreSQL 15 Β· SQLAlchemy Β· Alembic Multi-tenant data, async via asyncpg
Telephony Twilio Programmable Voice Inbound calls, bidirectional media streaming
Speech-to-Text Deepgram Nova-2 Real-time streaming transcription (mulaw 8kHz)
Text-to-Speech ElevenLabs Turbo v2.5 Streaming voice synthesis
AI Reasoning OpenAI GPT-4o / GPT-4o-mini Intent classification + response generation
Cache / Queue Redis 7 Phone-tree cache + Celery broker
Background Jobs Celery 5 Post-call transcription, alerts, DB writes
Storage AWS S3 (SSE-KMS) Encrypted recordings + presigned playback URLs
Auth Clerk JWT auth + multi-tenant org management
Monitoring Sentry Β· Nginx Error tracking + TLS / WebSocket reverse proxy

πŸ”„ How a Call Flows

  Patient dials   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   the clinic ──► β”‚  Twilio  │──►│  Deepgram   │──►│   GPT-4o     │──►│ ElevenLabs │──► Patient
    number        β”‚  Voice   β”‚   β”‚  (STT)      β”‚   β”‚  intent +    β”‚   β”‚   (TTS)    β”‚     hears
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  response    β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    a reply
                       β”‚                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚                                  β”‚
                       β–Ό                                  β–Ό
                 Phone Tree Engine                  Triage scoring
              (state machine, Redis)            (β‰₯8 β†’ instant transfer)
                       β”‚
                       β–Ό
            Disposition: AI answer Β· transfer Β· voicemail Β· appointment
                       β”‚
                       β–Ό
            Celery: upload recording, finalize transcript, notify staff
                       β”‚
                       β–Ό
                  Dashboard πŸ“Š
  1. Patient calls your practice number β†’ Twilio answers.
  2. MedVoice greets the caller and streams audio both ways.
  3. Deepgram transcribes; GPT-4o detects intent and generates a reply.
  4. The Phone Tree Engine advances state; triage can override and transfer immediately.
  5. The call ends with the right disposition; staff sees it all in the dashboard.

See archetecture.md for the full end-to-end architecture, data models, and node schema.


πŸš€ Quick Start

1) Clone & configure environment

git clone https://github.com/malakazlan/DOC_CALL.git
cd DOC_CALL
cp .env.example .env   # fill in your real keys and URLs

2) Create database tables

In the Supabase SQL Editor, run backend/supabase_schema.sql.

3) Run the backend (FastAPI)

cd backend
python -m venv .venv

Activate the virtual environment:

OS Command
Windows PowerShell .\.venv\Scripts\Activate.ps1
Windows CMD .venv\Scripts\activate.bat
macOS / Linux source .venv/bin/activate

Then install and run:

pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

4) Run the frontend (Next.js)

Create frontend/.env.local with your Clerk keys and the API URL, then:

cd frontend
npm install
npm run dev

Open http://localhost:3000 πŸŽ‰

🐳 Prefer Docker? docker compose up brings up the full stack.


πŸ“ Project Structure

medvoice-ai/
β”œβ”€β”€ backend/                  # FastAPI API
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ core/             # Phone-tree engine, intent, triage
β”‚   β”‚   β”œβ”€β”€ models/           # SQLAlchemy ORM
β”‚   β”‚   β”œβ”€β”€ routers/          # Twilio, practices, phone-trees, calls
β”‚   β”‚   β”œβ”€β”€ services/         # STT, TTS, LLM, voice agent, recording
β”‚   β”‚   └── workers/          # Celery tasks
β”‚   β”œβ”€β”€ supabase_schema.sql   # Run in Supabase to create tables
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ frontend/                 # Next.js 14
β”‚   β”œβ”€β”€ app/dashboard/        # Dashboard, calls, phone-tree, analytics
β”‚   β”œβ”€β”€ components/
β”‚   └── lib/
β”‚
β”œβ”€β”€ docs/                     # Product screenshots
β”œβ”€β”€ docker-compose.yml
└── archetecture.md           # Full system architecture

Full breakdown in STRUCTURE.md.


πŸ” Compliance Notes

  • HIPAA β€” PHI encrypted at rest (S3 SSE-KMS, encrypted DB volume) and in transit (TLS 1.2+). Caller numbers stored hashed; audit trail on all data access.
  • E911 β€” emergency disclaimer played on every call; immediate 911 instruction for the highest urgency scores.
  • TCPA β€” inbound-only by design; recording-consent prompt on every call, with 2-party-state disclosures auto-selected.

⚠️ Twilio Trial Accounts

If your Twilio account is on a trial plan, incoming calls are limited by Twilio's rules. To accept calls from any number worldwide, upgrade Twilio to a paid account.


πŸ“¦ Repository

πŸ”— github.com/malakazlan/DOC_CALL


MedVoice AI β€” AI phone automation for U.S. medical practices.

About

A multi-tenant SaaS platform where his team onboards medical practices, configures AI phone agents for each one, and those agents handle 100% of inbound calls scheduling, refills, triage, after-hours without human intervention unless necessary.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors