Agent Skillsmaziyarpanahi/openmed › reviewing-reidentification-risk

reviewing-reidentification-risk

GitHub

用于执行HIPAA专家认定风格的重识别风险评估。通过计算k-匿名性、l-多样性及运行对抗性攻击,量化去标识化数据集的残留风险,并生成合规备忘录,确保数据发布安全。

skills/reviewing-reidentification-risk/SKILL.md maziyarpanahi/openmed

触发场景

用户请求评估去标识化数据集的重识别风险 需要生成HIPAA专家认定(Expert Determination)合规报告 询问数据集是否可安全发布或存在单点识别风险

安装

npx skills add maziyarpanahi/openmed --skill reviewing-reidentification-risk -g -y
更多选项

不安装直接使用

npx skills use maziyarpanahi/openmed@reviewing-reidentification-risk

指定 Agent (Claude Code)

npx skills add maziyarpanahi/openmed --skill reviewing-reidentification-risk -a claude-code -g -y

安装 repo 全部 skill

npx skills add maziyarpanahi/openmed --all -g -y

预览 repo 内 skill

npx skills add maziyarpanahi/openmed --list

SKILL.md

Frontmatter
{
    "name": "reviewing-reidentification-risk",
    "license": "Apache-2.0",
    "metadata": {
        "pairs": "after",
        "project": "OpenMed",
        "version": "1.0",
        "category": "de-identification"
    },
    "description": "Run expert-determination-style quasi-identifier risk scoring (k-anonymity, l-diversity) plus OpenMed's empirical re-identification attack on a de-identified dataset, then document residual risk in a defensible memo. Use when the user needs HIPAA Expert Determination (45 CFR 164.514(b)(1)) support, asks whether a dataset is safe to release, worries about singling-out via age\/ZIP\/dates, or wants a statistical \"very small risk\" determination. Covers identifying quasi-identifiers, computing k-anonymity \/ l-diversity, running openmed.eval.attacks.reid (run_reid_attack \/ run_reid_benchmark) as the adversarial attack, and writing the risk memo. Pairs after deidentifying-clinical-text and auditing-deid-leakage."
}

Reviewing re-identification risk

Removing direct identifiers is not enough. A record stripped of name, SSN, and MRN can still be singled out by a combination of quasi-identifiers — age, ZIP/region, admission date, sex, rare diagnosis. The HIPAA Expert Determination pathway (45 CFR 164.514(b)(1)) requires a qualified person to apply statistical methods and document that the risk of re-identification is "very small." This skill produces that evidence: quasi-identifier risk metrics (k-anonymity, l-diversity) plus OpenMed's empirical re-identification attack, written up as a residual-risk memo.

When to use

  • After direct-identifier removal passes auditing-deid-leakage (no leaks) and you must decide whether the dataset is releasable.
  • The user invokes Expert Determination, asks for a re-identification risk score, k-anonymity, l-diversity, or a "very small risk" determination memo.
  • You need an adversarial linkage attack — modeling an attacker with auxiliary data — not just a structural metric.

Quick start

from openmed.eval.attacks.reid import run_reid_attack, run_reid_benchmark

# Synthetic de-identified records; each row is the released, de-id'd data.
deidentified = [
    {"record_id": "r1", "text": "[NAME], 47F, ZIP 021xx, admitted 2024-03."},
    {"record_id": "r2", "text": "[NAME], 47F, ZIP 021xx, admitted 2024-03."},
    {"record_id": "r3", "text": "[NAME], 88M, ZIP 597xx, admitted 2024-03."},  # singleton
]
# Auxiliary = what an attacker might already hold (e.g. a voter list).
auxiliary = [{"record_id": "v9", "text": "88M ZIP 597xx"}]

result = run_reid_attack(
    fixtures=[],                          # bring your own records below
    deidentified_records=deidentified,
    auxiliary_records=auxiliary,
)
metric = result.to_metric()
print(metric["aux_linkage_rate"],        # empirical linkage success
      metric["k_min"],                   # smallest equivalence-class size
      metric["singleton_count"],         # k=1 records (uniquely identifiable)
      metric["quasi_identifier_count"])

k_min is the population k-anonymity floor across the dataset; a k_min of 1 means at least one record is unique on its quasi-identifiers and is the highest re-identification risk. aux_linkage_rate is the empirical attack: how often the adversary's auxiliary data successfully links back to a released record.

To run against the bundled golden suite and emit a leaderboard-style report:

report = run_reid_benchmark(
    suite="golden",
    deidentified_records=deidentified,
    auxiliary_records=auxiliary,
    output_markdown="reid_risk.md",
)

