sethserver.com Subscribe
A blue cartoon robot sits at a brown desk writing on papers, surrounded by floating pink medical documents with crosses, heart monitor screens, pills, yellow warning triangles, and a broken padlock above its head, all set against a mint green background.

HIPAA, PHI, and AI: How Not to Accidentally Become a Non‑Compliant Data Processor

By Seth Black • Updated: September 17, 2026

AI · 7 min read

Like this kind of writing? Get one email a week with notes on startups, AI, and the occasional strong opinion about Python: subscribe to the newsletter.

HIPAA isn't scary because it's complicated. It's scary because it's simple, and simple rules plus clever engineers is how you end up on an OCR press release instead of in prod.

I worked at a SaaS company that advertised “AI” for financial automation. Their support team refused to show me how it worked unless I drove to their office and watched it live. So I drove over, sat in a little conference room, and watched someone click through their “AI pipeline.” Later I got access to the code. Surprise: most of the “AI” was column mapping and data formatting wrapped around a spreadsheet-flavored rule engine. It was just spreadsheet glue with a marketing budget.

Healthcare software has the same trap. You can ship something that looks like an AI product and accidentally build a PHI forwarding machine.

Privacy Rule vs Security Rule (dev translation)

HIPAA splits into two buckets that matter for programmers: Privacy and Security. hhs

Programmers usually start with Security because it looks like normal work: encryption, auth, networks, secrets, logs. Privacy is the part that sneaks in through “small” product decisions: what you send to vendors, what you keep, for how long, and who gets to see it. accountablehq

ePHI: yes, your chatbot is in it

If your system touches patient-identifying data tied to health info, you're in ePHI territory. A symptom list plus a name. A phone number plus “needs insulin refill.” “My MRI results looked bad, can you explain this?” in a chat box. metomic

Chatbots and agents are PHI magnets. Users will paste entire discharge summaries, labs, portal messages, all of it, because from their perspective your text box is just “helpful assistant that understands everything.”

If your app routes that text into an LLM API, you're now creating, transmitting, and processing ePHI. The feature label (“assistant,” “copilot,” “triage bot”) does not matter. The data flowing through it does. niu

The vendor landmine

Three quick realities:

This is where teams get “clever”:

HIPAA cares about whether the data can identify a person and relates to their health, not whether you intended to do anything with it. If the payload can still link to an individual, you’re sending PHI to a third party. Full stop. ncbi.nlm.nih

Builder controls that actually matter

1) BAAs with any vendor that can see PHI

If an AI vendor can see PHI in prompts, files, embeddings, fine-tune sets, or tool outputs, you need a BAA. Not “after we get a pilot,” not “once sales closes.” Before you touch real users. hipaavault

Count the boring stuff too:

If it can see prompts or responses, it can see PHI. metomic

2) Encryption, access control, and unexciting hosting choices

Do the basics, but treat them like production features, not a compliance checkbox. hhs

If staging is “prod with weaker controls and some real data,” what you actually built is a compliance bypass.

3) Redact PHI in prompts unless the provider is under BAA

No BAA? Treat that model endpoint like a public internet API. That means no PHI. accountablehq

Redaction needs to be concrete and deterministic to start. You can layer fancy stuff later. Something like this is a step up from nothing:

import re

PHI_PATTERNS = [
    (re.compile(r"\b\d{3}-\d{2}-\d{4}\b"), "[SSN]"),
    (re.compile(r"\b\d{10}\b"), "[PHONE]"),
    (re.compile(r"\b\d{1,2}/\d{1,2}/\d{2,4}\b"), "[DATE]"),
]

def redact(text: str) -> str:
    for pat, repl in PHI_PATTERNS:
        text = pat.sub(repl, text)
    return text

If you keep finding cases where you “absolutely need” the raw text, that's your signal to stop pretending: get the BAA, and design the system like it handles ePHI, because it does. hipaajournal

4) Vendor settings: training, retention, logging

Most AI providers now expose some knobs: accountablehq

Turn those on. Get them in the contract. Then verify they behave the way the slide deck claimed. Provider defaults are not tuned to your risk profile; they're tuned to whatever made sense for their product roadmap. signeasy

Chatbot guardrails that save you pain

A few rules that catch a lot of issues early:

Agents add another failure mode: tool calls. If the model can call search_patient_records and send_email, the tool layer needs hard permission checks and user scoping; the model is not a security boundary. Treat tools like untrusted input generators, not trusted peers. niu

What to log (and what to skip)

Logging is where “we care a lot about privacy” quietly becomes “we accidentally built a PHI archive.”

Log:

Avoid:

If you truly need to inspect content, build a gated workflow: short retention, explicit access control, and a clear paper trail. metomic

Quick vendor sanity checklist

Use this as a quick gut check before wiring a new AI service into anything clinical: hipaavault

HIPAA is mostly a pile of small decisions. Stack them well and you get reasonable safeguards. Stack them lazily and one day your “AI assistant” shows up as a line item in someone’s incident report. hipaajournal

-Sethers

Share this post
Newsletter

One email, once a week.

Notes on databases, systems, and the occasional strong opinion about Python. No spam, unsubscribe anytime.

Seth Black
Written by

Seth Black

Engineer and founder based in Texas. Writes about databases, AI, and running things in production. Embeds in small teams as lead engineer.

More from AI

View all →
AI

How to be a Good Farrier: What the Car Teaches Us About AI and Your Job

Nov 10, 2026
AI

Principle of Least Privilege in the AI Age

Apr 14, 2026
AI

How to Actually Secure MCP (Model Context Protocol)

Apr 14, 2026