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

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.6.2
File Size Uploaded Provenance Actions
lx_dtypes-0.6.2.tar.gz 4.9 MB Without provenance Details for lx_dtypes-0.6.2.tar.gz

Built distribution (wheel)

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

Total release size: 6.2 MB

Release files / lx_dtypes-0.6.2.tar.gz

Download URL lx_dtypes-0.6.2.tar.gz
Size 4.9 MB
Tags Source
SHA-256 checksum
How to use checksums
4e4431d1d4848012206734285fb815c51ff53f9af7a20427f300e17e6025a37b
BLAKE2b-256 checksum
How to use checksums
69f0b19b96b4c6d18a15fb059c67b4945c1bfba2be9b2ef94fb1a125c671d8c6
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.6.2-py3-none-any.whl

Download URL lx_dtypes-0.6.2-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ca5727731128ca649d35a238a79bbe792d4ff84cd505461aa8465b7b4febf9c6
BLAKE2b-256 checksum
How to use checksums
4d62b9597efb6f62427d77d46af15cb5722c867b3c2ee193b323e26335c77249
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.6.2

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.2 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