
Case Study: How an n8n Agency Deployed HIPAA-Compliant AI for a Hospital Network
A composite case study showing how an automation agency used n8n, fine-tuned local models, and on-premise deployment to deliver HIPAA-compliant AI to a regional hospital network.
This is a composite case study based on common patterns observed across healthcare AI deployments. Names, specifics, and figures are illustrative.
The Agency
MedFlow Automation is a 4-person agency specialising in healthcare workflow automation. The team: a founder with n8n and Make.com expertise, two automation engineers, and a project manager. No ML engineers. Annual revenue: approximately $400K from 12 healthcare clients on automation retainers.
The Client
Pacific Regional Health operates 3 hospitals and 14 outpatient clinics across a mid-size metro area. 2,400 staff. 180 physicians. Their IT team consists of a CTO, 2 system administrators, and a compliance officer.
The Problem
Pacific Regional was drowning in clinical documentation overhead. Physicians spent an average of 2 hours per day on documentation — progress notes, discharge summaries, referral letters, prior authorisation narratives. This was contributing to burnout and reducing the time available for patient care.
The CTO had evaluated several cloud-based AI documentation tools. All were rejected by the compliance officer for the same reason: they required sending Protected Health Information to third-party cloud APIs. Even with BAAs in place, the compliance team was not comfortable with the data leaving their network.
The CTO's requirements:
- AI-powered clinical note summarisation and draft generation
- All processing on Pacific Regional's infrastructure
- HIPAA-compliant architecture with full audit trails
- Integration with their Epic EHR system
- Budget: $80,000 for initial deployment, $3,000/month ongoing support
The Solution Architecture
MedFlow designed an architecture using their established stack, adapted for healthcare compliance:
Infrastructure
| Component | Specification | Cost |
|---|---|---|
| GPU server | Dell PowerEdge T550 with 2× RTX 5090 | $8,500 |
| n8n instance | Docker on existing VM in Pacific Regional's data centre | $0 (existing infrastructure) |
| Vector database | Qdrant (Docker) for clinical reference documents | $0 (open source) |
| Monitoring | Grafana + Loki for logging and alerting | $0 (open source) |
Model Stack
- Base model: Llama 3.1 8B (quantised to 4-bit for efficient inference)
- Fine-tuned adapters:
- Clinical note summarisation (trained on 3,000 de-identified notes)
- Discharge summary generation (trained on 2,500 examples)
- Referral letter drafting (trained on 1,800 examples)
- Inference engine: vLLM (chosen over Ollama for concurrent request handling across 3 hospitals)
Workflow Architecture
Epic EHR → HL7 FHIR Interface → n8n Webhook → Pre-processing →
vLLM Inference → Post-processing → Quality Queue → Epic EHR
All components running within Pacific Regional's network. No external API calls.
The Implementation
Phase 1: Data Preparation (Weeks 1-3)
MedFlow worked with Pacific Regional's IT team to:
- Extract training data: 8,000 clinical notes from the past 2 years, exported from Epic via their reporting tools
- De-identify: Used a combination of Microsoft Presidio and custom regex patterns to remove all 18 HIPAA PHI categories. MedFlow built the de-identification pipeline; Pacific Regional's staff ran it on their infrastructure so raw PHI never left the hospital network.
- Quality review: Pacific Regional's compliance officer reviewed a 10% sample of de-identified records. Two records had residual identifiers — the regex patterns were updated and the full dataset was re-processed.
- Format for training: MedFlow converted the de-identified notes into instruction-response pairs suitable for fine-tuning.
Phase 2: Fine-Tuning (Week 3-4)
MedFlow used Ertas Studio to train three LoRA adapters:
-
Clinical note summarisation: Input = full progress note, Output = structured SOAP summary
- Training: 3,000 examples, 45 minutes training time
- Validation accuracy: 93% (evaluated by Pacific Regional's clinical informatics team)
-
Discharge summary generation: Input = structured clinical data, Output = narrative discharge summary
- Training: 2,500 examples, 40 minutes
- Validation accuracy: 91%
-
Referral letter drafting: Input = referral request details + relevant clinical history, Output = formatted referral letter
- Training: 1,800 examples, 30 minutes
- Validation accuracy: 89%
All adapters exported as SafeTensors for vLLM deployment.
Phase 3: Infrastructure Deployment (Week 4-5)
MedFlow's automation engineers set up the stack on Pacific Regional's hardware:
- Installed vLLM with all three adapters configured
- Deployed n8n via Docker with PostgreSQL backend
- Configured the Epic integration via HL7 FHIR webhooks
- Built n8n workflows for each use case:
- Clinical note summarisation: triggered by physician completion of a note
- Discharge summary: triggered by discharge order
- Referral letter: triggered by referral request
- Set up Grafana dashboards for monitoring inference latency, throughput, and error rates
- Configured audit logging — every inference request and response written to Pacific Regional's SIEM
Phase 4: Compliance Validation (Week 5-6)
MedFlow and Pacific Regional's compliance officer completed the HIPAA compliance checklist:
- Administrative safeguards: documented, including AI-specific policies
- Physical safeguards: GPU server in locked data centre, access-controlled
- Technical safeguards: TLS, RBAC, audit logging, encryption at rest
- Clinical governance: AI Advisory Committee approved deployment with physician override requirement
Phase 5: Pilot and Rollout (Weeks 6-10)
- Week 6-7: Pilot with 12 physicians at one hospital. AI-generated summaries reviewed by physicians before being saved to the chart.
- Week 8: Feedback incorporated, adapter retrained with corrections (50 additional examples per adapter)
- Week 9-10: Rolled out to all 3 hospitals. Monitoring dashboards tracked adoption and quality.
The Results
After 3 Months of Production Use
| Metric | Before AI | After AI | Change |
|---|---|---|---|
| Physician documentation time | 2.1 hrs/day | 0.8 hrs/day | -62% |
| Discharge summary turnaround | 4.2 hours | 35 minutes | -86% |
| Referral letter turnaround | 2.8 hours | 15 minutes | -91% |
| Documentation-related complaints | 14/month | 3/month | -79% |
| Physician satisfaction (survey) | 3.1/10 | 7.8/10 | +152% |
Cost Analysis
| Annual Cost | |
|---|---|
| Previous state: Overtime and locum costs attributed to documentation burden | $280,000 |
| AI deployment: Hardware ($8,500 amortised over 3 years) + agency retainer ($36,000/year) + electricity ($1,000/year) | $39,833/year |
| Net annual savings | $240,167 |
ROI: 503% in the first year (accounting for the $80,000 implementation fee).
Staff Satisfaction
The most significant outcome was not financial. Physician satisfaction scores for documentation workflow improved from 3.1 to 7.8 out of 10. Two physicians who had been considering leaving cited the reduced documentation burden as a factor in staying. Retaining even one physician avoids $500K-1M in recruitment and onboarding costs.
Lessons Learned
What Worked Well
- Starting with de-identification pipeline. Building a robust, auditable de-identification process first gave the compliance team confidence in the entire project.
- Physician involvement in evaluation. Having clinicians review model outputs during validation — not just at pilot — caught issues early and built trust.
- n8n for orchestration. The visual workflow builder made it easy to demonstrate the data flow to the compliance officer. "Show me where the data goes" was answered by showing the n8n workflow.
- LoRA adapters for multiple tasks. Training separate adapters for each task (summarisation, discharge, referral) was better than one multi-task model. Each adapter could be evaluated and updated independently.
What They Would Do Differently
- More training data for referral letters. 1,800 examples was the minimum viable dataset. Quality improved noticeably when 500 additional examples were added during the pilot feedback phase.
- Earlier integration testing with Epic. The FHIR webhook integration took longer than expected due to Epic's specific authentication requirements. Starting this in parallel with fine-tuning would have saved a week.
- Physician champions first. Identifying 2-3 enthusiastic physician early adopters before the pilot accelerated adoption. The physicians who were sceptical were convinced by their peers, not by the agency.
Replicating This Model
For agencies considering healthcare AI deployments:
- The technical stack is replicable — n8n + vLLM + LoRA adapters work across healthcare organisations
- The compliance framework is standardised — HIPAA requirements are the same for every US healthcare deployment
- The data preparation pipeline is the bottleneck — invest in building a robust de-identification process
- Start with clinical note summarisation — it has the clearest ROI and the most straightforward evaluation criteria
- Use Ertas Studio for fine-tuning — it removes the ML expertise requirement from the agency team
Ship AI that runs on your users' devices.
Ertas early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.
Further Reading
- n8n + Local LLMs: Building HIPAA-Compliant Automation — Detailed technical guide for the n8n + local LLM stack
- HIPAA-Compliant AI: On-Premise vs. Cloud — The compliance architecture and decision framework
Ship AI that runs on your users' devices.
Early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.
Keep reading

AI Agency Opportunity in Healthcare: Selling to Hospitals and Clinics
Healthcare AI spending is growing at 24% CAGR, but hospitals lack ML teams. Agencies that understand HIPAA compliance have a defensible moat. Here's the market, service packages, sales motion, and revenue model.

AI Agency Tech Stack for Legal Clients: n8n + Fine-Tuned Models + On-Prem Deployment
The complete architecture for AI agencies serving law firms — from n8n orchestration to fine-tuned model inference to client-facing delivery. Component selection, deployment topology, and scaling considerations.

How to Pitch On-Premise AI to a Hospital CTO
A sales guide for AI agencies: how to frame on-premise AI for hospital CTOs, handle objections, structure your proposal, and navigate the healthcare procurement process.