Skip to content
Brainence
Back to all articles

16 min

AI and GDPR in healthcare: building GDPR- and HIPAA-safe LLM features

How to build LLM features that handle patient data safely under UK GDPR and HIPAA: architecture, de-identification, DPIAs, vendor contracts and controls.

Smooth orange and violet loops knotted together on a beige background in an abstract render

AI and GDPR can work together in healthcare software if patient data is minimised before it reaches the model, the model runs under a data processing agreement (and a BAA for US data), and every prompt is access-checked and logged. Add a DPIA and human review of clinical outputs, and LLM features can meet both UK GDPR and HIPAA.

The usual situation looks like this. Your product team wants summaries, triage or a patient chat assistant built on generative AI in healthcare. Your compliance lead says patient data can't leave the system. Both are right, and the job is to design a feature where both stay right.

This guide is for CTOs, product owners and heads of engineering at health tech companies selling into the UK, EU or US. We'll cover what GDPR and HIPAA each require, the architecture that satisfies both, a controls checklist, the DPIA, and where clinical safety rules start. The focus is AI and data protection in practice, not legal theory, so treat it as engineering guidance and run final decisions past your DPO and legal team.

Why do LLM features raise new data protection risks in healthcare?

LLM features create new paths for patient data to leak: into prompts, into third-party models, into logs and into generated answers. Large language models in healthcare also produce confident text that can be wrong, which turns a privacy question into a patient safety question.

Most of these risks don't come from the model itself. They come from how the feature is wired. Here's where we'd look first:

  • Identifiers in prompts: a clinician pastes a discharge letter into a summary box, and the name, NHS number and date of birth go with it
  • Data sent to third parties: a hosted model API is a processor, so patient data now sits with another company, often in another country
  • Outputs that reveal data: a retrieval feature answers a question using a record the user shouldn't see
  • Training on customer data: some plans and tools use inputs to improve models unless you switch it off or sign a contract that rules it out
  • Logs and caches: prompts and responses end up in application logs, analytics and vendor abuse monitoring
  • Hallucinations in clinical context: a wrong medication dose in a summary is a safety incident, not a typo

AI in healthcare data privacy and ethics concerns usually come back to two questions. Can you prove where every piece of patient data went? Can a qualified person check what the model produced before it affects care? If the answer to both is yes, most of the rest is detail.

Patient-facing products raise the stakes further. In a pharmacist consultation app we built, the WellCru app, users chat directly with certified pharmacists. Add an LLM assistant to a flow like that, and every message becomes potential health data in a prompt.

Planning an LLM feature that touches patient data?

Let's talk it through. Share what the feature should do, and we'll suggest an architecture that meets AI and GDPR requirements, plus HIPAA if you serve US customers.

Contact us

GDPR vs HIPAA: what each one requires from an LLM feature

GDPR protects all personal data of people in the UK and EU, with health data as a special category that needs extra justification. HIPAA protects health information handled by US healthcare organisations and their vendors. If you sell in both markets, your LLM feature has to meet both, and the stricter rule wins in each area.

UK GDPR / EU GDPRHIPAA
Who it applies toAny organisation processing personal data of people in the UK or EUUS covered entities (providers, health plans, clearinghouses) and their business associates
How health data is classifiedSpecial category data under Article 9Protected health information (PHI)
Legal basisA lawful basis under Article 6 plus an Article 9 condition, such as provision of health carePermitted uses such as treatment, payment and healthcare operations, plus the minimum necessary standard
Vendor contractData processing agreement (Article 28)Business associate agreement (BAA)
International transfersAdequacy decision or safeguards such as the UK IDTA or EU standard contractual clausesNo transfer rule as such, but the BAA and Security Rule apply wherever PHI is processed
Breach notificationRegulator within 72 hours where feasible; patients without undue delay if the risk is highPatients within 60 days; HHS within 60 days if 500+ people are affected
Patient rightsAccess, rectification, erasure, objection, and rights around automated decisionsAccess, amendment and an accounting of disclosures

Two details trip teams up. Under UK GDPR, you report a notifiable breach to the ICO within 72 hours of becoming aware of it. Under HIPAA, a business associate must tell the covered entity within 60 days, and the covered entity notifies patients and, for 500+ people, HHS.

UK GDPR and the Data Protection Act 2018

In the UK, GDPR health data rules sit in the UK GDPR and the Data Protection Act 2018, which sets out the Schedule 1 conditions for health and social care. The Data (Use and Access) Act 2025 amended both, and the ICO confirms all its data protection provisions were in force by 19 June 2026.

