In this article
Most healthcare AI projects don’t fail because the model is bad. They fail because nobody budgeted time for the compliance layer, and it surfaces late, usually right before a security review, when the cost of fixing it is highest.
If you’re building anything that touches patient data - a triage chatbot, an imaging tool, a scheduling agent, a monitoring dashboard - the AI part is often the easy part. Getting it into production inside a hospital or clinic without violating HIPAA is where projects actually slow down.
Summary
- Scope the BAA first. Define exactly what data the system touches before writing any application code.
- Build encryption and key management in from day one. AES-256 at rest, TLS 1.3 in transit, with a real key rotation plan, not a checkbox.
- Design access control at the record level, not just role level, since “clinician can view this patient’s data for this encounter” is the real requirement.
- Instrument audit logging at the data layer, so every read and write can answer who, what, when and why during a review.
- Treat EHR integration (HL7 FHIR R4 / SMART on FHIR) as its own workstream, since vendor implementations vary and sandbox behavior does not match production.
- Run the security review as confirmation, not discovery. It should validate an architecture built around these constraints, not uncover that they were missing.
Why healthcare AI projects stall at the compliance layer, not the model layer
A model that hits 90 percent accuracy on a benchmark dataset is not the same thing as a deployable clinical tool. Between those two states sits a list of requirements that has nothing to do with model architecture:
- A signed Business Associate Agreement (BAA) with every vendor or subprocessor that touches Protected Health Information (PHI)
- Encryption at rest and in transit, not as a checkbox but as an actual key management strategy
- Role-based access control fine-grained enough to satisfy an auditor, not just a login screen
- Audit logging that captures who accessed what, when and why, in a format that survives a compliance review
- A data retention and deletion policy that matches what you actually promised in the BAA
None of this is exotic engineering. It’s mostly discipline: decisions that need to be made before the first line of application code is written, not bolted on afterward. The teams that struggle are usually the ones who treated compliance as a launch checklist item instead of an architectural constraint from day one. This is also why teams without in-house healthcare experience often bring in a healthcare software development company early, before the architecture is locked in, rather than after a security review flags the gaps.
The real technical requirements
The five requirements above are not equally hard to get right. The next four sections break down the ones that actually determine whether a system passes a real compliance review: BAA scope, encryption, access control, and audit logging.
BAA scope
A BAA is not just a legal formality; it defines what your system is allowed to do with PHI. If your architecture assumes broader data access than the BAA permits, you will find out during an audit, not during development. Scope the BAA first, then build to it, not the other way around.
Encryption, concretely
AES-256 at rest and TLS 1.3 in transit are the baseline, not the ceiling. The part teams miss is key management: who can rotate keys, where they’re stored, and what happens if a key is compromised. A key management strategy that works for a SaaS product does not automatically work for PHI. Test it against your specific BAA obligations, not a generic best-practices checklist.
Access control granularity
Role-based access control in a typical SaaS app usually means “admin” versus “user”. In healthcare it usually needs to mean something closer to “this clinician can view this patient’s records because they are assigned to that patient’s care team, for this encounter, during this time window”. That level of granularity has to be designed into the data model early. Retrofitting it into a system built around simpler roles is expensive and error-prone.
Audit logging that actually holds up
Logging user X logged in is not sufficient. Auditors want to see who accessed which specific record, what they did with it, and why the system granted that access in the first place. Build this as a first-class part of the data layer, not as an afterthought sitting in application logs that nobody structured for compliance review.
EHR interoperability in practice
This is where most healthcare AI systems actually break, and it has nothing to do with AI. It’s integration engineering.
HL7 FHIR R4 is the standard most modern EHR systems support to some degree, and SMART on FHIR is the authorization layer that sits on top of it for app-to-EHR access. In theory, this gives you a clean, standardized way to read and write clinical data. In practice, every EHR vendor’s implementation has its own quirks, gaps and undocumented behavior.
A few things that consistently surprise teams building their first EHR integration:
- Not every FHIR resource is implemented the same way across vendors. A field that is required in the spec might be optional, missing, or populated with vendor-specific values in a real Epic or Cerner-style instance.
- Read access and write access are different battles. Getting a system to read patient data through FHIR is usually the easier half. Writing data back, especially anything that shows up in the clinician’s workflow, requires a different level of certification and testing.
- Sandbox behavior does not match production behavior. Most EHR vendors provide FHIR sandboxes for testing, and most of them behave differently than the production system in subtle ways: rate limits, field population and error handling all shift once you are live.
- Authorization is its own project. SMART on FHIR’s OAuth2-based flow is well documented, but getting the token scopes right and keeping them aligned with what your BAA actually permits takes real testing against a live or sandbox EHR instance, not just reading the spec.
None of this means EHR integration is impossible. It means it needs to be treated as its own workstream with its own timeline, not a footnote in the AI feature’s sprint plan.
A worked example: connecting an AI triage tool to an EHR
Take a concrete case: an AI-powered symptom triage chatbot that needs to write structured intake data into a patient’s EHR record before a clinician sees them.
The naive version of this project treats it as building the chatbot, calling an API, and done. The version that survives a security review looks more like this:
- Scope the BAA around exactly what the chatbot touches. In this case, symptom data and basic demographic identifiers, nothing broader.
- Design the data model around the access control granularity you will need, not the one that is easiest to build. If the chatbot’s output needs to be visible only to the assigned care team, that constraint shapes the schema from the start.
- Build the FHIR integration against the specific EHR instance you are targeting, test it in the vendor’s sandbox, and budget real time for the gap between sandbox and production behavior.
- Instrument audit logging at the point of data write, not as a wrapper added later. Every write to the EHR should carry enough context to answer “why did this happen” during a review.
- Run a security review before launch, not after. If the architecture was built around the BAA and access control requirements from the start, this step confirms the work rather than uncovering it.
The difference between a project that ships on time and one that stalls for months usually comes down to steps 2 and 3 being treated as core engineering work instead of integration details to figure out later.
Where compliance-by-design saves time
Every team eventually learns this lesson. The expensive way is discovering it during a failed security review three weeks before a planned launch, when the access control model needs to be rebuilt and the audit logging needs to be retrofitted into a system that was not designed to support it.
The cheaper way is designing around these constraints from the first architecture diagram: BAA scope defines what data flows exist, access control granularity defines the data model, and audit logging is part of the write path, not a bolt-on. These patterns are well understood by anyone who has shipped a few HIPAA-compliant systems before, which is exactly why it is worth borrowing that experience rather than relearning it the expensive way.
Either way, the technical requirements do not change. What changes is whether you hit them on your first attempt or your second.
Conclusion
HIPAA compliance in an AI system is not a separate checklist bolted onto the model. BAA scope, encryption and key management, record-level access control, audit logging, and EHR interoperability are all architectural decisions that need to be made before development starts, not after a security review flags what is missing. Get those five things right early, and the model is the easy part.