Rounds & Square Pegs
Lab

De-identify a dataset, step by step

Interactive

Learning objective: by the end of this lab, you will be able to name the categories of identifiers that make a health dataset re-identifiable, and describe what handling each category requires.

Toggle the two steps below and watch the sample dataset change. Read the explanation under each step for the reasoning, but drive it yourself first.

Re-identification risk: critical

Critical: names, phone numbers, and MRNs are exposed. Anyone with this file can identify every patient directly.

NamePhoneMRNDOBZIPAdmittedDiagnosis
Alex Chen555-0142MRN-882131987-03-14902102026-01-15Type 2 diabetes
Priya Patel555-0198MRN-882141992-11-02902112026-01-16Hypertension
Jordan Reyes555-0173MRN-882151979-07-22597182026-01-15Fibrodysplasia ossificans progressiva
Sam Okafor555-0156MRN-882161995-05-30902102026-01-17Seasonal allergies
Morgan Lee555-0189MRN-882171988-09-11902122026-01-16Migraine

Step 1: Direct identifiers

Names, phone numbers, and medical record numbers are direct identifiers. They are removed outright, not masked. There is no acceptable way to keep them and still call a dataset de-identified.

Step 2: Quasi-identifiers

Date of birth, ZIP code, and admission date are not identifying alone, but combined they frequently are. Generalise them: birth year instead of birth date, three-digit ZIP instead of five, month of admission instead of exact date.

Step 3: The small-cell problem

Even after steps 1 and 2, a rare diagnosis in a small ZIP code can still identify someone. Toggle both steps above and look at Jordan Reyes's row: a rare diagnosis holds even once the fields around it are generalised. This is why de-identification is a property of the whole dataset, not of any single field, and why it needs to be re-checked whenever a dataset is filtered or combined with another.

What to take away

Re-identification risk is cumulative and dataset-wide, not field-by-field. You just watched two fields fix most of a dataset and leave one row exposed anyway. That is not a bug in the exercise. It is the actual shape of the problem.