Skip to main content

meddeid-eval

Reproducible evaluation for clinical de-identification. meddeid-eval computes exact-span metrics, character-level recall, core-PII recall, non-PII redaction rate, and stability results from canonical MedDeID JSONL files.

See the suite evaluation workflow for the end-to-end handoff. This repository remains authoritative for metric definitions, commands, stability configuration, and plotting support.

Installation

python -m pip install meddeid-eval

Optional extras add model inference and plotting support:

python -m pip install 'meddeid-eval[infer,plots]'

Usage

meddeid-eval score \
  --gold meddeid-dutch-synthetic-benchmark.jsonl \
  --predictions predictions.jsonl \
  --name meddeid-dutch-synth \
  --seconds 18.4 \
  --device gpu \
  --output results/meddeid-dutch-synth.json
meddeid-eval stability expand --config stability.yaml

Gold and prediction files are matched by document_id and use half-open [begin, end) Unicode-code-point offsets. The score command reports exact precision, recall, and F1 together with character coverage and redaction metrics.

The score artifact also contains privacy-safe aggregate tables for recall by gold label, recall by sub-annotation category, non-PII redactions by predicted label, character-level label overlap, and exact-boundary label confusion. Source text and document identifiers are never included. non_pii_redaction_rate is the fraction of characters outside annotated PII spans covered by a prediction.

Comparison plots

Record a unique --name in each score artifact and render one or more systems:

meddeid-eval plot \
  --scores results/meddeid-dutch-synth.json results/comparator.json \
  --output-dir results/plots

The command writes PNG and vector PDF by default: a performance overview, gold-label and sub-annotation recall heatmaps, non-PII-redaction and exact-label confusion heatmaps, and an accuracy-versus-runtime plot when --seconds is available. Use --formats png,pdf,svg and --dpi 600 to override export settings.

Core-PII recall is the label-agnostic fraction of protocol-defined core PII characters covered by any predicted redaction. Each primary gold span owns a nested subannotations list. formatting, additional_info, medical_info, title, and time segments are excluded from the denominator.

Stability perturbations use the configured locale provider and its complete packaged resources. Dutch supports explicit nl-BE and nl-NL locale selection; English must be selected as either en-GB or en-US because bare en is ambiguous:

dataset: annotations.jsonl
output_dir: results/stability
language_profile: en-GB

The same provider owns name lookup selection and date/age interpretation, so GB DMY and US MDY behavior cannot fall back to Dutch globals.

stability analyze writes semantically ordered grouped bars, a year-shift line plot with note-cluster bootstrap intervals, and a paired degradation forest in both PNG and PDF. It pools roles by counts, marks missing observations as missing rather than zero, and reports pair and contributing-note counts.

For confirmatory claims spanning the three prespecified benchmarks, apply one Benjamini-Hochberg family per model after all analyses finish:

meddeid-eval stability adjust \
  --scope uza=results/uza/stability_analysis.json \
  --scope synthetic=results/synthetic/stability_analysis.json \
  --scope primary-care=results/primary-care/stability_analysis.json \
  --output-dir results/adjusted

Raw analyses remain unchanged; adjusted copies, a JSON audit manifest, and a flat CSV are written to the output directory.

To place BH-adjusted significance markers in the degradation forest, rerender an adjusted analysis:

meddeid-eval stability plot \
  --analysis results/adjusted/uza.stability_analysis.adjusted.json \
  --output-dir results/adjusted/uza-plots

External comparators

Comparison systems run in their own environments. Export their predictions in the canonical MedDeID JSONL schema and evaluate them with the same score command. Belgian DEDUCE is not installed by meddeid-eval.

Development

pip install -e '.[dev]'
pytest

Licence

AGPL-3.0-only. External comparison systems retain their own licence terms.

Download files

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

Source Distribution

meddeid_eval-0.3.0.tar.gz (63.8 kB view details)

Uploaded Source

Built Distribution

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

meddeid_eval-0.3.0-py3-none-any.whl (69.6 kB view details)

Uploaded Python 3

File details

Details for the file meddeid_eval-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for meddeid_eval-0.3.0.tar.gz
Algorithm Hash digest
SHA256 17a7998afccae5251e98f9b7b2d607fb1decc29b663a9b829c0ffff9974bce64
MD5 8fc9cf856dfaa71bdbfb7e631b10685b
BLAKE2b-256 8dd2ac8d8822bf239fc968c385cf09c4a1b12aead3c3ab4bc42f33045a48e143

See more details on using hashes here.

Provenance

The following attestation bundles were made for meddeid_eval-0.3.0.tar.gz:

Publisher: publish-python.yml on stighellemans/meddeid-eval

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_eval-0.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for meddeid_eval-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a68cde28bf16d29bfd67663f4bba4172ff17515d6c8772b01aa241d616fb421
MD5 e3667d9b3cf1bf4005fcfbaa88693d52
BLAKE2b-256 e008db66c8261148187c41be29a92c32961a9907cdffa1a8f610748b59df8397

See more details on using hashes here.

Provenance

The following attestation bundles were made for meddeid_eval-0.3.0-py3-none-any.whl:

Publisher: publish-python.yml on stighellemans/meddeid-eval

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

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.1

2 files

0.2.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