OpenMed: Clinical NLP and PHI De-Identification That Never Leaves Your Device

⬅️ Back to Tools

🛠️ OpenMed

What it isOpen-source clinical NLP: biomedical entity extraction, multilingual PII detection, and de-identification
PlatformPython (CPU/CUDA/MLX), Swift (OpenMedKit), REST service, browser via Transformers.js/WebGPU
PriceFree, Apache-2.0
Linkopenmed.life · PyPI · GitHub

Most “healthcare AI” products want your notes in their cloud. OpenMed flips that: you download the models once, run inference on your laptop, VPC, or iPhone, and PHI stays on your side of the fence. Version 1.7.0 ships 1,000+ specialized biomedical models, a 15-language PII catalog covering all 18 HIPAA Safe Harbor identifiers, and Apple MLX acceleration for Mac and iOS. Six million PyPI downloads and counting.

  1. These are extraction models, not chatbots. OpenMed models are encoder transformers (BERT, ELECTRA, DeBERTa families), not generative medical LLMs. They pull structured entities out of unstructured clinical text: diseases, drugs, genes, anatomy, chemicals, oncology terms. The arXiv paper reports state-of-the-art on 10 of 12 biomedical NER benchmarks. Think structured output from a discharge summary, not a conversational diagnosis.

  2. Four lines to something useful. The Python API is deliberately flat: analyze_text() for NER, extract_pii() for detection, deidentify() for redaction, BatchProcessor() for document batches. Same call shape across CPU, CUDA, and MLX backends. On Apple Silicon, pip install "openmed[mlx]" and MLX model names auto-fallback to PyTorch checkpoints on other hardware, so one model name runs everywhere.

  3. PII handling is the real differentiator. The catalog covers 55+ entity types across 15 language codes (ar, de, en, es, fr, he, hi, id, it, ja, nl, pt, te, th, tr) with locale-aware validators: French NIR, German Steuer-ID, Italian Codice Fiscale, Dutch BSN, Portuguese CPF/CNPJ, Luhn checks on cards. Smart entity merging reassembles subword fragments so 123-45-6789 stays whole instead of splitting into token shards. Redaction methods include mask, hash, date-shift, and Faker-backed surrogates that preserve format.

  4. Runs where compliance teams want it. Laptop, on-prem server, air-gapped VPC, native iOS app via OpenMedKit. No runtime telemetry, no license phone-home, no outbound API calls during inference. Models load from Hugging Face once (or a private mirror) and stay local. The site is explicit: OpenMed provides technical controls; your legal HIPAA/GDPR boundary is still your deployment architecture.

  5. One stack, four surfaces. Python for notebooks and services. OpenMedKit (Swift) for macOS/iOS apps. FastAPI REST service with POST /analyze, POST /pii/extract, POST /pii/deidentify. Browser export path via ONNX into Transformers.js for WebGPU token classification. Nemotron Privacy Filter variants ship in both PyTorch and MLX weights. Pick the surface that matches where your PHI already lives.

  6. Honest limitations. First run downloads model weights (hundreds of MB per checkpoint). This is not a turnkey HIPAA compliance certification: you still own access controls, audit logs, and BAAs with any upstream LLM you pair it with. OpenMed Agent (terminal clinical workflows) and Welna (patient-facing iOS app) are separate products built on the stack, not required to use the library. Generative reasoning still needs an external model; OpenMed handles extraction and de-ID, not clinical judgment.

Install & first run

pip install "openmed[hf]"

Apple Silicon with MLX acceleration:

pip install "openmed[mlx]"

Extract entities from clinical text:

from openmed import analyze_text

result = analyze_text(
    "Patient started on imatinib for chronic myeloid leukemia.",
    model_name="disease_detection_superclinical",
)

for entity in result.entities:
    print(f"{entity.label:<12} {entity.text:<28} {entity.confidence:.2f}")

Detect and redact PHI:

from openmed import extract_pii, deidentify

text = "Patient: John Doe, DOB: 01/15/1970, SSN: 123-45-6789"

result = extract_pii(text, model_name="pii_superclinical_large", use_smart_merging=True)
clean = deidentify(text, method="mask")

Spin up the REST service:

pip install "openmed[hf,service]"
uvicorn openmed.service.app:app --host 0.0.0.0 --port 8080

Full guides: openmed.life/docs · model registry · MLX backend

Worth your time if: you build clinical pipelines, research tools, or health apps where sending PHI to a vendor API is a non-starter, and you need structured extraction or de-identification before anything else touches the text.

Related TMFNK Content

Crepi il lupo! 🐺