bidsschematools.rules

Utilities for implementing schema.rules

This module is currently limited to constructing filename rules from schema.rules.files.

Functions

bidsschematools.rules.regexify_all(schema_dir=None)

Create full path regexes for all BIDS specification files.

Parameters:

schema_dir (str, optional) – A string pointing to a BIDS directory for which paths should be validated.

Returns:

  • all_regex (list of dict) – A list of dictionaries, with keys including ‘regex’ and ‘mandatory’.

  • my_schema (Mapping) – Nested dictionaries representing the full schema.

bidsschematools.rules.regexify_filename_rules(rule_group: Namespace, schema: Namespace, level: int)

Load schema rules into regular expressions

Parameters:
  • rule_group (Namespace) – The set of rules to load from the schema

  • schema (Namespace) – A nested dictionary, as returned by bidsschematools.schema.load_schema().

  • level (int) – The depth in rule_group to look for rules

Returns:

rules – A list of dictionaries, with keys including ‘regex’ and ‘mandatory’.

Return type:

list of dict