clinical-contract
Write healthcare data contracts, validate their structure, and check CSV or Parquet datasets against them.
clinical-contract is a lightweight tool for teams that need to describe, share, and verify clinical data expectations.
It helps you:
- write a data contract with a guided web editor or YAML;
- validate that the contract is correctly composed;
- check that a real
.parquetor.csvfile conforms to the expected schema; - run SQL quality rules with DuckDB;
- use the same logic in the browser, the CLI, and Python pipelines.
Live Web App
The project includes a static browser application designed for GitHub Pages:
The web app lets users create or load a contract, edit it visually, inspect the generated YAML, validate the contract, upload a CSV/Parquet file, preview the dataset, and run schema/quality checks directly in the browser with PyScript, Pyodide, and DuckDB.
Why It Exists
Clinical data exchanges often fail because the expected dataset is documented in one place while the real delivered file follows another reality.
clinical-contract keeps the expectation and the verification close together:
- the contract explains what the dataset should contain;
- the checker verifies what the dataset actually contains;
- the quality rules make important assumptions executable.
This makes data delivery easier to review, easier to automate, and easier to discuss between data producers and data consumers.
What It Checks
clinical-contract currently focuses on three practical layers:
-
Contract structure Required metadata, description fields, schema definitions, columns, and quality rules are validated before checking data.
-
Schema compatibility Required columns must exist and detected DuckDB types must match the contract logical or physical types.
-
Quality rules SQL checks are executed against the loaded CSV/Parquet file and reported as passed or failed.
Python Package
The same engine is available as a Python package on PyPI.
pip install clinical-contract
Validate a contract:
clinical-contract validate site/examples/contract.yaml
Check a data file:
clinical-contract check site/examples/contract.yaml site/examples/template.parquet
Use it from Python:
from clinical_contract import load_contract
contract, raw = load_contract("site/examples/contract.yaml")
report = contract.check("site/examples/template.parquet")
print(report.success)
Local Development
Clone the repository:
git clone https://github.com/artheioupfat/clinical-contract.git
cd clinical-contract
Install Python dependencies:
uv sync --extra dev
Run Python tests:
uv run pytest -v
Install web dependencies:
npm ci
Run site tests:
npm run test:site
Build the site CSS:
npm run build:site:css
Serve the static site locally:
python3 -m http.server 8000 --directory site
Then open http://127.0.0.1:8000.
Project Structure
src/clinical_contract/ Python package and validation engine
site/ Static web app for GitHub Pages
site/examples/ Browser template contract and sample dataset
tests/ Python test suite
site/tests/ JavaScript site tests
Status
The project is still evolving. The current focus is to keep the Python library, CLI, and browser app aligned around one DuckDB-based validation engine.
License
MIT — see LICENSE for details.
Author
Arthur PRIGENT — GitHub
Metadata
Release files for clinical-contract 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clinical_contract-0.1.8.tar.gz | 6.4 MB | With provenance | Details for clinical_contract-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clinical_contract-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for clinical_contract-0.1.8-py3-none-any.whl |
Total release size: 6.5 MB
Release files / clinical_contract-0.1.8.tar.gz
| Download URL | clinical_contract-0.1.8.tar.gz |
|---|---|
| Size | 6.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b4dbb9f2bcfc846bdb929c07084811481be7f457d845beee6297e7c0e5bf444
|
|
BLAKE2b-256 checksum How to use checksums |
ec3ab7803fb2771ff2ec557ea822f165715ef5a02577d8b8984d833957ad57c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 28, 2026.
Transparency logRelease files / clinical_contract-0.1.8-py3-none-any.whl
| Download URL | clinical_contract-0.1.8-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e0fefdb1193a7777cffe44a5473a074eedd6bf67bdaf9340f7e62c60f2367a9
|
|
BLAKE2b-256 checksum How to use checksums |
eeaf7b6457e66eec4656833244d543fbaee37ed6628c3878d86ee315b3f5107e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 28, 2026.
Transparency logSecurity for clinical-contract 0.1.8
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for clinical_contract-0.1.8.tar.gz
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 Jul 28, 2026.
Transparency logA 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.