ssb_timeseries.properties

Properties are type definitions used for series and datasets.

class SeriesType(*type_def, versioning=None, temporality=None)

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:
__eq__(other)

Equality test.

Return type:

bool

Parameters:

other (Self | None)

__init__(*type_def, versioning=None, temporality=None)

SeriesType constructor.

Parameters:
  • *type_def (str) – Keyword strings identifying versioning and/or temporality.

  • versioning (Versioning | None) – The versioning of the series.

  • temporality (Temporality | None) – The temporality of the series.

Return type:

None

__repr__()

Helper, returns code with required parameters to initialise given SeriesType.

Return type:

str

__str__()

Helper; returns ‘<versioning>_<temporality>’.

Return type:

str

classmethod as_of_at()

Same as SeriesType.estimate(): Shorthand for SeriesType(versioning=Versioning.AS_OF, temporality=Temporality.AT).

Return type:

Self

classmethod as_of_from_to()

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

Return type:

Self

property date_columns: list[str]

Returns the data columns corresponding to the series type temporality.

classmethod estimate()

Same as SeriesType.as_of_at(): Shorthand for SeriesType(versioning=Versioning.AS_OF, temporality=Temporality.AT).

Return type:

Self

classmethod from_to()

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

Return type:

Self

classmethod none_at()

Same as SeriesType.simple(): Shorthand for SeriesType(versioning=Versioning.NONE, temporality=Temporality.AT).

Return type:

Self

classmethod permutations()

Helper; returns [‘<versioning>_<temporality>’, …] .

Return type:

list[str]

classmethod simple()

Same as SeriesType.none_at(): Shorthand for SeriesType(versioning=Versioning.NONE, temporality=Temporality.AT).

Return type:

Self

class SuperEnum(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Generic enumeration helper.

__eq__(other)

Equality test.

Return type:

bool

Parameters:

other (Self)

__repr__()

Machine readable string representation, ideally sufficient to recreate object.

Return type:

str

__str__()

Human readable string representation of object.

Return type:

str

classmethod descriptions()

Returns a list of descriptions for all enum values.

Return type:

list

classmethod keys()

Returns a list of all the enum keys.

Return type:

list

classmethod to_dict()

Returns a dictionary representation of the enum.

Return type:

dict

classmethod values()

Returns a list of all the enum values.

Return type:

list

class Temporality(*values)

Bases: SuperEnum

Temporality describes the time dimensionality of each data point; notably duration or lack thereof.

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.

NONE = 0

No temporal dimension.

property date_columns: list[str]

Returns the data columns of the temporality.

class Versioning(*values)

Bases: SuperEnum

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.

estimate_types()

Helper; returns list of SeriesTypes for which Versioning is not NONE.

Return type:

list[str]

seriestype_from_str(dir_name)

Helper; returns SeriesType from directory name.

Return type:

SeriesType

Parameters:

dir_name (str)