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

Request to average endpoint times out #326

Open
MauriceHeinze opened this issue Jan 25, 2024 · 3 comments
Open

Request to average endpoint times out #326

MauriceHeinze opened this issue Jan 25, 2024 · 3 comments

Comments

@MauriceHeinze
Copy link

Hello,

We're facing issues using the average endpoint. The locations endpoint we use to get the closest station near by works fine, but as soon as we try to get the average values for the first location it fails.

Error in requests.get: 408 Client Error: Request Time-out for url: https://api.openaq.org/v2/averages?temporal=year&date_to=2024-01-25&date_from=2023-01-25&locations_id=3197&spatial=location

Thanks in advance for looking into it.

Best,
Maurice

@russbiggs
Copy link
Member

Hi Maurice, Thanks for reporting this. I can't replicate the timeout right now but this is common. The 408 timeout usually means the request is too complex or requesting too much data. In the case of this location it is only reporting PM10, so not too complex.

One confusing point is you are requesting yearly averages starting and ending from January 25. This returns a "yearly" average for 2023 from 01-25 until 12-31 and a "yearly" average for 2024 from 01-01 until 01-25. This latter is not a yearly average and is adding extra work for the query which may be slowing it down. This is a shortcoming of this endpoint that it allows this. I would recommend trying something like:

https://api.openaq.org/v2/averages?temporal=year&date_to=2024-01-01&date_from=2023-01-01&locations_id=3197&spatial=location

Which will appropriately get you the full average from 2023.

We are working on a new endpoint that will hopefully be more clear for yearly averaging.

@caparker do you have any other thoughts on this?

@MauriceHeinze
Copy link
Author

Thanks for the quick response, Russ!

@russbiggs
Copy link
Member

@MauriceHeinze do the adjusted date_from and date_to values meet with your intended query? or were you intentionally trying to get the cross-year average 2023-01-25 to 2024-01-25?

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