From d0311a9a8a9fe3a9cb3d83cae4b2e5a2fee042d5 Mon Sep 17 00:00:00 2001 From: edward-burn <9583964+edward-burn@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:02:07 +0000 Subject: [PATCH] some tweaks --- inst/shiny/scripts/preprocess.R | 57 ++++++++++++++++----------------- inst/shiny/server.R | 1 - inst/shiny/ui.R | 44 ++++++++++++++++++------- 3 files changed, 61 insertions(+), 41 deletions(-) diff --git a/inst/shiny/scripts/preprocess.R b/inst/shiny/scripts/preprocess.R index 34e79ba..89e349d 100644 --- a/inst/shiny/scripts/preprocess.R +++ b/inst/shiny/scripts/preprocess.R @@ -31,9 +31,9 @@ data <- omopgenerics::importSummarisedResult(file.path(getwd(),"data", "raw")) | # choices <- getChoices(data, flatten = TRUE) # -# # remove matched cohorts from choices -# choices$summarise_characteristics_grouping_cohort_name <- choices$summarise_characteristics_grouping_cohort_name[ -# !stringr::str_detect(choices$summarise_characteristics_grouping_cohort_name, "matched")] +# remove matched cohorts from choices +choices$summarise_characteristics_grouping_cohort_name <- choices$summarise_characteristics_grouping_cohort_name[ + !stringr::str_detect(choices$summarise_characteristics_grouping_cohort_name, "matched")] # settingsUsed <- unique(settings(data) |> pull("result_type")) dataFiltered <- list() @@ -50,36 +50,35 @@ for(i in seq_along(settingsUsed)){ # selected <- choices # -# selected$summarise_characteristics_grouping_cohort_name <- selected$summarise_characteristics_grouping_cohort_name[1] -# selected$summarise_large_scale_characteristics_grouping_cohort_name <- selected$summarise_large_scale_characteristics_grouping_cohort_name[1] +selected$summarise_characteristics_grouping_cohort_name <- selected$summarise_characteristics_grouping_cohort_name[1] +selected$summarise_large_scale_characteristics_grouping_cohort_name <- selected$summarise_large_scale_characteristics_grouping_cohort_name[1] # # choices$cohort_code_use_grouping_cohort_name <- codeUseCohorts # selected$cohort_code_use_grouping_cohort_name <- codeUseCohorts[1] # -# choices$compare_large_scale_characteristics_grouping_cdm_name <- choices$summarise_large_scale_characteristics_grouping_cdm_name -# choices$compare_large_scale_characteristics_grouping_cohort_1 <- choices$summarise_large_scale_characteristics_grouping_cohort_name -# choices$compare_large_scale_characteristics_grouping_cohort_2 <- choices$summarise_large_scale_characteristics_grouping_cohort_name -# selected$compare_large_scale_characteristics_grouping_cdm_name <- choices$compare_large_scale_characteristics_grouping_cdm_name -# selected$compare_large_scale_characteristics_grouping_cohort_1 <- choices$compare_large_scale_characteristics_grouping_cohort_1[1] -# selected$compare_large_scale_characteristics_grouping_cohort_2 <- choices$compare_large_scale_characteristics_grouping_cohort_1[2] -# -# choices$summarise_large_scale_characteristics_grouping_domain <- settings(dataFiltered$summarise_large_scale_characteristics) |> -# pull("table_name") -# selected$summarise_large_scale_characteristics_grouping_domain <- choices$summarise_large_scale_characteristics_grouping_domain -# -# choices$summarise_large_scale_characteristics_grouping_time_window <- unique(dataFiltered$summarise_large_scale_characteristics |> -# pull("variable_level")) -# selected$summarise_large_scale_characteristics_grouping_time_window <-choices$summarise_large_scale_characteristics_grouping_time_window -# -# orphanCodelist <- unique(dataFiltered$orphan_code_use |> -# visOmopResults::splitAll() |> pull("codelist_name")) -# orphanCdm <- unique(dataFiltered$orphan_code_use |> -# visOmopResults::addSettings() |> pull("cdm_name")) -# -# choices$orphan_grouping_cdm_name <- orphanCdm -# choices$orphan_grouping_codelist_name <- orphanCodelist -# selected$orphan_grouping_cdm_name <- orphanCdm -# selected$orphan_grouping_cohort_name <- orphanCodelist[1] +choices$compare_large_scale_characteristics_grouping_cdm_name <- choices$summarise_large_scale_characteristics_grouping_cdm_name +choices$compare_large_scale_characteristics_grouping_cohort_1 <- choices$summarise_large_scale_characteristics_grouping_cohort_name +choices$compare_large_scale_characteristics_grouping_cohort_2 <- choices$summarise_large_scale_characteristics_grouping_cohort_name +selected$compare_large_scale_characteristics_grouping_cdm_name <- choices$compare_large_scale_characteristics_grouping_cdm_name +selected$compare_large_scale_characteristics_grouping_cohort_1 <- choices$compare_large_scale_characteristics_grouping_cohort_1[1] +selected$compare_large_scale_characteristics_grouping_cohort_2 <- choices$compare_large_scale_characteristics_grouping_cohort_1[2] + +choices$summarise_large_scale_characteristics_grouping_domain <- settings(dataFiltered$summarise_large_scale_characteristics) |> + pull("table_name") +selected$summarise_large_scale_characteristics_grouping_domain <- choices$summarise_large_scale_characteristics_grouping_domain + +choices$summarise_large_scale_characteristics_grouping_time_window <- unique(dataFiltered$summarise_large_scale_characteristics |> + pull("variable_level")) +selected$summarise_large_scale_characteristics_grouping_time_window <-choices$summarise_large_scale_characteristics_grouping_time_window + +orphanCodelist <- unique(dataFiltered$orphan_code_use |> + visOmopResults::splitAll() |> pull("codelist_name")) +orphanCdm <- unique(dataFiltered$orphan_code_use |> + visOmopResults::addSettings() |> pull("cdm_name")) +choices$orphan_grouping_cdm_name <- orphanCdm +choices$orphan_grouping_codelist_name <- orphanCodelist +selected$orphan_grouping_cdm_name <- orphanCdm +selected$orphan_grouping_cohort_name <- orphanCodelist[1] # # unmappedCodelist <- unique(dataFiltered$unmapped_codes |> # visOmopResults::splitAll() |> pull("codelist_name")) diff --git a/inst/shiny/server.R b/inst/shiny/server.R index b405d0d..e0adb5c 100644 --- a/inst/shiny/server.R +++ b/inst/shiny/server.R @@ -884,7 +884,6 @@ server <- function(input, output, session) { result <- dataFiltered$orphan_code_use |> dplyr::filter(cdm_name %in% input$orphan_grouping_cdm_name, group_level %in% input$orphan_grouping_codelist_name) - tbl <- CodelistGenerator::tableOrphanCodes( result, header = input$orphan_gt_99_header, diff --git a/inst/shiny/ui.R b/inst/shiny/ui.R index fb75edd..158babf 100644 --- a/inst/shiny/ui.R +++ b/inst/shiny/ui.R @@ -2,9 +2,8 @@ # Be careful editing this file ui <- bslib::page_navbar( - theme = bs_theme(bootswatch = "zephyr"), - - #minty pulse + theme = bs_theme(bootswatch = "pulse"), + # zephyr title = "PhenotypeR", bslib::nav_panel( @@ -13,10 +12,11 @@ ui <- bslib::page_navbar( shiny::includeMarkdown(path = "background.md") ), - + # Database diagnostics ----- bslib::nav_menu( title = "Database diagnostics", icon = shiny::icon("list"), + ## snapshot ----- bslib::nav_panel( title = "Snapshot", icon = shiny::icon("clipboard-list"), @@ -39,6 +39,7 @@ ui <- bslib::page_navbar( gt::gt_output("summarise_omop_snapshot_gt_17") |> withSpinner() ) ), + ## observation periods ----- bslib::nav_panel( title = "Observation periods", icon = shiny::icon("eye"), @@ -65,10 +66,17 @@ ui <- bslib::page_navbar( ) ) ), - + # Codelist diagnostics ----- bslib::nav_menu( title = "Codelist diagnostics", icon = shiny::icon("list"), + ## achilles code use ----- + bslib::nav_panel( + title = "Achilles Code Use", + icon = shiny::icon("database") + ), + + ## unmapped concepts ----- bslib::nav_panel( title = "Unmapped concepts", icon = shiny::icon("database"), @@ -146,6 +154,7 @@ ui <- bslib::page_navbar( ) ), + ## Orphan codes ----- bslib::nav_panel( title = "Orphan codes", icon = shiny::icon("circle-half-stroke"), @@ -222,10 +231,13 @@ ui <- bslib::page_navbar( ), + # Cohort diagnostics ----- + bslib::nav_menu( title = "Cohort diagnostics", icon = shiny::icon("list"), + ## Cohort code use ----- bslib::nav_panel( title = "Cohort code use", @@ -319,7 +331,7 @@ ui <- bslib::page_navbar( ) ) ), - + ## Cohort characteristics ----- bslib::nav_panel( title = "Cohort characteristics", icon = shiny::icon("users-gear"), @@ -375,9 +387,6 @@ ui <- bslib::page_navbar( ) ) ) - - - ) ), bslib::card( @@ -400,6 +409,8 @@ ui <- bslib::page_navbar( ) ) ), + ## Large scale characteristics ----- + bslib::nav_panel( title = "Large scale characteristics", icon = shiny::icon("arrow-up-right-dots"), @@ -531,6 +542,7 @@ ui <- bslib::page_navbar( ) ) ), + ## Compare large scale characteristics ----- bslib::nav_panel( title = "Compare large scale characteristics", icon = shiny::icon("arrow-up-right-dots"), @@ -570,8 +582,8 @@ ui <- bslib::page_navbar( full_screen = TRUE, plotly::plotlyOutput("plotly_compare_lsc") |> withSpinner() ) - )), + ## Cohort overlap ----- bslib::nav_panel( title = "Cohort overlap", icon = shiny::icon("circle-half-stroke"), @@ -742,9 +754,12 @@ ui <- bslib::page_navbar( ) ) ), + + # Population diagnostics ----- bslib::nav_menu( title = "Population diagnostics", icon = shiny::icon("list"), + ## Incidence ----- bslib::nav_panel( title = "Incidence", icon = shiny::icon("chart-line"), @@ -918,7 +933,7 @@ ui <- bslib::page_navbar( ) ) ) - ) + ), # , # bslib::nav_panel( # title = "Attrition", @@ -1136,6 +1151,12 @@ ui <- bslib::page_navbar( # ) # ) # ) + + ## Prevalence ----- + bslib::nav_panel( + title = "Prevalence", + icon = shiny::icon("chart-line") + ) ), bslib::nav_spacer(), bslib::nav_item( @@ -1148,4 +1169,5 @@ ui <- bslib::page_navbar( ) ) ) + # end ------ )