OpenMed

πŸš€ Description

maziyarpanahi/openmed β€” local-first healthcare AI that never leaves the device. Clinical NER (diseases, drugs, anatomy, genes) and HIPAA PII de-identification running 100% on your own hardware: pip install "openmed[hf]", one function call, no API key, no network call, no patient data leaving the network. 1,000+ curated medical models Β· 247 PII checkpoints Β· 15 languages Β· Apache-2.0.

Runs everywhere the data lives: CPU/CUDA PyTorch, Apple Silicon via MLX (24–33Γ— faster than CPU PyTorch for the Privacy Filter), native iOS/macOS apps through OpenMedKit (Swift), a Dockerized FastAPI REST service, and in-browser WebGPU token classification via Transformers.js ONNX export.

🧩 Features

  • One-liner NER β€” analyze_text(text, model_name="disease_detection_superclinical") β†’ typed entities with confidence; registry of specialist models (disease, pharma, anatomy, gene, PII) 109M–434M params.
  • HIPAA-aware de-identification β€” all 18 Safe Harbor identifiers; deidentify() methods: mask, replace (Faker-backed, locale-aware, format-preserving fakes incl. CPF/BSN/Aadhaar/PESEL-style national IDs), hash, shift_dates. Policy profiles for HIPAA/GDPR/research with signed audit reports.
  • Smart entity merging β€” keeps 01/15/1970 one DATE instead of tokenizer fragments.
  • Privacy Filter family β€” three weight sets on the OpenAI Privacy Filter architecture (gpt-oss-style sparse-MoE): OpenAI baseline, NVIDIA Nemotron-PII fine-tune, OpenMed multilingual; same extract_pii() API, MLX + 8-bit variants; MLX names auto-fall-back to PyTorch checkpoints on non-Apple hosts.
  • Multilingual PII β€” 15 language codes (ar, de, en, es, fr, he, hi, id, it, ja, nl, pt, te, th, tr). No Polish.
  • Production REST service β€” warm pools, dynamic batching, request coalescing, rate limits, /livez /readyz, model unload/keep-alive; batch mode up to 3.3Γ— CPU throughput.
  • Air-gapped mode β€” point model_id at a local directory; never contacts Hugging Face Hub.
  • FHIR + HL7 v2 interop docs β€” de-identification wired into healthcare data formats.

Reasoning for

The strongest example yet in this vault of the local-first, data-never-leaves pattern applied to a regulated domain β€” the same argument Voicebox makes for voice and LibreChat for chat, but with real compliance stakes (its security policy treats a redaction bypass as a vulnerability). Two practical angles for me: (1) the PII de-identification pipeline is domain-generic β€” 247 checkpoints, Faker-backed format-preserving replacement, and policy profiles are directly relevant to any client project that must scrub personal data before sending text to a cloud LLM; (2) as a document pipeline it composes with MinerU / Unlimited-OCR β€” scan/parse first, then extract entities and redact on-device. Polish absence limits direct PLSoft use for now.

Alternatives considered

  • Cloud medical APIs (AWS Comprehend Medical, Google Healthcare NLP) β€” per-call pricing, PHI sent to the vendor; OpenMed’s entire pitch is the inverse.
  • Microsoft Presidio β€” general-purpose open-source PII de-identification, regex+NER hybrid; OpenMed is transformer-based, medical-specialized, with far more checkpoints.
  • spaCy/scispaCy β€” lighter biomedical NER, weaker on de-identification tooling and deployment story.
  • MinerU Β· Unlimited-OCR β€” upstream document parsing; combined = scan β†’ structure β†’ de-identify, all local
  • Voicebox Β· LibreChat β€” the local-first pattern in other modalities
  • AI Agent Security β€” the data-leaves-the-network risk class this eliminates

Template: tool