From d10f5b62314f14cafb79d90c7a9167c4a326bca6 Mon Sep 17 00:00:00 2001 From: jreps Date: Fri, 2 Feb 2024 13:27:21 -0500 Subject: [PATCH 1/2] Update sccs-results-full.R - fixes github actions issue 103 --- R/sccs-results-full.R | 67 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/R/sccs-results-full.R b/R/sccs-results-full.R index 66ab1b4f..768b3b5a 100644 --- a/R/sccs-results-full.R +++ b/R/sccs-results-full.R @@ -16,7 +16,7 @@ sccsFullResultViewer <- function(id) { shiny::tabPanel( "Power", shiny::div(shiny::strong("Table 1."), "For each variable of interest: the number of cases (people with at least one outcome), the number of years those people were observed, the number of outcomes, the number of subjects with at least one exposure, the number of patient-years exposed, the number of outcomes while exposed, and the minimum detectable relative risk (MDRR)."), - shiny::tableOutput(ns("powerTable")) + resultTableViewer(ns('powerTable')) ), shiny::tabPanel( "Attrition", @@ -135,8 +135,7 @@ sccsFullResultServer <- function( ncol = 2 ) - # move these to a different submodule? - output$powerTable <- shiny::renderTable({ + powerTable <- shiny::reactive({ row <- selectedRow() if (is.null(row)) { return(NULL) @@ -155,18 +154,64 @@ sccsFullResultServer <- function( ) %>% dplyr::mutate(observedDays = .data$observedDays / 365.25, covariateDays = .data$covariateDays / 365.25) - colnames(resTargetTable) <- c("Variable", - "Cases", - "Years observed", - "Outcomes", - "Persons exposed", - "Years exposed", - "Outcomes while exposed", - "MDRR") + return(resTargetTable) } }) + colDefsInput <- list( + covariateName = reactable::colDef( + header = withTooltip( + "Variable", + "The covariate" + )), + outcomeSubjects = reactable::colDef( + header = withTooltip( + "Cases", + "The number of cases" + )), + observedDays = reactable::colDef( + format = reactable::colFormat(digits = 2), + header = withTooltip( + "Years observed", + "The total years observed" + )), + outcomeEvents = reactable::colDef( + header = withTooltip( + "Outcomes", + "The total number of outcomes" + )), + covariateSubjects = reactable::colDef( + header = withTooltip( + "Persons exposed", + "The total number of people exposed" + )), + covariateDays = reactable::colDef( + format = reactable::colFormat(digits = 2), + header = withTooltip( + "Years exposed", + "The total number of years exposed" + )), + covariateOutcomes = reactable::colDef( + header = withTooltip( + "Outcomes while exposed", + "The total number of outcomes while exposed" + )), + mdrr = reactable::colDef( + format = reactable::colFormat(digits = 4), + header = withTooltip( + "MDRR", + "The minimal detectable relative risk" + )) + ) + + # move these to a different submodule? + output$powerTable <- resultTableServer( + id = "powerTable", # how is this working without session$ns + df = powerTable, + colDefsInput = colDefsInput + ) + output$attritionPlot <- shiny::renderPlot({ row <- selectedRow() From 1f9e9627aa25ac2371b670cb5beecc92de024ea4 Mon Sep 17 00:00:00 2001 From: jreps Date: Tue, 6 Feb 2024 15:52:54 -0500 Subject: [PATCH 2/2] Update sccs-results-full.R fixing test fail due to assignment --- R/sccs-results-full.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/sccs-results-full.R b/R/sccs-results-full.R index 768b3b5a..279349d8 100644 --- a/R/sccs-results-full.R +++ b/R/sccs-results-full.R @@ -206,7 +206,7 @@ sccsFullResultServer <- function( ) # move these to a different submodule? - output$powerTable <- resultTableServer( + resultTableServer( id = "powerTable", # how is this working without session$ns df = powerTable, colDefsInput = colDefsInput