For LLM features, the most relevant change is automated decision-making. The rules are more permissive now, but stricter limits still apply when special category data such as health data is involved. Data can keep flowing from the EU to the UK: the EU renewed its UK adequacy decision in December 2025, until December 2031.

When HIPAA applies to a UK or EU software company

HIPAA follows the data, not your office address. If you build software for a US hospital, clinic or health plan, and your system creates, receives, stores or transmits their PHI, you're a business associate. You need a BAA with the customer and with any vendor, including an LLM provider, that touches that PHI.

HIPAA-compliant AI therefore means more than picking a model with a BAA. Your own platform must meet the Security Rule too. HHS proposed a stricter Security Rule in January 2025, with mandatory encryption and multi-factor authentication, but final action has been pushed back to July 2027.

Architecture patterns for compliant LLM features

A compliant LLM feature puts controls between your application and the model: de-identification, access checks, a model hosted under the right contract, output filtering and an audit log. Each layer removes a risk, so no single setting or vendor promise has to carry the whole load.

Minimise and de-identify data before it reaches the prompt

The safest patient data in a prompt is the data that isn't there. Most summarisation and drafting tasks don't need names, addresses or record numbers, so replace them with tokens before the call and restore them afterwards inside your own system.

Be precise about what that achieves. Under UK GDPR, pseudonymised data is still personal data; the ICO's pseudonymisation guidance treats it as a security measure, not an exit from the law. Under HIPAA, data counts as de-identified only through one of two HHS methods: Safe Harbor, which removes 18 listed identifiers, or Expert Determination. Free-text clinical notes rarely pass Safe Harbor without careful work.

Choose where the model runs: vendor API under a DPA/BAA, private cloud endpoints, or a self-hosted open model

You have three realistic options, and each trades control for cost and effort:

  • Vendor API: OpenAI, for example, offers a BAA for its API when your account uses modified retention, and says it doesn't train on API business data by default. Consumer ChatGPT plans aren't covered
  • Private cloud endpoints: Azure OpenAI, Amazon Bedrock and Google Vertex AI run models in your cloud account and region, covered by the cloud provider's BAA. Check model-level eligibility, because not every model on a platform is on the provider's HIPAA list
  • Self-hosted open model: data never leaves your infrastructure, but you take on GPU costs, model updates, evaluation and security. We'd usually build this layer in Python

No vendor is "compliant" by itself: a BAA or DPA only covers you if your configuration matches its terms. For EU and UK data, check where inference happens, not only where data is stored. OpenAI, for instance, now offers data residency in Europe and the UK for eligible API customers. Our guide to build vs buy under compliance pressure covers the wider decision.

RAG over patient records with role-based access

Retrieval-augmented generation (RAG) lets the model answer from your records instead of its training data. The risk is that retrieval ignores permissions, so the access check must run before retrieval, using the same roles your application already enforces.

In practice: tag every document chunk with its patient and access scope, filter the vector search by the user's permissions, and log which records were retrieved for each answer. We built role-based access into a corporate wellness platform whose health risk tracker processes biomarker and activity data; the same principle applies to clinical records.

Logging, retention and "no training on our data" settings

You need an audit trail of who asked what and which data was used, without turning your logs into a second copy of the patient record. Log metadata and record IDs by default, keep full prompts only where you have a clear reason, and set short retention periods.

Check three settings on every vendor: training on your data (off), retention of prompts and outputs (zero or as short as the contract allows), and human review for abuse monitoring (covered by your agreement). Our DevOps team usually wires these checks into deployment, so a configuration change can't quietly undo them.

Planning AI and GDPR controls for a healthcare product?

Tell us what your LLM feature should do and which markets you serve. We'll come back with an architecture that fits AI and GDPR rules for patient data, and an honest view of the effort.

Contact us

AI and GDPR compliance checklist for LLM features

AI and GDPR compliance for an LLM feature comes down to 10 controls, most of which also cover HIPAA. Use this checklist to see what each law expects and how it usually gets built.

