generated from rpodcast/r_dev_projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
36 additions
and
651 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,29 @@ | ||
library(shiny) | ||
library(bslib) | ||
library(pointblank) | ||
library(gt) | ||
source("R/utils.R") | ||
|
||
# Define UI for app that draws a histogram ---- | ||
ui <- fluidPage( | ||
|
||
# App title ---- | ||
titlePanel(hello_world()), | ||
|
||
# Sidebar layout with input and output definitions ---- | ||
sidebarLayout( | ||
|
||
# Sidebar panel for inputs ---- | ||
sidebarPanel( | ||
|
||
# Input: Slider for the number of bins ---- | ||
sliderInput(inputId = "bins", | ||
label = "Number of bins:", | ||
min = 1, | ||
max = 50, | ||
value = 30) | ||
|
||
), | ||
|
||
# Main panel for displaying outputs ---- | ||
mainPanel( | ||
|
||
# Output: Histogram ---- | ||
gt_output("gt_table"), | ||
#plotOutput(outputId = "distPlot"), | ||
verbatimTextOutput("df") | ||
|
||
) | ||
library(reactable) | ||
#source("R/utils.R") | ||
|
||
# obtain record objects from object storage | ||
podcast_dupdf <- podcastdb_dupdf_object() | ||
analysis_metrics_df <- podcastdb_analysisdf_object() | ||
|
||
ui <- page_sidebar( | ||
title = "My Dashboard", | ||
sidebar = "Sidebar", | ||
# main content | ||
card( | ||
card_header("Duplicate Records Summary"), | ||
mod_tbl_ui("record_analysis") | ||
) | ||
) | ||
|
||
# Define server logic required to draw a histogram ---- | ||
server <- function(input, output) { | ||
|
||
dupdf <- podcastdb_dupdf_object() | ||
pb_object <- podcastdb_pointblank_object() | ||
# Histogram of the Old Faithful Geyser Data ---- | ||
# with requested number of bins | ||
# This expression that generates a histogram is wrapped in a call | ||
# to renderPlot to indicate that: | ||
# | ||
# 1. It is "reactive" and therefore should be automatically | ||
# re-executed when inputs (input$bins) change | ||
# 2. Its output type is a plot | ||
# output$distPlot <- renderPlot({ | ||
|
||
# x <- faithful$waiting | ||
# bins <- seq(min(x), max(x), length.out = input$bins + 1) | ||
|
||
# hist(x, breaks = bins, col = "#75AADB", border = "white", | ||
# xlab = "Waiting time to next eruption (in mins)", | ||
# main = "Histogram of waiting times") | ||
|
||
# }) | ||
|
||
output$df <- renderPrint({ | ||
str(dupdf) | ||
}) | ||
|
||
output$gt_table <- render_gt({ | ||
get_agent_report(pb_object, display_table = FALSE) | ||
}) | ||
|
||
|
||
|
||
server <- function(input, output, session) { | ||
analysis_metrics_rv <- reactive(analysis_metrics_df) | ||
mod_tbl_server("record_analysis", analysis_metrics_rv) | ||
} | ||
|
||
|
||
# Create Shiny app ---- | ||
shinyApp(ui = ui, server = server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
default: | ||
pointblank_object_path: "https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcastdb_pointblank_object/podcastdb_pointblank_object" | ||
podcast_dup_df_path: "https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcast_dup_df.rds" | ||
podcast_analysis_df_path: "https://podcast20-projects.us-east-1.linodeobjects.com/exports/analysis_metrics_df.rds" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"name":"app.R","content":"library(shiny)\nlibrary(pointblank)\nlibrary(gt)\nsource(\"R/utils.R\")\n\n# Define UI for app that draws a histogram ----\nui <- fluidPage(\n\n # App title ----\n titlePanel(hello_world()),\n\n # Sidebar layout with input and output definitions ----\n sidebarLayout(\n\n # Sidebar panel for inputs ----\n sidebarPanel(\n\n # Input: Slider for the number of bins ----\n sliderInput(inputId = \"bins\",\n label = \"Number of bins:\",\n min = 1,\n max = 50,\n value = 30)\n\n ),\n\n # Main panel for displaying outputs ----\n mainPanel(\n\n # Output: Histogram ----\n gt_output(\"gt_table\"),\n #plotOutput(outputId = \"distPlot\"),\n verbatimTextOutput(\"df\")\n\n )\n )\n)\n\n# Define server logic required to draw a histogram ----\nserver <- function(input, output) {\n\n dupdf <- podcastdb_dupdf_object()\n pb_object <- podcastdb_pointblank_object()\n # Histogram of the Old Faithful Geyser Data ----\n # with requested number of bins\n # This expression that generates a histogram is wrapped in a call\n # to renderPlot to indicate that:\n #\n # 1. It is \"reactive\" and therefore should be automatically\n # re-executed when inputs (input$bins) change\n # 2. Its output type is a plot\n # output$distPlot <- renderPlot({\n\n # x <- faithful$waiting\n # bins <- seq(min(x), max(x), length.out = input$bins + 1)\n\n # hist(x, breaks = bins, col = \"#75AADB\", border = \"white\",\n # xlab = \"Waiting time to next eruption (in mins)\",\n # main = \"Histogram of waiting times\")\n\n # })\n\n output$df <- renderPrint({\n str(dupdf)\n })\n\n output$gt_table <- render_gt({\n get_agent_report(pb_object, display_table = FALSE)\n })\n\n\n\n}\n\n# Create Shiny app ----\nshinyApp(ui = ui, server = server)","type":"text"},{"name":"R/utils.R","content":"hello_world <- function() {\n print(\"Hello World!\")\n}\n\npodcastdb_pointblank_object <- function() {\n tmp_file <- tempfile(pattern = \"pointblank\")\n download.file(\n url = config::get(\"pointblank_object_path\"),\n destfile = tmp_file\n )\n\n res <- pointblank::x_read_disk(\n filename = fs::path_file(tmp_file),\n path = fs::path_dir(tmp_file)\n )\n\n unlink(tmp_file)\n return(res)\n}\n\npodcastdb_dupdf_object <- function() {\n tmp_file <- tempfile(pattern = \"pointblank\")\n\n download.file(\n url = config::get(\"podcast_dup_df_path\"),\n destfile = tmp_file\n )\n\n res <- readRDS(tmp_file)\n\n unlink(tmp_file)\n return(res)\n}\n","type":"text"},{"name":"config.yml","content":"default:\n pointblank_object_path: \"https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcastdb_pointblank_object/podcastdb_pointblank_object\"\n podcast_dup_df_path: \"https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcast_dup_df.rds\"\n ","type":"text"}] | ||
[{"name":"app.R","content":"library(shiny)\nlibrary(bslib)\nlibrary(pointblank)\nlibrary(gt)\nlibrary(reactable)\n#source(\"R/utils.R\")\n\n# obtain record objects from object storage\npodcast_dupdf <- podcastdb_dupdf_object()\nanalysis_metrics_df <- podcastdb_analysisdf_object()\n\nui <- page_sidebar(\n title = \"My Dashboard\",\n sidebar = \"Sidebar\",\n # main content\n card(\n card_header(\"Duplicate Records Summary\"),\n mod_tbl_ui(\"record_analysis\")\n )\n)\n\nserver <- function(input, output, session) {\n analysis_metrics_rv <- reactive(analysis_metrics_df)\n mod_tbl_server(\"record_analysis\", analysis_metrics_rv)\n}\n\n\n# Create Shiny app ----\nshinyApp(ui = ui, server = server)","type":"text"},{"name":"R/fct_tables.R","content":"record_analysis_table <- function(df) {\n reactable::reactable(df)\n}\n\nrecord_detail_table <- function(df) {\n reactable::reactable(df)\n}","type":"text"},{"name":"R/mod_tbl.R","content":"#' tbl UI Function\n#'\n#' @description A shiny Module.\n#'\n#' @param id,input,output,session Internal parameters for {shiny}.\n#'\n#' @noRd \n#'\n#' @importFrom shiny NS tagList \nmod_tbl_ui <- function(id) {\n ns <- NS(id)\n tagList(\n reactable::reactableOutput(ns(\"record_table\"))\n )\n}\n\n#' tbl Server Functions\n#'\n#' @noRd\n#' \nmod_tbl_server <- function(id, record_df) {\n moduleServer(id, function(input, output, session) {\n ns <- session$ns\n\n output$record_table <- reactable::renderReactable({\n req(record_df())\n record_detail_table(record_df())\n })\n })\n}","type":"text"},{"name":"R/utils.R","content":"hello_world <- function() {\n print(\"Hello World!\")\n}\n\npodcastdb_pointblank_object <- function() {\n tmp_file <- tempfile(pattern = \"pointblank\")\n download.file(\n url = config::get(\"pointblank_object_path\"),\n destfile = tmp_file\n )\n\n res <- pointblank::x_read_disk(\n filename = fs::path_file(tmp_file),\n path = fs::path_dir(tmp_file)\n )\n\n unlink(tmp_file)\n return(res)\n}\n\npodcastdb_dupdf_object <- function() {\n tmp_file <- tempfile(pattern = \"dupdf\")\n\n download.file(\n url = config::get(\"podcast_dup_df_path\"),\n destfile = tmp_file\n )\n\n res <- readRDS(tmp_file)\n\n unlink(tmp_file)\n return(res)\n}\n\npodcastdb_analysisdf_object <- function() {\n tmp_file <- tempfile(pattern = \"analysisdf\")\n\n download.file(\n url = config::get(\"podcast_analysis_df_path\"),\n destfile = tmp_file\n )\n\n res <- readRDS(tmp_file)\n\n unlink(tmp_file)\n return(res)\n}\n","type":"text"},{"name":"config.yml","content":"default:\n pointblank_object_path: \"https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcastdb_pointblank_object/podcastdb_pointblank_object\"\n podcast_dup_df_path: \"https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcast_dup_df.rds\"\n podcast_analysis_df_path: \"https://podcast20-projects.us-east-1.linodeobjects.com/exports/analysis_metrics_df.rds\"\n ","type":"text"}] |
This file was deleted.
Oops, something went wrong.