LinkML schema for BER data integration work
https://ber-data.github.io/bertron-schema
-
src/ - source files
- sample_data/ - example data
- [schema]
- jsonschema -- autogenerated JSON Schema model
- linkml -- LinkML schema source files
- datamodel -- autogenerated Python datamodel
-
tests/ - Python tests
Edits should be made to the LinkML source files and propagated to other formats using LinkML generators (see below for instructions).
Details
To run commands you may use `make` or the command runner [just](https://github.com/casey/just/), which is a better choice on Windows. Use the `make` command or `just` commands to generate project artefacts: * `make help` or `just --list`: list all pre-defined tasks * `make all` or `just all`: make everything * `make deploy` or `just deploy`: deploys siteThis repo uses uv to manage the python environment and dependencies.
See the uv docs for uv installation instructions.
Install the project dependencies and create a virtual environment:
uv syncRun tests or other scripts:
uv run <command>
uv run pytest tests/These assume that you have already run uv sync to install the schema virtual environment and dependencies.
generate standard repo artefacts (JSON Schema and Pydantic versions of the schema)
make gen-artefactsgenerate derived files in all formats and save them to the project directory:
uv run gen-project -d project/ src/schema/linkml/bertron_schema.yamlvalidate the LinkML schema file:
uv run linkml-lint --validate src/schema/linkml/bertron_schema.yamllint the LinkML schema file:
uv run linkml-lint src/schema/linkml/bertron_schema.yamlvalidate data (in file data.yaml) against the schema:
uv run linkml-validate -s src/schema/linkml/bertron_schema.yaml data.yamlgenerate JSON Schema version:
uv run gen-json-schema src/schema/linkml/bertron_schema.yaml > src/schema/jsonschema/bertron_schema.jsongenerate Python classes:
uv run gen-python src/schema/linkml/bertron_schema.yaml > src/schema/datamodel/bertron_schema.pygenerate Pydantic classes:
uv run gen-pydantic src/schema/linkml/bertron_schema.yaml > src/schema/datamodel/bertron_schema_pydantic.pyinstall the JSON Schema check script:
brew install check-jsonschemaor
pip install check-jsonschemaTo test a file or files against the schema, use the command:
check-jsonschema --schemafile src/schema/jsonschema/bertron_schema.json data_file_1.json data_file_2.jsonor
check-jsonschema --schemafile src/schema/jsonschema/bertron_schema.json src/sample_data/valid/*.jsonThis project was made with linkml-project-cookiecutter.