Skip to content
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

?period_name=hod / dow / moy returns 500 for v3 /measurements #168

Open
majesticio opened this issue Jun 13, 2023 · 2 comments
Open

?period_name=hod / dow / moy returns 500 for v3 /measurements #168

majesticio opened this issue Jun 13, 2023 · 2 comments

Comments

@majesticio
Copy link
Contributor

@caparker not sure if the problem is here that the query in measurements.py doesn't have a way to use 'hod', 'dow', or 'moy' in the query, and is not failing gracefully if period_name=hod is used. Will try to put '1hod' into the SQL query similarly to '1 month'. example:
https://api.openaq.org/v3/locations/2178/measurements?date_from=2023-06-12T12:00:00&date_to=2023-06-13T13:00:00&period_name=hod

@caparker
Copy link
Collaborator

Those are from the /v2/averages method and likely do not have a place in the measurements endpoint because they do not return a valid timestamp. The same method would work in the trends endpoint though. I would recommend that split it out into two different query models, PeriodNameQuery which could be used in /v2/averages and /v3/trends and then maybe PeriodQuery which would be used in the /v3/measurements endpoint.

factor = "to_char(datetime - '1sec'::interval, 'HH24') as hod"

@majesticio
Copy link
Contributor Author

Thanks for clarifying, that was an assumption on my part that those were supposed to be included

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants