plexus.data.DataCache module

class plexus.data.DataCache.DataCache(**parameters)

Bases: ABC

A data cache is responsible for loading data from a source and caching it locally. This is an abstract base class that defines the interface and the parameter validation schema. Subclasses are responsible for implementing the actual data loading logic. Most subclasses will also need to extend the Parameters class to define any necessary parameters for getting the data.

Initialize the DataCache instance with the given parameters.

Parameters

**parametersdict

Arbitrary keyword arguments that are used to initialize the Parameters instance.

Raises

ValidationError

If the provided parameters do not pass validation.

class Parameters(*, class_name: str = 'DataCache')

Bases: BaseModel

Parameters for data caching. Override this class to define any necessary parameters for getting the data.

Attributes

classstr

The name of the data cache class.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

class_name: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

__init__(**parameters)

Initialize the DataCache instance with the given parameters.

Parameters

**parametersdict

Arbitrary keyword arguments that are used to initialize the Parameters instance.

Raises

ValidationError

If the provided parameters do not pass validation.

abstract load_dataframe(*args, **kwargs)

Load a dataframe based on the provided parameters.

Returns

pd.DataFrame

The loaded dataframe.

This method must be implemented by all subclasses.

log_validation_errors()

Log validation errors for the parameters.

Parameters

errorValidationError

The validation error object containing details about the validation failures.