Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ No cloud. No vendor lock-in. No patient data leaving your network.</p>
</p>

<p>
<b>2,000+ models</b> &nbsp;·&nbsp; <b>17 model-backed PII languages</b> &nbsp;·&nbsp; <b>600+ PII checkpoints</b> &nbsp;·&nbsp; <b>100% on-device</b> &nbsp;·&nbsp; <b>Apache-2.0</b>
<b>2,000+ models</b> &nbsp;·&nbsp; <b>20 model-backed PII languages</b> &nbsp;·&nbsp; <b>600+ PII checkpoints</b> &nbsp;·&nbsp; <b>100% on-device</b> &nbsp;·&nbsp; <b>Apache-2.0</b>
</p>

<p>
Expand Down Expand Up @@ -503,10 +503,10 @@ On non-Apple-Silicon hosts, MLX model names are automatically substituted with t

---

## Multilingual PII (17 model-backed languages)
## Multilingual PII (20 model-backed languages)

Extraction and de-identification support **17 supported PII language codes**:
`ar`, `de`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`, `ko`, `nl`, `pt`, `ro`, `te`, `th`, and `tr`, with **600+ PII checkpoints** in total.
Extraction and de-identification support **20 supported PII language codes**:
`ar`, `cs`, `de`, `el`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`, `ko`, `nl`, `pt`, `ro`, `te`, `th`, `tr`, and `uk`, with **600+ PII checkpoints** in total.
These are the model-backed PII language allow-list.
OpenMed also includes validator-backed national-ID coverage for additional
ID-only locales such as Polish, Latvian, Slovak, Malay, Filipino, and Danish.
Expand Down
3 changes: 3 additions & 0 deletions clients/go/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ const (
LangTH PIILanguage = "th"
LangKO PIILanguage = "ko"
LangRO PIILanguage = "ro"
LangUK PIILanguage = "uk"
LangCS PIILanguage = "cs"
LangEL PIILanguage = "el"
)

// DeidentificationMethod selects how detected PII spans are transformed by the
Expand Down
5 changes: 4 additions & 1 deletion clients/typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export type PIILanguage =
| "id"
| "th"
| "ko"
| "ro";
| "ro"
| "uk"
| "cs"
| "el";

export type DeidentificationMethod =
| "mask"
Expand Down
4 changes: 2 additions & 2 deletions docs/anonymization.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ local attention, sink tokens, RoPE+YaRN, tiktoken `o200k_base`), differing
only in their training data:

The per-language PII API uses `openmed.core.pii_i18n.SUPPORTED_LANGUAGES`
as its source of truth and supports **17 supported PII language codes**:
`ar`, `de`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`, `ko`, `nl`, `pt`, `ro`, `te`, `th`, and `tr`.
as its source of truth and supports **20 supported PII language codes**:
`ar`, `cs`, `de`, `el`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`, `ko`, `nl`, `pt`, `ro`, `te`, `th`, `tr`, and `uk`.
These are the model-backed PII language allow-list.
Additional validator-backed national-ID providers cover ID-only locales such as
Polish, Latvian, Slovak, Malay, Filipino, and Danish without adding
Expand Down
30 changes: 24 additions & 6 deletions docs/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@
"id",
"th",
"ko",
"ro"
"ro",
"uk",
"cs",
"el"
],
"title": "Lang",
"type": "string"
Expand Down Expand Up @@ -417,7 +420,10 @@
"id",
"th",
"ko",
"ro"
"ro",
"uk",
"cs",
"el"
],
"title": "Lang",
"type": "string"
Expand Down Expand Up @@ -540,7 +546,10 @@
"id",
"th",
"ko",
"ro"
"ro",
"uk",
"cs",
"el"
],
"title": "Lang",
"type": "string"
Expand Down Expand Up @@ -636,7 +645,10 @@
"id",
"th",
"ko",
"ro"
"ro",
"uk",
"cs",
"el"
],
"title": "Lang",
"type": "string"
Expand Down Expand Up @@ -752,7 +764,10 @@
"id",
"th",
"ko",
"ro"
"ro",
"uk",
"cs",
"el"
],
"title": "Lang",
"type": "string"
Expand Down Expand Up @@ -876,7 +891,10 @@
"id",
"th",
"ko",
"ro"
"ro",
"uk",
"cs",
"el"
],
"title": "Lang",
"type": "string"
Expand Down
6 changes: 3 additions & 3 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ model argument. Override `model_name` only when you need a specific checkpoint,

