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

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.6
File Size Uploaded Provenance Actions
lx_dtypes-0.7.6.tar.gz 1.0 MB Without provenance Details for lx_dtypes-0.7.6.tar.gz

Built distribution (wheel)

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

Total release size: 2.6 MB

Release files / lx_dtypes-0.7.6.tar.gz

Download URL lx_dtypes-0.7.6.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
3d9929b8f0b5910d224f60b3c4449e51a6d29641e50ebfa0f28e0c4b4a86dc77
BLAKE2b-256 checksum
How to use checksums
3ebb764d1a46a4c7b9313cae34f513b52ffafd6e2e1f0910554da3c8c3502bde
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.6-py3-none-any.whl

Download URL lx_dtypes-0.7.6-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4328f0a5f374088ff9ca257d8dd9143eebe0f0817685127072ee15be437e112e
BLAKE2b-256 checksum
How to use checksums
4a930aad808f2c0c0ec3a0ba777fd41d420a56fab003039e4db87965fc961e4c
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.6

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