rfortherestofus / omni

RMarkdown template, ggplot2 theme, and table function for OMNI Institute
https://rfortherestofus.github.io/omni/
Other
21 stars 5 forks source link

Survey monkey function for the OMNI package? #80

Closed OskaratOmni closed 7 months ago

OskaratOmni commented 9 months ago

Hey @tvroylandt and @dgkeyes , This is a question about whether or not it would be worth the effort to add a Survey Monkey (SM) function to the OMNI package.

We use SM for some projects. I have set up some R scripts to download from SM using this package: https://github.com/mattroumaya/surveymonkey and it works fairly well. I have a brief/terse tutorial that helps others through the process.

This package requires logging into our SM account and creating an app which in turn generates a token that lets Rstudio talk to Survey Monkey. An equivalent version of this for SM would probably require a setup function whereby the user provides this token as an argument.

I am not sure if there would be significant gains to adding this to the OMNI R package but there are some things that make me want to consider it:

Do either of you have some feedback or additional considerations on this? I like the idea of making the OMNI R package a 'one stop shop' for all survey and reporting needs but I have not convinced myself that it would necessarily be worth the effort to have this SM set up as part of the package.

Please let me know what you think - Thanks!

tvroylandt commented 9 months ago

Hi @OskaratOmni, I think it's worth adding it since you have the Qualtrics connection. Could you provide us with the tutorial and codes so that I can setup the functions please ? (by mail for the token)

dgkeyes commented 9 months ago

Good timing on this because I just recently came across a new package for working with Survey Monkey. I haven't looked super closely at it to know how it handles variable names. However, I do think having the workflow be similar to what we do for the Qualtrics functions would be helpful.

OskaratOmni commented 9 months ago

Oh great, thanks David! I looked this over and the process for getting a 'token' to connect SM to Rstudio is the same and then I realized that a lot of the function names were the same as in the surveymonkey package linked above, in my first comment. The maintainer of the one you linked to is also the author of the surveymonkey package too, so that explains why they share some of the same functions.

It looks to me like package svmkR has more activity so I'm fine to go with that.

OskaratOmni commented 9 months ago

@tvroylandt here is the tutorial I made. apologies that it is quite rough - i made it... very fast. haha https://65b283eca3834196d13816a8--elegant-squirrel-ce3aa1.netlify.app/

It covers same info as on the github page for the surveymonkey package (along with a few details on the specifics of how we access OMNI via a server at the office).

The main 'trick' then is to streamline the process of getting these Oanth tokens.
I have encountered some strange issues with them before. The SM app can become inactive at seemingly random times and once I could access a survey just fine from one R project but got a 405 error using the exact same code in another R project at the same time. This really drove me crazy but I never figured out the reason.

If there is a trick for how to set up these token in Survey Monkey, so that they last longer and are stable, that would be great to figure out, but my suspicion is that accessing SM will in general be more buggy than accessing Qualtrics.

I will get a token as soon as I have the time.

OskaratOmni commented 9 months ago

Correction to the above - they actually forked surveymonkey to make svmkR.

We are not getting surveymonkey to work right now and are switching to svmkR

The issue is discussed here https://github.com/mattroumaya/surveymonkey/issues/73

but their solution isn't working (should be in the package anyway). I wonder if SM updated their API in a way that breaks that function again.

Anyway, since svmkR is more recent and surveymonkey might be broken at the moment we definitely want to use the svmkR package

tvroylandt commented 9 months ago

I'm not really sure it would be possible to improve the Oauth flow (see https://api.surveymonkey.com/v3/docs?shell#authentication)

What we could do is to add some functions into omni that would copy svmkR functions.

@OskaratOmni @dgkeyes

OskaratOmni commented 9 months ago

@tvroylandt - I think it is OK if we cannot improve it.

What I was thinking is that we have a function that is similar to qualtrics_connect() - probably called surveymonkey_connect() - that establishes the connection using that token we get by setting up the app. Is this okay?

One difference will be that the surveymonkey token we get when we set up the app will be less stable - so maybe there could be some more specific or diagnostic error messages? For example, if a user tries to connect to get a survey with surveymonkey_connect() but the SM server returns a 405 error, do we trigger the user to log in to survey monkey and re-activate the app? I'm sure my language is imprecise here @tvroylandt so please forgive that. Is functionality broadly similar to this possible?

OskaratOmni commented 9 months ago

Oh, and one of my colleagues was able to access surveys just fine after we switched to svmkR

dgkeyes commented 9 months ago

Glad to hear that! I would definitely use svmkrR moving forward.

This is from an upcoming issue of What's New in R:

image

dgkeyes commented 9 months ago

And yes, @tvroylandt, if you can please add functions that are as similar as possible to the Qualtrics functions, that would be good.

tvroylandt commented 9 months ago

Ok. I will put that on my to do list.

Just FYI, the function already exist in the svkmR package : https://soubhikbarari.com/svmkR/reference/set_token.html

Double thinking about that, I'm unsure it's a so good idea just to copy the function from one package to put them in omni. Especially since the package is young and could move later, it would force us to redo that later. I think it would be best to write a good vignette about how to use svmkR, including on how to setup a token.

dgkeyes commented 9 months ago

Let me discuss this with @OskaratOmni on our call we have this Friday and we'll reply here afterwards.