-
Notifications
You must be signed in to change notification settings - Fork 5
Some fetching functions don't appropriately stop/warn on epidata msgs/status #83
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
Comments
For the specific case of "no results":
Here, I think we probably favor raising the error message. And for any other type of error message, we'd probably want to raise it even more than the "no results" one. I forget if there are status codes / messages to indicate warnings (maybe status codes > 1?); returning a warning + results might also be a desired outcome in some cases. |
The second case above needs a little more thought. If there is data available, the user will want to format it, probably to a tibble. That might mean we'd want to expose a conversion function from the classic/raw format to tibble, maybe something like |
Throwing an error on no results doesn't seem right to me, mostly because I found it a very common workflow to try a cross product of a set of dates or geos, make requests for each, and then compile together. Since I generally don't know ahead of time which param combinations will yield values, this tends to encourage a "poke and see" kind of approach. Having to wrap this workflow in a try catch block would be a bit annoying, though I guess doable. |
Is this a common workflow you'd want to do, or that you see people using? Would just directly putting in the geos & dates in one API request work? I'd imagine error vs. not for no data is actually a server-side todo, and [the clients] should just raise all epidata errors as errors? Unless we're aiming for backwards compatibility. |
It's a workflow that I seemed to converge on whenever I did exploratory analysis. Also the old clients separated geos and time_values into many separate requests, since we didn't support multiple values there. But yea, many of these issues go away with multi geo/time_value queries. Hm, I suppose it wouldn't be too bad to error on no results. It's probably a mistake if a query returns nothing and can always be worked around with a catch block. |
API keys rollout is going to make appropriately warning here more important. |
We stop for httr status codes, but not Epidata errors / status codes. For example, we don't stop for the "no results" error. Testing out a few fetching functions:
Created on 2023-04-10 by the reprex package (v2.0.1)
So
fetch_json
has this problem, and probablyfetch_tbl
andfetch_csv
too, though it may not be clear because of #17. (fetch_classic
is fine, as it's representing the error directly and not throwing it away, though I'm not sure we want that 0-row 0-column data frame or something else.)The text was updated successfully, but these errors were encountered: