/BigQuery-Visualiser

A Shiny app to visualise BigQuery data in R. Open sourced so you can deploy on your own Shiny server.

Primary LanguageR

BigQuery-Visualiser

A Shiny app to visualise BigQuery data in R.

Open sourced so you can deploy on your own Shiny server.

Introduction

bigQuery-demo

After releasing the public Shiny app BigQuery Visualiser Nov 2015, good feedback was how it couldn't be used by some organisations due to security policy to not let unknown apps access to your BigQuery account.

Since there is not yet a read only BigQuery scope, one alternative is to allow a JSON upload for verification, but this is pending a fix in httr

This leaves this solution, allowing users to download their own copy of the Shiny app, for deployment on their own server.

Setup

  • Clone this library to your own local computer
  • Install dependencies:
install.packages("devtools")
devtools::install_github("MarkEdmondson1234/googleAuthR")
devtools::install_github("MarkEdmondson1234/bigQueryR")
devtools::install_github("timelyportfolio/listviewer")
  • I recommended setting up a local redirect URI at 127.0.0.1:1221 for testing, and one with the URL of where your app will eventually be deployed.
  • The setup should look something like this:

oauth2-setup-bigquery-visualiser

  • Update the server.R file to include your credentials. The comments at the top of the file are reproduced below:
  ## The bigQueryR client Ids do not have billing enabled, 
  ## so to work with your own data you need to replace the below with your own
  ## Google API console keys with billing enabled. Do that here:
  ## https://console.developers.google.com/apis/credentials/oauthclient

  options("googleAuthR.webapp.client_id" = getOption("bigQueryR.webapp.client_id"))
  options("googleAuthR.webapp.client_secret" = getOption("bigQueryR.webapp.client_secret"))
  
  ## Once you have made your keys comment out the above options and comment in the below 
#   options("googleAuthR.webapp.client_id" = "YOUR_CLIENT_ID_FOR_OAUTH_TYPE_WEB_APPLICATION")
#   options("googleAuthR.webapp.client_secret" = "YOUR_CLIENT_SECRET_FOR_OAUTH_TYPE_WEB_APPLICATION")
  • Launch the app locally using:
shiny::runApp(port=1221)

...where the variable port is equal to the one you set up in the Google Dev Console (1221 in this example).

For Shiny server deployment onto the web no port is needed.

Feedback

If you have any improvements such as new plot types or feedback raise an issue or submit a pull request.