pseudonymizing-for-gdpr
What it does
This skill teaches an agent how to hide personal details in text while keeping a separate key that can link records back later. It follows GDPR rules for pseudonymization, which are different from full anonymization.
When to use it
- ✓When a team must process personal or health data about people in the EU and needs a reversible safeguard.
- ✓When a project needs to link records back to a person later, such as for a patient follow-up, while the key stays apart.
- ✓When a reviewer asks for the difference between pseudonymization and anonymization to be written down.
Skill link
https://github.com/maziyarpanahi/openmed/blob/master/skills/pseudonymizing-for-gdpr/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Can you pseudonymize these patient notes for my EU study and keep the linking key stored separately?”
5 new skills a week. 1 minute to read.
How it works
The agent replaces personal details with masks and saves a mapping in a separate place. Only authorized people can use that mapping to link the data back.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
- Choose reversible pseudonymization, not masking. Use
method="replace"withpolicy="gdpr_pseudonymization"andkeep_mapping=True. Replacement surrogates keep the text usable for downstream NLP while remaining non-identifying.consistent=True(optionally withseed=) makes repeated mentions resolve to one stable surrogate so intra-document linkage survives. - Split the data from the key immediately. The moment
deidentifyreturns, routeresult.deidentified_textto your working store andresult.mappingto 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." - Process the pseudonymized text freely. Run
analyze_text, analytics, model training, or transfer ondeidentified_text. The key never leaves the vault during ordinary processing. - 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. - 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-riskbefore relying on it.
Hand-off to / from OpenMed
- From `extracting-pi
FAQ
Is pseudonymized data still personal data?
Yes. The skill states that it remains personal data under GDPR, because it can be linked back.
Does this make data anonymous?
No. Anonymous data cannot be linked back, while this method allows controlled re-linking.
Where should the key be kept?
The skill says to keep the key separate from the working data, with technical and organizational controls.
Details
Original description by the author
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.
repo: maziyarpanahi/openmed
Popularity
- GitHub stars
- 5.8k
- Ranking position
- #14720
- License
- Apache-2.0
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
annotating-variants
5.8kHelps your agent predict what a genetic variant does, convert HGVS names to genome positions and attach population frequencies, using free public annotators.
ask-openmed
5.8kHelps your agent pick the right OpenMed workflow for a clinical text request, starting with a privacy check whenever patient data may be present.
assembling-fhir-bundles
5.8kPackages several FHIR health records into one transaction Bundle ready to send to an EHR, with the internal references linked correctly.
auditing-deid-leakage
5.8kScans de-identified clinical text for leftover identifiers such as SSNs, card numbers, emails and dates, and blocks release if any remain.
Similar skills
gitcrawl
394kLets your agent search a saved archive of GitHub issues and pull requests, group duplicates, and check their current status on GitHub.
slacrawl
394kLets your agent search and count messages in a local Slack archive, check how fresh that archive is, and refresh it when needed.
goplaces
394kHelps your agent search for places, get their details and reviews, and resolve place names using Google Places, with JSON output for scripts.