Timeseer Client allows querying of data and metadata from timeseer.
Project description
Timeseer.AI Client
Timeseer includes a Python client that can connect to a running instance of Timeseer Bus.
Get your api key in the Timeseer application under Configure > Global preferences > Api keys
>>> from timeseer_client import *
>>> client = Client(('<api-key-name>', '<api-key>'), 'localhost', 8081)
>>> list(client.search(SeriesSelector('row')))
[Metadata(series=SeriesSelector(source='row', name='test-tag-1'), description='', unit='m', limit_low=0.0, limit_high=1.0, accuracy=0.1), Metadata(series=SeriesSelector(source='row', name='test-tag-2'), description='test-tag-2', unit='kg', limit_low=0.0, limit_high=1.0, accuracy=0.1), Metadata(series=SeriesSelector(source='row', name='test-tag-3'), description='', unit='kPa', limit_low=0.0, limit_high=10.0, accuracy=1.0)]
>>> client.get_metadata(SeriesSelector('row', 'test-tag-1'))
Metadata(series=SeriesSelector(source='row', name='test-tag-1'), description='', unit='m', limit_low=0.0, limit_high=1.0, accuracy=0.1)
>>> client.get_data(SeriesSelector('row', 'test-tag-1'))
pyarrow.Table
ts: timestamp[us, tz=utc]
value: double
>>> client.get_data(SeriesSelector('row', 'test-tag-1')).to_pandas().set_index('ts')
value
ts
2020-01-01 00:00:00+00:00 1.0
2020-02-01 00:00:00+00:00 2.0
2020-03-01 00:00:00+00:00 2.0
2020-04-01 00:00:00+00:00 1.0
2020-05-01 00:00:00+00:00 1.0
>>> client.get_event_frames()
pyarrow.Table
interval: struct<start_date: timestamp[us, tz=UTC], end_date: timestamp[us, tz=UTC]>
child 0, start_date: timestamp[us, tz=UTC]
child 1, end_date: timestamp[us, tz=UTC]
type: string
source: string
name: string
>>> client.get_event_frames(selector=SeriesSelector('row', 'test-tag-2'), frame_type='Negative slopes').flatten().to_pandas()
interval.start_date interval.end_date type source name
0 2020-01-01 00:00:00+00:00 2020-02-08 00:00:00+00:00 Negative slopes row test-tag-2
1 2020-03-19 00:00:00+00:00 2020-11-01 00:00:00+00:00 Negative slopes row test-tag-2
>>> from dateutil.parser import parse as parse_date
>>> client.get_event_frames(selector=SeriesSelector('row', 'test-tag-2'), frame_type='Negative slopes', start_date=parse_date('2020-03-01T00:00:00Z')).flatten().to_pandas()
interval.start_date interval.end_date type source name
0 2020-03-19 00:00:00+00:00 2020-11-01 00:00:00+00:00 Negative slopes row test-tag-2
>>> client.get_event_frames(selector=SeriesSelector('row', 'test-tag-2'), frame_type='Negative slopes', end_date=parse_date('2020-03-01T00:00:00Z')).flatten().to_pandas()
interval.start_date interval.end_date type source name
0 2020-01-01 00:00:00+00:00 2020-02-08 00:00:00+00:00 Negative slopes row test-tag-2
Full documentation is available by running:
>>> help(timeseer_client)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timeseer-0.2.0.tar.gz
(10.6 kB
view hashes)
Built Distributions
timeseer-0.2.0-py3.9.egg
(19.7 kB
view hashes)