Case study: Healthcare AI

A multi-tenant AI clinical documentation platform

A clinician-in-the-loop documentation platform: visit audio becomes reviewable chart drafts, grounded in the patient's records and connected to the EHR.

Client
A healthcare software client, name withheld
My role
Lead engineer, discovery through go-live
Engagement
Delivered through Torch Solutions
Period
2024 to present

I worked on this as a Senior Software Engineer at Torch Solutions, the engineering firm contracted by the client. The product belongs to the client.

Illustrative mockup of a clinic schedule screen listing the day's visits with their status

These are illustrative mockups of the same workflows. The client's interface and all patient data are not shown.

Project overview

The product is a clinical documentation platform for outpatient clinics. It records the visit, drafts the chart, and lets the clinician review and correct everything before it is relied on.

I led the engineering from the first requirements conversations through architecture, implementation, staging and go-live, including the EHR and telephony integrations.

The business problem

Clinicians lose hours to documentation and to switching between systems. Most AI note demos fail in a real clinic because a generate button is the easy part.

Manual re-entry kills adoption

Medications, vitals and allergies already live in the EHR. Staff will not type them again.

One-shot generation is not clinically acceptable

A provider has to see what was generated, from what, and be able to change it.

Prior records are trapped in PDFs

Scanned documents and lab reports hold the context providers need during a visit.

Patient data is the constraint, not a feature

Multiple clinics, several roles, and protected health information in every workflow.

My role and responsibilities

Primary engineering ownership across the engagement, working with the client's clinical and operations stakeholders.

  • Turned raw clinical and operational requirements into personas, journeys, constraints and a phased delivery plan
  • Designed the multi-tenant domain model, API boundaries, background processing and integration layers
  • Implemented the Django API, the AI charting pipeline, document retrieval and the patient-scoped assistant
  • Built the EHR integration layer and browser-based calling with an inbound queue
  • Set up environments, deployment and staging validation, and supported go-live

Technical challenges

Chart generation is a dependency graph

Sections depend on each other and on who is allowed to write them. A manual edit has to mark dependent sections as stale instead of silently regenerating them.

Long-running AI work behind a clinical UI

Transcription, chart runs, OCR and embedding take time. None of it can block the screen a nurse or provider is working in, and all of it has to show progress.

Retrieval that cannot leak between patients

Document search and the assistant are constrained to one patient in one clinic at the query level, not by prompt instructions.

EHR integration without vendor lock-in

The product core talks to an internal interface. Vendor-specific adapters sit behind it, with field mappings an administrator can configure.

Privacy-conscious engineering under delivery pressure

Activity feeds and logs are designed to avoid raw transcripts and document text, and inbound calls are never attached to a patient from caller ID alone.

Solution and implementation

A clinic-scoped platform where AI is a visible pipeline with progress, attempts and revisions, and clinicians stay in control of clinical content.

AI charting pipeline

  • Speech-to-text on visit audio through background workers, with transcript review
  • Configurable chart categories and segments with their own prompts and model settings
  • Live progress, attempts and revision history for every run
  • Edits mark dependent sections stale so nothing changes behind the provider's back

Document intelligence and the patient-scoped assistant

  • Upload or EHR sync, then OCR, chunking, embedding and retrieval
  • Embeddings stored beside relational clinical data in PostgreSQL with pgvector
  • Assistant conversations bound to one patient, with retrieval before generation and cited sources

EHR integration

  • A provider-agnostic service layer with concrete adapters behind a stable internal API
  • Medications, vitals, allergies, problems, appointments and documents as modules a clinic enables deliberately
  • Sync as background jobs so EHR latency and rate limits never freeze the encounter

Tenancy, roles and operations

  • Every query and write bound to the user's clinic, with nurse, provider and admin roles
  • JWT authentication with SAML single sign-on support
  • Admin tooling for onboarding a practice: modules, chart templates, mappings and prompts
  • Browser calling with an inbound hold queue and explicit patient assignment
Web application (Vue) → REST, server-sent events and WebSockets → API (Django)Background workers (Celery + Redis) for transcription, chart runs, document ingest and EHR syncPostgreSQL with pgvector for clinical data and embeddings; object storage with presigned uploadsExternal services behind internal clients: speech-to-text, language models, OCR, telephony, EHR
Generalized architecture. Internal infrastructure details are omitted.
Illustrative mockup of an encounter workspace showing AI documentation progress
Encounter workspaceNurse intake and provider charting in one place, with live progress for AI documentation runs.
Illustrative mockup of an AI-drafted chart note with revision history and sources
Reviewable chart draftsDrafts carry revisions and sources, and the provider edits or re-runs any section.
Illustrative mockup of a document viewer with extracted clinical data beside the source file
Document intelligenceScanned records and lab PDFs are extracted, indexed and tied to the patient.
Illustrative mockup of a patient-scoped assistant answering a question with cited records
Patient-scoped assistantProviders ask questions about one patient and get answers grounded in that patient's records.

Technology stack

Backend
Django, Django REST Framework, Celery, Redis, Channels
Data
PostgreSQL, pgvector
AI
OpenAI models, speech-to-text, OCR and document extraction, embeddings
Integrations
Athenahealth (EHR), Twilio (telephony)
Frontend
Vue 3, Vite, Pinia
Cloud
AWS, including S3
Auth
JWT, SAML single sign-on

Outcomes

Only results that are documented are listed here.

  • Delivered from requirements to a production multi-tenant platform
  • One patient context across schedule, encounter, documents, assistant and calls
  • AI documentation that is inspectable: runs, attempts, revisions and stale dependencies
  • EHR data feeds intake and clinical modules through a stable integration layer
  • Practices are onboarded through admin tooling instead of engineering scripts

Lessons learned

  • Treat AI as a pipeline with state. Progress, attempts and revisions are what make clinicians willing to use it every day.
  • Scope retrieval in the query. Tenant and patient boundaries belong in the data layer, where they can be tested.
  • Put vendors behind your own interface early. It costs little at the start and makes the second integration routine.
  • Design privacy into events and logs from the first sprint. Retrofitting it later means auditing everything already written.
  • AI Product Development: Taking an AI product from idea or prototype to production-ready software: architecture, backend, frontend, integrations, testing and deployment.
  • AI Agents & Workflow Automation: Voice agents, conversational AI, RAG systems and AI-driven workflows that connect to the systems a business already runs on, with human approval where it matters.

More case studies

Working on something similar?

If your product has the same kind of constraints, I am glad to talk through how I would approach it.

Or email sarmadkhalique001@gmail.com