Skip to content

Instantly share code, notes, and snippets.

@shubhamagarwal92
Last active August 17, 2017 15:19
Show Gist options
  • Save shubhamagarwal92/1f0e48f1c37b40cb3dc11ddaeffea771 to your computer and use it in GitHub Desktop.
Save shubhamagarwal92/1f0e48f1c37b40cb3dc11ddaeffea771 to your computer and use it in GitHub Desktop.
GSoC 2017 PEcAn Shiny workflowPlot Git logs
diff --git a/db/R/query.dplyr.R b/db/R/query.dplyr.R
index 18c52d7..f392886 100644
--- a/db/R/query.dplyr.R
+++ b/db/R/query.dplyr.R
@@ -134,14 +134,16 @@ runs <- function(bety, workflow_id) {
#' @inheritParams dbHostInfo
#' @param session Session object passed through Shiny
#' @export
-get_workflow_ids <- function(bety, session) {
+get_workflow_ids <- function(bety, session,all.ids=FALSE) {
query <- isolate(parseQueryString(session$clientData$url_search))
- if ("workflow_id" %in% names(query)) {
+ # If we dont want all workflow ids but only workflow id from the user url query
+ if (!all.ids & "workflow_id" %in% names(query)) {
ids <- unlist(query[names(query) == "workflow_id"], use.names = FALSE)
} else {
# Get all workflow IDs
ids <- workflows(bety, ensemble = TRUE) %>% distinct(workflow_id) %>% collect %>%
.[["workflow_id"]] %>% sort(decreasing = TRUE)
+ # pull(.,workflow_id) %>% sort(decreasing = TRUE)
}
return(ids)
} # get_workflow_ids
@@ -208,3 +210,85 @@ get_var_names <- function(bety, workflow_id, run_id, remove_pool = TRUE) {
}
return(var_names)
} # get_var_names
+
+#' Get vector of variable names for a particular workflow and run ID
+#' @inheritParams get_var_names
+#' @param run_id Run ID
+#' @param workflow_id Workflow ID
+#' @export
+var_names_all <- function(bety, workflow_id, run_id) {
+ # @return List of variable names
+ # Get variables for a particular workflow and run id
+ var_names <- get_var_names(bety, workflow_id, run_id)
+ # Remove variables which should not be shown to the user
+ removeVarNames <- c('Year','FracJulianDay')
+ var_names <- var_names[!var_names %in% removeVarNames]
+ return(var_names)
+} # var_names_all
+
+#' Load data for a single run of the model
+#' @inheritParams var_names_all
+#' @inheritParams workflow
+#' @param run_id Run ID
+#' @param workflow_id Workflow ID
+#' @export
+load_data_single_run <- function(bety, workflow_id,run_id) {
+ # For a particular combination of workflow and run id, loads
+ # all variables from all files.
+ # @return Dataframe for one run
+ # Adapted from earlier code in pecan/shiny/workflowPlot/server.R
+ globalDF <- data.frame()
+ workflow <- collect(workflow(bety, workflow_id))
+ # Use the function 'var_names_all' to get all variables
+ removeVarNames <- c('Year','FracJulianDay')
+ var_names <- var_names_all(bety,workflow_id,run_id)
+ # Using earlier code, refactored
+ if(nrow(workflow) > 0) {
+ outputfolder <- file.path(workflow$folder, 'out', run_id)
+ files <- list.files(outputfolder, "*.nc$", full.names=TRUE)
+ for(file in files) {
+ nc <- nc_open(file)
+ for(var_name in var_names){
+ dates <- NA
+ vals <- NA
+ title <- var_name
+ ylab <- ""
+ var <- ncdf4::ncatt_get(nc, var_name)
+ #sw <- if ('Swdown' %in% names(nc$var)) ncdf4::ncvar_get(nc, 'Swdown') else TRUE
+ # Snow water
+ sw <- TRUE
+ # Check required bcoz many files don't contain title
+ if(!is.null(var$long_name)){
+ title <- var$long_name
+ }
+ # Check required bcoz many files don't contain units
+ if(!is.null(var$units)){
+ ylab <- var$units
+ }
+ x <- ncdays2date(ncdf4::ncvar_get(nc, 'time'), ncdf4::ncatt_get(nc, 'time'))
+ y <- ncdf4::ncvar_get(nc, var_name)
+ b <- !is.na(x) & !is.na(y) & sw != 0
+ dates <- if(is.na(dates)) x[b] else c(dates, x[b])
+ dates <- as.POSIXct(dates)
+ vals <- if(is.na(vals)) y[b] else c(vals, y[b])
+ xlab <- "Time"
+ # Values of the data which we will plot
+ valuesDF <- data.frame(dates,vals)
+ # Meta information about the data.
+ metaDF <- data.frame(workflow_id,run_id,title,xlab,ylab,var_name)
+ # Meta and Values DF created differently because they would of different
+ # number of rows. cbind would repeat metaDF(1X6) to the size of valuesDF
+ currentDF <- cbind(valuesDF,metaDF)
+ globalDF <- rbind(globalDF,currentDF)
+ }
+ ncdf4::nc_close(nc)
+ }
+ }
+ # Required to convert from factors to characters
+ # Otherwise error by ggplotly
+ globalDF$title <- as.character(globalDF$title)
+ globalDF$xlab <- as.character(globalDF$xlab)
+ globalDF$ylab <- as.character(globalDF$ylab)
+ globalDF$var_name <- as.character(globalDF$var_name)
+ return(globalDF)
+} #load_data_single_run
diff --git a/shiny/workflowPlot/helper.R b/shiny/workflowPlot/helper.R
new file mode 100644
index 0000000..7e4cee2
--- /dev/null
+++ b/shiny/workflowPlot/helper.R
@@ -0,0 +1,54 @@
+# Helper function which checks and downloads required packages
+checkAndDownload<-function(packageNames) {
+ for(packageName in packageNames) {
+ if(!isInstalled(packageName)) {
+ install.packages(packageName,repos="http://lib.stat.cmu.edu/R/CRAN")
+ }
+ library(packageName,character.only=TRUE,quietly=TRUE,verbose=FALSE)
+ }
+}
+isInstalled <- function(mypkg){
+ is.element(mypkg, installed.packages()[,1])
+}
+# checkAndDownload(c('plotly','scales','dplyr'))
+# We can also save the csv on the run from the shiny app as well
+# write.csv(inputs_df,file='/home/carya/pecan/shiny/workflowPlot/inputs_df.csv',
+# quote = FALSE,sep = ',',col.names = TRUE,row.names=FALSE)
+
+# Stashing Code for file upload to shiny app
+# Based on https://shiny.rstudio.com/gallery/file-upload.html
+
+# ui.R
+# tags$hr(),
+# fileInput('file1', 'Choose CSV File to upload data',
+# accept=c('text/csv',
+# 'text/comma-separated-values,text/plain',
+# '.csv')),
+# checkboxInput('header', 'Header', TRUE),
+# radioButtons('sep', 'Separator',
+# c(Comma=',',
+# Semicolon=';',
+# Tab='\t'),
+# ','),
+# radioButtons('quote', 'Quote',
+# c(None='',
+# 'Double Quote'='"',
+# 'Single Quote'="'"),
+# ''),
+# textInput("inputRecordID", "Input Record ID for file", "1000011260"),
+# textInput("formatID", "Format ID for file (Default CSV)", "5000000002"),
+# actionButton("load_data", "Load External Data")
+
+# server.R
+# loadExternalData <-eventReactive(input$load_data,{
+# inFile <- input$file1
+# if (is.null(inFile))
+# return(data.frame())
+# # output$info1 <- renderText({
+# # # paste0(nrow(externalData))
+# # paste0(inFile$datapath)
+# # })
+# externalData <- read.csv(inFile$datapath, header=input$header, sep=input$sep,
+# quote=input$quote)
+# return(externalData)
+# })
diff --git a/shiny/workflowPlot/server.R b/shiny/workflowPlot/server.R
index 1f4d31e..a81e11c 100644
--- a/shiny/workflowPlot/server.R
+++ b/shiny/workflowPlot/server.R
@@ -1,101 +1,266 @@
library(PEcAn.visualization)
library(PEcAn.DB)
+library(PEcAn.settings)
+library(PEcAn.benchmark)
+library(PEcAn.utils)
library(shiny)
library(ncdf4)
library(ggplot2)
-
-
+# Helper allows to load functions and variables that could be shared both by server.R and ui.R
+# source('helper.R')
+library(plotly)
+library(scales)
+library(lubridate)
+library(dplyr)
+library(reshape2)
+# Maximum size of file allowed to be uploaded: 100MB
+options(shiny.maxRequestSize=100*1024^2)
# Define server logic
server <- shinyServer(function(input, output, session) {
bety <- betyConnect()
-
- ranges <- reactiveValues(x = NULL, y = NULL)
-
- print("RESTART")
- # set the workflow id(s)
- ids <- get_workflow_ids(bety, session)
- updateSelectizeInput(session, "workflow_id", choices=ids)
- workflow_id <- reactive({
- req(input$workflow_id)
- workflow_id <- input$workflow_id
- })
-
- # update the run_ids if user changes workflow
- run_ids <- reactive(get_run_ids(bety, workflow_id()))
+ # Update all workflow ids
observe({
- updateSelectizeInput(session, "run_id", choices=run_ids())
+ # get_workflow_ids function (line 137) in db/R/query.dplyr.R takes a flag to check
+ # if we want to load all workflow ids.
+ # get_workflow_id function from query.dplyr.R
+ all_ids <- get_workflow_ids(bety, session,all.ids=TRUE)
+ updateSelectizeInput(session, "all_workflow_id", choices=all_ids)
})
-
- # update variables if user changes run
- var_names <- reactive({
- run_ids <- get_run_ids(bety, workflow_id())
- var_names <- get_var_names(bety, workflow_id(), run_ids[1])
- return(var_names)
+ # Update all run ids
+ all_run_ids <- reactive({
+ # Retrieves all run ids for seleted workflow ids
+ # Returns ('workflow ',w_id,', run ',r_id)
+ req(input$all_workflow_id)
+ w_ids <- input$all_workflow_id
+ # Will return a list
+ run_id_list <- c()
+ for(w_id in w_ids){
+ # For all the workflow ids
+ r_ids <- get_run_ids(bety, w_id)
+ for(r_id in r_ids){
+ # Each workflow id can have more than one run ids
+ # ',' as a separator between workflow id and run id
+ list_item <- paste0('workflow ',w_id,', run ',r_id)
+ run_id_list <- c(run_id_list,list_item)
+ }
+ }
+ return(run_id_list)
})
+ # Update all run_ids ('workflow ',w_id,', run ',r_id)
observe({
- updateSelectizeInput(session, "variable_name", choices=var_names())
+ updateSelectizeInput(session, "all_run_id", choices=all_run_ids())
})
-
- observe({
- ignore <- input$variable_name
- ranges$x <- NULL
- ranges$y <- NULL
+ return_DF_from_run_ID <- function(diff_ids){
+ # Called by function parse_ids_from_input_runID
+ # which is a wrapper of this function
+ # Returns a DF for a particular run_id
+ split_string <- strsplit(diff_ids,',')[[1]]
+ # Workflow id is the first element. Trim leading and ending white spaces. Split by space now
+ wID <- as.numeric(strsplit(trimws(split_string[1],which = c("both")),' ')[[1]][2])
+ # Run id is the second element
+ runID <- as.numeric(strsplit(trimws(split_string[2],which = c("both")),' ')[[1]][2])
+ return(data.frame(wID,runID))
+ }
+ # Wrapper over return_DF_from_run_ID
+ # @param list of multiple run ids
+ # run_id_string: ('workflow' workflow_ID, 'run' run_id)
+ # @return Data Frame of workflow and run ids
+ parse_ids_from_input_runID <- function(run_id_list){
+ globalDF <- data.frame()
+ for(w_run_id in run_id_list){
+ globalDF <- rbind(globalDF,return_DF_from_run_ID(w_run_id))
+ }
+ return(globalDF)
+ }
+ # Update variable names observeEvent on input$load
+ observeEvent(input$load,{
+ req(input$all_run_id)
+ # All information about a model is contained in 'all_run_id' string
+ ids_DF <- parse_ids_from_input_runID(input$all_run_id)
+ var_name_list <- c()
+ for(row_num in 1:nrow(ids_DF)){
+ var_name_list <- c(var_name_list,var_names_all(bety,ids_DF$wID[row_num],ids_DF$runID[row_num]))
+ }
+ updateSelectizeInput(session, "variable_name", choices=var_name_list)
})
-
- observeEvent(input$plot_dblclick, {
- brush <- input$plot_brush
- if (!is.null(brush)) {
- ranges$x <- as.POSIXct(c(brush$xmin, brush$xmax), origin = "1970-01-01", tz = "UTC")
- ranges$y <- c(brush$ymin, brush$ymax)
- } else {
- ranges$x <- NULL
- ranges$y <- NULL
+ # Loads data for all workflow and run ids after the load button is pressed.
+ # All information about a model is contained in 'all_run_id' string
+ # Wrapper over 'load_data_single_run' in PEcAn.db::query.dplyr
+ # Model data different from observations data
+ loadNewData <-eventReactive(input$load,{
+ req(input$all_run_id)
+ # Get IDs DF from 'all_run_id' string
+ ids_DF <- parse_ids_from_input_runID(input$all_run_id)
+ globalDF <- data.frame()
+ for(row_num in 1:nrow(ids_DF)){
+ globalDF <- rbind(globalDF, load_data_single_run(bety,ids_DF$wID[row_num],ids_DF$runID[row_num]))
}
+ return(globalDF)
})
-
- output$outputPlot <- renderPlot({
- workflow_id <- isolate(input$workflow_id)
- run_id <- isolate(input$run_id)
- var_name <- input$variable_name
- if (workflow_id != "" && run_id != "" && var_name != "") {
- workflow <- collect(workflow(bety, workflow_id))
- if(nrow(workflow) > 0) {
- outputfolder <- file.path(workflow$folder, 'out', run_id)
- files <- list.files(outputfolder, "*.nc$", full.names=TRUE)
- dates <- NA
- vals <- NA
- title <- var_name
- ylab <- ""
- for(file in files) {
- nc <- nc_open(file)
- var <- ncdf4::ncatt_get(nc, var_name)
- #sw <- if ('Swdown' %in% names(nc$var)) ncdf4::ncvar_get(nc, 'Swdown') else TRUE
- sw <- TRUE
- title <- var$long_name
- ylab <- var$units
- x <- ncdays2date(ncdf4::ncvar_get(nc, 'time'), ncdf4::ncatt_get(nc, 'time'))
- y <- ncdf4::ncvar_get(nc, var_name)
- b <- !is.na(x) & !is.na(y) & sw != 0
- dates <- if(is.na(dates)) x[b] else c(dates, x[b])
- vals <- if(is.na(vals)) y[b] else c(vals, y[b])
- ncdf4::nc_close(nc)
- }
- xlab <- if (is.null(ranges$x)) "Time" else paste(ranges$x, collapse=" - ")
- # plot result
- print(ranges$x)
- plt <- ggplot(data.frame(dates, vals), aes(x=dates, y=vals)) +
- geom_point(aes(color="Model output")) +
-# geom_smooth(aes(fill = "Spline fit")) +
- coord_cartesian(xlim = ranges$x, ylim = ranges$y) +
- scale_y_continuous(labels=fancy_scientific) +
- labs(title=title, x=xlab, y=ylab) +
- scale_color_manual(name = "", values = "black") +
- scale_fill_manual(name = "", values = "grey50")
- plot(plt)
- add_icon()
+ # Allows to load actual data (different from model output) following the tutorial
+ # https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/AnalyzeOutput/modelVSdata.Rmd
+ # @params: bety,settings,File_path,File_format
+ # loadObservationData <- function(bety,settings,File_path,File_format){
+ loadObservationData <- function(bety,inputs_df){
+ input_id <- inputs_df$input_id
+ File_format <- getFileFormat(bety,input_id)
+ start.year <- as.numeric(lubridate::year(inputs_df$start_date))
+ end.year <- as.numeric(lubridate::year(inputs_df$end_date))
+ File_path <- inputs_df$filePath
+ # TODO There is an issue with the db where file names are not saved properly.
+ # To make it work with the VM, uncomment the line below
+ # File_path <- paste0(inputs_df$filePath,'.csv')
+ site.id <- inputs_df$site_id
+ site<-PEcAn.DB::query.site(site.id,bety$con)
+ observations<-PEcAn.benchmark::load_data(data.path = File_path, format= File_format, time.row = File_format$time.row, site = site, start_year = start.year, end_year = end.year)
+ return(observations)
+ }
+ # This function is a wrapper over PEcAn.DB::query.format.vars where
+ # file format can be retrieved using either by input or format id.
+ getFileFormat <- function(bety,input.id,format.id=NULL){
+ # TODO Retaining the code for getting file format using format Id as in tutorial
+ # File_format <- PEcAn.DB::query.format.vars(bety = bety, format.id = format.id)
+ File_format <- PEcAn.DB::query.format.vars(bety = bety, input.id = input.id)
+ return(File_format)
+ }
+ getSettingsFromWorkflowId <- function(bety,workflowID){
+ basePath <- tbl(bety, 'workflows') %>% dplyr::filter(id %in% workflowID) %>% pull(folder)
+ configPath <- file.path(basePath, 'pecan.CONFIGS.xml')
+ # Second way of providing configPath. More of a hack
+ # configPath <- paste0("~/output/PEcAn_",workflowID,"/pecan.CONFIGS.xml")
+ settings<-PEcAn.settings::read.settings(configPath)
+ return(settings)
+ }
+ observeEvent(input$load,{
+ # Retrieves all site ids from multiple seleted run ids when load button is pressed
+ req(input$all_run_id)
+ ids_DF <- parse_ids_from_input_runID(input$all_run_id)
+ site_id_list <- c()
+ for(row_num in 1:nrow(ids_DF)){
+ settings <- getSettingsFromWorkflowId(bety,ids_DF$wID[row_num])
+ site.id <- c(settings$run$site$id)
+ site_id_list <- c(site_id_list,site.id)
+ }
+ updateSelectizeInput(session, "all_site_id", choices=site_id_list)
+ })
+ # Get input id from selected site id. Returns inputs_df which is used to load observation data
+ getInputs <- function(bety,site_Id){
+ # Subsetting the input id list based on the current (VM) machine
+ my_hostname <- PEcAn.utils::fqdn()
+ my_machine_id <- tbl(bety, 'machines') %>% dplyr::filter(hostname == my_hostname) %>% pull(id)
+ # Inner join 'inputs' table with 'dbfiles' table
+ # inputs_df would contain all the information about the site and input id required for
+ # the tutorial mentioned above to compare model run with actual observations
+ inputs_df <- tbl(bety, 'dbfiles') %>%
+ dplyr::filter(container_type == 'Input', machine_id == my_machine_id) %>%
+ inner_join(tbl(bety, 'inputs') %>% dplyr::filter(site_id %in% site_Id), by = c('container_id' = 'id')) %>%
+ collect()
+ # Order by container id (==input id)
+ inputs_df <- inputs_df[order(inputs_df$container_id),]
+ # Mutate column as (input id, name) to be shown to the user
+ inputs_df <- inputs_df %>%
+ dplyr::mutate(input_selection_list = paste(inputs_df$container_id, inputs_df$name),
+ filePath = paste0(inputs_df$file_path,'/', inputs_df$file_name)) %>%
+ dplyr::select(input_id = container_id,filePath,input_selection_list,start_date,end_date,site_id,name,
+ machine_id,file_name,file_path)
+ return(inputs_df)
+ }
+ # Update input id list as (input id, name)
+ observe({
+ req(input$all_site_id)
+ inputs_df <- getInputs(bety,c(input$all_site_id))
+ updateSelectizeInput(session, "all_input_id", choices=inputs_df$input_selection_list)
+ })
+ # Renders ggplotly
+ output$outputPlot <- renderPlotly({
+ # Error messages
+ validate(
+ need(input$all_workflow_id, 'Select workflow id'),
+ need(input$all_run_id, 'Select Run id'),
+ need(input$variable_name, 'Click the button to load data. Please allow some time')
+ )
+ # Load data
+ masterDF <- loadNewData()
+ # Convert from factor to character. For subsetting
+ masterDF$var_name <- as.character(masterDF$var_name)
+ # Convert to factor. Required for ggplot
+ masterDF$run_id <- as.factor(as.character(masterDF$run_id))
+ # Filter by variable name
+ df <- masterDF %>%
+ dplyr::filter(var_name == input$variable_name)
+ # Another way to make dynamic slider
+ # https://stackoverflow.com/questions/18700589/interactive-reactive-change-of-min-max-values-of-sliderinput
+ # output$slider <- renderUI({
+ # sliderInput("smooth_n", "Value for smoothing:", min=0, max=nrow(df), value=80)
+ # })
+ updateSliderInput(session,"smooth_n", min=0, max=nrow(df))
+ # Meta information about the plot
+ title <- unique(df$title)
+ xlab <- unique(df$xlab)
+ ylab <- unique(df$ylab)
+ # ggplot function for scatter plots.
+ plt <- ggplot(df, aes(x=dates, y=vals, color=run_id))
+ # model_geom <- switch(input$plotType, scatterPlot = geom_point, lineChart = geom_line)
+ # plt <- plt + model_geom()
+ # Toggle chart type using switch
+ switch(input$plotType,
+ "scatterPlot" = {
+ plt <- plt + geom_point()
+ },
+ "lineChart" = {
+ plt <- plt + geom_line()
+ }
+ )
+ # Check if user wants to load external data (==observations)
+ # Similar to using event reactive
+ if (input$load_data>0) {
+ # Retaining the code for getting file format using formatID
+ # File_format <- getFileFormat(bety,input$formatID)
+ # Input ID is of the form (input id, Name). Split by space and use the first element
+ inputs_df <- getInputs(bety,c(input$all_site_id))
+ inputs_df <- inputs_df %>% dplyr::filter(input_selection_list == input$all_input_id)
+ externalData <- loadObservationData(bety,inputs_df)
+ # If variable found in the uploaded file.
+ # TODO for now, actual observations can be plotted again a single model run (particular run id)
+ # Have to enhance to allow multiple run ids
+ if (input$variable_name %in% names(externalData)){
+ # No need for subsetting though as align data returns for now only the provided variable name
+ # externalData <- externalData %>% dplyr::select(posix,dplyr::one_of(input$variable_name))
+ var = input$variable_name
+ df = df %>% select(posix = dates, var = vals)
+ colnames(df)[2]<-paste0(var) # Required for align data to work
+ aligned_data = PEcAn.benchmark::align_data(model.calc = df, obvs.calc = externalData, var =var, align_method = "match_timestep")
+ colnames(aligned_data) <- c("model","observations","Date") # Order returned by align_data
+ # Melt dataframe to plot two types of columns together
+ aligned_data <- reshape2::melt(aligned_data, "Date")
+ # From the tutorial, if want to plot model vs observations
+ # plot(aligned_dat$NEE.m, aligned_dat$NEE.o)
+ # abline(0,1,col="red") ## intercept=0, slope=1
+ data_geom <- switch(input$data_geom, point = geom_point, line = geom_line)
+ plt <- ggplot(aligned_data, aes(x=Date, y=value, color=variable)) + data_geom()
+ output$outputNoVariableFound <- renderText({
+ paste0("Plotting data outputs.")
+ })
+ }
+ # Shiny output if variable not found
+ else {
+ output$outputNoVariableFound <- renderText({
+ paste0("Data related to variable not found in the observations uploaded. Select another variable")
+ })
}
}
+ plt <- plt + labs(title=title, x=xlab, y=ylab) + geom_smooth(n=input$smooth_n)
+ # Earlier code for smoothing, y labels, color and fill values
+ # Retaining if we want to use ggplot instead of ggplotly
+ # geom_smooth(aes(fill = "Spline fit")) +
+ # scale_y_continuous(labels=fancy_scientific) +
+ # scale_color_manual(name = "", values = "black") +
+ # scale_fill_manual(name = "", values = "grey50")
+ plt<-ggplotly(plt)
+ # Not able to add icon over ggplotly
+ # add_icon()
})
-})
-
+}) # Shiny server closes here
+# To run the shiny app locally
+# runApp(port=6480, launch.browser=FALSE)
# runApp(port=5658, launch.browser=FALSE)
diff --git a/shiny/workflowPlot/ui.R b/shiny/workflowPlot/ui.R
index 5f7c596..4ce8cf0 100644
--- a/shiny/workflowPlot/ui.R
+++ b/shiny/workflowPlot/ui.R
@@ -1,21 +1,42 @@
library(shiny)
-
+# Helper allows to load functions and variables that could be shared both by server.R and ui.R
+source('helper.R')
# Define UI
ui <- shinyUI(fluidPage(
# Application title
titlePanel("Workflow Plots"),
-
sidebarLayout(
sidebarPanel(
- selectInput("workflow_id", "Workflow ID", c()),
- selectInput("run_id", "Run ID", c()),
- selectInput("variable_name", "Variable Name", "")
+ p("Please select the workflow IDs to continue. You can select multiple IDs"),
+ selectizeInput("all_workflow_id", "Mutliple Workflow IDs", c(),multiple=TRUE),
+ p("Please select the run IDs. You can select multiple IDs"),
+ selectizeInput("all_run_id", "Mutliple Run IDs", c(),multiple=TRUE),
+ actionButton("load", "Load Model outputs"),
+ selectInput("variable_name", "Variable Name", ""),
+ radioButtons("plotType", "Plot Type (for Model Outputs)",
+ c("Scatter Plot" = "scatterPlot",
+ "Line Chart" = "lineChart"),
+ selected="scatterPlot"),
+ # uiOutput("slider"),
+ sliderInput("smooth_n", "Value for smoothing:",
+ min=0, max=100, value=80),
+ tags$hr(),
+ tags$hr(),
+ selectizeInput("all_site_id", "Select Site ID", c()),
+ # If loading multiple sites in future
+ # selectizeInput("all_site_id", "Select Site ID", c(), multiple=TRUE),
+ selectizeInput("all_input_id", "Select Input ID", c()),
+ radioButtons("data_geom", "Plot Type (for loaded data)",
+ c("Scatter Plot" = "point",
+ "Line Chart" = "line"),
+ selected="point"),
+ actionButton("load_data", "Load External Data")
),
mainPanel(
- plotOutput("outputPlot",
- brush = brushOpts(id = "plot_brush",
- resetOnNew = TRUE),
- dblclick = "plot_dblclick")
+ plotlyOutput("outputPlot"),
+ verbatimTextOutput("outputNoVariableFound")
+ # ,verbatimTextOutput("info")
+ # ,verbatimTextOutput("info1")
)
)
))
commit 536bb852a72b1ac17dbf27a7c02b8e8ba8831439
Author: shubhamagarwal92 <[email protected]>
Date: Thu Aug 17 09:30:26 2017 -0500
Correcting file path related to input id
commit 19672507fa068276ea76d6cca7a07e6a78ddfac7
Merge: 02f7a03 f062e43
Author: shubhamagarwal92 <[email protected]>
Date: Thu Aug 17 09:28:31 2017 -0500
Merge branch 'develop' of https://github.com/PecanProject/pecan into shiny-viz-gsoc
commit 02f7a0366ec9083adfaf1e4c4c5a3181c5c610d1
Author: shubhamagarwal92 <[email protected]>
Date: Thu Aug 17 09:27:11 2017 -0500
Cleaning code for submission.
commit 808b8497a8c77a101f8713996c9f71aa1c821e8e
Author: shubhamagarwal92 <[email protected]>
Date: Mon Aug 14 05:10:08 2017 -0500
Call to align data
commit 305faee4cd14e2f32dbda8a516875493f494dffa
Author: shubhamagarwal92 <[email protected]>
Date: Sat Aug 5 09:06:04 2017 -0500
Working flow for subsetting input id based on VM
commit f25f1e4e868416a66b27469b742de780d1f953d6
Author: shubhamagarwal92 <[email protected]>
Date: Thu Aug 3 03:13:04 2017 -0500
Cleaning code in ui.R, Stashing file upload in helper, subset input ids in server.R
commit 46eb96ecc9f3cd3cb44aff5772ba5d4039bf6d01
Merge: de58450 562831c
Author: shubhamagarwal92 <[email protected]>
Date: Wed Aug 2 06:56:34 2017 -0500
Merge branch 'shiny-viz-gsoc' of https://github.com/shubhamagarwal92/pecan into shiny-viz-gsoc
commit de5845068144168eef91158053233459693f7180
Author: shubhamagarwal92 <[email protected]>
Date: Wed Aug 2 06:53:38 2017 -0500
Subset input id based on vm machine
commit 22520204d7962e2918d5dcbfb11377e8423f4746
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 29 15:37:23 2017 -0500
Input ids populated based on site ids.Step 2-8 Alexey comments. git stash due to corrupted version
commit dd8345cbe7a168d123860e4524d6f3401a2a02aa
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 29 13:16:14 2017 -0500
Query unique site ids
commit 0489481762592d41710d9fcab6e0f625c5ab6234
Author: shubhamagarwal92 <[email protected]>
Date: Tue Jul 25 18:10:51 2017 -0500
Reverting back to using input id instead of format id
commit 455035fd2c5e9cd3bd73e0e5a6eb12248f70a01f
Merge: 30b1f8d 024f8b3
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 22 05:13:26 2017 -0500
Merge branch 'develop' of https://github.com/PecanProject/pecan into shiny-viz-gsoc
commit 30b1f8df8b96d3f97d80e2d382b8494618bed240
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 22 05:13:02 2017 -0500
Removing getSettingsFromWorkflowId from settings
commit e68ed8107eb5e28e041d807258059a96ae8b8e7e
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 22 05:01:27 2017 -0500
Use geom_smooth. Incorporating comments by Alexey
commit 04d1b5014b5df4ec0df04d2d8a9727797137bc9a
Author: shubhamagarwal92 <[email protected]>
Date: Wed Jul 19 07:52:54 2017 -0500
Small comment for file size
commit faeb7ea5cda96123436f283183eadabfd1e2e6b6
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 15 09:22:33 2017 -0500
Adding geom smooth
commit 9d6d7ab457489dc23f855c9b6adf4e4bc6a57124
Author: shubhamagarwal92 <[email protected]>
Date: Sun Jul 9 10:34:37 2017 -0500
Loading external data
commit 9696ce7648ce0883b34a880dc1613b4d892fc388
Author: shubhamagarwal92 <[email protected]>
Date: Sun Jul 9 08:58:49 2017 -0500
Experimenting with loading external data
commit a7c0077c4eb591cd738e1b2a42a4eaf66780e4a8
Author: shubhamagarwal92 <[email protected]>
Date: Wed Jul 5 21:36:33 2017 -0500
UI for loading external data
commit 9562a356151573b2b1d7a1fc2c2ed8e4751a26eb
Merge: 9dd65e9 62d896c
Author: shubhamagarwal92 <[email protected]>
Date: Mon Jul 3 19:43:38 2017 -0500
Merge branch 'develop' of https://github.com/PecanProject/pecan into shiny-viz-gsoc
commit 9dd65e9b37cdbee84ab3e9ce8331856dea46e002
Author: shubhamagarwal92 <[email protected]>
Date: Mon Jul 3 19:42:58 2017 -0500
Allow toggle for chart type. observeEvent while loading variables. Commenting source helper.R
commit 6564875cc272090809d5c54452faa2f8b853d775
Author: shubhamagarwal92 <[email protected]>
Date: Sun Jul 2 16:31:24 2017 -0500
Updating inheritParams for load_data_single_run
commit a3148ac588e29e965aa2c7c963d5dbb70b060ba8
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 1 21:22:50 2017 -0500
Description error
commit eecea127015ed3f6d7902ac75628a48bc3a1190e
Merge: 17f1e88 a62260d
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 1 21:05:47 2017 -0500
Merge branch 'develop' of https://github.com/PecanProject/pecan into shiny-viz-gsoc
commit 17f1e88dc7ad28a50a7222e82d619c3b4eaf0303
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 1 21:04:19 2017 -0500
Updating PR based on comments
commit eff7182977b813872939995c8aec3173bf2d2ea7
Merge: e3c663d 2be1221
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 1 17:09:01 2017 -0500
Merge branch 'shiny-viz-gsoc' of https://github.com/shubhamagarwal92/pecan into shiny-viz-gsoc
commit e3c663d90e80a80a7c681fe8fcc750b4ad31b117
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jul 1 17:06:29 2017 -0500
Moving functions from helper.R to query.dplyr.R
commit 3968705ee44d57fb3734b629cc171b191bf5a379
Merge: c657700 e559015
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jun 24 15:09:52 2017 -0500
Merge branch 'develop' of https://github.com/PecanProject/pecan into shiny-viz-gsoc
commit c657700c8375baecada6866bd3172081020d818b
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jun 24 10:02:52 2017 -0500
Refactored, commented and clean code.
commit a2ebfb844dae09bac527c32dcaaa6273ee8043fe
Author: shubhamagarwal92 <[email protected]>
Date: Fri Jun 23 19:22:50 2017 -0500
Multiple run ids. Removed debugging text. Need to clean code
commit a33f6310b7371626b190c7834304011f23c7d1c9
Author: shubhamagarwal92 <[email protected]>
Date: Thu Jun 22 15:39:42 2017 -0500
Allowing multiple load. Modified server.R
commit 78e26feaae72cb6d6b3c01928a875d9740143c70
Author: shubhamagarwal92 <[email protected]>
Date: Wed Jun 21 04:41:25 2017 -0500
Working demo. Caching not done yet
commit cb9e1cf054b15ccaf3195cb05806f16cb6163894
Author: shubhamagarwal92 <[email protected]>
Date: Tue Jun 20 20:14:54 2017 -0500
Changes for backend
commit 836c3ed26606c724fbce18b7e8275a3995e22c4b
Author: shubhamagarwal92 <[email protected]>
Date: Tue Jun 20 15:54:27 2017 -0500
Changing load data button to load model outputs
commit 25dbb08070627332439e4171ce608cb4245276a6
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jun 17 19:13:56 2017 -0500
Updating query.dplyr.R. Multiple selection server.R and ui.R
commit 2a6f3c522b15abf9a05ba13ec90595cd3ea2ee20
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jun 17 08:09:26 2017 -0500
UI related changes. Working on server.R
commit 8151d89b81d03b7184a9fd0436a26f71ad7b2513
Author: shubhamagarwal92 <[email protected]>
Date: Mon Jun 12 10:41:24 2017 -0500
Multiple workflow and run ids
commit ae0da51e6655af64baa3df6515a524fee9ceb1ea
Author: shubhamagarwal92 <[email protected]>
Date: Sun Jun 11 11:06:25 2017 -0500
Code formatting related comments. Adding action button to ui
commit 5fa6e79eac0dc966feeb3f2aa5fab2255263cd3a
Author: shubhamagarwal92 <[email protected]>
Date: Sat Jun 3 21:48:29 2017 -0500
Refactoring shiny code to load all variables at once. Also allow models from different run and workflow ids
commit 69cbb61a1901f0ea4cc43160539e07e78a63b4b3
Author: shubhamagarwal92 <[email protected]>
Date: Sun May 21 13:02:52 2017 -0500
Experimenting with ggplotly for interactiveness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment