Dataset and its Components

class Component[source]

Bases: Base

Generic component representation within the dataset architecture.

id: Mapped[int]
type: Mapped[str]
classmethod get(**filters) Base | None

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.

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.

class Dataset[source]

Bases: Component

Represents a collection of components as a dataset.

id: Mapped[int]
components: Mapped[List[Component]]
name: Mapped[str]
add(*components: Component) None[source]

Adds components to the dataset.

Parameters:

components (Component) – Component instances to be added to the dataset.

Raises:

TypeError – If a dataset is added to itself or circular references are detected.

index(**kwargs)[source]

Perform indexing on components.

report() None[source]

Generate report for dataset.

query(returns: List[str] | None = None, **filters) List[source]

Query components based on filter criteria.

Parameters:
  • returns (list of str, optional) – Specific fields to return, defaults to all or object if None.

  • filters (dict) – Filter conditions to apply on the query.

Returns:

List of components or queried data meeting the filter criteria.

Return type:

list

classmethod get(**filters) Base | None

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.

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.

type: Mapped[str]