Skip to main content

meddeid-core

meddeid-core provides the language-neutral contracts shared by the MedDeID suite: the document schema, 15-label data taxonomy, ordered 14-label model head, record normalization, and character-offset validation.

The suite documentation explains how this contract moves through MedDeID workflows. This repository is the authority for the schema, taxonomy, label order, and offset rules.

Installation

pip install meddeid-core

Install the optional Pydantic models with:

pip install 'meddeid-core[models]'

Python API

from meddeid_core import BERT_ENTITY_LABELS, normalize_record, validate_record

record = normalize_record(record)
validate_record(record)

MedDeID uses half-open [begin, end) offsets measured in Unicode code points. The only canonical top-level span container is spans.

The core package also owns the language-neutral meddeid.age-granularity.v1 JSON contract. load_age_granularity_policy() loads the packaged default, a custom JSON path, or a mapping and returns its validated calendar generalizer and deterministic identity. Language packages remain responsible only for parsing and localized rendering.

Benchmark subannotations are nested under their parent primary span. A non-empty subannotation list must be a complete, contiguous partition of the parent, and all offsets remain absolute document offsets:

{
  "begin": 0,
  "end": 11,
  "text": "Jan Peeters",
  "label": "Name:Patient",
  "category": "Name",
  "subtype": "Patient",
  "subannotations": [
    {"begin": 0, "end": 3, "text": "Jan", "category": "given"},
    {"begin": 3, "end": 4, "text": " ", "category": "formatting"},
    {"begin": 4, "end": 11, "text": "Peeters", "category": "family"}
  ]
}

Normalize canonical JSONL

The normalizer standardizes fields within records that use the canonical document_id, text, and spans containers. For example, it can convert start to begin:

meddeid-normalize-jsonl input.jsonl normalized.jsonl

Other top-level span containers, including annotations, entities, deid_spans, and items, are not part of the MedDeID schema and are rejected.

Taxonomy contract

The Python taxonomy is authoritative. The generated language-neutral contract is committed at contracts/taxonomy.json for JavaScript and non-Python consumers. After an intentional taxonomy change, regenerate it with:

python scripts/export_contracts.py

Language-specific behavior belongs in packages such as meddeid-language-nl; this package has no language rules or model runtime.

Development

pip install -e '.[dev]'
pytest

Licence

AGPL-3.0-only. See NOTICE for attribution information.

Metadata

Release files for meddeid-core 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meddeid-core 0.2.1
File Size Uploaded
meddeid_core-0.2.1.tar.gz 42.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for meddeid-core 0.2.1
File Interpreter ABI Platform
meddeid_core-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 81.2 kB

Release files / meddeid_core-0.2.1.tar.gz

Download URL meddeid_core-0.2.1.tar.gz
Size 42.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ff58cc2bc0bbb18fc2395a71f08979e1175ff58e570846952f7e3acc646b32a1
BLAKE2b-256 checksum
How to use checksums
bbc4e300d3d045b907401ec3c65e3fc5b0a6db19134d0b6789bc1809db60bdf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release files / meddeid_core-0.2.1-py3-none-any.whl

Download URL meddeid_core-0.2.1-py3-none-any.whl
Size 39.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50350295f5dbaac71f9f3c63be0ed34932cc42424312accb6063b94acc96080d
BLAKE2b-256 checksum
How to use checksums
80bead1baadd7dc2655d58dc1a7c38ae3d7321864f034bcf7322e4b156dedb6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release 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