-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features/v3 annual averaging #352
Conversation
Also added the ability to change the base table from hourly to daily, though this has not been implimented yet.
A couple things I would like to work through and better understand: This pattern feels a bit odd to me I assume when you say "
Then the question is do we need other options beyond our chosen defaults? i.e. do we need the options for both daily-annual average and monthly-annual average (and "raw" annual average etc.). The other question would be can we realistically deliver every granularity in a performant enough way? Currently hour of day summaries for a single year is finnicky in terms of being fast enough for the timeout. |
We are trying to address two questions,
For the first, what table do they want to pull from I think it should look like this
The benefit of this is that we can have a different response model and filters for each resource. For the second, how does the user want to aggregate the data, we have a few options, for example, lets say the user wants to take the raw measurements and aggregate them to daily values, we have the following options
My assumption would be that the response from this call would be shaped differently than the response from the But if the response was not different I could see going the We also have the trends aggregates to think about |
There is still a little to do, like clean up queries and responses but I wanted to get this out for review just to make sure this is the right direction. You can get a feel for the new paths by looking at the tests. |
The "raw" measurements endpoint /v3/sensors/{sensrs_id}/measurements for this is currently not working. Throwing this error: ValueError: column tz.timezones_id does not exist |
This allows us to use the same query class even when we just need to alter the query field
Not passing all tests yet but very close
The same query seems to work locally but not in the test?
* add instruments_id query param for locations endpoint (#357) * add instruments_id query param for locations endpoint * Fixed typos in test --------- Co-authored-by: Christian Parker <[email protected]> * Features/v3 manufacturers query param (#358) * add manufacturers_id parameter * add manufacturers_id parameter to locations route --------- Co-authored-by: Christian Parker <[email protected]> * Some misc fixes for v3 * V3 licenses resources (#356) * added licenses resources * license resources * Added validation and some tests, removed trailing spaces * Added license router to main app - Moved the utils tests to the unit tests - remove locations from the url list because its covered in the sensors test now * fixes missing columns for licenses * license resource updates * Just some spacing my editor fixed --------- Co-authored-by: Christian Parker <[email protected]> * Feature/rate limit headers redux (#363) * update to rate limit algorithm and headers * Feature/v3 providers updates (#364) * remove licenses from providers and change owner_entity to entitiesId for v3/providers * Features/v3 annual averaging (#352) * Updated to let users aggregate to annual average Also added the ability to change the base table from hourly to daily, though this has not been implimented yet. * Added ability to change base table to sensors * Added new paths and tests and have basic working examples * add display name for measurand * revert * Testing out a method where we can alter query strings This allows us to use the same query class even when we just need to alter the query field * Updated tests and queries Not passing all tests yet but very close * One test still failing: days -> moy The same query seems to work locally but not in the test? * Fixed timestamp issues - passing all tests --------- Co-authored-by: Russ Biggs <[email protected]> * V3 locations fix (#365) * add license query params and utils fix * add licenses param tests * Added the missing test fix --------- Co-authored-by: Christian Parker <[email protected]> --------- Co-authored-by: Christian Parker <[email protected]>
Pull request fixes issues for annual averaging but we also discussed updated endpoints as well, instead of using the
period_name
.For the path updates I suggest the following
sensors/1/measurements
-- raw data for sensor 1sensors/1/hours
-- hourly data for sensor 1sensors/1/days
-- daily data for sensor 1sensors/1/years
-- annual data for sensor 1sensors/1/measurements/hourly
-- raw data aggregated to hourly for sensor 1 (really an alias for hourly data)sensors/1/measurements/daily
-- raw data aggregated to daily for sensor 1, we dont store this so this would be novelsensors/1/days/yearly
-- daily data for sensor 1 aggregated to a yearThe nice thing about above is that it would turn the
period_name
into another resource. The only thing I worry about for something like this is that the combination of the base/aggregation could be confusing but it would have its own endpoint and therefor we could offer a great description.Lets say that a user wants to see the annual average of daily values, it would be
sensors/1/days/yearly
which reads better to me than
sensors/1/measurements/daily?period_name=year
sensors/1/daily?period_name=year