Specification

Define the specification for the dataset.

class Specification[source]

Bases: Base

Generic specification representation.

name: Mapped[str]
details: Mapped[list[str]]
build_path(strict=True, **tags)[source]

Construct path given a set of tags.

Parameters:
  • strict (bool) – If True, the tags provided should exactly match the requirements. If False, extra tags are ignored and the first matching path is built.

  • tags (key, value mappings) – name:value tag pairs used for path building.

Returns:

path – The constructed path if successful, else None.

Return type:

str

static create_from_file(path)[source]

Create Specification from yaml file.

extract_tags(path)[source]

Return tag:value pairs based on file path.

classmethod get(**identifiers)[source]

Return an instance from index if found, else None.

Parameters:

filters (dict) – Dictionary of filter conditions used for querying.

Return type:

An instance of cls or None if not found.

organize(rules)[source]

Create organized copy of source directories based on defined rules.

Parameters:

rules (dict) – Dictionary describing instructions for organizing.

property tags

Return list of tags defined in the specification.

classmethod get_identifiers(**kwargs) Dict[str, Any]

Return dictionary of class identifier attributes and their values.

Parameters:

kwargs (key, value pairs) – Key-value pairs of identifier attributes and their values.

Return type:

A dictionary of the identifiers with their respective values.

classmethod options(**filters) List[Base]

Return all existing instances from index.

Parameters:

filters (dict) – Dictionary of filter conditions used for querying.

Return type:

A list of instances of cls that match the filters.

validate_path(path)[source]

Return True if path is valid according to specification.