De-identifying FHIR Data: Where Identifiers Hide and Which Techniques Actually Work
HIPAA Safe Harbor vs Expert Determination, the FHIR elements that leak identity, and redaction, generalization, date shifting and pseudonymization.
By the FHIR Toolbox team, Omindra Labs · 6 min read ·
Checked against the official specifications listed under Standards and references at the end of this article.
Removing Patient.name doesn't de-identify a FHIR Bundle. Identity leaks through dates, resource ids, references, narrative HTML, free-text notes and extensions. A dataset that looks anonymous can often be linked back to individuals in minutes. This guide maps where identifiers hide in FHIR and how to handle each one. It isn't legal advice: for data that will be released, the standard you must meet depends on your jurisdiction and your agreements, and should be decided with your privacy officer.
Two terms that get confused
- De-identification removes or transforms identifiers so individuals can't reasonably be identified. Under the US HIPAA Privacy Rule, properly de-identified data is no longer protected health information.
- Pseudonymization replaces identifiers with consistent tokens (patient
00123456becomesa91f…everywhere). Records stay linkable to each other. Whoever holds the key or mapping can re-identify them, so in most regulatory frameworks (including GDPR) pseudonymized data is still personal data.
The two HIPAA methods
HIPAA (45 CFR §164.514) recognizes two ways to de-identify:
- Safe Harbor — remove 18 listed identifier types, and have no actual knowledge that what's left could identify someone. The list includes names; geographic units smaller than a state (with a narrow exception for the first three ZIP digits); all elements of dates except the year for dates directly related to the individual; ages over 89; phone, fax, email; SSN, medical record, health plan, account, certificate and license numbers; vehicle and device identifiers; URLs and IP addresses; biometrics; full-face photos; and any other unique identifying number, characteristic or code.
- Expert Determination — a qualified expert applies statistical methods and documents that the risk of re-identification is very small. This is the route for keeping more utility, such as shifted but realistic dates.
Safe Harbor is mechanical, which makes it a good checklist for FHIR, but also strict: keeping full admission dates or 5-digit ZIP codes means it no longer applies.
Where identifiers hide in FHIR
| Location | Example | Notes |
|---|---|---|
Patient.name, telecom, address, photo | Obvious direct identifiers | Also in Patient.contact, RelatedPerson, Practitioner |
identifier (any resource) | MRN, SSN, insurance member id | Present on Patient, Encounter, Claim, Coverage and more |
Patient.birthDate | 1987-02-20 | Keep only the year for Safe Harbor; aggregate ages over 89 |
| Every other date | Encounter.period, Observation.effectiveDateTime, Condition.onsetDateTime, meta.lastUpdated | Easy to miss. Dates of service are identifiers under Safe Harbor |
| Resource ids and references | Patient/00123456, "subject": {"reference": "Patient/00123456"} | Many systems use the MRN as the resource id |
| Narrative | text.div | Generated HTML usually repeats name, birth date and MRN |
| Free text | Observation.note, valueString, CodeableConcept.text, Condition.note | Clinicians write names, places and dates in notes |
| Attachments | DocumentReference.content.attachment.data | Base64 PDFs and images with full demographics |
| Extensions | Race, ethnicity, birthplace, mother's maiden name | Quasi-identifiers that enable linkage |
fullUrl, meta.source, Provenance | Server URLs, device and user identifiers | Reveal facility and system |
Device.serialNumber, udiCarrier | Implant serial numbers | Listed explicitly in Safe Harbor |
Techniques, and when to use each
Redaction
Remove the element entirely. It's the right default for direct identifiers like names, telecom, photos and SSNs. Removing elements is better than replacing values with "[REDACTED]" strings, because a string where FHIR expects an array or object produces invalid resources that downstream tools reject.
Generalization
Reduce precision instead of removing: birthDate 1987-02-20 becomes 1987; ZIP 74047 becomes 740; age 93 becomes "90 or older". FHIR's partial dates make this natural, since "birthDate": "1987" is valid.
Date shifting
Move every date for a patient by the same random offset (for example −137 days). Intervals stay intact: length of stay, time between lab results, age at diagnosis to within the shift. That's what most research needs. Two rules:
- Use one offset per patient, applied to every date in every resource for that patient, or the timeline falls apart.
- Shifted dates are still full dates, so date shifting alone doesn't satisfy Safe Harbor. It's typically used under Expert Determination or a data use agreement.
Pseudonymization of ids and references
Replace resource ids with a keyed hash (for example HMAC-SHA256 with a secret key) and apply the same transformation to every reference:
Patient/00123456 -> Patient/7f3c9a1e2b...
"reference": "Patient/00123456" -> "reference": "Patient/7f3c9a1e2b..."
Don't use a plain unsalted hash: MRNs and SSNs come from small spaces and can be brute-forced. Keep the key separate from the dataset, or destroy it if re-identification will never be needed.
Free text and narrative
There's no reliable automatic way to clean free text without a dedicated clinical NLP de-identification tool. For most datasets, the safe choice is to remove text, note and attachment data entirely and keep only coded data.
A worked example
Before:
{
"resourceType": "Encounter",
"id": "00123456-enc-7",
"identifier": [{ "system": "http://hospital.example.org/visit", "value": "V-2026-55102" }],
"status": "finished",
"class": { "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode", "code": "IMP" },
"subject": { "reference": "Patient/00123456", "display": "Amy Shaw" },
"period": { "start": "2026-03-05T09:30:00-06:00", "end": "2026-03-09T14:00:00-06:00" },
"serviceProvider": { "reference": "Organization/mounds-general" }
}
After (pseudonymized ids, display removed, dates shifted by −137 days under an Expert Determination):
{
"resourceType": "Encounter",
"id": "e5b0c2d4a1",
"status": "finished",
"class": { "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode", "code": "IMP" },
"subject": { "reference": "Patient/7f3c9a1e2b" },
"period": { "start": "2025-10-19T09:30:00-06:00", "end": "2025-10-23T14:00:00-06:00" }
}
The visit identifier is gone, the display name is gone, the facility reference is gone (it could narrow the patient down to one small hospital), and the four-day length of stay is preserved. Under Safe Harbor you'd reduce the dates to 2026 instead.
Tools
- Microsoft's open-source FHIR Tools for Anonymization applies a configuration of FHIRPath-based rules (redact, date shift, crypto-hash, encrypt, substitute, perturb, generalize) to FHIR data. It ships with a Safe Harbor-oriented sample configuration. It's a good starting point for pipelines.
- The FHIR Toolbox Anonymizer is for a different job: quickly scrubbing an example before you paste it into a ticket, chat or bug report. It replaces common identifying elements (
name,telecom,address,birthDate,identifier,photo,contact,communication,deceasedDateTimeand narrativetext) with"[REDACTED]", wherever they appear, in your browser. It does not shift or remove other dates, pseudonymize ids and references, or clean free-text notes, and the output isn't valid FHIR. Don't use it to prepare research or release datasets.
A checklist before sharing
- Decide the standard first: Safe Harbor, Expert Determination, or a data use agreement with a limited data set.
- Remove direct identifiers, including in
contact, RelatedPerson and Practitioner. - Handle every date, not just
birthDate. - Pseudonymize or drop ids, and transform references consistently.
- Drop narrative, notes, free-text values and attachments unless reviewed.
- Review extensions and rare codes (a rare diagnosis in a small region can identify someone).
- Strip
fullUrlserver addresses,meta.sourceand Provenance. - Validate the output, so a broken Bundle doesn't push someone to "fix" it from the original data.
Try it
To see every element a resource contains, including the less obvious places above, explore it in the tree visualizer or list its elements in the Resource Inspector before you decide what to remove. To scrub a sample for a bug report, use the Anonymizer. Everything runs locally in your browser.
Standards and references
- HHS: Guidance on de-identification of PHI
- 45 CFR §164.514 (eCFR)
- Microsoft FHIR Tools for Anonymization
- FHIR R4: Narrative
FHIR Toolbox is a free collection of HL7 FHIR tools by Omindra Labs. The tools process your data in your browser; it is not uploaded for normal tool operations.