Library reference

class json_timeseries.TsRecord(timestamp: datetime, value: float | str | int, quality: int = None, annotation: str = None)[source]

A record of TimeSeries object

Parameters:
  • timestamp (datetime) – Timestamp

  • value (Union[float, str, int]) – Value

  • quality (int) – Quality

  • annotation (str) – Annotation

class json_timeseries.TimeSeries(name: str, units: str = None, identifier: str = '657489c0-4819-4bd5-a17b-00d74782cf7b', data_type: str = 'NUMBER', records: List[TsRecord] | TsRecord = None)[source]

TimeSeries object

Parameters:
  • data_type (str, optional) – Type of time series. E.g.: ‘NUMBER’, ‘TEXT’, ‘TIME’, ‘COORDINATES’

  • records (list, optional) – List of records

  • name (str) – Time series name

  • identifier (str, optional) – Time series ID. Autogenerated as UUID4 if not specified

insert(records: TsRecord | List[TsRecord])[source]

Insert single or multiple records

toJSON() str[source]

Outputs formatted JSON

class json_timeseries.JtsDocument(series: List[TimeSeries] | TimeSeries = None, version: str = '1.0')[source]

JTS document object

Raises:

[TypeError] – [Value of ‘series’ must be types of TimeSeries or List[TimeSeries]]

addSeries(series: List[TimeSeries] | TimeSeries)[source]

Add single or multiple TimeSeries

static fromJSON(json_str: str) JtsDocument[source]

Create a new jtsDocument from JSON

getSeries(identifier: str) TimeSeries[source]

Get series by id

toJSON() dict[source]

Output as dictionary of JSON structure

Returns:

Python dictionary of JSON structure

Return type:

dict

toJSONString() str[source]

Output as stringified JSON (json.dumps)

Returns:

Output as stringified JSON

Return type:

str