ssb_timeseries.types.series

Series types: the versioning and temporality combinations that define a dataset.

AS_OF_AT = SeriesType(versioning=Versioning.AS_OF, temporality=Temporality.AT)

Instance of SeriesType for estimates at points in time, versioned by ‘as of’ dates.

AS_OF_FROM_TO = SeriesType(versioning=Versioning.AS_OF, temporality=Temporality.FROM_TO)

Instance of SeriesType for estimates over validity periods, versioned by ‘as of’ dates.

NONE_AT = SeriesType(versioning=Versioning.NONE, temporality=Temporality.AT)

Instance of SeriesType for non-versioned data with a single point in time per observation.

NONE_FROM_TO = SeriesType(versioning=Versioning.NONE, temporality=Temporality.FROM_TO)

Instance of SeriesType for non-versioned data with a validity period per observation.

class SeriesType(versioning, temporality)

Bases: object

SeriesTypes are defined by combinations of attributes that have technical implications for time series datasets.

Notable examples are Versioning and Temporality, but a few more may be added later.

Parameters:
__repr__()

Reconstructable representation, sufficient to recreate the value.

Return type:

str

__str__()

Canonical spelling, also used as the persisted directory name.

Return type:

str

property date_columns: list[str]

Returns the date columns for the series type.

classmethod from_name(name)

Return the SeriesType with the given canonical name, ignoring case.

The canonical names are the persisted spellings, for example ‘NONE_AT’.

Return type:

SeriesType

Parameters:

name (str)

classmethod from_tag_values(versioning, temporality)

Return the SeriesType stored as the ‘versioning’ and ‘temporality’ tag values.

Return type:

SeriesType

Parameters:
temporality: Temporality
versioning: Versioning
class Temporality(*values)

Bases: Enum

Temporality describes the time dimensionality of each data point: a single point in time or a period.

AT = 1

Single points in time, expressed with (exact) ‘valid_at’ dates.

FROM_TO = 2

Duration periods, expressed with ‘valid_from’ (inclusive) and ‘valid_to’ (exclusive) dates.

property date_columns: list[str]

Returns the date columns of the temporality.

class Versioning(*values)

Bases: Enum

Versioning refers to how revisions of data are identified (named).

AS_OF = 1

Version identified by dates allows date arithemetic (‘equals’ | ‘greater than’ | ‘smaller than’ | ‘between’).

NAMES = 2

Versions identified by free text names.

This functionality is under consideration, hence preparepared in the type system, but with not all the way through IO and core modules.

NONE = 0

Version control only. Versions are not accessible through API.

property date_columns: list[str]

Returns the date columns for versioning.