-
Notifications
You must be signed in to change notification settings - Fork 5
Make endpoint arg order consistent: geo, time #26
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea but I suspect the argument ordering in this package was designed to match the old/existing delphi_epidata R client interface. Has this change been discussed with Tooling?
Ah, I will check in with them. |
I forget where we landed on this. IF we go with this change, think there are some changes still required: e.g., But I'm not sure we want this order. I think time then geo is going to be a bit awkward paired with epiprocess, tsibble, (gtsibble if it materialized), which words things geo/key then time/index. And I think that most groups of endpoints have also been geo then time, which suggests that it might be the more natural order. Regarding backwards compatibility: I'm mostly worried about people using flusight helper snippets like this one, which unfortunately do not call by name and use the two different orderings (covidcast and covidcast_epidata). I doubt but would like to know if people are using it already for other things. Any new users after this I wouldn't worry too much about: those that transition from covidcast pkg already have to reformat the time ranges; reordering isn't that much more hassle; and those that transition from delphi_epidata can probably deal with this small change (and may have to deal with larger hassles reformatting epiweeks/dates for epiranges). Some options:
We should discuss at a tooling meeting soon. |
I don't think I ever got much feedback on this. I'm not tied to a particular order, I just picked one because it seemed like a pretty arbitrary choice. I'm fine with (source_signal, geo, time) though, it makes sense. I think it's worth enforcing consistency, even if it breaks some helper snippets. That's a one-time cost, whereas user frustration from argument inconsistency within and across packages would be a continual friction. |
Informal poll here also suggests that geo before time is more natural. So unfortunately, I think things will need to be inverted here to follow a geo before time convention instead. Consistency is definitely a major pro. I am a little nervous about breaking the only code snippets for this package we've really thrown out there to the modeling community to try using, especially with these types of error messages possible (this is the current "wrong" order): epidatr::covidcast("hhs","confirmed_admissions_covid_1d","state","day","tx","20220101") %>% fetch_tbl()
#> Error in fetch_csv(epidata_call, fields) : Bad Request (HTTP 400).
epidatr::covidcast("hhs","confirmed_admissions_covid_1d","state","day","tx","20220101") %>% fetch_classic()
#> $epidata
#> data frame with 0 columns and 0 rows
#>
#> $message
#> [1] "not a valid date: tx"
#>
#> $result
#> [1] -1 although there's also this: epidatr::covidcast("hhs","confirmed_admissions_covid_1d","state","day","tx",20220101)
#> Error in `check_string_param()`:
#> ! argument geo_values is not a string
#> Run `rlang::last_error()` to see where the error occurred. which is maybe a little easier to debug. But I imagine we can do better. Perhaps a few early, ad-hoc checks to try to detect someone using the old order (e.g., using "state" for the time type or an epirange for the geo_values) and trying to set them straight + mentioning what version the ordering was swapped around in. And the snippet repo should be updated to require this version for the relevant code snippets [and fix its own breakage]. [Plus |
+1 on this in particular |
Thanks for doing that poll Logan. Agree with having backwards compatibility for a few versions + a warning message. If anyone wants to take over this PR, I would be happy with that. I'm not sure when I'll work on these clients again. |
0f86002
to
1756578
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, all my questions are non-blocking.
question: should we also reorder the field info / columns for covidcast
?
(but please sanity-check my minor changes) |
Oh, wait... issue: we don't have smart detection of people trying to use the old order. Should we add? Also, Dmitry, could you please update flusight-helper-snippets to work with this update if it doesn't already? |
I think we don't need to do smart detection here: the API server error codes should be enough |
I also already fixed create_epidata_call in the other PR |
I don't know what you mean about reodering column order / field info for covidcast. Could you link to code? |
* update tests * reorder `create_epidata_call` arg order for `covidcast` * add test-covidcast.R * correct epidatr vignette param order * build vignettes, update gitignore * document testthat >= 3.1.5 dev dependency in suggests Co-authored-by: Logan C. Brooks <[email protected]>
Fixes #24