Workflow

  1. Enumerate quasi-identifiers (QIs). List every field an outsider could plausibly know and cross-reference: age/DOB, ZIP/region, dates of service, sex, race, rare conditions, provider. Direct identifiers should already be gone (verified by auditing-deid-leakage); QIs are what's left to worry about.
  2. Compute k-anonymity. For each equivalence class (records sharing the same QI combination), the class size is k. run_reid_attack returns k_min and the list of singleton_records (k=1). A common Expert Determination target is k ≥ a documented threshold (e.g. k ≥ 5 or k ≥ 11) for every record.
  3. Check l-diversity on sensitive attributes. k-anonymity hides which record, but if every record in a class shares the same sensitive value (e.g. all HIV-positive), the attribute leaks anyway. Require ≥ l distinct sensitive values per class; flag homogeneous classes.
  4. Run the empirical attack. run_reid_attack / run_reid_benchmark model an adversary with auxiliary_records and measure actual linkage success (aux_linkage_rate), residual leakage (leakage_rate), surrogate-consistency leaks, and date-shift-inversion leaks. Structural metrics bound risk; the attack demonstrates it.
  5. Generalize or suppress, then re-score. For singletons / low-k classes, coarsen QIs (age → age band, ZIP5 → ZIP3, exact date → month/quarter) or suppress the record, then re-run until k_min and linkage rate meet your documented threshold.
  6. Write the determination memo. Record the QIs considered, methods applied, k_min, l-diversity, the attack's aux_linkage_rate, the assumptions about attacker capability, and the conclusion that residual risk is "very small." Cite the metrics — never paste raw records into the memo.

Hand-off to / from OpenMed

  • From auditing-deid-leakage: only score QI risk once direct-identifier leakage is zero. A leak short-circuits the whole determination.
  • OpenMed calls: from openmed.eval.attacks.reid import run_reid_attack, run_reid_benchmark, generate_reid_leaderboard. The attack delegates to openmed.risk.risk_report for k-anonymity / linkage internals.
  • To evaluating-with-leakage-gates: register reid_leakage_rate as a gate in the eval harness so re-identification risk regressions fail CI.
  • From pseudonymizing-for-gdpr: pseudonymized output is still re-identifiable via QIs — run this attack before claiming a dataset is low-risk or anonymized.

Edge cases & gotchas

  • Expert Determination is a human judgment. OpenMed produces the statistics; a qualified expert signs the determination. The tool supports the memo, it is not the memo.
  • Auxiliary data assumptions drive the result. Linkage rate is only as meaningful as the auxiliary_records you model. Document the assumed attacker (motivated insider vs. public voter list) — different aux sets, different risk.
  • Singletons are the headline. A single k=1 record can sink a release; check singleton_count and singleton_records first.
  • Date-shift can be inverted. Preserving intervals across a date shift lets an attacker re-anchor the timeline; the attack flags date_shift_inversion_rate. Watch it when de-id used method="shift_dates".
  • No raw records in artifacts. Reports carry counts, rates, and offsets. Keep the underlying dataset out of the memo and out of logs.
  • Local-first. Run the attack on-device; never ship candidate-release data to a third party to "test" re-identifiability.

Standards & references

版本历史

  • f213557 当前 2026-07-23 00:45

同 Skill 集合

skills/benchmark-pii-recall/SKILL.md
skills/building-with-openmed/SKILL.md
skills/deidentify-a-dataset/SKILL.md
skills/extract-clinical-entities-to-fhir/SKILL.md
skills/loading-openmed-models/SKILL.md
skills/pick-a-pii-model/SKILL.md
skills/annotating-variants/SKILL.md
skills/assembling-fhir-bundles/SKILL.md
skills/auditing-deid-leakage/SKILL.md
skills/auditing-deidentification-runs/SKILL.md
skills/auditing-part11-trails/SKILL.md
skills/auditing-safe-harbor-checklist/SKILL.md
skills/auditing-subgroup-fairness/SKILL.md
skills/authoring-model-cards/SKILL.md
skills/batch-processing-clinical-text/SKILL.md
skills/benchmarking-clinical-ner/SKILL.md
skills/bridging-presidio-and-spacy/SKILL.md
skills/building-gold-corpus/SKILL.md
skills/building-patient-timelines/SKILL.md
skills/checking-hipaa-compliance/SKILL.md
skills/choosing-openmed-models/SKILL.md
skills/coding-hcc-risk-adjustment/SKILL.md
skills/coding-icd10/SKILL.md
skills/computing-ecqms/SKILL.md
skills/configuring-privacy-policies/SKILL.md
skills/defining-cohort-phenotypes/SKILL.md
skills/deidentifying-clinical-text/SKILL.md
skills/deidentifying-multilingual-text/SKILL.md
skills/deploying-openmed-mcp/SKILL.md
skills/detecting-pv-signals/SKILL.md
skills/enforcing-nophi-logging/SKILL.md
skills/etl-to-omop-cdm/SKILL.md
skills/evaluating-with-leakage-gates/SKILL.md
skills/exporting-bulk-fhir/SKILL.md
skills/exporting-to-fhir/SKILL.md
skills/extracting-clinical-entities/SKILL.md
skills/extracting-dicom-metadata/SKILL.md
skills/extracting-lab-tables/SKILL.md
skills/extracting-pii-entities/SKILL.md
skills/extracting-sdoh/SKILL.md
skills/fetching-fhir-resources/SKILL.md
skills/gating-deid-leakage/SKILL.md
skills/generating-synthea-data/SKILL.md
skills/generating-synthetic-surrogates/SKILL.md
skills/ingesting-clinical-documents/SKILL.md
skills/linking-umls-concepts/SKILL.md
skills/mapping-loinc/SKILL.md
skills/mapping-to-snomed/SKILL.md
skills/mining-pubmed-literature/SKILL.md
skills/normalizing-rxnorm/SKILL.md

元信息

文件数
0
版本
de90aba
Hash
52bb16dd
收录时间
2026-07-23 00:45

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 08:10
浙ICP备14020137号-1 $访客地图$