Skip to main content

meddeid

Local inference for the meddeid-dutch-synth clinical de-identification model, available as a Python API, command-line interface, batch processor, and optional FastAPI service. Data generation, training, evaluation, and annotation packages are not required for inference.

For cross-suite navigation and task-oriented guidance, see the MedDeID documentation. This repository remains authoritative for inference APIs, CLI options, service settings, and deployment.

Easiest start: Docker

Docker is the recommended path for people who do not need the Python API. The published image contains the pinned model, starts without Hub access, runs as a non-root user, and is exposed only on your own computer by default.

  1. Install and start Docker Desktop.

  2. Clone this repository and start MedDeID:

    git clone https://github.com/stighellemans/meddeid.git
    cd meddeid
    ./scripts/start-local.sh
    

The script generates a private API key, pulls the published multi-architecture image, starts the service, waits for the model to become ready, and prints the browser address. Open http://127.0.0.1:8000/ui and paste the MEDDEID_API_KEY value from .env. The page lets you de-identify and copy a note without writing code. Technical API documentation is at http://127.0.0.1:8000/docs. Stop the service with ./scripts/stop-local.sh.

See Production deployment before exposing the service to another machine or processing real clinical data.

Python install

Install the released Python API, CLI, batch runner, and HTTP service from PyPI:

python -m pip install 'meddeid[server]'

See Inference and deployment for the exact availability matrix and operational guidance.

Quick start

meddeid deidentify note.txt
from meddeid import Deidentifier

deid = Deidentifier.from_pretrained("stighellemans/meddeid-dutch-synth")
result = deid("Patiënt Alex Voorbeeld kwam op controle.")
print(result.deid_text)
deid.close()

The self-contained model bundle is downloaded and cached on first use. Document text is processed locally and is not sent to Hugging Face. Inspect the resolved model, immutable revision, runtime, device, language profile, and package versions with:

meddeid model-info

For offline or air-gapped use, download an immutable snapshot in advance:

hf download stighellemans/meddeid-dutch-synth \
  --revision <immutable-hub-sha> \
  --local-dir ./meddeid-dutch-synth
meddeid deidentify note.txt --model ./meddeid-dutch-synth

Use revision= in Python or --revision on the CLI to pin reproducible deployments.

Batch inference

Canonical MedDeID JSONL can be processed directly. The batch command preserves document IDs and order, supports interruption-safe resume, and writes a sidecar manifest with input, output, model, profile, runtime, and timing metadata. Existing output is never overwritten implicitly.

meddeid batch project/splits/test.jsonl --output predictions.jsonl

This normal path uses the default model, downloads it on first use, and chooses the local device automatically. Add --revision, --device, or an alternate --model only when the deployment requires those controls.

HTTP service

PyTorch inference works on CPU, Apple MPS, and CUDA:

MEDDEID_DEVICE=cpu meddeid-server

For an authenticated service:

export MEDDEID_API_KEY='<random secret>'
export MEDDEID_REQUIRE_API_KEY=true
meddeid-server

The service provides:

  • POST /deidentify for one document;
  • POST /deidentify-batch for throughput-oriented batches; and
  • GET /health for model identity and backend readiness.

For NVIDIA production serving, MedDeID can use a TensorRT engine hosted by NVIDIA Triton while retaining the same tokenization, decoding, and Dutch post-processing contract:

MEDDEID_BACKEND=triton \
MEDDEID_TRITON_URL=http://triton:8000 \
meddeid-server

See Inference and deployment for the complete Python, JSONL, metadata, HTTP, Docker, TensorRT/Triton, sizing, and concurrency guide. Operators should also read Production deployment.

Language profile and metadata

The Dutch model bundle pins meddeid-language-nl profile nl-BE@1. Optional trusted metadata can recover known patient or caregiver names and other known values after neural inference. Metadata is not concatenated to the note or sent to the model as an input feature. Incorrect metadata can create false-positive redactions, so callers must validate it.

Belgian DEDUCE is an independent comparison system and is not installed by this package.

Privacy and limitations

Local processing reduces data movement but does not guarantee anonymity. Validate the model on representative data from the intended setting, monitor both missed PII and unnecessary redaction, and use human review where errors can create material privacy risk. Secure cached models, inputs, outputs, manifests, and service logs according to your organization’s requirements.

Development

python -m pip install \
  -e ../meddeid-core \
  -e ../meddeid-language-nl \
  -e '.[dev]'
pytest

Licence

AGPL-3.0-only. Model weights are distributed separately under the terms stated in their model card.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meddeid-0.1.1.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meddeid-0.1.1-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file meddeid-0.1.1.tar.gz.

File metadata

  • Download URL: meddeid-0.1.1.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for meddeid-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b70229c4760fbb865e76a0794d11aef5edbf4caffde4d35bae072883da928f5e
MD5 f92ff6f1fa97feb9e2b10dbfbeafbd99
BLAKE2b-256 88af7c9f58b26f44232e8d05a20cdafb3b5a1c5a6bcbd28d6e151cb881ebe077

See more details on using hashes here.

Provenance

The following attestation bundles were made for meddeid-0.1.1.tar.gz:

Publisher: publish-python.yml on stighellemans/meddeid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file meddeid-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: meddeid-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for meddeid-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 812e3ff8ae390d8618939df3dd961b64e34ebcebce243324d10538f927d2ea89
MD5 1bad3d1470b0bd298ef20ae78d96d154
BLAKE2b-256 a5caf1c8a8a880212692cb0e9ecf73c4543172101602d0a140bc2753a7e9f9ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for meddeid-0.1.1-py3-none-any.whl:

Publisher: publish-python.yml on stighellemans/meddeid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page