From openmed-skills
De-identify non-English clinical text on-device with OpenMed, supporting multiple languages and locale-aware fake surrogates for national IDs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/openmed-skills:deidentifying-multilingual-textThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
OpenMed de-identifies clinical text in many languages, each with a dedicated
OpenMed de-identifies clinical text in many languages, each with a dedicated
PII model, language-specific regex patterns (national IDs, phone formats), and a
locale-aware surrogate generator. Pass lang= to deidentify / extract_pii
and the right model, patterns, and fake-data tables are selected automatically.
Everything runs on-device.
Use it whenever the source text is not English, or when surrogates must look native to the locale (a German note should get German-looking fake names and a valid-format Steuer-ID surrogate, not a US SSN).
import openmed
from openmed.core.pii_i18n import SUPPORTED_LANGUAGES, get_patterns_for_language
print(sorted(SUPPORTED_LANGUAGES)) # query it; the set is the source of truth
# Language-appropriate default model for a code:
models = openmed.get_pii_models_by_language("es")
# Language-specific regex patterns (national IDs, phones, etc.):
patterns = get_patterns_for_language("de")
The set currently spans English plus European, South Asian, Middle Eastern, and
East Asian languages — but always read SUPPORTED_LANGUAGES rather than
trusting a number, since it changes as models ship. MCP exposes the same list
via openmed_list_pii_languages.
import openmed
nota = (
"El paciente Carlos Hernández (DNI 12345678Z), nacido el 11/04/1979, "
"vive en Calle Mayor 5, Madrid. Teléfono 612 345 678."
)
result = openmed.deidentify(
nota,
lang="es", # selects the Spanish PII model + ES patterns
method="replace", # locale-native fake values
locale="es_ES", # Faker locale (defaults from lang via LANG_TO_LOCALE)
)
print(result.deidentified_text)
# El paciente [surrogate name] (DNI [surrogate]), nacido el [date], ...
For German, just switch the code:
befund = "Patientin Anna Müller, geb. 11.04.1979, Steuer-ID 12 345 678 901."
result = openmed.deidentify(befund, lang="de", method="replace")
SUPPORTED_LANGUAGES.lang= to deidentify/extract_pii. This selects the
language-specific model (via get_pii_models_by_language) and the regex
pattern set (via get_patterns_for_language) for national IDs and formats.locale= for surrogates when method="replace". If omitted, the
locale is derived from lang through LANG_TO_LOCALE (e.g. pt→pt_PT).
Override for regional variants (pt_BR, en_GB, Gulf/Levant Arabic).deidentify auto-strips diacritics before inference and maps
spans back to the original accented text. You normally do not set
normalize_accents yourself.consistent=True, seed=....The pattern sets encode and the validators check real national identifier
formats and checksums, so structured IDs are caught even when the model is
unsure. Examples available in openmed.core.pii_i18n:
| Language | Identifier | Validator |
|---|---|---|
| French | NIR / INSEE | validate_french_nir |
| German | Steuer-ID | validate_german_steuer_id |
| Italian | Codice Fiscale | validate_italian_codice_fiscale |
| Spanish | DNI / NIE | validate_spanish_dni, validate_spanish_nie |
| Dutch | BSN | validate_dutch_bsn |
| Hindi | Aadhaar | validate_aadhaar |
| Portuguese | CPF / CNPJ | validate_portuguese_cpf, validate_portuguese_cnpj |
| Turkish | TCKN | validate_turkish_tckn |
These map to OpenMed CANONICAL_LABELS (ID_NUM, SSN) and are redacted by
the same policy actions as any other identifier.
deidentifying-clinical-text — methods, thresholds,
keep_mapping, policies (all accept lang/locale).generating-synthetic-surrogates — locale-native fakes and
custom providers per language.configuring-privacy-policies — policy= works with any lang.auditing-deidentification-runs records the model and language in
the no-PHI report.openmed_deidentify / openmed_list_pii_languages;
REST POST /pii/deidentify (both take a language parameter).lang=; the default model is English only.lang ≠ locale. lang picks the detection model and patterns;
locale shapes the replacement fakes. Set both when surrogate realism
matters (e.g. lang="pt", locale="pt_BR").te→en_IN and warns once. Override locale= if you need closer
regional surrogates.11/04/1979 as 11 April; the date logic is language-aware — keep lang set
when shifting dates.audit=True and consider a second pass.openmed/core/pii_i18n.py (SUPPORTED_LANGUAGES,
get_patterns_for_language, validators), openmed/core/model_registry.py
(get_pii_models_by_language), openmed/core/anonymizer/locales.py
(LANG_TO_LOCALE).npx claudepluginhub maziyarpanahi/openmed --plugin openmed-skillsRemove, mask, or replace PHI/PII in clinical free text on-device using OpenMed's deidentify(). Use when de-identifying medical notes, redacting PHI before sharing, or choosing a de-id method.
Guides medical researchers in de-identifying clinical data before LLM analysis using a local Python CLI with regex-based PHI detection. Supports 10 country locales (kr, us, jp, cn, de, uk, fr, ca, au, in) and CSV/TSV/Excel input.
De-identifies PHI via HIPAA safe harbor (removes 18 identifiers) and expert determination methods. Assesses re-identification risks, limited datasets, and data agreements.