Package for easy datarequests from sensortings
Project description
pandassta: combining sensorthings and pandas
pandassta
package allows easy tools to interact with a FROST-Server Sensorthings API, using pandas dataframes.
This package was developed within a quality assurance project, which is reflected in some specific functions.
Installation
pip install pandassta
Basic usage
Building query
Different wrappers are available for some common queries, but custom queries can easily be constructed. The code below builds a query to get the observations per datastream, with the observed properties of thing 1.
obsprop = Entity(Entities.OBSERVEDPROPERTY)
obsprop.selection = [Properties.NAME, Properties.IOT_ID]
obs = Entity(Entities.OBSERVATIONS)
obs.settings = [Settings.COUNT("true"), Settings.TOP(0)]
obs.selection = [Properties.IOT_ID]
ds = Entity(Entities.DATASTREAMS)
ds.settings = [Settings.COUNT("true")]
ds.expand = [obsprop, obs]
ds.selection = [
Properties.NAME,
Properties.IOT_ID,
Properties.DESCRIPTION,
Properties.UNITOFMEASUREMENT,
Entities.OBSERVEDPROPERTY,
]
thing = Entity(Entities.THINGS)
thing.id = 1
thing.selection = [Properties.NAME, Properties.IOT_ID, Entities.DATASTREAMS]
thing.expand = [ds]
query = Query(base_url=config.load_sta_url(), root_entity=thing)
query_http = query.build()
Components
General definitions: sta.py
Reflection of the sensorthings structure.
Construction and execution of queries: sta_requests.py
Classes and function that allow or simplify the construction requests.
General function to go from a json response to a pandas dataframe: df.py
Classes and functions to convert observations to a dataframe.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pandassta-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94f9c39571365154cfd4177dfe37e080eab20605a77c203d77894f74813be2ce |
|
MD5 | 095928c29483353ba863b3b8329c72d1 |
|
BLAKE2b-256 | 8b343601fc419d0919b6ac42aca62e5d65995cb165e7995f7697ba9a8051696d |