ropensci / qualtRics

Download ⬇️ Qualtrics survey data directly into R!
https://docs.ropensci.org/qualtRics
Other
215 stars 70 forks source link

last_response still fetches all responses #153

Closed weiyangtham closed 4 years ago

weiyangtham commented 4 years ago

I'm otherwise able to get the responses with fetch_survey, but even when I enter a response ID into last_response, I get all the responses instead of only those after the response ID. I've tried those on a couple of different projects without success

juliasilge commented 4 years ago

Well. This is rather embarrassing. 🙈

I haven't noticed this since taking over maintenance over this package, but the last_response argument doesn't actually do anything. The argument is checked but then never actually used. Specifically, it is not included in the JSON payload sent to the Qualtrics API. This is probably because this is not one of the parameters of the API.

So where does that leave us? I am going to need to deprecate this argument because the API doesn't work like this. Thanks for bringing this to my attention, and I apologize for the confusion!

weiyangtham commented 4 years ago

Good to know and thank you! the package is a lifesaver

juliasilge commented 4 years ago

Just found this in check_params():

  # No longer used:
  # if ("last_response" %in% names(args)) {
  #   if (!is.null(args$last_response)) {
  #     assert_lastResponseId_string(args$last_response)
  #   }
juliasilge commented 4 years ago

The warning users will see will look like this:

Warning messages:
1: The `last_response` argument of `fetch_survey()` is deprecated as of qualtRics 3.1.2.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 
jmobrien commented 4 years ago

Sorry, @juliasilge. You should brush off that embarrassment and send it my way.

The older response API endpoint DID have had a lastResponseId param that this got passed to, and I neglected to document the change when it was removed in #135.

The new API doesn't support anything quite like it, though. There are "continuation tokens" but we don't support them yet, and they require some forethought to work.

However, @weiyangtham, I think you could get the same effect by pulling RecordedDate from the last response and passing that to start_date.

You'd need to format it properly, though, see here: https://api.qualtrics.com/docs/dates-and-times

EDIT: this won't work yet because of how the payload is internally constructed. We'd need to handle start_date a bit more flexibly first, to include times as well as dates.