-
Notifications
You must be signed in to change notification settings - Fork 71
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
Automating downloading of complete QSF library from Qualtrics user library #299
Comments
Hi @yuvso, Question to help me figure out what you need--what do you need the QSF's for? The function If you need the QSF's as QSF's--for, say, other people to upload using the web interface, the qualtRics package doesn't yet have the ability to get them. That said, the API endpoint that While we don't yet have the QSF option added to |
Could this be an argument to the existing |
I could see both being workable. Possibly, yes. I think the relevant considerations are the quite different output we'd want (R list vs JSON). Also, we might want to add a few more arguments--maybe one for writing directly to a file† vs stdout, maybe also one for prettifying the JSON beforehand so it's human-readable. Definitely something that could work inside †(Bringing up direct writing because writing JSON direct to file needs something like I actually already made a super-quick |
|
Well, this is the proprietary method of Qualtrics' migration and re-installation of a specific survey. It's best way I know of, to back survey's up in most complete manner. |
@yuvso, thanks. That's what I assumed at a default. It does seem like something people might commonly want, and so something we should consider supporting. I'm currently experimenting in draft #302 with how we might support getting QSFs easily through the API. The new function for that (for now, approach isn't decided) is If you do try it on your use case, we'd love feedback on any issues, ideas, or suggestions that you discover. You're also welcome to submit PRs for code changes directly if that interests you. |
Thanks!
Have tried reinstalling qualtRics and running fetch_qsf().
This is what I get:
Error in get0(oNam, envir = ns) :
lazy-load database '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/stringr/R/stringr.rdb' is corrupt
In addition: Warning messages:
1: In get0(oNam, envir = ns) : restarting interrupted promise evaluation
2: In get0(oNam, envir = ns) :
Error in get0(oNam, envir = ns) :
lazy-load database '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/stringr/R/stringr.rdb' is corrupt
Yuval
… On 8 Dec 2022, at 16:29, jmobrien ***@***.***> wrote:
@yuvso <https://github.com/yuvso>, thanks. That's what I assumed at a default. It does seem like something people might commonly want, and so something we should consider supporting.
I'm currently experimenting in draft #302 <#302> with how we might support getting QSFs easily through the API. The new function for that (for now, approach isn't decided) is fetch_qsf(). If you're interested in trying it out (with the understanding that it's still not officially a part of the package), the draft version can be installed with remotes::install_github("ropensci/qualtRics", ref = "0060364").
If you do try it on your use case, we'd love feedback on any issues, ideas, or suggestions that you discover. You're also welcome to submit PRs for code changes directly if that interests you.
—
Reply to this email directly, view it on GitHub <#299 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/A4TTTYDE4N3E4KZQ7AF4EDDWMHWE7ANCNFSM6AAAAAASWRNGXI>.
You are receiving this because you were mentioned.
|
@yuvso I would restart R, install stringr, restart R, and then try again. Make sure you are not saving your workspace in between. |
Now fetching works fine. What is the best way to save it to QSF file locally? I’m not sure about handling JSON formats in R environment.
Thanks,
Yuval
… On 8 Dec 2022, at 18:28, Julia Silge ***@***.***> wrote:
@yuvso <https://github.com/yuvso> I would restart R, install stringr, restart R, and then try again.
—
Reply to this email directly, view it on GitHub <#299 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/A4TTTYHBWLPZRPSDBU4WHJDWMIEEDANCNFSM6AAAAAASWRNGXI>.
You are receiving this because you were mentioned.
|
I typically use |
@juliasilge, weirdly enough The only way I've figured out so far is to write the lines out manually, like below using # Make connection to file:
connection <-
file(filepath)
# Write lines of JSON to file:
writeLines(
text = [downloadedJSON],
con = connection
)
close(connection)
But, since I think you're right @yuvso to expect that most of the time people will want to save rather than work with the JSON in R , in the fetch_qsf([surveyID], save = TRUE file = "survey.qsf")
should (if everything's working) create the appropriate file called survey.qsf in your working directory. There might be other ways to save, but I'm still learning. If you needed to do a bunch, I suppose you could set up something with these tools using |
Just for fun, something like the below would, I think, save QSF's for every survey in your # List all surveys:
qualtRics::all_surveys() |>
# Create potential filenames for each combining survey id and survey name:
dplyr::mutate(
file = glue::glue("{surveyID} - {title}.qsf", surveyID = id, title = name)
) |>
# Take just the key parts:
dplyr::select(surveyID = id, file) |>
# Cycle through list, saving each to the new filename
purrr::pwalk(fetch_qsf, save = TRUE) I haven't actually tested the above, because it would run hundreds of API calls for me and make tons of files. But I think it illustrates an idea of a how this might integrate |
@juliasilge now I'm wondering whether we should have renamed the "id" column in
|
I've run the latest, seems to be an error within glue::glue() Error in eval(parse(text = text, keep.source = FALSE), envir) : |
My mistake @yuvso--I restructured that right before posting it, and forgot to change those .x's and .y's to what they should be. (.x/.y is something used inside the purrr::map/walk functions, but that glue call isn't inside there anymore). I edited the code above, and it seems to be working now. You're welcome to try it again if you like. But mainly it's still just an illustration, and/or maybe something that could go into examples/vignettes for this functionality. |
Thanks! This look great, I've tested your latest version and it worked like a charm. |
This is great! |
Hi, first of all - thanks for your lovely qualtRics package. It is very useful!
I've encountered a problem, I need to download all my qualtrics surveys - data, metadata and QSF files - from my user account.
I used qualtRics to automate downloading and saving of both survey data and metadata successfully. However - I have not found a way through qualtRics script to fetch the list, and download QSF files.
Obviously this should not be a problem, as QSF are equivalent to surveyIDs and since identification and opening a connection is already happening through "fetch survey" command.
Thank you for any help!
Yuval
The text was updated successfully, but these errors were encountered: