Skip to content

Commit a58388f

Browse files
committed
add section to describe model generation script
1 parent 84836ca commit a58388f

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Codecov](https://codecov.io/gh/ANCPLabOldenburg/ancp-bids/branch/main/graph/badge.svg)](https://codecov.io/gh/ANCPLabOldenburg/ancp-bids)
66
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
77

8-
# ancpBIDS Technical Overview
8+
**ancpBIDS** is a modular Python library for reading, querying, validating, and writing BIDS datasets. Its architecture is designed for extensibility and maintainability.
99

1010
## Key Features
1111

@@ -41,8 +41,6 @@
4141

4242
## Architecture
4343

44-
**ancpBIDS** is a modular Python library for reading, querying, validating, and writing BIDS datasets. Its architecture is designed for extensibility and maintainability, with the following key components:
45-
4644
- **Core Models:**
4745
The core BIDS data model is implemented in `ancpbids/model_base.py` and versioned model files (e.g., `model_v1_8_0.py`). These define the schema and object graph for BIDS datasets.
4846

@@ -112,6 +110,29 @@ The plugin system is a core feature for extensibility:
112110

113111
- The codebase uses type hints and docstrings for clarity.
114112
- Contributions should follow PEP8 and include tests and documentation.
113+
## Model Generation Utility
114+
115+
The script `tools/generatemodel.py` is provided to automate the generation of Python model classes from BIDS schema files. This utility ensures that the codebase can easily stay up-to-date with the latest BIDS schema versions.
116+
117+
**Features:**
118+
- Fetches the latest or a specified BIDS schema version directly from the official BIDS GitHub repository.
119+
- Downloads the schema and generates Python model files in the `ancpbids/` directory (e.g., `model_base.py`, `model_v<version>.py`).
120+
- Supports custom ordering and enum generation for BIDS datatypes, modalities, suffixes, and entities.
121+
122+
**Usage:**
123+
124+
```bash
125+
cd tools
126+
python generatemodel.py [--schema-version <version>]
127+
```
128+
129+
- If `--schema-version` is omitted, the latest available schema version will be used.
130+
- The generated files will be saved in the `ancpbids/` directory and the corresponding schema in the `schema/` directory.
131+
132+
**When to use:**
133+
- When a new BIDS schema version is released and you want to update the models.
134+
- When making changes to the schema or model structure for development or testing.
135+
115136

116137
## Further Reading
117138

0 commit comments

Comments
 (0)