### Which languages are supported?

PII extraction and de-identification support **17 supported PII language codes**:
`ar`, `de`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`, `ko`, `nl`, `pt`, `ro`, `te`, `th`, and `tr`.
PII extraction and de-identification support **20 supported PII language codes**:
`ar`, `cs`, `de`, `el`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`, `ko`, `nl`, `pt`, `ro`, `te`, `th`, `tr`, and `uk`.
These are the model-backed PII language allow-list.
Validator-backed national-ID coverage is broader for specific ID-only locales,
including Polish, Latvian, Slovak, Malay, Filipino, and Danish.
The README keeps a short multilingual example set in
[Multilingual PII](https://github.com/maziyarpanahi/openmed#multilingual-pii-17-model-backed-languages).
[Multilingual PII](https://github.com/maziyarpanahi/openmed#multilingual-pii-20-model-backed-languages).

Clinical NER coverage depends on the selected registry model. Check each model's `languages`, `entity_types`, and
specialization in the [Model Registry](model-registry.md) before putting it behind an API or batch job.
Expand Down
2 changes: 1 addition & 1 deletion docs/feature-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ coverage, see
| Canonical span contracts | Versioned `OpenMedSpan`, schema fingerprints, redaction action schemas, provenance, and compatibility gates. | `openmed/core/schemas/`, [De-identification API](./api/deidentification.md), `examples/v16_policy_audit_release_gates.py` |
| Audit and review evidence | Signed audit reports, reproducibility hashes, review bundles, FHIR `Provenance`/`AuditEvent`, audit diffs, and PHI-safe previews. | `openmed/core/audit.py`, `openmed/core/redaction_preview.py`, `openmed/risk/audit_diff.py`, `openmed/clinical/exporters/fhir/provenance.py`, `examples/v16_policy_audit_release_gates.py` |
| Runtime de-identification features | `DeidentificationResult.to_dataframe`, surrogate vaults, patient-keyed date shifting, format-preserving redaction, minimum-necessary action selection, streaming redaction, explain traces, section stamping, and risk budgets. | `openmed/core/pii.py`, `openmed/core/surrogate_vault.py`, `openmed/core/date_shift.py`, `openmed/core/anonymizer/format_preserve.py`, `openmed/core/redaction_strength.py`, `openmed/core/streaming.py`, `openmed/core/explain.py`, `openmed/risk/budget.py` |
| Multilingual PII | 17 supported PII language codes: ar, de, en, es, fr, he, hi, id, it, ja, ko, nl, pt, ro, te, th, and tr in the model-backed allow-list; locale validators, script detection, date/number normalization, deterministic locale PHI generation, and ID-only national-ID providers for additional locales. | `openmed/core/pii_i18n.py`, `openmed/core/script_detect.py`, `openmed/core/locale_formats.py`, `openmed/core/anonymizer/locales.py`, `openmed/training/synthetic/locale_phi.py`, `examples/pii_multilingual_new_languages.py` |
| Multilingual PII | 20 supported PII language codes: ar, cs, de, el, en, es, fr, he, hi, id, it, ja, ko, nl, pt, ro, te, th, tr, and uk in the model-backed allow-list; locale validators, script detection, date/number normalization, deterministic locale PHI generation, and ID-only national-ID providers for additional locales. | `openmed/core/pii_i18n.py`, `openmed/core/script_detect.py`, `openmed/core/locale_formats.py`, `openmed/core/anonymizer/locales.py`, `openmed/training/synthetic/locale_phi.py`, `examples/pii_multilingual_new_languages.py` |

## Multimodal And Structured Inputs

Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ coverage, and stronger release evidence:
- **Python, Swift, Kotlin/Android, REST, gRPC, React Native, TypeScript, and
browser paths** including OpenMedKit, typed REST clients, ONNX/WebGPU, and
Transformers.js export bundles.
- **17 supported PII language codes: ar, de, en, es, fr, he, hi, id, it, ja,
ko, nl, pt, ro, te, th, and tr** in the model-backed allow-list, with
- **20 supported PII language codes: ar, cs, de, el, en, es, fr, he, hi, id,
it, ja, ko, nl, pt, ro, te, th, tr, and uk** in the model-backed allow-list, with
locale-aware validation and surrogate generation, plus additional
validator-backed national-ID coverage for ID-only locales.
- **Release evidence** for leakage heatmaps, model scorecards, threshold
Expand Down
30 changes: 30 additions & 0 deletions docs/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ locale resolution, determinism, and cross-document surrogate vaults, see
| Code | Language | Default PII model | Faker locale | Notes |
| ------ | ---------- | ---------------------------------------------------------- | ------------ | ----------------------------------------------------------- |
| `ar` | Arabic | `OpenMed/OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1` | `ar_EG` | Egypt is the most-populous Arabic locale; override per call. |
| `cs` | Czech | `OpenMed/privacy-filter-multilingual` | `cs_CZ` | Rodné číslo checksum-aware surrogates. |
| `de` | German | `OpenMed/OpenMed-PII-German-SuperClinical-Small-44M-v1` | `de_DE` | Steuer-ID surrogates via `GermanSteuerIdProvider`. |
| `el` | Greek | `OpenMed/privacy-filter-multilingual` | `el_GR` | AMKA Luhn-aware surrogates. |
| `en` | English | `OpenMed/OpenMed-PII-SuperClinical-Small-44M-v1` | `en_US` | Default model splits names into `first_name`/`last_name`. |
| `es` | Spanish | `OpenMed/OpenMed-PII-Spanish-SuperClinical-Small-44M-v1` | `es_ES` | DNI/NIE checksum-aware surrogates. |
| `fr` | French | `OpenMed/OpenMed-PII-French-SuperClinical-Small-44M-v1` | `fr_FR` | NIR / INSEE surrogates via `fr_FR.ssn`. |
Expand All @@ -52,6 +54,7 @@ locale resolution, determinism, and cross-document surrogate vaults, see
| `te` | Telugu | `OpenMed/OpenMed-PII-Telugu-SuperClinical-Large-434M-v1` | `en_IN` | No Faker Telugu locale — `en_IN` approximation (warns once). |
| `th` | Thai | `OpenMed/privacy-filter-multilingual` | `th_TH` | Served by the multilingual privacy filter; Thai NID-aware. |
| `tr` | Turkish | `OpenMed/OpenMed-PII-Turkish-SuperClinical-Small-44M-v1` | `tr_TR` | TCKN surrogates. |
| `uk` | Ukrainian | `OpenMed/privacy-filter-multilingual` | `uk_UA` | RNOKPP checksum-aware surrogates. |

Codes outside this list (for example `zh`, `pl`, `lv`, `sk`, `ms`, `tl`, `da`)
are **not** model-backed PII languages. Several of them still have
Expand All @@ -76,6 +79,15 @@ Before: المريضة ليلى حسن، الهاتف +20 10 1234 5678
After: المريضة [NAME]، الهاتف [PHONE]
```

### Czech — `cs`

- Model: `OpenMed/privacy-filter-multilingual` · locale `cs_CZ`

```text
Before: Pacient Jan Novák, rodné číslo 751116/0008
After: Pacient [NAME], rodné číslo [ID]
```

### German — `de`

- Model: `OpenMed/OpenMed-PII-German-SuperClinical-Small-44M-v1` · locale `de_DE`
Expand All @@ -85,6 +97,15 @@ Before: Patientin Anna Müller, Steuer-ID 86095742719
After: Patientin [NAME], Steuer-ID [ID]
```

### Greek — `el`

- Model: `OpenMed/privacy-filter-multilingual` · locale `el_GR`

```text
Before: Ασθενής Γιώργος Παπαδόπουλος, ΑΜΚΑ 16117508024
After: Ασθενής [NAME], ΑΜΚΑ [ID]
```

### English — `en`

- Model: `OpenMed/OpenMed-PII-SuperClinical-Small-44M-v1` · locale `en_US`
Expand Down Expand Up @@ -221,3 +242,12 @@ After: ผู้ป่วย [NAME] โทร [PHONE]
Before: Hasta Ayşe Yılmaz, TCKN 10000000146
After: Hasta [NAME], TCKN [ID]
```

### Ukrainian — `uk`

- Model: `OpenMed/privacy-filter-multilingual` · locale `uk_UA`

```text
Before: Пацієнтка Олена Коваль, РНОКПП 2974281300
After: Пацієнтка [NAME], РНОКПП [ID]
```
7 changes: 4 additions & 3 deletions docs/rest-recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ hardware):
## Extract PII — `POST /pii/extract`

Detect personally identifiable information. Unless `model_name` is set, OpenMed
selects the recommended PII model for `lang`. The 17 supported PII language
codes: `ar`, `de`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`, `ko`, `nl`,
`pt`, `ro`, `te`, `th`, and `tr`. `confidence_threshold` defaults to `0.5`.
selects the recommended PII model for `lang`. The 20 supported PII language
codes: `ar`, `cs`, `de`, `el`, `en`, `es`, `fr`, `he`, `hi`, `id`, `it`, `ja`,
`ko`, `nl`, `pt`, `ro`, `te`, `th`, `tr`, and `uk`. `confidence_threshold`
defaults to `0.5`.

```bash
curl -sS --max-time 310 -X POST "$OPENMED_URL/pii/extract" \
Expand Down
8 changes: 4 additions & 4 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ text = validate_input(user_supplied_text, max_length=2000, allow_empty=False)
**Symptom.** A PII call with an unrecognized `lang` raises:

```text
ValueError: Unsupported language 'xx'. Supported: ['ar', 'de', 'en', 'es', 'fr', 'he', 'hi', 'id', 'it', 'ja', 'ko', 'nl', 'pt', 'ro', 'te', 'th', 'tr']
ValueError: Unsupported language 'xx'. Supported: ['ar', 'cs', 'de', 'el', 'en', 'es', 'fr', 'he', 'hi', 'id', 'it', 'ja', 'ko', 'nl', 'pt', 'ro', 'te', 'th', 'tr', 'uk']
```

**Cause.** PII extraction and de-identification support **17 supported PII language codes: ar, de, en, es,
fr, he, hi, id, it, ja, ko, nl, pt, ro, te, th, and tr**. Passing anything outside that set (or a mistyped
code) raises this error.
**Cause.** PII extraction and de-identification support **20 supported PII language codes: ar, cs, de, el,
en, es, fr, he, hi, id, it, ja, ko, nl, pt, ro, te, th, tr, and uk**. Passing anything outside that set (or a
mistyped code) raises this error.

**Fix.** Use one of the supported codes with `extract_pii(..., lang="<code>")`. Clinical NER coverage depends
on the selected registry model — check each model's `languages` in the
Expand Down
2 changes: 1 addition & 1 deletion docs/website/assets/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function moonSVG() {
return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>`;
}

/* ---------- PHI Demo (cycles through 7 of the 17 languages OpenMed supports) ------ */
/* ---------- PHI Demo (cycles through 7 of the 20 languages OpenMed supports) ------ */
const PHI_SAMPLES = [
{
lang: "en",
Expand Down
Loading
Loading