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.
  • Shared model policies and an explicit contract/evaluation boundary.
  • 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.evaluation 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.7.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.7.5
File Size Uploaded Provenance Actions
lx_dtypes-0.7.5.tar.gz 1.0 MB Without provenance Details for lx_dtypes-0.7.5.tar.gz

Built distribution (wheel)

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

Total release size: 2.6 MB

Release files / lx_dtypes-0.7.5.tar.gz

Download URL lx_dtypes-0.7.5.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
4a56c937e6c8636b253ff9b4a74e06eed825620c2ab1d2c8aa6794b6db8b9535
BLAKE2b-256 checksum
How to use checksums
60ddebe78548ff461b238e2dc6cb401cd236bac531fa31c6a7c1915cfe173901
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

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

Download URL lx_dtypes-0.7.5-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b42a8124eaa1cd4cb1500ab65bb2b6925a8417f4ea1431eb2b4fd52ac2e600b4
BLAKE2b-256 checksum
How to use checksums
e60964d036c25b2b6b867b1d6df4edf32c9a369f0a767991d68e112d4e92f808
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for lx-dtypes 0.7.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.

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

Release history Release notifications | RSS feed

This release

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