UrbanCCD-UChicago / aot-client-py

The Official Python Client to the Array of Things API
https://api.arrayofthings.org/
Other
6 stars 2 forks source link

Document usage of time_bucket parameter #8

Open chrisluedtke opened 5 years ago

chrisluedtke commented 5 years ago

I'd love to use this parameter rather than pulling and normalizing/interpolating data on my end, but documentation does not make the usage clear.

vforgione commented 5 years ago

Sorry about that. Like the other issue I'm really pressed for time.

Here's an example: https://api-of-things.plenar.io/api/observations?time_bucket=avg:6%20hours&sensor=metsense.htu21d.temperature&node=004

The pattern is time_bucket={function}:{interval} where function is a Postgres statistical function and interval is a Postgres interval value.

You're also going to need to limit to the sensor you want to aggregate, and it usually makes sense to also limit to a node or project (rather than all the nodes).

vforgione commented 5 years ago

Correction to the above comment: the function value is one of min, max, avg or median. I reviewed the controller code and remembered that I had restricted it to those.

vforgione commented 5 years ago

I update the docs a bit. If you want to be a superstar and take a look and let me know if that's sufficient I'd like to hear your thoughts -- in general. I really don't like Apiary as I find it really restrictive, and I'm not sure how to best document really involved stuff like this function.

chrisluedtke commented 5 years ago

Yes, that clears it up. I'll be playing with this in the next day or two.

image