# Repository Briefing: maziyarpanahi/openmed
> Source: https://repoforai.com/repo/maziyarpanahi/openmed (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/maziyarpanahi/openmed
- **Official Docs / Website**: https://openmed.life/
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: A+ (95/100 · Maintenance 35/35 · Adoption 20/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v4.0.0 (2026-11-27) — https://github.com/maziyarpanahi/openmed/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, Self-Hosted, Local AI, GPU, API
- **Momentum**: 5,896 ★ total (+4 24h / +45 7d) · 779 forks
- **Topics**: `android`, `clinical-nlp`, `healthcare`, `hipaa`, `ios`, `javascript`, `llm`, `local-llm`, `mlx`, `ner`, `nlp`, `on-device`
- **When to Use**: Best for: Teams that need to extract clinical entities and de-identify notes or documents on infrastructure they control, with a review step before indexing, analysis, or sharing. Skip if: You want a managed clinical service, an out-of-the-box compliance guarantee, or only need to run one checkpoint and already have a validated privacy pipeline.

## Overview
```text
### Architecture & Core Mechanics
OpenMed is a clinical preprocessing SDK, not a retrieval engine. Its Python APIs separate clinical entity extraction (`analyze_text`), PII span detection (`extract_pii`), and text transformation (`deidentify`). The selected model and language route determine the inference path. Applications can call these operations in-process, process collections with `BatchProcessor`, or integrate through REST, CLI, or MCP; the MCP surface includes a typed tool registry.

The Python Hugging Face path supports CPU and CUDA. OpenMedKit provides a Swift/MLX path with CoreML fallback for supported token-classification artifacts, while Android uses Kotlin and ONNX Runtime Mobile. Compatible ONNX exports can also run on Python CPU or in the browser via Transformers.js. Kotlin parity tests check tokenizer offsets, span boundaries, and decoder outputs against Python, but do not imply that every registry model is portable across runtimes.

### Key Capabilities & Differentiators
The registry contains 2,266 manifest entries. Its specialized checkpoints include a 434M disease model for `DISEASE`, `CONDITION`, and `DIAGNOSIS`, and a 109M anatomy model for `ANATOMY`, `ORGAN`, and `BODY_PART`. PII extraction supports 42 language routes, 35 of them model-backed. Russian currently uses a multilingual default-model placeholder; the optional Indic NER family requires explicitly configured weights and is neither bundled nor automatically selected.

Smart merging addresses PII spans split during tokenization. De-identification can mask or replace text, hash values, or shift dates. Beyond text, the mobile workflow supports local document intake and redaction review, including manual coverage of a handwritten signature and checking the exported PDF before sharing. The CPU clinical-brief demo illustrates evidence grounding and review handoff with synthetic NER/NLI test doubles; it does not validate trained-model performance or clinical fitness.

### Trade-offs & Limitations
For one model on one backend, a direct Hugging Face or ONNX Runtime integration can be simpler. OpenMed earns its integration cost when a team needs both clinical NER and de-identification, or wants to share workflows across servers and devices. Compared with a managed API, local inference can keep payloads within infrastructure you control, but shifts artifact distribution, capacity planning, upgrade testing, and privacy validation to your team.

The Apache-2.0 SDK license does not settle the terms of individual weights or datasets, and catalog size does not establish accuracy for a given language or document type. A Safe Harbor-aligned configuration can target the 18 identifier categories, but it does not confer HIPAA compliance. Use representative data to check residual identifiers, clinically relevant text removed by mistake, and final exports. Size RAM and VRAM against the actual model set, input lengths, and concurrency rather than a single baseline.

### Hardware & Deployment Guide
Start with Python 3.11+ and `openmed[hf]` for CPU or CUDA, or `openmed[mlx]` on Apple Silicon. Add the `service` extra to run `python -m openmed.service.logging` with `/health`, `/analyze`, `/pii/extract`, and `/pii/deidentify`. The root Dockerfile and Compose configuration provide a self-hosted path on port 8080; test the model preload list, resident-model cap, concurrency, and request-body timeouts under representative load.

For disconnected operation, stage compatible weights and tokenizer assets in advance and verify the full workflow without network access. Downloads, remote adapters, telemetry-enabled paths, and configured integrations can still use a network. The release sequence shows what has changed: v3.2.0 broadened language routing and local model integrations, v3.3.0 added workflows for documents, images, speech, and waveforms, and v4.0.0 advanced offline mobile document processing and redaction review.
```

## Key Capabilities
```text
- Language routing: 42 PII language codes, 35 model-backed; Russian currently uses a multilingual fallback placeholder.
- Clinical model catalog: 2,266 manifest entries, including specialized checkpoints for disease, medication, anatomy, and gene entities.
- De-identification: Smart merging joins fragmented PII spans; transformations include masking, replacement, hashing, and date shifting.
- Android deployment: ONNX exports support fp32, fp16, INT8, and optional `.ort` artifacts; Kotlin parity tests cover offsets, span boundaries, and decoder outputs.
- Browser inference: Token-classification ONNX bundles can run through Transformers.js, with a documented WebGPU path.
- Service controls: Docker Compose exposes port 8080 and configures model preloading, resident-model limits, concurrency, and request-body timeouts.
```

## Quick Start / Clone
```bash
npm install openmed @huggingface/transformers
```
