deidentifying-multilingual-text
できること
このスキルは、多くの言語で書かれた臨床ノートから患者の識別子を取り除きます。国ごとのIDや電話番号の言語別のパターンを使います。英語以外の医療記録を扱うチーム向けです。
使う場面
- ✓臨床ノートが英語以外の言語で書かれているとき。
- ✓ノートにスペインのDNIやブラジルのCPFなど、国の識別番号が含まれているとき。
- ✓置き換える架空の値が、そのノートの地域らしく見える必要があるとき。
スキルのリンク
https://github.com/maziyarpanahi/openmed/blob/master/skills/deidentifying-multilingual-text/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“これらの医療ノートはスペイン語で、DNIの番号が含まれています。患者の識別子を取り除き、文章は自然なまま残してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、ノートの言語に合うモデルとパターンを選び、地域に合った架空の値を使って識別子を取り除くか置き換えます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
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)
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")
Workflow
- Confirm the language is supported by checking
SUPPORTED_LANGUAGES. - Pass
lang=todeidentify/extract_pii. This selects the language-specific model (viaget_pii_models_by_language) and the regex pattern set (viaget_patterns_for_language) for national IDs and formats. - Set
locale=for surrogates whenmethod="replace". If omitted, the locale is derived fromlangthroughLANG_TO_LOCALE(e.g.pt→pt_PT). Override for regional variants (pt_BR,en_GB, Gulf/Levant Arabic). - Let accent normalization happen. For models trained on accent-free text
(Spanish),
deidentifyauto-strips diacritics before inference and maps spans back to the original accented text. You normally do not setnormalize_accentsyourself. - 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:
| 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.
Hand-off to / from OpenMed
- Core de-id:
deidentifying-clinical-text— methods, thresholds,keep_mapping, policies (all acceptlang/locale). - Surrogates:
generating-synthetic-surrogates— locale-native fakes and custom providers per language. - Policies:
configuring-privacy-policies—policy=works with anylang. - Audit:
auditing-deidentification-runsrecords the model and language in the no-PHI report. - Other surfaces: MCP
openmed_deidentify/openmed_list_pii_languages; RESTPOST /pii/deidentify(both take a language parameter).
Edge cases & gotchas
- **Never
よくある質問
どの言語に対応していますか?
対応言語の一覧は実行時に確認します。新しいモデルが出るたびに増えるためです。
インターネット接続は必要ですか?
いいえ。モデルを一度ダウンロードした後は、端末上で処理されます。
国のID形式にも対応していますか?
はい。DNI、codice fiscale、CPFなど、言語ごとの国のID形式のパターンを使います。
詳細
作者による元の説明
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-tex
repo: maziyarpanahi/openmed
人気
- GitHubのスター
- 5.8k
- ランキング
- #14690
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
annotating-variants
5.8kエージェントが、無料の公開アノテーターを使って、遺伝子バリアントの作用を予測し、HGVS名をゲノム上の位置に変換し、集団の頻度を付与できるよう支援します。
ask-openmed
5.8kエージェントが、臨床テキストの依頼に合ったOpenMedのワークフローを選べるよう支援します。患者データが含まれる可能性がある場合は、必ずプライバシーの確認から始めます。
assembling-fhir-bundles
5.8kエージェントが、複数のFHIR健康記録を、内部の参照を正しくつないだ一つのトランザクションBundleにまとめ、EHRに送れる状態にします。
auditing-deid-leakage
5.8kエージェントが、匿名化済みの臨床テキストに残っている識別子(SSN、カード番号、メール、日付など)をスキャンし、残っていれば公開を止めます。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。