Skip to content

Commit

Permalink
Converted the Shiny App into a package
Browse files Browse the repository at this point in the history
  • Loading branch information
koolgax99 committed Jun 29, 2023
1 parent 620bec0 commit 28c1a1e
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 141,809 deletions.
3 changes: 3 additions & 0 deletions shiny/NewForecastingDashboard/.Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^NewForecastingDashboard\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
1 change: 1 addition & 0 deletions shiny/NewForecastingDashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.Rproj.user
14 changes: 14 additions & 0 deletions shiny/NewForecastingDashboard/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Package: NewForecastingDashboard
Title: New PEcAn Forecasting Dashboard
Version: 0.0.0.9000
Authors@R:
person("Nihar", "Sanda", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5303-6400"))
Description: This project allows to view the Forecasting plots very efficiently.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
Depends:
R (>= 2.10)
LazyData: true
2 changes: 2 additions & 0 deletions shiny/NewForecastingDashboard/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2023
COPYRIGHT HOLDER: NewForecastingDashboard authors
21 changes: 21 additions & 0 deletions shiny/NewForecastingDashboard/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2023 NewForecastingDashboard authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions shiny/NewForecastingDashboard/NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by roxygen2: do not edit by hand

5 changes: 5 additions & 0 deletions shiny/NewForecastingDashboard/R/app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
library(shiny)

newForecastingDashboardApp <- function(...) {
shinyApp(ui = ui, server = server, options = list(includeCSS("./R/styles.css")), ...)
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
server <- function(input, output) {

# Filter the data based on the selected site_id, start_date and the variable
data()$datetime <- as.POSIXct(data()$datetime)
data()$error <- abs(data()$observation - data()$mean)
data$datetime <- as.POSIXct(data$datetime)
data$error <- abs(data$observation - data$mean)
data
filtered_data_nee <- reactive({
filter(data, variable == "nee" & observation != "NA" & site_id == input$site_id & reference_datetime == input$start_date)
filter(data, variable == "nee" & site_id == input$site_id & reference_datetime == input$start_date)
})
filtered_data_le <- reactive({
filter(data, variable == "le" & site_id == input$site_id & reference_datetime == input$start_date)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ library(rattle)
library(leaflet)
library(htmltools)

data<-read_csv("~/pecan/shiny/gsoc/terrestial_30min_example.csv")

ui <- dashboardPage( skin = "black",
dashboardHeader(title = "Flux Dashboard"),

dashboardSidebar(
selectInput("site_id", h3("Select Site:"), choices = unique(data$site_id)),
selectInput(inputId = "start_date", label="Forecast Horizon Date:", choices = unique(data$reference_datetime)),
Expand All @@ -28,11 +26,11 @@ ui <- dashboardPage( skin = "black",
menuItem("LE Error", tabName = "le_err", icon = icon("tree"))
)
),

dashboardBody(
tabItems(
#Map Tab
tabItem(tabName = "nee_ft",
tabItem(tabName = "nee_ft",
fluidRow(div(
style = "margin: 10px;",
tags$div(
Expand All @@ -41,7 +39,7 @@ ui <- dashboardPage( skin = "black",
)
))
),
tabItem(tabName = "nee_sct",
tabItem(tabName = "nee_sct",
fluidRow(div(
style = "margin: 10px;",
tags$div(
Expand All @@ -50,7 +48,7 @@ ui <- dashboardPage( skin = "black",
)
))
),
tabItem(tabName = "nee_err",
tabItem(tabName = "nee_err",
fluidRow(div(
style = "margin: 10px;",
tags$div(
Expand All @@ -59,7 +57,7 @@ ui <- dashboardPage( skin = "black",
)
))
),
tabItem(tabName = "le_ft",
tabItem(tabName = "le_ft",
fluidRow(div(
style = "margin: 10px;",
tags$div(
Expand All @@ -68,7 +66,7 @@ ui <- dashboardPage( skin = "black",
)
))
),
tabItem(tabName = "le_sct",
tabItem(tabName = "le_sct",
fluidRow(div(
style = "margin: 10px;",
tags$div(
Expand All @@ -77,7 +75,7 @@ ui <- dashboardPage( skin = "black",
)
))
),
tabItem(tabName = "le_err",
tabItem(tabName = "le_err",
fluidRow(div(
style = "margin: 10px;",
tags$div(
Expand Down
3 changes: 0 additions & 3 deletions shiny/NewForecastingDashboard/app.R

This file was deleted.

Binary file added shiny/NewForecastingDashboard/data/data.rda
Binary file not shown.
36 changes: 0 additions & 36 deletions shiny/NewForecastingDashboard/graphs.R

This file was deleted.

Loading

0 comments on commit 28c1a1e

Please sign in to comment.