-
Notifications
You must be signed in to change notification settings - Fork 72
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
Feature: Option to download in progress responses #220
Comments
Turns out there's an option to get in-progress responses within the API endpoint we're already using. Appears to be an either/or situation, though--you'd have to get completed and in-progress cases with different runs. )Much like how the web interface shows that on two pages; guessing it's something to do with how the Qualtrics engine works.) https://api.qualtrics.com/api-reference/reference/responseImportsExports.json/paths/~1surveys~1%7BsurveyId%7D~1export-responses/post (see I've got some other work to add soon, and it would be trivial enough to just add this as a param to @juliasilge, thoughts on UI goals though? It might be more complicated than just adding a param, since we'd need to add some careful arg checking (e.g., the new param would almost certainly not play nice w/ |
What do you think about a separate function? I'm leaning that way, and calling it a "helper function". I'm looking at the args to We can use |
That would be fine, maybe something like We'd end up import all the args other than |
Both in progress and completed responses have start and end dates on the data end. For reference what I am using right now is below. Essentially re-stacking the in progress and completed responses to set up some reporting. A colleague has an implementation on their package https://github.com/ppssphysics/QualtricsInR . EOS_add_1 <- QualtricsInR::get_survey_responses(surveys[ i,"id"], exportResponsesInProgress = TRUE, |
Ah, looks like you are right: library(tidyverse)
req_body <- list(useLabels = TRUE,
includeDisplayOrder = TRUE,
exportResponsesInProgress = TRUE,
startDate = "2020-02-01T00:00:00Z",
format = "csv") %>%
map(jsonlite::unbox) %>%
jsonlite::toJSON()
req_body
#> {"useLabels":true,"includeDisplayOrder":true,"exportResponsesInProgress":true,"startDate":"2020-02-01T00:00:00Z","format":"csv"}
fetch_url <- qualtRics:::create_fetch_url(Sys.getenv("QUALTRICS_BASE_URL"),
"SV_3gbwq8aJgqPwQDP")
rs <- qualtRics:::qualtrics_api_request("POST", url = fetch_url, body = req_body)
rs$meta
#> $requestId
#> [1] "2ef5f4a5-e845-4762-8e83-b81c1f0f7938"
#>
#> $httpStatus
#> [1] "200 - OK" Created on 2021-06-10 by the reprex package (v2.0.0) So maybe we just yet another 😩 argument to |
Hold on--I thought those two weren't equivalent? (referencing #158.) I agree you'd expect to see the usual StartDate and EndDate variables in the response download (or at least StartDate? Not sure what would be in EndDate). BUT per the API docs (and confusingly), arguments @juliasilge I think you'd have to follow through with that request to see if adding startDate actually did anything. |
Maybe somewhat more relevant to #158 than here, but while I'm at it--is there an existing tool that can render date-times with the "T" separator, and/or add the timezone adjustments to the end? That would actually make finishing several needed features a lot easier. |
Ah, right, I am remembering these issues now with the date time arguments. I know that in another issue I said it was good to create functions that mirrored the API endpoints, but it's possible that adding I don't know of a tool in R that creates date time strings that look like what is needed here exactly. It seems pretty non-standard to me. I would probably use glue to create them: glue::glue("{Sys.Date()}T{format(Sys.time(), '%H:%M:%S')}Z")
#> 2021-06-10T14:56:25Z Created on 2021-06-10 by the reprex package (v2.0.0) |
Huh. I just looked and apparently it's ISO standard 8601: https://www.w3.org/TR/NOTE-datetime. And lubridate has something for that: https://lubridate.tidyverse.org/reference/format_ISO8601.html |
I think the fact that API results are mutually exclusive depending on that switch is a solid case for a separate function. One counterpoint, though: we could include the ...come to think of it, though, separate function or not all of this might not naturally play nice with the caching stuff behind |
That's an interesting idea of |
Would be fantastic to have the option to download in progress as well as completed responses from fetch_survey(). It's helpful for monitoring incoming data before finalising surveys.
The text was updated successfully, but these errors were encountered: