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.
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.