By Nukri Basharuli and George Zhgenti

JointSpace is a physical therapy clinic in Dubai. It wanted a model that could read a patient's full rehab history — comorbidities, progress notes, therapist comments — and help plan treatment. A hosted API was off the table: their clinical director put it plainly, sending data to external APIs was a non-starter. Running a model of the right quality in-house wasn't realistic either.

Yma Health solved this with us, and it's now in production with two customers: the clinic and Simplex Himes, a certified EHR provider in the UAE. Below is how it works, a code pattern you can adapt, and how this maps to HIPAA and GDPR if you're not in Dubai.

Why standard de-identification wasn't enough

The regulator is the Dubai Health Authority. DHA treats data as personal unless both direct identifiers and quasi-identifiers are removed. Stripping the name and the Emirates ID number doesn't get you there. Age plus neighborhood plus a rare diagnosis plus an employer often points to exactly one person.

Rules and regexes catch direct identifiers but miss context. They won't flag "the only commercial pilot among the clinic's patients." A model will. So Yma gave the de-identification job to Google's MedGemma 27B, a multimodal model that reads both the text of a record and its images.

That creates a different problem. To de-identify a record, the model first has to read it raw, so the raw record has to reach wherever the model runs.

The architecture

Yma calls its layer a "VPN for healthcare." It's middleware that runs on Super Protocol inside attested confidential environments. The flow:

  1. Yma requests data from the middleware.
  2. The middleware queries the clinic's EHR.
  3. Raw records come back over secure tunnels straight into the confidential environment.
  4. MedGemma, inside that environment, removes identifiers and keeps the clinical context.
  5. Only the de-identified output goes out to Yma. Inference on it then runs on NVIDIA B200 GPUs in Nebius AI Cloud, also in confidential mode.

None of the participants sees the raw records: not Simplex, not Yma, not Super, not Nebius, not the preprocessing provider. No changes were made to the certified EHR systems, and the clinics kept their existing workflows.

The code: a de-identification step

The snippets below are our own example. They follow the same pattern as the production setup, but they aren't Yma's code. MedGemma runs here as a dedicated deployment inside a confidential environment, not as a model from the shared Router catalog. It exposes an OpenAI-compatible API, so the client code is the same as in our previous post on Confidential Router:

import json, re from openai import OpenAI deid = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key=KEY) # via Gatekeeper SYSTEM = """You de-identify clinical records. Remove direct identifiers: names, ID numbers, phone, email, addresses, exact dates (keep the year and relative intervals like "3 weeks after surgery"). Remove or generalize quasi-identifiers: employer, rare occupation, nationality, small-area location, rare family details. Do not change clinical content: diagnoses, medications, measurements, findings. Return JSON: {"text": "...", "removed": [{"type": "...", "original": "..."}]}""" def deidentify(record: str) -> dict: r = deid.chat.completions.create( model="medgemma-27b", temperature=0, response_format={"type": "json_object"}, messages=[{"role": "system", "content": SYSTEM}, {"role": "user", "content": record}], ) return json.loads(r.choices[0].message.content) 

A model's output is probabilistic, so it doesn't get the final say. A deterministic check runs after it, and that check decides whether a record leaves:

PATTERNS = { "emirates_id": r"\b784-?\d{4}-?\d{7}-?\d\b", "phone": r"\+?971[\s-]?\d{1,2}[\s-]?\d{3}[\s-]?\d{4}", "email": r"[\w.+-]+@[\w-]+\.[\w.]+", "full_date": r"\b\d{1,2}[/.-]\d{1,2}[/.-]\d{2,4}\b", } def release_ok(result: dict) -> bool: text = result["text"] if any(re.search(p, text) for p in PATTERNS.values()): return False # nothing the model says it removed may still be in the output return not any(item["original"] in text for item in result["removed"]) out = deidentify(raw_record) if release_ok(out): send_to_yma(out["text"]) else: quarantine(raw_record_id) # stays inside the enclave, flagged for review 

Where this runs matters. deidentify, release_ok and the raw record all live inside the confidential environment. If the model misses something and the check catches it, the raw record goes nowhere: it stays inside and gets flagged for review. In a conventional setup, a de-identification miss means the operator of the machine running the model has already had access to raw PHI.

If you're in the US: HIPAA

HIPAA gives you two routes to de-identification. Safe Harbor means removing 18 listed identifier types. Expert Determination means a qualified expert concludes the re-identification risk is very small. DHA's approach to quasi-identifiers is closer to the second. An LLM step doesn't make data de-identified under HIPAA on its own; your expert and your method do.

There's a second piece. While raw records are being processed inside the environment, they're PHI. Since 2016, HHS guidance has been clear that a cloud provider is a business associate even if it stores only encrypted ePHI and has no key. Confidential computing doesn't remove the need for a BAA. What it does is shrink the set of people who can technically see the data, and make that verifiable. Super signs BAAs.

If you're in the EU: GDPR

Under GDPR, pseudonymized data is still personal data. Only truly anonymous data falls outside the regulation (Recital 26), and the bar is high — the same quasi-identifier logic DHA uses. Processing raw records is processing health data, a special category under Article 9. You'll need a DPA with each processor and most likely a DPIA. Attestation helps you show technical measures under Article 32: you have cryptographic proof of which code processed the data and that the operator couldn't access it.

The results

As reported by Yma and its customers:

  • zero changes to certified EHR systems;
  • 100% compliance with DHA anonymization rules;
  • two customers live.

Sergei Savvov, Yma's co-founder and CTO, says they previously had to write extensive custom anonymization code; MedGemma now does that work inside the secure environment. Google features the project in its Health AI Developer Foundations showcase.

Full case study: superprotocol.com/case-studies/yma.