01 · Case study

Mediary

Real-time AI scribing and medical coding: audio in, structured clinical note and live CPT feedback out.

Role
Founding engineer
Focus
Backend architecture, Real-time processing, AI integration, Asynchronous jobs, Clinical workflows
Stack
TypeScript · Node.js · Deepgram · Azure OpenAI · Prisma · MySQL · BullMQ · Redis · Auth0
Status
Shipped
Metric
2 min → <1 min

Problem

Clinicians spend a large part of every encounter documenting it. Mediary listens to the encounter, turns it into a structured clinical note, and suggests billing codes while the visit is still fresh. When I joined, the product existed as an MVP built by an outsourced team, and its core systems weren’t designed for real-time AI processing.

Mediary has since shut down, so this write-up stands in for a live product link.

My role

I took over the architecture after the outsourced MVP and redesigned the core systems. I designed the streaming encounter pipeline, built the distributed job queue behind note generation and billing, and worked closely with clinicians to translate their workflow pain points into product features.

Architecture

The encounter pipeline runs in four stages. Audio is streamed in and transcribed in real time. During the appointment, billing logic reads the live transcript and returns CPT feedback. After the visit ends, an LLM structures the transcript into a clinical note. Billing and note generation run on a distributed job queue so encounters can be processed concurrently.

Mediary encounter pipelineAudio streams into real-time transcription, then billing logic with live CPT feedback during the appointment, then LLM structuring into a clinical note after the visit ends. A job queue with retries and scalable workers runs billing and LLM structuring.audio streamtranscriptionbilling + CPTLLM structuringjob queue · retries · scalable workers
Audio → real-time transcription → billing logic with live CPT feedback → LLM structuring after the visit. A distributed job queue runs billing and note generation concurrently, with automatic retries.

I designed the job queue end to end.

Engineering challenges

Redesigning an inherited MVP for real time

The outsourced build worked as a demo but not as a real-time system. Rather than starting over, I redesigned the core systems around a streaming pipeline so each stage could hand work to the next as soon as it was ready.

The core blocker was that the MVP had no queue. Each note was processed only after the previous one finished, so one slow encounter held up every encounter behind it.

Concurrent note generation and billing

Note generation and billing are slow, failure-prone calls to external services. I built a distributed job queue that runs them concurrently and scales the number of workers. Failed jobs retry automatically with exponential backoff, using BullMQ’s built-in retries, so a transient failure doesn’t lose a clinician’s note. If every automatic retry failed, the clinician could retrigger the whole process with a button in the UI.

Live CPT feedback

Billing logic runs on the live transcript and returns CPT feedback during the encounter, before the note is written. Clinicians saw it during the appointment as a gamified checklist.

Outcome

After the redesign, note turnaround dropped from about two minutes to under one minute.