Skip to main content

lx-data-models

PyPI Python CI Documentation codecov License: MIT

lx-dtypes provides typed models for clinical research data. It checks data against study rules and versioned medical terminology. Applications can collect validation findings during data capture and validate records before storage or exchange. The package also supports FHIR conversion and Django integration.

Highlights

  • Reusable models for terminology, patient records, reports, and host integration.
  • Versioned YAML knowledge bases with deterministic loading.
  • Report-template checks for structure, coverage, and captured data.
  • FHIR clinical data and terminology conversion.
  • Type, test, and documentation checks in CI.

The package is in alpha. We aim to keep public imports stable. Releases before 1.0 may include documented breaking changes.

Installation

lx-dtypes supports Python 3.12.

python -m pip install lx-dtypes

Quick start

Validate a study setup without raising for invalid input:

from lx_dtypes.models.contracts.study_setup import StudySetupDefinition
from lx_dtypes.validation import validate_contract

result = validate_contract(StudySetupDefinition, {"schema_version": "1.0"})
for issue in result.report.issues:
    print(issue.code, issue.path, issue.message)

# result.value contains the typed model only when the contract is valid.

For ledger data, assess_examination(knowledge_base, payload, template_name="...") checks terminology provenance and applies the selected template's study rules. Findings are advisory; the host decides when to require correction. See the cross-layer validation guide for error codes, evaluation status, and strict persistence boundaries.

Load a knowledge-base module shipped with the package:

from lx_dtypes import load_knowledge_base

knowledge_base = load_knowledge_base("report_template_examples")

print(knowledge_base.config.knowledge_base_identity)
print(sorted(knowledge_base.report_template))

Registry-backed deployments require an exact module version. The knowledge-base authoring guide explains versioning and deployment.

Provision the packaged catalog before starting a registry-backed host:

export LX_DTYPES_KB_REGISTRY=/var/lib/my-host/terminology/registry.json
lx-dtypes-kb-registry bootstrap

The command exits nonzero if the registry is invalid or a packaged identity cannot load. Hosts must treat that failure as a startup blocker.

Documentation

Follow the reader roadmap from the model overview to a working example, then choose terminology, reporting, or application integration. You can start with the topic that fits your work.

Build the documentation locally with:

python -m pip install -e ".[docs]"
make -C docs html

Development

Questions, documentation fixes, synthetic examples, and code changes are useful ways to contribute. Start with CONTRIBUTING.md for setup, checks, and pull requests. See CHANGELOG.md for release notes and SECURITY.md for vulnerability reporting.

For scoped repository navigation, start at structure.yml and follow the agent context guide.

License and citation

Distributed under the MIT License. If you use lx-dtypes in published work, cite the project using CITATION.cff.

Metadata

Release files for lx-dtypes 0.5.5

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

Source distribution (sdist)

Source distribution for lx-dtypes 0.5.5
File Size Uploaded Provenance
lx_dtypes-0.5.5.tar.gz 4.9 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lx-dtypes 0.5.5
File Interpreter ABI Platform
lx_dtypes-0.5.5-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 MB

Release files / lx_dtypes-0.5.5.tar.gz

Download URL lx_dtypes-0.5.5.tar.gz
Size 4.9 MB
Tags Source
SHA-256 checksum
How to use checksums
7be59fc6c854ff2395e8942801dec359fa0fc6684fbca4cd3a16acfd3cf5d29b
BLAKE2b-256 checksum
How to use checksums
ec68b685347123d8cc67eee63d1f793fc8dd001cd7ad93a23cbbe794b1c7b5de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / lx_dtypes-0.5.5-py3-none-any.whl

Download URL lx_dtypes-0.5.5-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8fc69c9ea6022009027e8fc993e4d4cddda5f51990fcdf72103af883848569ad
BLAKE2b-256 checksum
How to use checksums
1b777ced583d66b2b7633a9dd195a3797d1ea855955c3eac31748486cc925160
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for lx-dtypes 0.5.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.5.5 This release

2 release files No provenance

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