Agent Skillsmaziyarpanahi/openmed › pseudonymizing-for-gdpr

pseudonymizing-for-gdpr

GitHub

用于对欧盟个人及健康数据执行GDPR合规的伪匿名化处理。通过OpenMed工具生成可逆映射,并将重关联密钥与数据分离存储,确保在保留后续授权重关联能力的同时满足法律要求。

skills/pseudonymizing-for-gdpr/SKILL.md maziyarpanahi/openmed

Trigger Scenarios

处理受GDPR约束的个人或健康数据 需要可逆的伪匿名化而非不可逆的去标识化 需将重关联密钥与数据分离存储 涉及GDPR第4条第5款或第9条的合规需求

Install

npx skills add maziyarpanahi/openmed --skill pseudonymizing-for-gdpr -g -y
More Options

Use without installing

npx skills use maziyarpanahi/openmed@pseudonymizing-for-gdpr

指定 Agent (Claude Code)

npx skills add maziyarpanahi/openmed --skill pseudonymizing-for-gdpr -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": "pseudonymizing-for-gdpr",
    "license": "Apache-2.0",
    "metadata": {
        "pairs": "after",
        "project": "OpenMed",
        "version": "1.0",
        "category": "de-identification"
    },
    "description": "Apply GDPR-grade pseudonymization to clinical or personal text with OpenMed, keeping a separately-held re-linkage key so the data can be controlled-re-linked later. Use when the user must process EU personal\/health data under GDPR, asks for pseudonymization vs anonymization, needs Art. 4(5) \/ Art. 9 \/ Recital 26 alignment, wants a reversible mapping\/key vault held apart from the data, or needs controlled re-linkage. Covers openmed.deidentify(policy=\"gdpr_pseudonymization\", keep_mapping=True), storing the mapping in a separate key vault, reidentify() for authorized re-linkage, and retention. Pairs after extracting-pii-entities and configuring-privacy-policies."
}

Pseudonymizing for GDPR

Pseudonymization under the GDPR (Art. 4(5)) means processing personal data so it "can no longer be attributed to a specific data subject without the use of additional information" — provided that additional information (the re-linkage key) is "kept separately and is subject to technical and organisational measures." Crucially, pseudonymized data is still personal data (Recital 26): re-linkage is possible, so GDPR still applies. This is the opposite of anonymization, where re-identification is irreversibly prevented and the data falls outside the GDPR.

OpenMed implements this with a single reversible de-identification pass plus a mapping you store away from the data. This skill covers producing that mapping, vaulting the key separately, and re-linking under authorization.

When to use

  • You process EU residents' personal or special-category health data (Art. 9) and need a lawful, reversible safeguard rather than full anonymization.
  • You need to keep a record-linkage capability (e.g. to recontact a patient, reconcile longitudinal records, or honor a Subject Access Request) but must separate the linkage key from the working dataset.
  • A reviewer asks for the pseudonymization-vs-anonymization distinction in writing, or for the ENISA-style "additional information kept separately" control to be demonstrable.

Do not use this when the goal is irreversible anonymization for open release — there, drop the mapping entirely and gate residual risk with reviewing-reidentification-risk. Pseudonymization keeps a key; anonymization must not.

Quick start

import openmed

# Synthetic record — never run this skill's examples on real PHI.
note = "Patient Maria Schmidt (ID 4471) seen 2024-03-02; contact maria@example.de."

result = openmed.deidentify(
    note,
    method="replace",                 # realistic surrogates, not [LABEL] holes
    policy="gdpr_pseudonymization",   # bundled GDPR profile
    keep_mapping=True,                # produce the reversible re-linkage map
    consistent=True,                  # same input -> same surrogate in the doc
    seed=20240302,                    # cross-run reproducibility of surrogates
)

pseudonymized_text = result.deidentified_text   # safe to process / analyze
relink_key = result.mapping                      # surrogate -> original; SECRET

result.deidentified_text is the pseudonymized payload. result.mapping is the "additional information" GDPR Art. 4(5) requires be kept separately — it is the key that makes re-linkage possible, and therefore the most sensitive artifact in the whole flow.

Workflow

  1. Choose reversible pseudonymization, not masking. Use method="replace" with policy="gdpr_pseudonymization" and keep_mapping=True. Replacement surrogates keep the text usable for downstream NLP while remaining non-identifying. consistent=True (optionally with seed=) makes repeated mentions resolve to one stable surrogate so intra-document linkage survives.
  2. Split the data from the key immediately. The moment deidentify returns, route result.deidentified_text to your working store and result.mapping to a separate, access-controlled key vault — different system, different credentials, different backups. Never persist them in the same row, file, bucket, or log line. This separation is the technical-and-organisational measure that makes the data pseudonymized rather than just "personal data with PII in it."
  3. Process the pseudonymized text freely. Run analyze_text, analytics, model training, or transfer on deidentified_text. The key never leaves the vault during ordinary processing.
  4. Re-link only under authorization. When a lawful basis exists (e.g. an authorized SAR or recontact), fetch the mapping from the vault and call openmed.reidentify(deidentified_text, mapping). Log that a re-linkage happened (who, when, why, record id) — but never log the restored plaintext.
  5. Apply retention to the key. The mapping has its own retention clock. When the lawful basis for re-linkage ends, destroy the mapping. Once the key is irreversibly gone and no other re-identification path remains, the remaining text approaches anonymization and GDPR obligations shrink accordingly. Verify that claim with reviewing-reidentification-risk before relying on it.

Hand-off to / from OpenMed

  • From extracting-pii-entities / configuring-privacy-policies: confirm the detector recall and the active policy profile before pseudonymizing, since any identifier the detector misses leaks into deidentified_text.
  • OpenMed call: Python from openmed import deidentify, reidentify; the same capability is exposed as MCP tool openmed_deidentify and REST /deidentify. Pass policy="gdpr_pseudonymization", keep_mapping=True.
  • To auditing-deid-leakage: scan result.deidentified_text for residual identifiers before it leaves the boundary — pseudonymization is only as strong as detection.
  • To reviewing-reidentification-risk: quasi-identifier (age, ZIP, dates) re-identification still applies to pseudonymized data; score k-anonymity on the output and document residual risk.

Edge cases & gotchas

  • Pseudonymized ≠ anonymized. As long as mapping exists anywhere, the data is personal data under Recital 26. Do not market a keep_mapping=True output as "anonymous."
  • The mapping is the crown jewel. A leaked mapping re-identifies everything at once. Treat it as the highest-sensitivity secret: encrypt at rest, restrict access, audit reads.
  • Surrogates can still carry quasi-identifiers. method="replace" swaps the identifier text, but free-text age, rare diagnosis, ZIP, or admission dates remain. Pseudonymization does not address singling-out; pair with QI risk scoring.
  • Reproducibility cuts both ways. A fixed seed makes surrogates stable across runs (good for linkage) but means an attacker who learns the seed and algorithm can reproduce surrogates — keep the seed with the key, not the data.
  • Special-category data (Art. 9). Health data needs a lawful basis before processing; pseudonymization is a safeguard, not a lawful basis on its own.
  • Local-first. Run entirely on-device. Do not send EU personal data to a cloud de-identification service to satisfy GDPR — that may itself be a transfer.

Standards & references

Version History

  • f213557 Current 2026-07-23 00:45

Same Skill Collection

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

Metadata

Files
0
Version
de90aba
Hash
a4df912d
Indexed
2026-07-23 00:45

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 07:45
浙ICP备14020137号-1 $bản đồ khách truy cập$