Skip to main content

BIDS-pydantic-models

Overview

BIDS-pydantic-models is a series of pydantic models which validate against versions of the BIDS metadata schema which is used in the JSON BIDS sidecar, from the official BIDS GitHub page

Each model is created using BIDS-pydantic.

Table of Contents

How To Contribute

Got a great idea for something to implement in BIDS-pydantic, or maybe you have just found a bug? Create an issue to get in touch with the development team and we’ll take it from there.

Quickstart

If you just want to use the models in your project. Download the pydantic models file for the BIDS schema version you wish to use from the models directory, and add it to your code-base. These files are generated using the bids-pydantic make -a command (see below).

If you want to use the command line tool to generate the models, keep reading this README.

Installation

Install with:

$ pip install bids-pydantic-models

BIDS-pydantic-models can be installed as a module directly from the python package index. For more information how to use a python package in this way please see https://docs.python.org/3/installing/index.html

Python Version

We recommend using the latest version of Python. BIDS-pydantic supports Python 3.9 and newer.

Dependencies

These distributions will be installed automatically when installing BIDS-pydantic-models.

  • pydantic - currently only compatible with v1

Usage

Just import the model you want to use:

from bids_pydantic_models.bids_metadata_v1_7_0 import BidsMetadata

then use the class as you would with any other pydantic model. For example:

bids_metadata = BidsMetadata(
    EchoTime=5.0, BolusCutOffFlag=True
)
bids_metadata.LabelingDuration=1.0

with open("bids_metadata.json", "w") as f:
    f.write(bids_metadata.json(indent=4, exclude_unset=True))

For more information, reference the pydantic documentation

Currently supported schema versions are:

  • v1.7.0
  • v1.8.0

NOTE: the model files in the Git repository may not correspond directly with those that are installed using pip. This is due to the fact that the models are auto-generated by GSPs CI/CD system. However, version information is always displayed at the top of the model files.

Acknowledgements

Conversion from schema to pydantic models is carried out using datamodel-code-generator. Data validation is performed using pydantic.

License

You can check out the full license here This project is licensed under the terms of the MIT license.

Release files for BIDS-pydantic-models 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BIDS-pydantic-models 0.0.3
File Size Uploaded
BIDS-pydantic-models-0.0.3.tar.gz 59.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for BIDS-pydantic-models 0.0.3
File Interpreter ABI Platform
BIDS_pydantic_models-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 119.4 kB

Release files / BIDS-pydantic-models-0.0.3.tar.gz

Download URL BIDS-pydantic-models-0.0.3.tar.gz
Size 59.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d36f819c2ef90e927096402e353f75abe07c90dac4b740eeb23053a71d2ebd9b
BLAKE2b-256 checksum
How to use checksums
c70d38863e63aa543a33cfc1089a7681bac5eda0c3ed984c95b5d13cdb8c730a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / BIDS_pydantic_models-0.0.3-py3-none-any.whl

Download URL BIDS_pydantic_models-0.0.3-py3-none-any.whl
Size 60.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02fac325e904849de0350d0c8c74126b65df34883ea1f33b70d76a5459578b6f
BLAKE2b-256 checksum
How to use checksums
e9f4b92f9f3d777c1dab7e09c8cc42e2c4a13430bda04ac73e94d29951518eda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

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