OpenMed: Local Clinical NLP & PII De-ID SDK
OpenMed is an SDK for running clinical NER and HIPAA-oriented PII de-identification locally in Python, Swift, or Kotlin, processing patient text on your own hardware instead of a hosted API. Reach for it if you need offline or air-gapped medical text processing across Apple MLX, Android ONNX, or browser WebGPU; skip it if you want a compliance guarantee baked in — the README says SDK use alone doesn't establish HIPAA compliance.
Understanding OpenMed's On-Device Healthcare AI
OpenMed is an Apache-2.0 SDK packaging 2,200+ medical models for clinical NER and PII de-identification behind one Python API — analyze_text, extract_pii, deidentify — plus native builds for Swift/MLX, Android ONNX, and browser Transformers.js. It processes text locally once model files are on disk; only the initial download or opted-in remote adapters touch the network. It also ships an MCP server and skills/ catalog for coding agents.
Core Capabilities for Medical Text Processing
- ✓Same API across backends: analyze_text() and extract_pii()/deidentify() route to CPU, CUDA, Apple MLX, ONNX, or browser WebGPU by swapping only the model_name argument, per the README.
- ✓Four built-in de-identification methods in deidentify() — mask, replace (Faker-backed synthetic substitution), hash, and shift_dates (a configurable day offset) — all demonstrated in the README against the same sample patient record.
- ✓Smart entity merging keeps multi-token PII spans, like a full date, intact instead of splitting them across tokenizer boundaries, per the README.
- ✓A Privacy Filter model family: three fine-tunes — OpenAI Privacy Filter, a Nemotron-PII tune, and an OpenMed Multilingual variant — sharing one sparse-MoE architecture and API; the README's own benchmark shows MLX running 24-33x faster than CPU PyTorch for this family (median per-inference-step latency).
- ✓35 supported PII language codes, 33 of them model-backed today; Russian currently falls back to a documented multilingual default, and an optional Indic NER add-on covers four more routes when a user sets OPENMED_INDIC_NER_MODEL.
- ✓Validator-backed national-ID coverage for ID-only locales the README names directly, including Poland, Latvia, Slovakia, Malaysia, the Philippines, and Finland.
- ✓A FastAPI REST service exposing /health, /analyze, /pii/extract, and /pii/deidentify alongside the Python API.
- ✓Agent-ready by design: an MCP server, a typed tool registry, and a skills/ catalog whose SKILL.md folders install into Claude Code, Codex, and OpenCode via install-skills.sh.
Applying OpenMed in Healthcare Workflows
- •Extracting disease, drug, or anatomy entities from a clinical note locally, using registry models like disease_detection_superclinical or pharma_detection_superclinical instead of sending the note to a third-party API.
- •De-identifying a discharge summary before it leaves a hospital network, choosing mask, replace, hash, or shift_dates depending on whether the output needs to stay human-readable or become fully synthetic.
- •Running the same ONNX PII model from a Python backend, an Android app via ONNX Runtime Mobile, and a browser tab via Transformers.js/WebGPU — the README walks through all three for one model.
- •Processing PII in a non-English note: the README includes worked examples in Portuguese, Dutch, Hindi, Arabic, Japanese, and Turkish, each with its own entity output.
- •Wiring a coding agent — Claude Code, Codex, or OpenCode — to call OpenMed's de-identify/analyze pipeline on synthetic placeholders through the skills catalog, then running the resulting pipeline locally on real notes.
- •Building an offline or air-gapped pipeline by pointing model_id at a local model directory so OpenMed skips the Hugging Face Hub entirely.
Getting Started with OpenMed
Python: pip install --upgrade "openmed[hf]" for the core plus Hugging Face runtime on Linux, macOS, or Windows with CPU or CUDA — the README requires Python 3.10+. Add [hf,service] for the REST service or [mlx] for Apple Silicon acceleration. Swift: add the package via Swift Package Manager — .package(url: "https://github.com/maziyarpanahi/openmed.git", from: "2.1.0") — which resolves OpenMedKit for import OpenMedKit. Android: add the JitPack repository scoped to com.github.maziyarpanahi in settings.gradle.kts, then depend on com.github.maziyarpanahi:openmed:v2.1.0. Browser: npm install openmed @huggingface/transformers, then load an exported ONNX model with loadOnnxModel(). Docker: docker build -t openmed:local . for the REST service.
Performing Clinical NER and PII De-identification
Clinical NER runs through one call: analyze_text(text, model_name="disease_detection_superclinical") returns result.entities, each with a label, text span, and confidence score — the README's own example tags 'chronic myeloid leukemia' as DISEASE at 0.98 confidence. PII de-identification follows the same shape: extract_pii(text, model_name="pii_superclinical_large", use_smart_merging=True) finds entities like NAME, DATE, and SSN, then deidentify(text, method="mask"|"replace"|"hash"|"shift_dates") rewrites the text — the README runs all four methods against one synthetic record. For volume, BatchProcessor(model_name=..., group_entities=True) processes a list of texts in one call; the README reports up to 3.3x the throughput of one-at-a-time processing on CPU and 2.2x on MLX.
Strengths
- ✓One API surface spans five deployment targets — Python/CPU/CUDA, Apple MLX, Android ONNX Runtime Mobile, browser WebGPU, and a FastAPI service — so switching backend means changing model_name, not rewriting the calling code.
- ✓Concrete de-identification options instead of one blanket redaction: mask, replace, hash, and shift_dates let you choose readable output or fully synthetic output depending on the downstream use.
- ✓Multilingual PII coverage goes past a language list — the README's worked examples in Portuguese, Dutch, Hindi, Arabic, Japanese, and Turkish each show real entity output.
- ✓The offline path is explicit and documented, not incidental: pointing model_id at a local directory is confirmed to skip the Hugging Face Hub, which matters for air-gapped clinical environments.
- ✓Agent tooling — an MCP server, a typed tool registry, and a skills/ catalog — is a first-class interface alongside the Python API, not bolted on afterward.
Considerations for HIPAA Compliance and Deployment
- △HIPAA compliance isn't a checkbox: the README says The 18 identifier categories are targetable by a Safe Harbor-aligned configuration, but expert deployment review is still required and using the SDK alone doesn't establish compliance.
- △The on-device promise only holds after setup — model downloads, remote-provider adapters, telemetry-enabled paths, and any user-configured integrations are documented as separate network boundaries in the README.
- △Language coverage is uneven: of the 35 supported PII language codes, only 33 are model-backed, Russian currently routes to a documented multilingual default placeholder, and the Indic NER add-on is optional and not bundled.
- △Model and dataset licensing isn't uniform — the SDK itself is Apache-2.0, but the README says individual model and dataset terms vary, so each catalog entry needs its own check.
- △The README's benchmark figures (24-33x MLX speedup, up to 3.3x/2.2x batch throughput) come without a documented methodology or hardware spec beyond 'Apple Silicon' and 'CPU', so treat them as vendor-reported rather than independently verified.
Other Approaches to Local Healthcare NLP
Frequently Asked Questions about OpenMed
OpenMed doesn't claim HIPAA compliance on its own — the README says the 18 identifier categories can be targeted by its Safe Harbor-aligned configuration, but expert deployment review is still required and SDK use alone doesn't establish compliance.
The OpenMed SDK is released under the Apache-2.0 license, though the README notes that individual model and dataset terms can vary and should be checked separately.
OpenMed ships a Python API for CPU, CUDA, and MLX, a Swift package (OpenMedKit) for Apple hardware, a Kotlin library for Android via ONNX Runtime Mobile, and a JavaScript path through Transformers.js in the browser.
OpenMed supports offline and air-gapped use by pointing model_name or model_id at a local model directory, which the README confirms skips the Hugging Face Hub once the model files are already on disk.
OpenMed documents 35 supported PII language codes, with 33 backed by dedicated models today; an optional Indic NER add-on can extend coverage further once a user configures it.
OpenMed's deidentify() function offers four methods: mask (label replacement), replace (Faker-backed synthetic substitution), hash (irreversible hashing), and shift_dates (shifting dates by a configurable number of days).
The problem it solves
Most ways to run clinical NER or PII redaction today mean sending patient text — protected health information — to a hosted API, which is exactly the kind of transfer that makes a hospital's compliance and data-privacy review harder. OpenMed's README frames its own reason for existing around that gap: a local runtime that processes clinical text on infrastructure you control, after the needed model artifacts are downloaded once, instead of routing every note through a cloud endpoint.
Who should try it — and who should skip
Reach for OpenMed if you're building a clinical or healthcare product and need medical NER or PII de-identification running on infrastructure you control — a Python backend, an iOS app via MLX/OpenMedKit, an Android app via ONNX Runtime Mobile, or a browser tab via WebGPU — and you're prepared to do your own HIPAA validation on top of it. Skip it if you need a compliance certification bundled in: the README is explicit that Safe Harbor-aligned configuration and SDK use don't themselves establish HIPAA compliance, so sign-off from your legal or compliance team is still on you.
Related repositories
Curious whether openmed is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about openmed.
