CompletenessChecker#

class openstef_models.transforms.validation.completeness_checker.CompletenessChecker(**data: Any) None[source]

Bases: BaseConfig, TimeSeriesTransform

Transformer to check the completeness of time series load data.

Completeness is defined as the ratio of non-missing values to the total number of values in a given time series. This class can be configured to check specific columns and apply weights to their importance in the completeness calculation.

Example

>>> from datetime import datetime, timedelta
>>> import numpy as np
>>> import pandas as pd
>>> from openstef_core.datasets import TimeSeriesDataset
>>> from openstef_models.transforms.validation import (
...     CompletenessChecker,
... )
>>> data = pd.DataFrame({
...     'radiation': [100, np.nan, np.nan, np.nan],
...     'temperature': [20, np.nan, 24, np.nan],
...     'wind_speed': [np.nan, np.nan, np.nan, np.nan],
... },
... index=pd.date_range("2025-01-01", periods=4, freq="15min"))
>>> dataset = TimeSeriesDataset(data, timedelta(minutes=15))
>>> transform = CompletenessChecker()
>>> transform.transform(dataset)
Traceback (most recent call last):
openstef_core.exceptions.InsufficientlyCompleteError: ...not sufficiently complete...
Parameters:

data (Any)

columns: list[str] | None
weights: dict[str, float] | None
completeness_threshold: float
transform(data: TimeSeriesDataset) TimeSeriesDataset[source]

Returns the input data unchanged or raises an error if the data is incomplete.

Parameters:
Returns:

The unmodified input TimeSeriesDataset.

Raises:

InsufficientlyCompleteError – If the dataset is not sufficiently complete.

Return type:

TimeSeriesDataset

features_added() list[str][source]

List of feature names added by this transform.

Return type:

list[str]

Returns:

A list of strings representing the names of features added to the dataset by this transform. Default is an empty list.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}

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