Back to projects

№ 008Health & learningIn production at a clinic

Medical Clinic Fax Automation

Faxed referrals and lab results read by AI, checked by a person, then filed in the EMR.

Document processing for medical faxes, including extraction, classification and human verification. Related work includes the clinic application, fax dashboard prototypes, cloud infrastructure and eClinicalWorks integration documentation.

  • OCR
  • AI extraction
  • AWS
  • Workflow automation
A referral fax next to the fields the model extracted. Nothing reaches the EMR until a person approves it.
A referral fax next to the fields the model extracted. Nothing reaches the EMR until a person approves it.

The problem

A clinic receives referral and lab faxes all day. Someone opens each one, reads it and retypes the patient details into the EMR. It is slow, and a typo in a date of birth is a patient-safety problem, not a clerical one.

Who it is for

Front-desk and intake staff at a clinic that runs on faxes, and the practice owner paying for the retyping.

What it does

  1. 01

    Read next to the source

    Each fax is OCR'd, a model classifies it and pulls out the patient fields. The reviewer sees the PDF and the extracted fields side by side.

    A referral fax next to the fields the model extracted. Nothing reaches the EMR until a person approves it.
    A referral fax next to the fields the model extracted. Nothing reaches the EMR until a person approves it.
  2. 02

    Nothing files itself

    Every extraction waits in a review queue. A person confirms or corrects each field. Only then does the record go to the EMR.

    Correcting an AI-suggested patient name before the split is accepted. The source page stays visible alongside.
    Correcting an AI-suggested patient name before the split is accepted. The source page stays visible alongside.
  3. 03

    Multi-patient faxes

    One fax with three patients is split into three records before review.

    One fax, ten patients. The split step separates them before review.
    One fax, ten patients. The split step separates them before review.
  4. 04

    The queue and the numbers

    Statuses, priority and assignee for each fax; analytics for volume and review time.

    The review queue: needs-review, approved and sent, with sender and priority. Sample data.
    The review queue: needs-review, approved and sent, with sender and priority. Sample data.
  5. 05

    Audit and integrations

    Every approval and edit is logged with who and when. EMR credentials never reach the browser.

    Every approval and edit is logged with who and when.
    Every approval and edit is logged with who and when.

How it works

Faxes arrive through a fax API. An ingest service stores the PDF and queues it. OCR runs, with a fallback extractor for poor scans. A language model on AWS Bedrock classifies the document and extracts the fields. The review app shows the result to a person, and approval sends it to the EMR. Logs are stripped of patient data. An outreach module handles follow-up messages.

  • Fastify on AWS ECS
  • Postgres
  • S3
  • SQS
  • Cognito
  • Textract
  • Claude on Bedrock
  • Terraform
  • KMS
  • Next.js dashboard
Role
Built by Vas.
Status
In production at a clinic.

The Challenge

The problem

Medical staff spent 5-10 minutes per fax manually extracting patient data from 50+ daily faxes (lab results, referrals, consults). High error rates in manual data entry created compliance risks and potential patient safety issues. HIPAA compliance requirements made automation complex and risky.

Why existing solutions failed

Generic OCR solutions couldn't handle the variety of medical document formats (text PDFs, scanned forms, handwritten notes). Off-the-shelf systems lacked the accuracy needed for medical data extraction. Existing solutions didn't provide the human-in-the-loop verification required for medical contexts. HIPAA compliance and EMR integration were afterthoughts.

Business impact

Staff spending 4-8 hours daily on fax processing meant higher labor costs and reduced time for patient care. Data entry errors led to treatment delays and potential liability. Manual processes couldn't scale with clinic growth. HIPAA compliance risks created legal exposure.

Our Solution

Approach

Built an event-driven microservices pipeline on AWS ECS Fargate. WestFax API ingests faxes, triggering a processing chain: OCR Worker (dual-system with pdfparse and AWS Textract), Extract Worker (Claude AI via Bedrock extracts 6-8 fields with confidence scores), LLM Worker for validation, and Review Dashboard (Next.js 14) for human verification before EMR delivery. Full HIPAA compliance with KMS encryption, audit logs, and PHI-redacted logging.

Workflow

WestFax API receives fax → Ingest API stores PDF in S3 + creates DB record + sends SQS message → OCR Worker (pdfparse for text PDFs, AWS Textract for scanned) → Extract Worker (Claude AI extracts patient name, DOB, MRN, provider, date, document type with confidence scores) → LLM Worker validates → Review Dashboard for human verification → EMR delivery via API → Audit trail logged

Key features

  • Dual OCR system: pdfparse for text PDFs, AWS Textract for scanned forms
  • Claude AI extraction of 6-8 medical fields with confidence scores
  • Human-in-the-loop review dashboard before EMR submission
  • Event-driven microservices with AWS SQS queues
  • 60-second median processing time end-to-end
  • 98%+ accuracy after human verification
  • HIPAA compliant: KMS encryption, audit logs, PHI-redacted logs
  • TLS 1.2+ for all network communication
  • Direct EMR integration for approved documents

Results

Before

5-10 minutes manual data entry per fax, high error rates, HIPAA compliance risks, 50+ faxes/day overwhelming staff, no audit trail

After

60-second AI processing with human verification, 98%+ accuracy, full HIPAA compliance with audit trails, unlimited scalability, complete traceability

What changed for the business

$60,000 in annual savings from 80% time reduction (5-10 minutes to 1 minute per document). 95% fewer errors eliminated treatment delays and reduced liability risk. Staff reallocation to patient care improved clinic capacity. Full audit trails and HIPAA compliance passed all regulatory audits. Human-in-the-loop verification ensured medical accuracy while maintaining speed gains.

Technical Details

Architecture

Event-driven microservices on AWS ECS Fargate. Fastify (TypeScript) services communicate via AWS SQS queues. PostgreSQL stores structured data, S3 stores encrypted PDFs with KMS. Dual OCR system: pdfparse for text-based PDFs, AWS Textract for scanned forms. Claude AI via Bedrock extracts medical fields with confidence scores. Next.js 14 dashboard provides human verification interface. All PHI encrypted at rest (S3 KMS) and in transit (TLS 1.2+).

Integrations

  • WestFax API for incoming fax reception
  • AWS Textract for scanned document OCR
  • pdfparse for text-based PDF extraction
  • Claude AI (Bedrock) for field extraction
  • AWS SQS for event-driven queue processing
  • AWS S3 with KMS encryption for PDF storage
  • PostgreSQL for structured data and audit logs
  • EMR system API for document delivery
  • Next.js 14 review dashboard

Security and compliance

  • HIPAA-compliant infrastructure and processes
  • KMS encryption for all S3 stored documents
  • TLS 1.2+ for all network communication
  • PHI-redacted application logs (CloudWatch)
  • Complete audit trail in PostgreSQL
  • Human verification before EMR submission
  • Role-based access control for dashboard
  • Connection pooling for secure database access
  • Business Associate Agreement (BAA) compliance

Technologies

  • Fastify
  • TypeScript
  • AWS ECS Fargate
  • AWS SQS
  • S3
  • PostgreSQL
  • AWS Textract
  • Claude (Bedrock)
  • Next.js 14
  • pdfparse
  • WestFax API
  • AWS KMS

Related

Next project

Shark Oilfield Services Platform

Turns client emails into priced proposals for a multi-branch oilfield services supplier.