ControlGDPRHIPAAHow to implement
Lawful basisArticle 6 basis plus Article 9 conditionPermitted use and minimum necessaryDocument the purpose per feature; block uses outside it
Data minimisationRequiredMinimum necessary standardStrip identifiers before prompts; send only fields the task needs
EncryptionAppropriate security (Article 32)Security Rule safeguardTLS in transit, encryption at rest, managed keys
Access controlAppropriate securityAccess controls and unique user IDsRole-based access enforced before retrieval and prompting
Audit logsAccountabilityAudit controlsLog user, purpose, record IDs and model version per request
Vendor contractsDPA with each processorBAA with each business associateSign before any real data flows; check the services listed
Data residencyTransfer safeguards outside the UK/EUSet by contract and policyPin model and storage regions; record them in the DPIA
Retention and deletionStorage limitationRecord retention policiesShort log retention; zero-retention settings with vendors
Patient rights requestsAccess, erasure, objectionAccess and amendmentMake prompts, outputs and logs searchable by patient ID
Breach responseICO within 72 hours where feasibleNotify within 60 daysInclude the LLM vendor in your incident plan and contacts

GDPR compliant AI isn't a property of the model. It's the sum of these controls, documented well enough that you can show them to a regulator or a hospital's information governance team.

When do you need a DPIA for an AI feature?

You almost always need a data protection impact assessment (DPIA) for an LLM feature that processes health data. The ICO's DPIA guidance requires one for large-scale processing of special category data, and for innovative technology, including AI, combined with another high-risk factor.

What a DPIA for AI should cover

A DPIA for AI doesn't need to be a 60-page document, but it does need to be specific. A short outline that works for most LLM features:

  • Purpose: what the feature does, for whom, and why an LLM is needed
  • Data flows: what goes into prompts, where the model runs, what is stored and for how long
  • Risks: re-identification, unauthorised access, transfers, inaccurate outputs, over-reliance by staff
  • Mitigations: the controls from the checklist above, with owners
  • Sign-off: DPO advice, residual risk and the decision to proceed

We don't recommend copying an AI DPIA template wholesale. The ICO lists examples of high-risk processing, and its own screening checklist is a better start than a generic form.

HIPAA security risk analysis for the same feature

HIPAA has no DPIA, but the Security Rule requires a risk analysis of where ePHI is created, stored and sent. Run it alongside the DPIA, using the same data flow diagram, so you maintain one picture of the system instead of two that drift apart.

Clinical safety, transparency and human oversight

Data protection is only half of LLM healthcare regulation. If a feature influences diagnosis or treatment, medical device rules may apply, and in England clinical risk management standards apply to most health IT anyway.

When an LLM feature becomes a medical device (MHRA, EU MDR)

What decides it is intended purpose, not technology. An LLM that drafts admin letters is usually not a medical device. One that suggests diagnoses or triage levels probably is, under both the UK MDR and the EU MDR. The MHRA's software and AI guidance explains how to qualify a product, and its ambient voice guidance applies the same test to LLM-based scribes.

UK regulation of AI in healthcare is also changing. The MHRA's National Commission published 44 recommendations in September 2026, including staged approvals for AI products, and the government responded in October 2026.

UK clinical safety standards (DCB0129/DCB0160) and the EU AI Act

In England, DCB0129 applies to manufacturers of health IT and DCB0160 to the organisations deploying it. Both are mandatory under the Health and Social Care Act 2012 and require a named clinical safety officer. NHS England is reviewing them, partly to reflect AI, so check the current versions before you start.

In the EU, AI-enabled medical devices that need a notified body are high-risk under the AI Act. Under the Digital Omnibus, AI built into products regulated under Annex I, such as medical devices, must comply from 2 August 2028. Standalone high-risk systems listed in Annex III, such as AI used in hiring or credit scoring, follow an earlier date, 2 December 2027. Patient-facing chatbots must already tell users they're talking to AI. Our EU AI Act guide covers the transparency rules.

Human-in-the-loop and explaining outputs to clinicians and patients

LLM healthcare law and ethics point the same way: a qualified person should check outputs before they affect care. Design for that from the start, with a review step that shows the source records next to the generated text, so checking takes seconds rather than minutes.

Tell patients when they're talking to AI, and tell clinicians what the model can't do. Our smart healthcare development work follows the same rule: the person accountable for the decision sees enough context to make it.

A rule of thumb we use when designing review steps: if a clinician can't check an output against its source in under a minute, the review will get skipped on a busy shift. So put the cited lines from the record next to each generated sentence, and make rejecting a draft as quick as accepting it.

How to roll out a compliant LLM feature step by step

