To de-identify medical records, treat the two halves differently. Structured fields, such as names, record numbers and dates in EHR tables, get a rule per column. Unstructured text, such as clinical notes and transcripts, needs detection that reads each sentence in context. Then make sure the same patient gets the same replacement in both, so the data still links up. For the HIPAA rules behind this, see our HIPAA de-identification guide; for the general methods, see data de-identification.
Here is one patient in two places, before and after:
EHR table (before) patient_name: Maria Lopez | mrn: 4471-0928 | dob: 1958-06-02 | zip: 02139 | admit: 2026-03-14 Discharge note (before) Maria Lopez was admitted 3/14 with heart failure. Her daughter Ana (617-555-0142) will drive her to follow-up with Dr. Kim. EHR table (after) patient_name: <PERSON>VJYe03W</PERSON> | mrn: <MRN>k82Pq1Zr</MRN> | birth_year: 1958 | zip3: 021 | admit: 2026-04-02 (shifted) Discharge note (after) <PERSON>VJYe03W</PERSON> was admitted <DATE>4/2</DATE> with heart failure. Her daughter <PERSON>0AmY0AcJ</PERSON> (<PHONE>8349201756</PHONE>) will drive her to follow-up with Dr. <PERSON>Lk9Tz4</PERSON>.
The patient has the same token in the table and the note. Her daughter and her doctor get tokens of their own. The diagnosis stays as written.
Structured medical data: a rule per field
EHR tables, lab results, claims and billing records hold PHI in known columns, so each column gets a method that fits how the data will be used.
| Field | Method | Why |
|---|---|---|
| Patient name | Consistent token | Analysts never need the name, but they need one patient to stay one patient |
| Medical record or member number | Consistent token | Keeps joins between EHR, claims and notes working |
| Date of birth | Year only, or age band | Keeps age analysis; ages over 89 go into one group under Safe Harbor |
| Admission and service dates | Shift by the same random offset per patient | Keeps length of stay and readmission intervals correct |
| ZIP code | First three digits, or 000 for small areas | Keeps regional analysis within the Safe Harbor ZIP rule |
| Phone, email, address | Remove or token | Rarely needed for analysis |
| Comment and notes columns | Treat as unstructured text | Free text inside a table hides names and numbers that column rules miss |
Date shifting is not Safe Harbor on its own, because Safe Harbor removes all date parts except the year. Teams that need real intervals usually use Expert Determination.
Unstructured medical data: read the text in context
Most PHI in a hospital sits in unstructured data: discharge summaries, progress notes, referral letters, call transcripts, scanned PDFs and the metadata in imaging files. It is hard to de-identify for four reasons:
- Names appear mid-sentence, often without capital letters in dictated notes.
- Other people appear too. Relatives, employers and household members count under Safe Harbor; clinicians may need to stay or go depending on your policy.
- Dates and places take many forms: “3/14”, “last Tuesday”, “the clinic on Elm Street”.
- Medical words look like names. “Parkinson”, “Hodgkin” and “Bell” are conditions, not people.
Pattern matching catches record numbers and phone numbers well, but misses names and context. De-identification of clinical text needs NLP-based detection that reads the whole sentence and tells a patient from a disease named after a person. For notes that go to an LLM, read does redacting clinical notes meet HIPAA Safe Harbor? and how to de-identify PHI in AI workflows.
Keep each patient consistent across tables and notes
The most common failure is not a missed name. It is inconsistency: the table replaces Maria Lopez with one code, the note with a placeholder, and the claims feed with another code. The records no longer link, so readmission studies, cohorts and AI training break.
Fix it by giving the same value the same token everywhere, at any time. Keep the mapping in a separate, protected vault, so approved roles can request a real value by policy and each request is logged. If a dataset must never be re-identified, anonymize it instead and keep no mapping.
De-identify medical records at scale
- Backfill history first. Run years of notes and claims through an asynchronous batch job, then switch to each new load.
- De-identify in the pipeline, before data lands in the lake or warehouse, so raw copies do not spread.
- Measure what you missed. Check a sample of your own notes by hand and count missed identifiers before release.
- Document the method and who can see real values.
Protecto finds PHI in structured columns, clinical free text and imaging metadata, adds your own identifiers such as member numbers in days, and gives each patient one token everywhere. It runs through its API, a Snowflake UDF, Databricks, Kafka or Spark, as SaaS or inside your environment. A healthcare data platform has about 750M claims documents in scope for AI with Protecto, and a healthcare insurer has handled 50M+ records. See PHI de-identification for data lakes.
Using de-identified medical records for AI
De-identified records are what most teams use to train and evaluate clinical models, build retrieval over notes and run analytics with outside partners. Consistent tokens keep the clinical story intact, so a model can still follow who did what. For model training specifically, see AI training data de-identification.
Frequently asked questions
Can medical records be de-identified automatically?
Yes, for most of the work. Automated detection handles structured fields and clinical free text at scale. Pair it with a documented method and a reviewed sample of the output before each release.
How do you de-identify clinical notes?
Use detection that reads each sentence in context to find names, dates, places and numbers, including those of relatives. Replace them with consistent tokens or remove them, keep the clinical words as written, and check a sample by hand before release.
Are de-identified medical records still PHI?
Not if they meet HIPAA Safe Harbor or Expert Determination. Records that keep a token mapping, shifted dates or a limited data set are usually still PHI. More answers are in our HIPAA de-identification FAQ.
