Measure reidentification risk in a release
A dataset that looks anonymous can still be unique. This skill estimates uniqueness over the quasi-identifiers and coarsens until the release is defensible.
Procedure
Enumerate the quasi-identifiers in the release: age, sex, postcode, job, dates, and any rare attributes.
Compute k-anonymity by grouping on the quasi-identifier set and finding the smallest group:
select min(cnt) from (
select age, sex, left(postcode,3) pc, count(*) cnt
from rel group by 1,2,3) s;
Target k >= 5 for a public release and k >= 3 for tightly controlled sharing. Anything below needs generalisation of the smallest groups.
Generalise the highest-cardinality identifiers: exact age to five-year bands, full postcode to sector, day to month.
Recompute after each change and document the trade between utility and risk.
Check uniqueness against external data. A rare combination appearing once is re-identifiable at k >= 5 if a public register maps it.
Watch duration and relative-time attacks: birth date plus an event date can recover a direct identifier.
Consider differential privacy for aggregate releases, adding calibrated noise and publishing the privacy budget (epsilon).
Write the release statement: quasi-identifiers present, k achieved, and the external-data check performed.
Pitfalls
- Removing names is not anonymisation; uniqueness in the quasi-identifiers re-identifies the row.
- k-anonymity ignores homogeneity and background knowledge; a same-valued group still discloses its sensitive attribute.
- Small cells in a cross-tab (counts of one or two) leak; suppress or generalise them.
- Free-text and comments are quasi-identifiers and cannot be bucketed; remove or manually review them.
- Over-coarsening destroys utility and pushes analysts back to the raw store, defeating the release.
Verification
psql "$REL_DB" -c "select min(cnt) from (select q1,q2,left(q3,3) q3,count(*) cnt from rel group by 1,2,3) s" # must be >= k target
Report the k achieved, the quasi-identifiers generalised, the external-data check, and any residual unique row.
1---2name: measure-reidentification-risk-in-a-release3description: Use when releasing a dataset that is meant to be anonymous and uniqueness could still identify people. Compute k-anonymity on the quasi-identifiers and generalise until the release is defensible.4metadata:5 source: https://skillmd.com/skills/jiayaoqijia/measure-reidentification-risk-in-a-release6---78# Measure reidentification risk in a release910A dataset that looks anonymous can still be unique. This skill estimates uniqueness over the quasi-identifiers and coarsens until the release is defensible.1112## Procedure13141. Enumerate the quasi-identifiers in the release: age, sex, postcode, job, dates, and any rare attributes.15162. Compute k-anonymity by grouping on the quasi-identifier set and finding the smallest group:17 ```sql18 select min(cnt) from (19 select age, sex, left(postcode,3) pc, count(*) cnt20 from rel group by 1,2,3) s;21 ```22233. Target k >= 5 for a public release and k >= 3 for tightly controlled sharing. Anything below needs generalisation of the smallest groups.24254. Generalise the highest-cardinality identifiers: exact age to five-year bands, full postcode to sector, day to month.26275. Recompute after each change and document the trade between utility and risk.28296. Check uniqueness against external data. A rare combination appearing once is re-identifiable at k >= 5 if a public register maps it.30317. Watch duration and relative-time attacks: birth date plus an event date can recover a direct identifier.32338. Consider differential privacy for aggregate releases, adding calibrated noise and publishing the privacy budget (epsilon).34359. Write the release statement: quasi-identifiers present, k achieved, and the external-data check performed.3637## Pitfalls3839- Removing names is not anonymisation; uniqueness in the quasi-identifiers re-identifies the row.40- k-anonymity ignores homogeneity and background knowledge; a same-valued group still discloses its sensitive attribute.41- Small cells in a cross-tab (counts of one or two) leak; suppress or generalise them.42- Free-text and comments are quasi-identifiers and cannot be bucketed; remove or manually review them.43- Over-coarsening destroys utility and pushes analysts back to the raw store, defeating the release.4445## Verification4647 psql "$REL_DB" -c "select min(cnt) from (select q1,q2,left(q3,3) q3,count(*) cnt from rel group by 1,2,3) s" # must be >= k target4849Report the k achieved, the quasi-identifiers generalised, the external-data check, and any residual unique row.