From 840b5c581dd1f1c2ee9d85ba9c1f86427aa3a0e6 Mon Sep 17 00:00:00 2001 From: edward-burn <9583964+edward-burn@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:49:22 +0000 Subject: [PATCH] achilles code use closes #101 --- inst/shiny/server.R | 15 +++++++++ inst/shiny/ui.R | 78 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 3 deletions(-) diff --git a/inst/shiny/server.R b/inst/shiny/server.R index e0adb5c..7848d6f 100644 --- a/inst/shiny/server.R +++ b/inst/shiny/server.R @@ -94,6 +94,21 @@ server <- function(input, output, session) { ) + # achilles_code_use ----- + + createOutputAchillesCodeUse <- shiny::reactive({ + achillesFiltered <- dataFiltered$achilles_code_use |> + filterData("achilles_code_use", input) + CodelistGenerator::tableAchillesCodeUse(achillesFiltered, + header = input$achilles_code_use_header, + groupColumn = input$achilles_code_use_groupColumn, + hide = input$achilles_code_use_hide) + + }) + + output$achilles_code_use_gt <- gt::render_gt({ + createOutputAchillesCodeUse() + }) # summarise_observation_period ----- ## tidy summarise_observation_period ----- getTidyDataSummariseObservationPeriod <- shiny::reactive({ diff --git a/inst/shiny/ui.R b/inst/shiny/ui.R index 158babf..623637a 100644 --- a/inst/shiny/ui.R +++ b/inst/shiny/ui.R @@ -72,10 +72,82 @@ ui <- bslib::page_navbar( icon = shiny::icon("list"), ## achilles code use ----- bslib::nav_panel( - title = "Achilles Code Use", - icon = shiny::icon("database") + title = "Achilles code use", + icon = shiny::icon("database"), + bslib::layout_sidebar( + sidebar = bslib::sidebar(width = 400, open = "closed", + bslib::accordion( + bslib::accordion_panel( + title = "Settings", + shinyWidgets::pickerInput( + inputId = "achilles_code_use_grouping_cdm_name", + label = "Database", + choices = NULL, + selected = NULL, + multiple = TRUE, + options = list(`actions-box` = TRUE, size = 10, `selected-text-format` = "count > 3") + ), + shinyWidgets::pickerInput( + inputId = "achilles_code_use_grouping_codelist_name", + label = "Codelist name", + choices = NULL, + selected = NULL, + multiple = TRUE, + options = list(`actions-box` = TRUE, size = 10, `selected-text-format` = "count > 3") + ) + ), + bslib::accordion_panel( + title = "Table formatting", + sortable::bucket_list( + header = NULL, + sortable::add_rank_list( + text = "none", + labels = c( "codelist_name"), + input_id = "achilles_code_use_none" + ), + sortable::add_rank_list( + text = "header", + labels = c("cdm_name", "estimate_name"), + input_id = "achilles_code_use_header" + ), + sortable::add_rank_list( + text = "groupColumn", + labels = NULL, + input_id = "achilles_code_use_groupColumn" + ), + sortable::add_rank_list( + text = "hide", + labels = character(), + input_id = "achilles_code_use_hide" + ) + ) + ) + ) + ), + bslib::nav_panel( + title = "achilles_code_use", + bslib::card( + full_screen = TRUE, + bslib::card_header( + bslib::popover( + shiny::icon("download"), + shinyWidgets::pickerInput( + inputId = "achilles_code_use_formatted_download_type", + label = "File type", + selected = "docx", + choices = c("docx", "png", "pdf", "html"), + multiple = FALSE + ), + shiny::downloadButton(outputId = "achilles_code_use_formatted_download", label = "Download") + ), + class = "text-end" + ), + gt::gt_output("achilles_code_use_gt") |> withSpinner() + ) + ) + ) ), - + ## unmapped concepts ----- bslib::nav_panel( title = "Unmapped concepts",