Skip to content

ber-data/bertron-schema

Repository files navigation

bertron-schema

LinkML schema for BER data integration work

Website

https://ber-data.github.io/bertron-schema

Repository Structure

Edits should be made to the LinkML source files and propagated to other formats using LinkML generators (see below for instructions).

Developer Documentation

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 site

Software Installation

This 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 sync

Run tests or other scripts:

uv run <command>
uv run pytest tests/

Useful commands

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-artefacts

generate derived files in all formats and save them to the project directory:

uv run gen-project -d project/ src/schema/linkml/bertron_schema.yaml

validate the LinkML schema file:

uv run linkml-lint --validate src/schema/linkml/bertron_schema.yaml

lint the LinkML schema file:

uv run linkml-lint src/schema/linkml/bertron_schema.yaml

validate data (in file data.yaml) against the schema:

uv run linkml-validate -s src/schema/linkml/bertron_schema.yaml data.yaml

generate JSON Schema version:

uv run gen-json-schema src/schema/linkml/bertron_schema.yaml > src/schema/jsonschema/bertron_schema.json

generate Python classes:

uv run gen-python src/schema/linkml/bertron_schema.yaml > src/schema/datamodel/bertron_schema.py

generate Pydantic classes:

uv run gen-pydantic src/schema/linkml/bertron_schema.yaml > src/schema/datamodel/bertron_schema_pydantic.py

JSON Schema data validation

install the JSON Schema check script:

brew install check-jsonschema

or

pip install check-jsonschema

To 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.json

or

check-jsonschema --schemafile src/schema/jsonschema/bertron_schema.json src/sample_data/valid/*.json

Credits

This project was made with linkml-project-cookiecutter.

About

LinkML schema for BERtron project.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 9