Deidentifying Multilingual Text logo

Deidentifying Multilingual Text

CommunityPopular
maziyarpanahi
deidentifying-multilingual-text

De-identify non-English clinical text on-device with OpenMed by passing lang= and locale= to deidentify(). Use when the user has Spanish, German, French, Italian, Portuguese, Dutch, Hindi, Telugu, Arabic, Japanese, or Turkish medical notes, needs locale-aware fake surrogates, must handle language-specific national IDs (DNI, NIR, Steuer-ID, codice fiscale, BSN, CPF, TCKN, Aadhaar), or asks which languages OpenMed PII supports. Covers SUPPORTED_LANGUAGES, get_pii_models_by_language, get_patterns_for_language, LANG_TO_LOCALE, and accent normalization. Pairs with OpenMed deidentifying-clinical-text and generating-synthetic-surrogates.

Overview

Publishermaziyarpanahi
Repositoryopenmed
Skill namedeidentifying-multilingual-text
Stars
5.3K
Forks
677
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by maziyarpanahi on GitHub. Read the source before you install it.

Installation

Install the Deidentifying Multilingual Text AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maziyarpanahi/openmed.git /tmp/openmed
mkdir -p .claude/skills
cp -r /tmp/openmed/skills/deidentifying-multilingual-text .claude/skills/deidentifying-multilingual-text
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Deidentifying Multilingual Text in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Deidentifying Multilingual Text on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Deidentifying Multilingual Text is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

De-identifying multilingual text

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.

When to use this skill

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).

Discover supported languages at runtime — don't hardcode

python
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.

Quick start (Spanish)

python
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:

python
befund = "Patientin Anna Müller, geb. 11.04.1979, Steuer-ID 12 345 678 901."
result = openmed.deidentify(befund, lang="de", method="replace")

Workflow

  1. Confirm the language is supported by checking SUPPORTED_LANGUAGES.
  2. Pass 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.
  3. Set locale= for surrogates when method="replace". If omitted, the locale is derived from lang through LANG_TO_LOCALE (e.g. ptpt_PT). Override for regional variants (pt_BR, en_GB, Gulf/Levant Arabic).
  4. Let accent normalization happen. For models trained on accent-free text (Spanish), deidentify auto-strips diacritics before inference and maps spans back to the original accented text. You normally do not set normalize_accents yourself.
  5. Keep surrogates stable across a document with consistent=True, seed=....

Language-specific national IDs

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:

LanguageIdentifierValidator
FrenchNIR / INSEEvalidate_french_nir
GermanSteuer-IDvalidate_german_steuer_id
ItalianCodice Fiscalevalidate_italian_codice_fiscale
SpanishDNI / NIEvalidate_spanish_dni, validate_spanish_nie
DutchBSNvalidate_dutch_bsn
HindiAadhaarvalidate_aadhaar
PortugueseCPF / CNPJvalidate_portuguese_cpf, validate_portuguese_cnpj
TurkishTCKNvalidate_turkish_tckn

These map to OpenMed CANONICAL_LABELS (ID_NUM, SSN) and are redacted by the same policy actions as any other identifier.

Hand-off to / from OpenMed

  • Core de-id: deidentifying-clinical-text — methods, thresholds, keep_mapping, policies (all accept lang/locale).
  • Surrogates: generating-synthetic-surrogates — locale-native fakes and custom providers per language.
  • Policies: configuring-privacy-policiespolicy= works with any lang.
  • Audit: auditing-deidentification-runs records the model and language in the no-PHI report.
  • Other surfaces: MCP openmed_deidentify / openmed_list_pii_languages; REST POST /pii/deidentify (both take a language parameter).

Edge cases & gotchas

  • Never run the English model on other languages. Recall collapses. Always pass lang=; the default model is English only.
  • langlocale. 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").
  • Some locales are approximations. Faker has no Telugu locale, so OpenMed maps teen_IN and warns once. Override locale= if you need closer regional surrogates.
  • Date order varies. Day-first languages (fr, de, it, es, nl, pt, …) parse 11/04/1979 as 11 April; the date logic is language-aware — keep lang set when shifting dates.
  • Mixed-language notes (e.g. English headers in a Spanish chart) may lower recall; verify residual risk with audit=True and consider a second pass.
  • No raw PHI in logs regardless of language — offsets, labels, hashes only.

Standards & references

  • HIPAA de-identification, 45 CFR 164.514(b) (US) and GDPR / national DPAs for EU subjects: https://www.hhs.gov/hipaa/for-professionals/privacy/special-topics/de-identification/index.html
  • National ID format references are encoded in OpenMed validators (no external registry bundled).
  • OpenMed source: 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).

Frequently asked questions

What does the Deidentifying Multilingual Text AI skill do?

De-identify non-English clinical text on-device with OpenMed by passing lang= and locale= to deidentify(). Use when the user has Spanish, German, French, Italian, Portuguese, Dutch, Hindi, Telugu, Arabic, Japanese, or Turkish medical notes, needs locale-aware fake surrogates, must handle language-specific national IDs (DNI, NIR, Steuer-ID, codice fiscale, BSN, CPF, TCKN, Aadhaar), or asks which languages OpenMed PII supports. Covers SUPPORTED_LANGUAGES, get_pii_models_by_language, get_patterns_for_language, LANG_TO_LOCALE, and accent normalization. Pairs with OpenMed deidentifying-clinical-...

Why use Deidentifying Multilingual Text on TypingMind?

Because you install it once and use it with any model. Deidentifying Multilingual Text is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Deidentifying Multilingual Text in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/maziyarpanahi/openmed/tree/master/skills/deidentifying-multilingual-text. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Deidentifying Multilingual Text?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Deidentifying Multilingual Text?

As many as you like. As long as a model supports skills, you can use Deidentifying Multilingual Text with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Deidentifying Multilingual Text AI skill free?

Yes. It is published on GitHub by maziyarpanahi under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