From c3dde2b6f3feb1ca8be207ef91a2c998c868f659 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 26 Mar 2024 00:37:52 +0530 Subject: [PATCH 1/4] Add PR and Issue Templates --- .github/ISSUE_TEMPLATE.md | 13 ++++++++ .github/ISSUE_TEMPLATE/Bug_report.md | 38 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/Doc_changes.md | 18 +++++++++++ .github/ISSUE_TEMPLATE/Feature_request.md | 24 ++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 35 +++++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/Bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/Doc_changes.md create mode 100644 .github/ISSUE_TEMPLATE/Feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..bd2d2c5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,13 @@ + + + +## Description + + +## Context + + + + +## Possible Implementation + diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 0000000..6edc052 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +### Bug Description + +A clear and concise description of what the bug is. + +In the format "When I do X, I expect Y but observe Z" + +### To Reproduce + +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +## Expected behavior + +A clear and concise description of what you expected to happen. + +## Screenshots + +If applicable, add screenshots to help explain your problem. + +## Machine (please complete the following information): + + - Server [e.g. BU, NCSA, VM, etc.] + - OS: [e.g.Linux] + - Browser(if applicable) [e.g. chrome, safari] + - Version [e.g. 22] + +## Additional context + +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/Doc_changes.md b/.github/ISSUE_TEMPLATE/Doc_changes.md new file mode 100644 index 0000000..5ca90ae --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Doc_changes.md @@ -0,0 +1,18 @@ +--- +name: Documentation Changes +about: Create a report to help us improve + +--- + +### Document Change needed + +A clear description of what changes are needed with the location of the error, or that needs to be fixed. + +Example: +There is a broken URL link in the documentation. It is in the master version in section 13.2.1 on line 17. The underlying file is `/pecan/book_source/04_advanced_user_guide/01_R_workflow.Rmd`. The correct link should be https://aws.amazon.com/. + +### Information for those wanting to make changes + +Please follow the instructions in the [Editing this Book](https://pecanproject.github.io/pecan-documentation/develop/about-the-pecan-book.html#bookediting) section of the documentation. + +All R-markdown files related to documentation are located within the main directory `/pecan/book_source` except for the demos and vignettes which are in `pecan/documentation/tutorials`. diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 0000000..1ab93df --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,24 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +## Description + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +## Proposed Solution + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +## Alternatives Considered + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +## Additional Context + +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1293b3e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,35 @@ + + + + +## Description + + +## Motivation and Context + + + +## Review Time Estimate + +- [ ] Immediately +- [ ] Within one week +- [ ] When possible + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + + +- [ ] My change requires a change to the documentation. +- [ ] My name is in the list of CITATION.cff +- [ ] I have updated the CHANGELOG.md. +- [ ] I have updated the documentation accordingly. +- [ ] I have read the **CONTRIBUTING** document. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. + + From b1d4d300473f2f53f62806f5b490f74977a573c2 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 26 Mar 2024 00:38:55 +0530 Subject: [PATCH 2/4] PR Templete test with Linting changes --- R/mod_dashboard.R | 189 ++++++++++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 82 deletions(-) diff --git a/R/mod_dashboard.R b/R/mod_dashboard.R index f41abac..ef38530 100644 --- a/R/mod_dashboard.R +++ b/R/mod_dashboard.R @@ -4,20 +4,20 @@ #' #' @param id,input,output,session Internal parameters for {shiny}. #' -#' @noRd +#' @noRd #' -#' @importFrom shiny NS tagList +#' @importFrom shiny NS tagList -mod_dashboard_ui <- function(id){ +mod_dashboard_ui <- function(id) { ns <- NS(id) - + tagList( fluidRow( shinydashboard::valueBox( "Next Test", subtitle = "At 06:05 UTC", icon = icon("github"), - href="https://github.com/PecanProject/pecan-status-board/tree/main/.github/workflows/auto-schedule.yaml", + href = "https://github.com/PecanProject/pecan-status-board/tree/main/.github/workflows/auto-schedule.yaml", color = "green" ), shinydashboard::valueBox( @@ -30,55 +30,61 @@ mod_dashboard_ui <- function(id){ "Code", subtitle = "GitHub", icon = icon("code"), - href="https://github.com/PecanProject/pecan-status-board", + href = "https://github.com/PecanProject/pecan-status-board", color = "green" ) ), fluidRow( - shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/auto-schedule.yaml/badge.svg", height="100%", width="100%", align="center")), - shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/push-ci.yaml/badge.svg", height="100%", width="100%", align="center")), - shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/manual-test.yaml/badge.svg", height="100%", width="100%", align="center")) + shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/auto-schedule.yaml/badge.svg", height = "100%", width = "100%", align = "center")), + shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/push-ci.yaml/badge.svg", height = "100%", width = "100%", align = "center")), + shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/manual-test.yaml/badge.svg", height = "100%", width = "100%", align = "center")) ), fluidRow( column( 12, - shinydashboard::box(width = "100%", title = "Scatter Plot", - shinycssloaders::withSpinner((plotly::plotlyOutput(ns("plot_scatter"))))) + shinydashboard::box( + width = "100%", title = "Scatter Plot", + shinycssloaders::withSpinner((plotly::plotlyOutput(ns("plot_scatter")))) + ) ) ), fluidRow( column( 12, - shinydashboard::box(width = 12, - shinycssloaders::withSpinner((plotOutput(ns("bar_plot1"))))) + shinydashboard::box( + width = 12, + shinycssloaders::withSpinner((plotOutput(ns("bar_plot1")))) + ) ) ), fluidRow( shinydashboard::box( - shinycssloaders::withSpinner((plotOutput(ns("bar_plot2"))))), + shinycssloaders::withSpinner((plotOutput(ns("bar_plot2")))) + ), shinydashboard::box( - shinycssloaders::withSpinner((plotOutput(ns("bar_plot3"))))) + shinycssloaders::withSpinner((plotOutput(ns("bar_plot3")))) + ) ) ) } #' dashboard Server Functions -#' @noRd +#' @noRd -mod_dashboard_server <- function(id){ - moduleServer( id, function(input, output, session){ +mod_dashboard_server <- function(id) { + moduleServer(id, function(input, output, session) { ns <- session$ns result <- testrun_report() - + output$plot_scatter <- plotly::renderPlotly({ color_var <- - ifelse(grepl("TRUE", result$success_status),"red", "green") + ifelse(grepl("TRUE", result$success_status), "red", "green") plotly::plot_ly( data = result, - x = ~ site_name, - y = ~ model_name, - text = ~ stage, - color = ~ success_status, + x = ~site_name, + y = ~model_name, + text = ~stage, + color = ~success_status, type = "scatter", size = 10, mode = "markers", @@ -87,92 +93,111 @@ mod_dashboard_server <- function(id){ sizemode = "diameter", opacity = 0.4, line = list( - color = 'black', + color = "black", width = 1 ) - )) + ) + ) }) - + # Bar Plot of Sites and their Success Percentage - + output$bar_plot1 <- renderPlot({ site_succ_percent <- tapply(result$success_status, result$site_name, mean) * 100 s_df <- data.frame(site_succ_percent) all_sites <- tibble::rownames_to_column(s_df, var = "site_name") - - ggplot2::ggplot(data = all_sites, - ggplot2::aes(x = site_name, - y = site_succ_percent, - fill = site_succ_percent)) + - ggplot2::ylim(0,100) + - ggplot2::geom_bar(stat = "identity", - color = "black", - position = ggplot2::position_dodge()) + + + ggplot2::ggplot( + data = all_sites, + ggplot2::aes( + x = site_name, + y = site_succ_percent, + fill = site_succ_percent + ) + ) + + ggplot2::ylim(0, 100) + + ggplot2::geom_bar( + stat = "identity", + color = "black", + position = ggplot2::position_dodge() + ) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs(title = "Success Percentage of Sites", - x = "Sites Name", - y = "Percentage(%)", - fill = " Success Percentage") - - } - ) - + ggplot2::labs( + title = "Success Percentage of Sites", + x = "Sites Name", + y = "Percentage(%)", + fill = " Success Percentage" + ) + }) + # Bar Plot of Models and their Success Percentage - + output$bar_plot2 <- renderPlot({ model_succ_percent <- tapply(result$success_status, result$model_name, mean) * 100 s_df <- data.frame(model_succ_percent) all_models <- tibble::rownames_to_column(s_df, var = "model_name") - - ggplot2::ggplot(data = all_models, - ggplot2::aes(x = model_name, - y = model_succ_percent, - fill = model_succ_percent)) + - ggplot2::ylim(0,100) + - ggplot2::geom_bar(stat = "identity", - color = "black", - position = ggplot2::position_dodge()) + + + ggplot2::ggplot( + data = all_models, + ggplot2::aes( + x = model_name, + y = model_succ_percent, + fill = model_succ_percent + ) + ) + + ggplot2::ylim(0, 100) + + ggplot2::geom_bar( + stat = "identity", + color = "black", + position = ggplot2::position_dodge() + ) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs(title = "Success Percentage of Model", - x = "Models Name", - y = "Percentage(%)", - fill = " Success Percentage") - - } - ) - + ggplot2::labs( + title = "Success Percentage of Model", + x = "Models Name", + y = "Percentage(%)", + fill = " Success Percentage" + ) + }) + # Bar Plot of Met and It's Success Percentage - + output$bar_plot3 <- renderPlot({ met_succ_percent <- tapply(result$success_status, result$met, mean) * 100 met_df <- data.frame(met_succ_percent) met_df <- na.omit(met_df) all_met <- tibble::rownames_to_column(met_df, var = "met_val") - - ggplot2::ggplot(data = all_met, - ggplot2::aes(x = met_val, - y = met_succ_percent, - fill = met_succ_percent)) + - ggplot2::ylim(0,100) + - ggplot2::geom_bar(stat = "identity", - color = "black", - position = ggplot2::position_dodge()) + + + ggplot2::ggplot( + data = all_met, + ggplot2::aes( + x = met_val, + y = met_succ_percent, + fill = met_succ_percent + ) + ) + + ggplot2::ylim(0, 100) + + ggplot2::geom_bar( + stat = "identity", + color = "black", + position = ggplot2::position_dodge() + ) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs(title = "Success Percentage of Met", - x = "Met", - y = "Percentage(%)", - fill = " Success Percentage") - - } - ) - - })} + ggplot2::labs( + title = "Success Percentage of Met", + x = "Met", + y = "Percentage(%)", + fill = " Success Percentage" + ) + }) + }) +} ## To be copied in the UI # mod_dashboard_ui("dashboard_ui_1") From c9f91de5f182cf9bc2cbb61b67344b4d968b0f58 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 26 Mar 2024 00:41:23 +0530 Subject: [PATCH 3/4] PR Template test with linting changes --- R/mod_ed2.R | 370 ++++++++++++++++++++++++++++------------------------ 1 file changed, 202 insertions(+), 168 deletions(-) diff --git a/R/mod_ed2.R b/R/mod_ed2.R index 67d86c7..49d52d4 100644 --- a/R/mod_ed2.R +++ b/R/mod_ed2.R @@ -4,38 +4,37 @@ #' #' @param id,input,output,session Internal parameters for {shiny}. #' -#' @noRd +#' @noRd +#' +#' @importFrom shiny NS tagList #' -#' @importFrom shiny NS tagList -#' -mod_ed2_ui <- function(id){ +mod_ed2_ui <- function(id) { ns <- NS(id) count <- ed2_report() ed2_count <- workflow_count(count) pass_test <- success_count(count) fail_test <- failure_count(count) - + tagList( fluidRow( - tagList( fluidRow( shinydashboard::valueBox( "Next Run", - subtitle = '06:30 AM UST', + subtitle = "06:30 AM UST", icon = icon("bell"), color = "teal" ), shinydashboard::valueBox( - 'Time', + "Time", subtitle = Sys.time(), icon = icon("clock"), color = "olive" ), shinydashboard::valueBox( "Check Logs", - subtitle = 'Details', + subtitle = "Details", icon = icon("chart-simple"), color = "maroon" ), @@ -60,37 +59,40 @@ mod_ed2_ui <- function(id){ ) ), fluidRow( - shinydashboard::box(width = 6, title = "Met Status", - shinycssloaders::withSpinner((plotOutput(ns("bar_plot1"))))), - shinydashboard::box(width =6 ,title = "Sites Status", shinycssloaders::withSpinner(DT::DTOutput(ns("status_table")))) + shinydashboard::box( + width = 6, title = "Met Status", + shinycssloaders::withSpinner((plotOutput(ns("bar_plot1")))) + ), + shinydashboard::box(width = 6, title = "Sites Status", shinycssloaders::withSpinner(DT::DTOutput(ns("status_table")))) ), fluidRow( - shinydashboard::tabBox( width = 12, title = "Status of Sites Workflows", - tabPanel(title = "AmerifluxLBL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap1"))) - ), - tabPanel(title = "CRUNCEP", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap2"))) - ), - tabPanel(title = "FLUXNET2015", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap3"))) - ), - tabPanel(title = "NARR", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap4"))) - ), - tabPanel(title = "GFDL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap5"))) - ) - )), + shinydashboard::tabBox( + width = 12, title = "Status of Sites Workflows", + tabPanel(title = "AmerifluxLBL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap1")))), + tabPanel(title = "CRUNCEP", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap2")))), + tabPanel(title = "FLUXNET2015", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap3")))), + tabPanel(title = "NARR", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap4")))), + tabPanel(title = "GFDL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap5")))) + ) + ), fluidRow( - shinydashboard::tabBox( width = 12, - tabPanel(title = "Workflows Log", - width = 12, shinycssloaders::withSpinner(DT::DTOutput(ns("error_table"))))) - - )) + shinydashboard::tabBox( + width = 12, + tabPanel( + title = "Workflows Log", + width = 12, shinycssloaders::withSpinner(DT::DTOutput(ns("error_table"))) + ) + ) + ) + ) ) } #' ed2 Server Functions #' -#' @noRd -mod_ed2_server <- function(id){ - moduleServer( id, function(input, output, session){ +#' @noRd +mod_ed2_server <- function(id) { + moduleServer(id, function(input, output, session) { ns <- session$ns result <- ed2_report() output$bar_plot1 <- renderPlot({ @@ -98,36 +100,42 @@ mod_ed2_server <- function(id){ met_df <- data.frame(met_succ_percent) met_df <- na.omit(met_df) all_met <- tibble::rownames_to_column(met_df, var = "met_val") - + # Success percentage of Mets - - ggplot2::ggplot(data = all_met, - ggplot2::aes(x = met_val, - y = met_succ_percent, - fill = met_succ_percent)) + - ggplot2::ylim(0,100) + - ggplot2::geom_bar(stat = "identity", - color = "black", - position = ggplot2::position_dodge()) + - #ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + + + ggplot2::ggplot( + data = all_met, + ggplot2::aes( + x = met_val, + y = met_succ_percent, + fill = met_succ_percent + ) + ) + + ggplot2::ylim(0, 100) + + ggplot2::geom_bar( + stat = "identity", + color = "black", + position = ggplot2::position_dodge() + ) + + # ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs(title = "Success Percentage of Met", - x = "Met", - y = "Percentage(%)", - fill = " Success Percentage") - - } - ) - - # Table - + ggplot2::labs( + title = "Success Percentage of Met", + x = "Met", + y = "Percentage(%)", + fill = " Success Percentage" + ) + }) + + # Table + output$status_table <- DT::renderDT({ - test_result = data.frame(result$site_id,result$site_name,result$pfts,result$success_status) + test_result <- data.frame(result$site_id, result$site_name, result$pfts, result$success_status) DT::datatable( data = test_result, rownames = TRUE, - colnames=c("Site ID", "Site Name", "PFTs", "Status"), + colnames = c("Site ID", "Site Name", "PFTs", "Status"), extensions = c("Buttons", "ColReorder", "Scroller"), options = list( autoWidth = TRUE, @@ -136,25 +144,27 @@ mod_ed2_server <- function(id){ scroller = TRUE, colReorder = TRUE, deferRender = TRUE, - buttons = c('copy', 'csv', 'excel', 'pdf'), + buttons = c("copy", "csv", "excel", "pdf"), dom = "Bfrtip", columnDefs = list( - list(orderable = TRUE, className = 'details-control', targets = 1) + list(orderable = TRUE, className = "details-control", targets = 1) ) ) ) }) - + # Error Log - + output$error_table <- DT::renderDT({ - error_data = read.csv("data/ed2-test/logs/ed2-log-data.csv") - error_data = data.frame(error_data$final_df.workflow_id,error_data$final_df.site_id,error_data$final_df.site_name,error_data$final_df.success_status, - error_data$final_df.error_log,error_data$final_df.met) + error_data <- read.csv("data/ed2-test/logs/ed2-log-data.csv") + error_data <- data.frame( + error_data$final_df.workflow_id, error_data$final_df.site_id, error_data$final_df.site_name, error_data$final_df.success_status, + error_data$final_df.error_log, error_data$final_df.met + ) DT::datatable( data = error_data, rownames = TRUE, - colnames=c("workflow_id","site_id","site_name","success_status","error_log","met"), + colnames = c("workflow_id", "site_id", "site_name", "success_status", "error_log", "met"), extensions = c("Buttons", "ColReorder", "Scroller"), options = list( autoWidth = TRUE, @@ -163,178 +173,202 @@ mod_ed2_server <- function(id){ scroller = TRUE, colReorder = TRUE, deferRender = TRUE, - buttons = c('copy', 'csv', 'excel', 'pdf'), + buttons = c("copy", "csv", "excel", "pdf"), dom = "Bfrtip", columnDefs = list( - list(orderable = TRUE, className = 'details-control', targets = 1) + list(orderable = TRUE, className = "details-control", targets = 1) ) ) ) }) - + # Getting Status of Workflows for Sites - - #Ameriflux + + # Ameriflux output$heatmap1 <- renderPlot({ report_all <- ed2_report() - report_AM <- report_all[report_all$met == 'AmerifluxLBL', ] - report1 <- data.frame(report_AM$site_id,report_AM$pft,report_AM$site_name,report_AM$workflow_id,report_AM$met) - colnames(report1) <- c('site_id','pfts','site_name','Workflow_id',"met") + report_AM <- report_all[report_all$met == "AmerifluxLBL", ] + report1 <- data.frame(report_AM$site_id, report_AM$pft, report_AM$site_name, report_AM$workflow_id, report_AM$met) + colnames(report1) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") data <- as.data.frame(workflow_status(report_AM)) data <- wf_sites_status(data) - main_data_AM <- merge(report1,data, by = 'Workflow_id') - col1 <- c("DONE","ERROR") + main_data_AM <- merge(report1, data, by = "Workflow_id") + col1 <- c("DONE", "ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1,col2) + f_col <- data.frame(col1, col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_AM, ggplot2::aes(x = as.character(site_id), - y = variable, fill= status)) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_AM, ggplot2::aes( + x = as.character(site_id), + y = variable, fill = status + )) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile(color = "white", - lwd = 1.5, - linetype = 1) + + ggplot2::geom_tile( + color = "white", + lwd = 1.5, + linetype = 1 + ) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal()+ - ggplot2::labs(title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal() + + ggplot2::labs( + title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - #CRUNCEP - + + # CRUNCEP + output$heatmap2 <- renderPlot({ report_all <- ed2_report() - report_CR <- report_all[report_all$met == 'CRUNCEP', ] - report2 <- data.frame(report_CR$site_id,report_CR$pft,report_CR$site_name,report_CR$workflow_id,report_CR$met) - colnames(report2) <- c('site_id','pfts','site_name','Workflow_id',"met") + report_CR <- report_all[report_all$met == "CRUNCEP", ] + report2 <- data.frame(report_CR$site_id, report_CR$pft, report_CR$site_name, report_CR$workflow_id, report_CR$met) + colnames(report2) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") data <- as.data.frame(workflow_status(report_CR)) data <- wf_sites_status(data) - main_data_CR <- merge(report2,data, by = 'Workflow_id') - col1 <- c("DONE","ERROR") + main_data_CR <- merge(report2, data, by = "Workflow_id") + col1 <- c("DONE", "ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1,col2) + f_col <- data.frame(col1, col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_CR, ggplot2::aes(x = as.character(site_id), - y = variable, fill= status)) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_CR, ggplot2::aes( + x = as.character(site_id), + y = variable, fill = status + )) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile(color = "white", - lwd = 1.5, - linetype = 1) + + ggplot2::geom_tile( + color = "white", + lwd = 1.5, + linetype = 1 + ) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal()+ - ggplot2::labs(title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal() + + ggplot2::labs( + title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - #Fluxnet - + + # Fluxnet + output$heatmap3 <- renderPlot({ report_all <- ed2_report() - report_FN <- report_all[report_all$met == 'Fluxnet2015', ] - report3 <- data.frame(report_FN$site_id,report_FN$pft,report_FN$site_name,report_FN$workflow_id,report_FN$met) - colnames(report3) <- c('site_id','pfts','site_name','Workflow_id',"met") + report_FN <- report_all[report_all$met == "Fluxnet2015", ] + report3 <- data.frame(report_FN$site_id, report_FN$pft, report_FN$site_name, report_FN$workflow_id, report_FN$met) + colnames(report3) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") data <- as.data.frame(workflow_status(report_FN)) data <- wf_sites_status(data) - main_data_FN <- merge(report3,data, by = 'Workflow_id') - col1 <- c("DONE","ERROR") + main_data_FN <- merge(report3, data, by = "Workflow_id") + col1 <- c("DONE", "ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1,col2) + f_col <- data.frame(col1, col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_FN, ggplot2::aes(x = as.character(site_id), - y = variable, fill= status)) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_FN, ggplot2::aes( + x = as.character(site_id), + y = variable, fill = status + )) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile(color = "white", - lwd = 1.5, - linetype = 1) + + ggplot2::geom_tile( + color = "white", + lwd = 1.5, + linetype = 1 + ) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal()+ - ggplot2::labs(title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal() + + ggplot2::labs( + title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - #NARR - + + # NARR + output$heatmap4 <- renderPlot({ report_all <- ed2_report() - report_NR <- report_all[report_all$met == 'NARR', ] - report4 <- data.frame(report_NR$site_id,report_NR$pft,report_NR$site_name,report_NR$workflow_id,report_NR$met) - colnames(report4) <- c('site_id','pfts','site_name','Workflow_id',"met") + report_NR <- report_all[report_all$met == "NARR", ] + report4 <- data.frame(report_NR$site_id, report_NR$pft, report_NR$site_name, report_NR$workflow_id, report_NR$met) + colnames(report4) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") data <- as.data.frame(workflow_status(report_NR)) data <- wf_sites_status(data) - main_data_NR <- merge(report4,data, by = 'Workflow_id') - col1 <- c("DONE","ERROR") + main_data_NR <- merge(report4, data, by = "Workflow_id") + col1 <- c("DONE", "ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1,col2) + f_col <- data.frame(col1, col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_NR, ggplot2::aes(x = as.character(site_id), - y = variable, fill= status)) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_NR, ggplot2::aes( + x = as.character(site_id), + y = variable, fill = status + )) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile(color = "white", - lwd = 1.5, - linetype = 1) + + ggplot2::geom_tile( + color = "white", + lwd = 1.5, + linetype = 1 + ) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal()+ - ggplot2::labs(title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal() + + ggplot2::labs( + title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - #GFDL - + + # GFDL + output$heatmap5 <- renderPlot({ report_all <- ed2_report() - report_GF <- report_all[report_all$met == 'GFDL', ] - report5 <- data.frame(report_GF$site_id,report_GF$pft,report_GF$site_name,report_GF$workflow_id,report_GF$met) - colnames(report5) <- c('site_id','pfts','site_name','Workflow_id',"met") + report_GF <- report_all[report_all$met == "GFDL", ] + report5 <- data.frame(report_GF$site_id, report_GF$pft, report_GF$site_name, report_GF$workflow_id, report_GF$met) + colnames(report5) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") data <- as.data.frame(workflow_status(report_GF)) data <- wf_sites_status(data) - main_data_NR <- merge(report5,data, by = 'Workflow_id') - col1 <- c("DONE","ERROR") + main_data_NR <- merge(report5, data, by = "Workflow_id") + col1 <- c("DONE", "ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1,col2) + f_col <- data.frame(col1, col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_NR, ggplot2::aes(x = as.character(site_id), - y = variable, fill= status)) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_NR, ggplot2::aes( + x = as.character(site_id), + y = variable, fill = status + )) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile(color = "white", - lwd = 1.5, - linetype = 1) + + ggplot2::geom_tile( + color = "white", + lwd = 1.5, + linetype = 1 + ) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal()+ - ggplot2::labs(title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal() + + ggplot2::labs( + title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - ###ENDS - + + ### ENDS }) } From a5cc4dd9d3fd1b2531f22232ea28008018470589 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Tue, 26 Mar 2024 00:52:43 +0530 Subject: [PATCH 4/4] reverting linter changes --- R/mod_dashboard.R | 189 ++++++++++------------- R/mod_ed2.R | 370 +++++++++++++++++++++------------------------- 2 files changed, 250 insertions(+), 309 deletions(-) diff --git a/R/mod_dashboard.R b/R/mod_dashboard.R index ef38530..f41abac 100644 --- a/R/mod_dashboard.R +++ b/R/mod_dashboard.R @@ -4,20 +4,20 @@ #' #' @param id,input,output,session Internal parameters for {shiny}. #' -#' @noRd +#' @noRd #' -#' @importFrom shiny NS tagList +#' @importFrom shiny NS tagList -mod_dashboard_ui <- function(id) { +mod_dashboard_ui <- function(id){ ns <- NS(id) - + tagList( fluidRow( shinydashboard::valueBox( "Next Test", subtitle = "At 06:05 UTC", icon = icon("github"), - href = "https://github.com/PecanProject/pecan-status-board/tree/main/.github/workflows/auto-schedule.yaml", + href="https://github.com/PecanProject/pecan-status-board/tree/main/.github/workflows/auto-schedule.yaml", color = "green" ), shinydashboard::valueBox( @@ -30,61 +30,55 @@ mod_dashboard_ui <- function(id) { "Code", subtitle = "GitHub", icon = icon("code"), - href = "https://github.com/PecanProject/pecan-status-board", + href="https://github.com/PecanProject/pecan-status-board", color = "green" ) ), fluidRow( - shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/auto-schedule.yaml/badge.svg", height = "100%", width = "100%", align = "center")), - shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/push-ci.yaml/badge.svg", height = "100%", width = "100%", align = "center")), - shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/manual-test.yaml/badge.svg", height = "100%", width = "100%", align = "center")) + shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/auto-schedule.yaml/badge.svg", height="100%", width="100%", align="center")), + shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/push-ci.yaml/badge.svg", height="100%", width="100%", align="center")), + shinydashboard::box(width = 4, tags$img(src = "https://github.com/PecanProject/pecan-status-board/actions/workflows/manual-test.yaml/badge.svg", height="100%", width="100%", align="center")) ), fluidRow( column( 12, - shinydashboard::box( - width = "100%", title = "Scatter Plot", - shinycssloaders::withSpinner((plotly::plotlyOutput(ns("plot_scatter")))) - ) + shinydashboard::box(width = "100%", title = "Scatter Plot", + shinycssloaders::withSpinner((plotly::plotlyOutput(ns("plot_scatter"))))) ) ), fluidRow( column( 12, - shinydashboard::box( - width = 12, - shinycssloaders::withSpinner((plotOutput(ns("bar_plot1")))) - ) + shinydashboard::box(width = 12, + shinycssloaders::withSpinner((plotOutput(ns("bar_plot1"))))) ) ), fluidRow( shinydashboard::box( - shinycssloaders::withSpinner((plotOutput(ns("bar_plot2")))) - ), + shinycssloaders::withSpinner((plotOutput(ns("bar_plot2"))))), shinydashboard::box( - shinycssloaders::withSpinner((plotOutput(ns("bar_plot3")))) - ) + shinycssloaders::withSpinner((plotOutput(ns("bar_plot3"))))) ) ) } #' dashboard Server Functions -#' @noRd +#' @noRd -mod_dashboard_server <- function(id) { - moduleServer(id, function(input, output, session) { +mod_dashboard_server <- function(id){ + moduleServer( id, function(input, output, session){ ns <- session$ns result <- testrun_report() - + output$plot_scatter <- plotly::renderPlotly({ color_var <- - ifelse(grepl("TRUE", result$success_status), "red", "green") + ifelse(grepl("TRUE", result$success_status),"red", "green") plotly::plot_ly( data = result, - x = ~site_name, - y = ~model_name, - text = ~stage, - color = ~success_status, + x = ~ site_name, + y = ~ model_name, + text = ~ stage, + color = ~ success_status, type = "scatter", size = 10, mode = "markers", @@ -93,111 +87,92 @@ mod_dashboard_server <- function(id) { sizemode = "diameter", opacity = 0.4, line = list( - color = "black", + color = 'black', width = 1 ) - ) - ) + )) }) - + # Bar Plot of Sites and their Success Percentage - + output$bar_plot1 <- renderPlot({ site_succ_percent <- tapply(result$success_status, result$site_name, mean) * 100 s_df <- data.frame(site_succ_percent) all_sites <- tibble::rownames_to_column(s_df, var = "site_name") - - ggplot2::ggplot( - data = all_sites, - ggplot2::aes( - x = site_name, - y = site_succ_percent, - fill = site_succ_percent - ) - ) + - ggplot2::ylim(0, 100) + - ggplot2::geom_bar( - stat = "identity", - color = "black", - position = ggplot2::position_dodge() - ) + + + ggplot2::ggplot(data = all_sites, + ggplot2::aes(x = site_name, + y = site_succ_percent, + fill = site_succ_percent)) + + ggplot2::ylim(0,100) + + ggplot2::geom_bar(stat = "identity", + color = "black", + position = ggplot2::position_dodge()) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs( - title = "Success Percentage of Sites", - x = "Sites Name", - y = "Percentage(%)", - fill = " Success Percentage" - ) - }) - + ggplot2::labs(title = "Success Percentage of Sites", + x = "Sites Name", + y = "Percentage(%)", + fill = " Success Percentage") + + } + ) + # Bar Plot of Models and their Success Percentage - + output$bar_plot2 <- renderPlot({ model_succ_percent <- tapply(result$success_status, result$model_name, mean) * 100 s_df <- data.frame(model_succ_percent) all_models <- tibble::rownames_to_column(s_df, var = "model_name") - - ggplot2::ggplot( - data = all_models, - ggplot2::aes( - x = model_name, - y = model_succ_percent, - fill = model_succ_percent - ) - ) + - ggplot2::ylim(0, 100) + - ggplot2::geom_bar( - stat = "identity", - color = "black", - position = ggplot2::position_dodge() - ) + + + ggplot2::ggplot(data = all_models, + ggplot2::aes(x = model_name, + y = model_succ_percent, + fill = model_succ_percent)) + + ggplot2::ylim(0,100) + + ggplot2::geom_bar(stat = "identity", + color = "black", + position = ggplot2::position_dodge()) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs( - title = "Success Percentage of Model", - x = "Models Name", - y = "Percentage(%)", - fill = " Success Percentage" - ) - }) - + ggplot2::labs(title = "Success Percentage of Model", + x = "Models Name", + y = "Percentage(%)", + fill = " Success Percentage") + + } + ) + # Bar Plot of Met and It's Success Percentage - + output$bar_plot3 <- renderPlot({ met_succ_percent <- tapply(result$success_status, result$met, mean) * 100 met_df <- data.frame(met_succ_percent) met_df <- na.omit(met_df) all_met <- tibble::rownames_to_column(met_df, var = "met_val") - - ggplot2::ggplot( - data = all_met, - ggplot2::aes( - x = met_val, - y = met_succ_percent, - fill = met_succ_percent - ) - ) + - ggplot2::ylim(0, 100) + - ggplot2::geom_bar( - stat = "identity", - color = "black", - position = ggplot2::position_dodge() - ) + + + ggplot2::ggplot(data = all_met, + ggplot2::aes(x = met_val, + y = met_succ_percent, + fill = met_succ_percent)) + + ggplot2::ylim(0,100) + + ggplot2::geom_bar(stat = "identity", + color = "black", + position = ggplot2::position_dodge()) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs( - title = "Success Percentage of Met", - x = "Met", - y = "Percentage(%)", - fill = " Success Percentage" - ) - }) - }) -} + ggplot2::labs(title = "Success Percentage of Met", + x = "Met", + y = "Percentage(%)", + fill = " Success Percentage") + + } + ) + + })} ## To be copied in the UI # mod_dashboard_ui("dashboard_ui_1") diff --git a/R/mod_ed2.R b/R/mod_ed2.R index 49d52d4..67d86c7 100644 --- a/R/mod_ed2.R +++ b/R/mod_ed2.R @@ -4,37 +4,38 @@ #' #' @param id,input,output,session Internal parameters for {shiny}. #' -#' @noRd -#' -#' @importFrom shiny NS tagList +#' @noRd #' +#' @importFrom shiny NS tagList +#' -mod_ed2_ui <- function(id) { +mod_ed2_ui <- function(id){ ns <- NS(id) count <- ed2_report() ed2_count <- workflow_count(count) pass_test <- success_count(count) fail_test <- failure_count(count) - + tagList( fluidRow( + tagList( fluidRow( shinydashboard::valueBox( "Next Run", - subtitle = "06:30 AM UST", + subtitle = '06:30 AM UST', icon = icon("bell"), color = "teal" ), shinydashboard::valueBox( - "Time", + 'Time', subtitle = Sys.time(), icon = icon("clock"), color = "olive" ), shinydashboard::valueBox( "Check Logs", - subtitle = "Details", + subtitle = 'Details', icon = icon("chart-simple"), color = "maroon" ), @@ -59,40 +60,37 @@ mod_ed2_ui <- function(id) { ) ), fluidRow( - shinydashboard::box( - width = 6, title = "Met Status", - shinycssloaders::withSpinner((plotOutput(ns("bar_plot1")))) - ), - shinydashboard::box(width = 6, title = "Sites Status", shinycssloaders::withSpinner(DT::DTOutput(ns("status_table")))) + shinydashboard::box(width = 6, title = "Met Status", + shinycssloaders::withSpinner((plotOutput(ns("bar_plot1"))))), + shinydashboard::box(width =6 ,title = "Sites Status", shinycssloaders::withSpinner(DT::DTOutput(ns("status_table")))) ), fluidRow( - shinydashboard::tabBox( - width = 12, title = "Status of Sites Workflows", - tabPanel(title = "AmerifluxLBL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap1")))), - tabPanel(title = "CRUNCEP", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap2")))), - tabPanel(title = "FLUXNET2015", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap3")))), - tabPanel(title = "NARR", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap4")))), - tabPanel(title = "GFDL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap5")))) - ) - ), + shinydashboard::tabBox( width = 12, title = "Status of Sites Workflows", + tabPanel(title = "AmerifluxLBL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap1"))) + ), + tabPanel(title = "CRUNCEP", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap2"))) + ), + tabPanel(title = "FLUXNET2015", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap3"))) + ), + tabPanel(title = "NARR", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap4"))) + ), + tabPanel(title = "GFDL", width = 12, shinycssloaders::withSpinner(plotOutput(ns("heatmap5"))) + ) + )), fluidRow( - shinydashboard::tabBox( - width = 12, - tabPanel( - title = "Workflows Log", - width = 12, shinycssloaders::withSpinner(DT::DTOutput(ns("error_table"))) - ) - ) - ) - ) + shinydashboard::tabBox( width = 12, + tabPanel(title = "Workflows Log", + width = 12, shinycssloaders::withSpinner(DT::DTOutput(ns("error_table"))))) + + )) ) } #' ed2 Server Functions #' -#' @noRd -mod_ed2_server <- function(id) { - moduleServer(id, function(input, output, session) { +#' @noRd +mod_ed2_server <- function(id){ + moduleServer( id, function(input, output, session){ ns <- session$ns result <- ed2_report() output$bar_plot1 <- renderPlot({ @@ -100,42 +98,36 @@ mod_ed2_server <- function(id) { met_df <- data.frame(met_succ_percent) met_df <- na.omit(met_df) all_met <- tibble::rownames_to_column(met_df, var = "met_val") - + # Success percentage of Mets - - ggplot2::ggplot( - data = all_met, - ggplot2::aes( - x = met_val, - y = met_succ_percent, - fill = met_succ_percent - ) - ) + - ggplot2::ylim(0, 100) + - ggplot2::geom_bar( - stat = "identity", - color = "black", - position = ggplot2::position_dodge() - ) + - # ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + + + ggplot2::ggplot(data = all_met, + ggplot2::aes(x = met_val, + y = met_succ_percent, + fill = met_succ_percent)) + + ggplot2::ylim(0,100) + + ggplot2::geom_bar(stat = "identity", + color = "black", + position = ggplot2::position_dodge()) + + #ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 4)) + ggplot2::theme_bw() + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + - ggplot2::labs( - title = "Success Percentage of Met", - x = "Met", - y = "Percentage(%)", - fill = " Success Percentage" - ) - }) - - # Table - + ggplot2::labs(title = "Success Percentage of Met", + x = "Met", + y = "Percentage(%)", + fill = " Success Percentage") + + } + ) + + # Table + output$status_table <- DT::renderDT({ - test_result <- data.frame(result$site_id, result$site_name, result$pfts, result$success_status) + test_result = data.frame(result$site_id,result$site_name,result$pfts,result$success_status) DT::datatable( data = test_result, rownames = TRUE, - colnames = c("Site ID", "Site Name", "PFTs", "Status"), + colnames=c("Site ID", "Site Name", "PFTs", "Status"), extensions = c("Buttons", "ColReorder", "Scroller"), options = list( autoWidth = TRUE, @@ -144,27 +136,25 @@ mod_ed2_server <- function(id) { scroller = TRUE, colReorder = TRUE, deferRender = TRUE, - buttons = c("copy", "csv", "excel", "pdf"), + buttons = c('copy', 'csv', 'excel', 'pdf'), dom = "Bfrtip", columnDefs = list( - list(orderable = TRUE, className = "details-control", targets = 1) + list(orderable = TRUE, className = 'details-control', targets = 1) ) ) ) }) - + # Error Log - + output$error_table <- DT::renderDT({ - error_data <- read.csv("data/ed2-test/logs/ed2-log-data.csv") - error_data <- data.frame( - error_data$final_df.workflow_id, error_data$final_df.site_id, error_data$final_df.site_name, error_data$final_df.success_status, - error_data$final_df.error_log, error_data$final_df.met - ) + error_data = read.csv("data/ed2-test/logs/ed2-log-data.csv") + error_data = data.frame(error_data$final_df.workflow_id,error_data$final_df.site_id,error_data$final_df.site_name,error_data$final_df.success_status, + error_data$final_df.error_log,error_data$final_df.met) DT::datatable( data = error_data, rownames = TRUE, - colnames = c("workflow_id", "site_id", "site_name", "success_status", "error_log", "met"), + colnames=c("workflow_id","site_id","site_name","success_status","error_log","met"), extensions = c("Buttons", "ColReorder", "Scroller"), options = list( autoWidth = TRUE, @@ -173,202 +163,178 @@ mod_ed2_server <- function(id) { scroller = TRUE, colReorder = TRUE, deferRender = TRUE, - buttons = c("copy", "csv", "excel", "pdf"), + buttons = c('copy', 'csv', 'excel', 'pdf'), dom = "Bfrtip", columnDefs = list( - list(orderable = TRUE, className = "details-control", targets = 1) + list(orderable = TRUE, className = 'details-control', targets = 1) ) ) ) }) - + # Getting Status of Workflows for Sites - - # Ameriflux + + #Ameriflux output$heatmap1 <- renderPlot({ report_all <- ed2_report() - report_AM <- report_all[report_all$met == "AmerifluxLBL", ] - report1 <- data.frame(report_AM$site_id, report_AM$pft, report_AM$site_name, report_AM$workflow_id, report_AM$met) - colnames(report1) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") + report_AM <- report_all[report_all$met == 'AmerifluxLBL', ] + report1 <- data.frame(report_AM$site_id,report_AM$pft,report_AM$site_name,report_AM$workflow_id,report_AM$met) + colnames(report1) <- c('site_id','pfts','site_name','Workflow_id',"met") data <- as.data.frame(workflow_status(report_AM)) data <- wf_sites_status(data) - main_data_AM <- merge(report1, data, by = "Workflow_id") - col1 <- c("DONE", "ERROR") + main_data_AM <- merge(report1,data, by = 'Workflow_id') + col1 <- c("DONE","ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1, col2) + f_col <- data.frame(col1,col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_AM, ggplot2::aes( - x = as.character(site_id), - y = variable, fill = status - )) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_AM, ggplot2::aes(x = as.character(site_id), + y = variable, fill= status)) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile( - color = "white", - lwd = 1.5, - linetype = 1 - ) + + ggplot2::geom_tile(color = "white", + lwd = 1.5, + linetype = 1) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal() + - ggplot2::labs( - title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal()+ + ggplot2::labs(title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - # CRUNCEP - + + #CRUNCEP + output$heatmap2 <- renderPlot({ report_all <- ed2_report() - report_CR <- report_all[report_all$met == "CRUNCEP", ] - report2 <- data.frame(report_CR$site_id, report_CR$pft, report_CR$site_name, report_CR$workflow_id, report_CR$met) - colnames(report2) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") + report_CR <- report_all[report_all$met == 'CRUNCEP', ] + report2 <- data.frame(report_CR$site_id,report_CR$pft,report_CR$site_name,report_CR$workflow_id,report_CR$met) + colnames(report2) <- c('site_id','pfts','site_name','Workflow_id',"met") data <- as.data.frame(workflow_status(report_CR)) data <- wf_sites_status(data) - main_data_CR <- merge(report2, data, by = "Workflow_id") - col1 <- c("DONE", "ERROR") + main_data_CR <- merge(report2,data, by = 'Workflow_id') + col1 <- c("DONE","ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1, col2) + f_col <- data.frame(col1,col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_CR, ggplot2::aes( - x = as.character(site_id), - y = variable, fill = status - )) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_CR, ggplot2::aes(x = as.character(site_id), + y = variable, fill= status)) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile( - color = "white", - lwd = 1.5, - linetype = 1 - ) + + ggplot2::geom_tile(color = "white", + lwd = 1.5, + linetype = 1) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal() + - ggplot2::labs( - title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal()+ + ggplot2::labs(title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - # Fluxnet - + + #Fluxnet + output$heatmap3 <- renderPlot({ report_all <- ed2_report() - report_FN <- report_all[report_all$met == "Fluxnet2015", ] - report3 <- data.frame(report_FN$site_id, report_FN$pft, report_FN$site_name, report_FN$workflow_id, report_FN$met) - colnames(report3) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") + report_FN <- report_all[report_all$met == 'Fluxnet2015', ] + report3 <- data.frame(report_FN$site_id,report_FN$pft,report_FN$site_name,report_FN$workflow_id,report_FN$met) + colnames(report3) <- c('site_id','pfts','site_name','Workflow_id',"met") data <- as.data.frame(workflow_status(report_FN)) data <- wf_sites_status(data) - main_data_FN <- merge(report3, data, by = "Workflow_id") - col1 <- c("DONE", "ERROR") + main_data_FN <- merge(report3,data, by = 'Workflow_id') + col1 <- c("DONE","ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1, col2) + f_col <- data.frame(col1,col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_FN, ggplot2::aes( - x = as.character(site_id), - y = variable, fill = status - )) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_FN, ggplot2::aes(x = as.character(site_id), + y = variable, fill= status)) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile( - color = "white", - lwd = 1.5, - linetype = 1 - ) + + ggplot2::geom_tile(color = "white", + lwd = 1.5, + linetype = 1) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal() + - ggplot2::labs( - title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal()+ + ggplot2::labs(title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - # NARR - + + #NARR + output$heatmap4 <- renderPlot({ report_all <- ed2_report() - report_NR <- report_all[report_all$met == "NARR", ] - report4 <- data.frame(report_NR$site_id, report_NR$pft, report_NR$site_name, report_NR$workflow_id, report_NR$met) - colnames(report4) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") + report_NR <- report_all[report_all$met == 'NARR', ] + report4 <- data.frame(report_NR$site_id,report_NR$pft,report_NR$site_name,report_NR$workflow_id,report_NR$met) + colnames(report4) <- c('site_id','pfts','site_name','Workflow_id',"met") data <- as.data.frame(workflow_status(report_NR)) data <- wf_sites_status(data) - main_data_NR <- merge(report4, data, by = "Workflow_id") - col1 <- c("DONE", "ERROR") + main_data_NR <- merge(report4,data, by = 'Workflow_id') + col1 <- c("DONE","ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1, col2) + f_col <- data.frame(col1,col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_NR, ggplot2::aes( - x = as.character(site_id), - y = variable, fill = status - )) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_NR, ggplot2::aes(x = as.character(site_id), + y = variable, fill= status)) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile( - color = "white", - lwd = 1.5, - linetype = 1 - ) + + ggplot2::geom_tile(color = "white", + lwd = 1.5, + linetype = 1) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal() + - ggplot2::labs( - title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal()+ + ggplot2::labs(title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - # GFDL - + + #GFDL + output$heatmap5 <- renderPlot({ report_all <- ed2_report() - report_GF <- report_all[report_all$met == "GFDL", ] - report5 <- data.frame(report_GF$site_id, report_GF$pft, report_GF$site_name, report_GF$workflow_id, report_GF$met) - colnames(report5) <- c("site_id", "pfts", "site_name", "Workflow_id", "met") + report_GF <- report_all[report_all$met == 'GFDL', ] + report5 <- data.frame(report_GF$site_id,report_GF$pft,report_GF$site_name,report_GF$workflow_id,report_GF$met) + colnames(report5) <- c('site_id','pfts','site_name','Workflow_id',"met") data <- as.data.frame(workflow_status(report_GF)) data <- wf_sites_status(data) - main_data_NR <- merge(report5, data, by = "Workflow_id") - col1 <- c("DONE", "ERROR") + main_data_NR <- merge(report5,data, by = 'Workflow_id') + col1 <- c("DONE","ERROR") col2 <- c("green", "red") - f_col <- data.frame(col1, col2) + f_col <- data.frame(col1,col2) col.plot <- as.character(f_col$col2) names(col.plot) <- as.character(f_col$col1) - ggplot2::ggplot(data = main_data_NR, ggplot2::aes( - x = as.character(site_id), - y = variable, fill = status - )) + - ggplot2::scale_fill_manual(values = col.plot) + + ggplot2::ggplot(data = main_data_NR, ggplot2::aes(x = as.character(site_id), + y = variable, fill= status)) + + ggplot2::scale_fill_manual(values = col.plot) + ggplot2::scale_x_discrete(guide = ggplot2::guide_axis(n.dodge = 3)) + - ggplot2::geom_tile( - color = "white", - lwd = 1.5, - linetype = 1 - ) + + ggplot2::geom_tile(color = "white", + lwd = 1.5, + linetype = 1) + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) + ggplot2::coord_fixed() + - ggplot2::theme_minimal() + - ggplot2::labs( - title = "Heat map", - x = "site_id", - y = "stages", - fill = "status" + ggplot2::theme_minimal()+ + ggplot2::labs(title = "Heat map", + x = "site_id", + y = "stages", + fill = "status" ) }) - - ### ENDS + + ###ENDS + }) }