-
Notifications
You must be signed in to change notification settings - Fork 0
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
Google Forms Data Extraction #29
Conversation
} | ||
|
||
|
||
google_pagination <- function(first_page_result) { |
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.
I think this is needed for google forms that have a lot of responses, however I don't have any google forms that have that many responses so I can't test this. But I'll keep this infrastructure here for when we do have some data that needs it.
@@ -1,55 +0,0 @@ | |||
# Extracting data from Google drive files |
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.
I deleted all this because now we are just passing tokens to googledrive
and having that do the work for us! Thanks to Howard for helping me figure this out.
@@ -68,7 +68,8 @@ get_token <- function(app_name, try = FALSE) { | |||
get_stored_token <- function(app_name) { | |||
if (app_name == "calendly") token <- getOption("calendly") | |||
if (app_name == "github") token <- getOption("github") | |||
if (app_name == "google") token <- try(readRDS(file.path(cache_secrets_folder(), "google.RDS")), silent = TRUE) | |||
if (app_name == "google") token <- getOption("google") |
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.
I realized we don't need to readRDS we can just set this as an option too.
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.
get_google_form()
may need to be examined as form_info$title
contains NULL.
get_multiple_forms()
looks good to me.
@@ -71,6 +71,7 @@ authorize <- function(app_name = NULL, | |||
scope = scopes_list, | |||
... | |||
) | |||
googledrive::drive_auth(token = token) |
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.
I was wondering why you had to add this line. Does this affect the Google Analytics code?
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.
At times we borrow the googledrive and googlesheets packages to do work for us. This makes it so that users don't have to do authorization for every single package. Instead they authorize metricminer and we send that authorization to the dependency packages we need.
} else { | ||
answers_df <- "no responses yet" | ||
} | ||
return(list(title = result$form_metadata$result$info$title, |
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.
When I run form_info <- get_google_form("https://docs.google.com/forms/d/1Z-lMMdUyubUqIvaSXeDu1tlB7_QpNTzOk3kfzjP2Uuo/edit")
, I get NULL
as the value for form_info$title
.
Is this expected behavior?
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.
After running the code to grab multiple forms, I see that code returns the title of the Google form, making me think the above behavior may be a bug.
metadata = metadata, | ||
answers = answers_df)) |
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.
What do you think of making these tibbles? The output can get pretty ugly: #25
This is a more universal problem that I want to address for all these functions #32 I'm thinking the solution should be 1) Make a specialized data class type to handle these data as well as a 2) set of handler functions. But this will be a much bigger set of work than will be done in this PR. |
I agree that these are issues but I think they will take more to address than is the scope of this PR. For ease of addressing this I'm going to merge this and move on. |
Purpose/implementation Section
What changes are being implemented in this Pull Request?
This is a set of functions that retrieve and get data from google forms.
Usage
Here's how these work. You can pass in a single URL or form id to a form and retrieve info:
You can extract multiple forms using
get_multiple_forms()
function