A compliant rollout makes the big decisions on paper first, then builds the controls, then tests with data that can't hurt anyone. Here's the sequence we'd suggest:

  1. Map data flows: every source, prompt, model call, log and output.
  2. Run the DPIA and the HIPAA risk analysis, using the same diagram.
  3. Choose the hosting model and sign the DPA and BAA before any real data flows.
  4. Build the de-identification, access control and logging layers.
  5. Pilot with synthetic or de-identified data and measure output quality. Our guide on POC to production in 6 weeks shows how to keep this stage short.
  6. Complete the clinical safety review and, if needed, the medical device assessment.
  7. Launch to a small group, monitor outputs and incidents, then scale.

How Brainence can help

Brainence is a software development company with 10+ years of experience and 50+ delivered projects, building web and mobile products for clients in the UK, EU, Canada and Australia.

If you're looking for a healthcare LLM development partner with teams in the UK and Eastern Europe, this is the work we do. Our healthcare software development team builds patient-facing apps and clinical platforms with role-based access, encryption and audit logs from day one. For LLM features, we start with hands-on tech discovery: we map the data flows, pick the hosting model with you, and build the controls before the feature reaches real patients.

  • Architecture for LLM features that meet UK GDPR, EU GDPR and HIPAA requirements
  • De-identification, RAG with role-based access, and audit logging
  • Integration with your existing EHR, patient and clinical systems
  • A dedicated team that can scale up for the build and down once the feature is live

One example is WellCru, a pharmacist consultation app we built with separate panels for admins, pharmacists and users. That separation of roles is the starting point for any LLM feature you add later.

FAQ

Is ChatGPT GDPR compliant?

It depends on the plan and setup. Business plans and the API come with a data processing agreement, no training on your data by default and European data residency options. Consumer plans aren't suitable for patient data. You still need a lawful basis, an Article 9 condition, a DPIA and controls on what goes into prompts.

Is ChatGPT HIPAA compliant?

Not by default. OpenAI signs a BAA for ChatGPT for Healthcare, ChatGPT Enterprise with a regulated workspace, and the API when your account uses modified retention. Consumer ChatGPT plans aren't covered, so they shouldn't receive PHI. Even with a BAA, your configuration and access controls decide whether your use is compliant.

Is a healthcare LLM safe to use with PHI?

It can be, with the right setup. You need a BAA or DPA with the provider, de-identification where the task allows it, role-based access, encryption, audit logs, zero or short retention and no training on your data. Clinical outputs also need review by a qualified person before they affect care.

What is a healthcare LLM?

A healthcare LLM is a large language model trained, tuned or configured for clinical and health content. Teams use it for tasks such as summarising notes, drafting letters, coding, triage support and patient chat. It can be a general model with healthcare controls around it, or a model adapted to medical language.

Do you need a DPIA for an AI feature?

Usually, yes. The ICO requires a DPIA for large-scale processing of health data and for innovative technology such as AI combined with another high-risk factor. An LLM feature that processes patient data typically meets both. Run the DPIA before development, and update it when the model, vendor or data flows change.

Can I send patient data to an LLM API under GDPR?

Yes, with conditions. To use an LLM with patient data under GDPR, you need a lawful basis, an Article 9 condition, a data processing agreement, transfer safeguards if data leaves the UK or EU, data minimisation and a DPIA. Strip identifiers the task doesn't need, and set zero or short retention with the provider.

Does de-identified data fall outside GDPR and HIPAA?

Truly anonymised data falls outside GDPR, but pseudonymised data doesn't, because it can be linked back to a person. HIPAA treats data as de-identified only through Safe Harbor, removing 18 identifiers, or Expert Determination. Free-text clinical notes are hard to de-identify reliably, so test before you rely on it.

Should we self-host an open-source model for healthcare?

Only if you need that level of control. Self-hosting keeps data in your infrastructure but adds GPU costs, model updates, evaluation and security work. For many teams, a hosted model under a BAA or DPA, in a private cloud region with zero retention, gives enough control for far less effort.

Let’s discuss your software needs

  • We’ll review your requirements and get back to you within 24 hours to schedule a free 30-minute consultation.
  • If your project requires confidentiality, we’ll sign an NDA before moving forward.
  • After the call, you’ll receive a detailed proposal with clear estimates and timelines.

You might need a dedicated engineering team, help modernizing an existing product, or a partner to build something new. We can help you work out the right approach, even if you’re still defining the scope.

Anna Vasylko, Chief Operating OfficerAnna Vasylko
Chief Operating Officer

What’s next

Our servicesGet full-cycle custom software development — from discovery to architecture design and delivery.

Hey there! 😉

Did you know Brainence can build your software from scratch or scale your team with dedicated development experts?

Let’s discuss your development needs.