Language-agnostic data contracts for clinical reasoning knowledge graphs.
- Version: v0.0 (scaffold — no schema content yet)
- License: Apache-2.0
- Posture: Public, open source, independently versioned
- Stage: Pre-schema. M0 infrastructure in progress.
- Companion library:
crkg(Python, depends on this package)
crkg-schema is the single source of truth for the data model underlying clinical reasoning knowledge graphs. The model is authored in LinkML and emitted into multiple target formats so that consumers in any language can validate, generate, and query data consistently.
Emission targets (all generated from one LinkML YAML source):
- JSON Schema (Draft 2020-12) — runtime validation in any language
- Pydantic v2 models — Python consumers
- Cypher DDL — Neo4j bootstrap (constraints, indexes)
- Mermaid class diagrams — documentation
- OWL / SHACL — optional, for RDF consumers (post-M1)
This package ships the schema source, the emitted artifacts, and a validator. It does not ship a graph store, ingestion logic, or Python helpers beyond the emitted Pydantic models — those live in crkg.
- Not a graph database, not a driver, not a loader
- Not tied to Neo4j, Memgraph, or any specific backend (the Cypher DDL emission is a convenience, not a coupling)
- Not a clinical terminology server (uses terminologies like ICD-11, SNOMED CT, LOINC, RxNorm as values, does not redistribute them)
- Not an application schema for any specific CDSS product — it is a substrate other projects build on
LinkML was chosen after evaluating JSON Schema, Protobuf, and SHACL for this role. The decision record is in ARCHITECTURE.md §3. In short:
- One YAML source → many target formats (JSON Schema, Pydantic, Cypher, OWL, SHACL, Mermaid) via
linkmltoolchain - First-class support for slots, classes, inheritance, and associations — the vocabulary a graph schema needs
- Genuine biomedical community adoption (Monarch Initiative, Biolink model, OBO foundry, NCATS projects)
- Permissive licensing (CC0 schema language, Apache-2.0 toolchain)
- Non-opinionated about storage — the same schema describes RDF graphs, Neo4j property graphs, or relational tables
Schema versioning is independent from consuming libraries.
- v0.0.x — placeholder and scaffold. Schema content is not yet authored.
- v0.1.x — pre-1.0, may break between minor versions. Consumers pin
>=0.1,<0.2. - v1.0.0 — schema stability commitment. Breaking changes from this point bump the major version. Deprecations carry through at least one minor version before removal.
Each release ships:
schema/— LinkML YAML sourceemitted/json-schema/— JSON Schema per classemitted/pydantic/— Pydantic v2 model moduleemitted/cypher/— Cypher constraint and index DDLemitted/mermaid/— class diagram sourcesfixtures/valid/— example instances per classfixtures/invalid/— adversarial instances that must fail validation
Consumers pick the artifacts they need. Most Python consumers install the Pydantic models via uv add crkg-schema (or pip install crkg-schema); everyone else consumes the JSON Schema files from the release tarball.
Note: During v0.0.x (infrastructure-only), releases are published to TestPyPI only. Production PyPI publishing will start at v0.1.0 once schema content lands.
# With uv (recommended)
uv add crkg-schema
# Or with pip
pip install crkg-schema
# From TestPyPI (v0.0.x only)
uv add --index-url https://test.pypi.org/simple/ crkg-schema
# or: pip install --index-url https://test.pypi.org/simple/ crkg-schema
# Non-Python consumers: download release artifacts
# curl -L https://github.com/balinesthesia/crkg-schema/releases/download/v0.1.0/crkg-schema-0.1.0.tar.gzcrkg— Python library. Depends oncrkg-schemafor Pydantic models and Cypher DDL. First consumer.clinical-rs— Rust workspace for clinical data engineering. Independent. May emit data shaped bycrkg-schemain future Rust ports.multiomics-rs— Rust workspace for molecular reference databases. Independent. Same possible future binding.Zluidr/hl7-rs— Rust HL7 v2 / FHIR / SATUSEHAT crates. Independent. Could emit Arrow records shaped bycrkg-schematypes at hospital ingestion boundaries.
None of these projects is a runtime dependency of crkg-schema. The dependency graph flows only inward (everyone depends on the schema; the schema depends on nothing of ours).
The schema describes data structures. It does not ship any clinical or molecular data. When consumers populate the schema with data from licensed sources (SNOMED CT, DrugBank, ICD-11, RxNorm, etc.), they remain responsible for compliance with those licenses. See NOTICE for the full attribution posture.
See CONTRIBUTING.md. Issues and PRs welcome; follow the branch naming and signed-commit guidelines in that file.
README.md— this fileARCHITECTURE.md— modeling philosophy, LinkML decision record, emission pipeline, schema layers, adapter contractsTODO.md— atomic M0 tasks, dependency-ordered, with SemVer gatesLICENSE— Apache-2.0NOTICE— third-party attributions
- v0.0 (2026-04-19): Initial scaffold. README, ARCHITECTURE, TODO, LICENSE, NOTICE. No schema content. M0 infrastructure starting.