From 7e18946121298f4fd29ca6f452b4988e55ede2ba Mon Sep 17 00:00:00 2001 From: Ruben Perez Perez Date: Wed, 7 Apr 2021 16:15:40 +0200 Subject: [PATCH] testing gs4_deauth --- R/divewatch.R | 6 +-- R/prep_data.R | 6 +-- divewatchrshiny/app.R | 100 ------------------------------------------ man/divewatch.Rd | 4 +- man/prep_data.Rd | 4 +- 5 files changed, 7 insertions(+), 113 deletions(-) delete mode 100644 divewatchrshiny/app.R diff --git a/R/divewatch.R b/R/divewatch.R index 2828d55..3076bee 100644 --- a/R/divewatch.R +++ b/R/divewatch.R @@ -7,7 +7,6 @@ #' #' @param data The URL ID of the database in google sheets, if no URL is provided a mock dataset generated #' by the test_data function will be read -#' @param email email account that will be used to access the Logbook in Google Spreadsheet #' #' @author Ruben Perez Perez #' @@ -23,9 +22,8 @@ #' } -divewatch <- function(data = NA, - email = NA){ - prep_data(data, email) +divewatch <- function(data = NA){ + prep_data(data) download.file("https://raw.githubusercontent.com/rubenpp7/divewatchr/master/files/overview.Rmd", "overview.Rmd") render("overview.Rmd") diff --git a/R/prep_data.R b/R/prep_data.R index 2f8feb0..11497a6 100644 --- a/R/prep_data.R +++ b/R/prep_data.R @@ -8,7 +8,6 @@ #' @param data The URL ID of the database in google sheets, if no URL is provided a mock dataset generated #' by the test_data function will be read #' @param path directory location where the files will be read from or written into -#' @param email email account that will be used to access the Logbook in Google Spreadsheet #' #' @author Ruben Perez Perez #' @@ -30,7 +29,7 @@ prep_data <- function (data = NA, - email = NA, + #email = NA, path = getwd()){ ### READ DATA @@ -38,7 +37,8 @@ prep_data <- function (data = NA, if(!is.na(data)){ # From Google sheets -gs4_auth(email) +#gs4_auth(email) +gs4_deauth() (scuba_log <- read_sheet(data, sheet = "logbook", na = "")) (scuba_geo <- read_sheet(data, sheet = "coordinates", na = "")) (scuba_typ <- read_sheet(data, sheet = "divetypes", na = "")) diff --git a/divewatchrshiny/app.R b/divewatchrshiny/app.R deleted file mode 100644 index 8a2ac45..0000000 --- a/divewatchrshiny/app.R +++ /dev/null @@ -1,100 +0,0 @@ -# -# This is a Shiny web application. You can run the application by clicking -# the 'Run App' button above. -# -# Find out more about building applications with Shiny here: -# -# http://shiny.rstudio.com/ -# - - - -library(shiny) -library(divewatchr) - - -path <<- "." -homed <<- getwd() - - -# Define UI for application that draws a histogram -ui <- fluidPage( - - - conditionalPanel(condition="$('body').hasClass('disconnected')", tags$div("Disconnected\n refresh browser.",id="disconnectmess")), - tags$script('Shiny.addCustomMessageHandler("setcookie",function(cookie) {document.cookie=cookie;});'), - - fluidRow( - column(9,titlePanel("Divewatchr")), - column(3,conditionalPanel(condition="$('html').hasClass('shiny-busy')", HTML('
'))) - ), - # Application title - #titlePanel("Old Faithful Geyser Data"), - - - - - # Sidebar with a slider input for number of bins - sidebarLayout( - sidebarPanel( - textInput('url','Google Spreadsheet page ID', value = "1PpXTVS8LdzbvwLHyAAhR2MdT9Iwdy-hiqJknUzF7Yqo"), - textInput('email','Email account to access the Logbook', value = ""), - actionButton("load","Load",icon("refresh")), - uiOutput("downloadbutton") # to download the html file from divewatch() - - ), - - # Show a plot of the generated distribution - mainPanel( - htmlOutput("htmldives") - )), - - - - - - - - -) - -# Define server logic required to draw a histogram -server <- function(input, output, session) { - - values<-reactiveValues(sourceURL="") - - observe({ - query <- parseQueryString(session$clientData$url_search) - if (!is.null(query[["baseurl"]]) & !is.null(query[["resource"]])) { - baseurl <- query[["baseurl"]] - resource <- query[["resource"]] - values$sourceURL <- paste0(baseurl, '/resource?r=', resource) - }} ) - - observeEvent(input$load,{ - if(!is.null(input$file)) - values$sourceURL<-input$file[4] - else if(!is.null(input$url)) - values$sourceURL<-input$url - - }) - - CheckDataset<-reactive({ - req(values$sourceURL) - return(divewatch (values$sourceURL, input$email)) - }) - - - - output$htmldives <- renderUI ({ - IPTreport<-CheckDataset() - - includeHTML("overview.html") - - }) - - -} - -# Run the application -shinyApp(ui = ui, server = server) diff --git a/man/divewatch.Rd b/man/divewatch.Rd index 2304256..bb06a43 100644 --- a/man/divewatch.Rd +++ b/man/divewatch.Rd @@ -4,13 +4,11 @@ \alias{divewatch} \title{Creates an overview of the logbook} \usage{ -divewatch(data = NA, email = NA) +divewatch(data = NA) } \arguments{ \item{data}{The URL ID of the database in google sheets, if no URL is provided a mock dataset generated by the test_data function will be read} - -\item{email}{email account that will be used to access the Logbook in Google Spreadsheet} } \value{ Creates an overview.html file with an overview of the diving logbook and creates a Fig folder with the images from the overview diff --git a/man/prep_data.Rd b/man/prep_data.Rd index 21b213f..522c72b 100644 --- a/man/prep_data.Rd +++ b/man/prep_data.Rd @@ -4,14 +4,12 @@ \alias{prep_data} \title{Prepares the data} \usage{ -prep_data(data = NA, email = NA, path = getwd()) +prep_data(data = NA, path = getwd()) } \arguments{ \item{data}{The URL ID of the database in google sheets, if no URL is provided a mock dataset generated by the test_data function will be read} -\item{email}{email account that will be used to access the Logbook in Google Spreadsheet} - \item{path}{directory location where the files will be read from or written into} } \value{