linkage-attack/README.md
2026-11-02 07:38:59 -07:00

36 lines
2 KiB
Markdown

# Linkage attack: re-identify an "anonymized" release
A hospital releases patient records with the names removed. A city publishes its voter roll. You join the two, as Sweeney did in 1997, measure how many patients you can name, and then test whether k-anonymity would have stopped you. All data is synthetic.
## What is what
| File | Role |
| :--- | :--- |
| `attack.py` | your code, at each `YOUR TASK` |
| `data.py` | the city, the voter roll and the hospital release (given) |
| `selfcheck.py` | checks each of your functions on small hand-checkable cases (given) |
| `experiments.py` | runs the attack and the defense and prints your tables (given); writes `results.json` |
| `FINDINGS.md` | your predictions, tables and answers |
The functions keep the names, arguments and return shapes the given files import. Do not change the given files; the instructor runs the originals against your `attack.py`.
## Build and run
Python 3 only, no packages, on any computer. No course container or network access is involved.
```text
python3 selfcheck.py
python3 experiments.py
```
The self-check reports PASS, FAIL with what it expected, or SKIP for a function you have not written yet. A SKIP is not a pass, and an exit code of 0 with SKIPs is not completion. `experiments.py` prints tables A, B and C and writes `results.json`; keep the printed tables in your report.
## Rules
All data is synthetic, generated by `data.py`. Do not run these methods against any real release or any real person's data, and keep the given records unchanged so your tables stay comparable.
## References
- Sweeney, "Simple Demographics Often Identify People Uniquely": <https://dataprivacylab.org/projects/identifiability/paper1.pdf>
- Narayanan and Shmatikov, "Myths and Fallacies of Personally Identifiable Information": <https://arxiv.org/abs/0811.3774>
- Python [Counter](https://docs.python.org/3/library/collections.html#collections.Counter) and [statistics](https://docs.python.org/3/library/statistics.html)