Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: aNCA
Title: (Pre-)Clinical NCA in a Dynamic Shiny App
Version: 0.1.0.9156
Version: 0.1.0.9157
Authors@R: c(
person("Ercan", "Suekuer", email = "ercan.suekuer@roche.com", role = "aut",
comment = c(ORCID = "0009-0001-1626-1526")),
Expand Down
20 changes: 10 additions & 10 deletions inst/shiny/modules/tab_nca/nca_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ nca_setup_ui <- function(id) {
navset_pill_list(
widths = c(2, 10),
nav_panel(
"Settings",
"NCA Settings",
fluidRow(
actionButton(
ns("open_save_settings_modal"),
Expand All @@ -29,17 +29,17 @@ nca_setup_ui <- function(id) {
class = "btn-primary"
)
),
fluidRow(units_table_ui(ns("units_table"))),
settings_ui(ns("nca_settings")),
accordion(
accordion_panel(
title = "Ratio Calculations",
ratios_table_ui(ns("ratio_calculations_table"))
),
open = c("General Settings", "Parameter Selection")
settings_ui(ns("nca_settings"))
),
nav_panel(
"Parameter Selection",
parameter_selection_ui(
ns("nca_setup_parameter"),
units_ui = units_table_ui(ns("units_table")),
intervals_ui = partial_intervals_ui(ns("nca_settings")),
ratios_ui = ratios_table_ui(ns("ratio_calculations_table"))
)
),
nav_panel("Parameter Selection", parameter_selection_ui(ns("nca_setup_parameter"))),
nav_panel("Slope Selector", slope_selector_ui(ns("slope_selector"))),
nav_panel("General Exclusions", general_exclusions_ui(ns("general_exclusions")))
)
Expand Down
45 changes: 36 additions & 9 deletions inst/shiny/modules/tab_nca/setup/parameter_selection.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#' `list("Study Type A" = c("p1", "p2"))`.}
#' \item{types_df}{A `reactive` data frame containing the study type detection results.}

parameter_selection_ui <- function(id) {
parameter_selection_ui <- function(id,
units_ui = NULL,
intervals_ui = NULL,
ratios_ui = NULL) {
ns <- NS(id)
tagList(
# Header row with help button
Expand All @@ -31,10 +34,14 @@ parameter_selection_ui <- function(id) {
),
column(
width = 8,
actionButton(ns("show_param_ref"),
label = "PK parameter details",
icon = icon("book"),
class = "btn-sm btn-outline-primary"
div(
class = "d-flex gap-2",
actionButton(ns("show_param_ref"),
label = "PK parameter details",
icon = icon("book"),
class = "btn-sm btn-outline-primary"
),
units_ui
)
),
column(
Expand All @@ -55,9 +62,19 @@ parameter_selection_ui <- function(id) {
"for that study type. Hover a column header to see the ",
"full parameter name."
),
tags$li(
tags$b("Partial interval calculations"),
": Define custom time intervals for partial AUC ",
"and related parameters."
),
tags$li(
tags$b("Ratio calculations"),
": Configure parameter ratio calculations ",
"between analytes."
),
tags$li(
tags$b("Detected study types"),
": Expandable section showing detected study types ",
": Study types detected in the data ",
"and the number of subjects."
)
)
Expand Down Expand Up @@ -113,6 +130,16 @@ parameter_selection_ui <- function(id) {

br(),
accordion(
accordion_panel(
title = "Partial Interval Calculations",
icon = icon("clock"),
intervals_ui
),
accordion_panel(
title = "Ratio Calculations",
icon = icon("divide"),
ratios_ui
),
accordion_panel(
title = "Detected Study Types",
icon = icon("microscope"),
Expand Down Expand Up @@ -430,7 +457,7 @@ parameter_selection_server <- function(id, processed_pknca_data, parameter_overr
can_exc <- params$can_excretion[i]
locs <- character(0)
if (type %in% c("Standard", "IV")) {
locs <- c(locs, "Setup > Parameter Selection")
locs <- c(locs, "Parameter Selection > Matrix")
}
if (type == "Urine" || identical(can_exc, "T")) {
locs <- c(
Expand All @@ -439,10 +466,10 @@ parameter_selection_server <- function(id, processed_pknca_data, parameter_overr
}
if (type == "PKNCA-not-covered" && cat == "Ratio") {
locs <- c(
locs, "Additional Analysis > Ratios"
locs, "Parameter Selection > Ratio Calculations"
)
}
if (length(locs) == 0) "Setup > Parameter Selection"
if (length(locs) == 0) "Parameter Selection > Matrix"
else paste(locs, collapse = "; ")
},
character(1)
Expand Down
147 changes: 78 additions & 69 deletions inst/shiny/modules/tab_nca/setup/settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,83 @@
#'
#' @returns A reactive with a list with all settings.

#' Partial Interval Calculations UI
#'
#' Extracted so it can be placed in the Parameter Selection tab
#' while keeping its server logic in settings_server.
#'
#' @param id The settings module namespace ID (same as settings_ui).
partial_intervals_ui <- function(id) {
ns <- NS(id)
tagList(
fluidRow(
column(
width = 10,
actionButton(ns("addRow"), "(+) Add Row", class = "btn-success"),
),
column(
width = 2,
dropdown(
div(
tags$h2("Partial Interval Calculations Help"),
p(
"Define custom time intervals for calculating partial area",
"and related parameters. Add a row for each interval you need."
),
p("For each row, specify:"),
tags$ul(
tags$li(
tags$b("Parameter"),
": The interval calculation to perform (e.g., AUCINT, AUCINTA, CAVGINT)."
),
tags$li(
tags$b("Start"),
": Start time of the interval."
),
tags$li(
tags$b("End"),
": End time of the interval."
)
),
p(
tags$b("Note:"),
" Rows with missing Start or End values will be ignored."
),
tags$table(
class = "imputation-help-table",
tags$thead(
tags$tr(
tags$th("Parameter"),
tags$th("Description")
)
),
tags$tbody(
tr("AUCINT", "AUC from T1 to T2 (based on AUClast extrapolation)"),
tr("AUCINTD", "AUC from T1 to T2 Normalized by Dose"),
tr("AUCINTA", "AUCint (based on AUCall extrapolation)"),
tr("AUCINTAD", "AUCint (based on AUCall extrapolation, dose-aware)"),
tr("AUCINTIS", "AUCint (based on AUCinf,obs extrapolation)"),
tr("AUCINTID", "AUCint (based on AUCinf,obs extrapolation, dose-aware)"),
tr("AUCINTIP", "AUCint (based on AUCinf,pred extrapolation)"),
tr("AUCINTPD", "AUCint (based on AUCinf,pred extrapolation, dose-aware)"),
tr("CAVGINT", "Average Concentration from T1 to T2"),
tr("RCAMINT", "Amount Recovered from T1 to T2"),
tr("FREXINT", "Fraction Excreted from T1 to T2")
)
)
),
style = "unite",
right = TRUE,
icon = icon("question"),
status = "primary",
width = "600px"
)
)
),
reactableOutput(ns("int_parameters_table"))
)
}

settings_ui <- function(id) {
ns <- NS(id)

Expand Down Expand Up @@ -100,74 +177,6 @@ settings_ui <- function(id) {
# Moved input_switch for should_impute_c0 into the data_imputation module
data_imputation_ui(ns("data_imputation"))
),
accordion_panel(
title = "Partial Interval Calculations",
fluidRow(
column(
width = 10,
actionButton(ns("addRow"), "(+) Add Row", class = "btn-success"),
),
column(
width = 2,
dropdown(
div(
tags$h2("Partial Interval Calculations Help"),
p(
"Define custom time intervals for calculating partial area",
"and related parameters. Add a row for each interval you need."
),
p("For each row, specify:"),
tags$ul(
tags$li(
tags$b("Parameter"),
": The interval calculation to perform (e.g., AUCINT, AUCINTA, CAVGINT)."
),
tags$li(
tags$b("Start"),
": Start time of the interval."
),
tags$li(
tags$b("End"),
": End time of the interval."
)
),
p(
tags$b("Note:"),
" Rows with missing Start or End values will be ignored."
),
tags$table(
class = "imputation-help-table",
tags$thead(
tags$tr(
tags$th("Parameter"),
tags$th("Description")
)
),
tags$tbody(
tr("AUCINT", "AUC from T1 to T2 (based on AUClast extrapolation)"),
tr("AUCINTD", "AUC from T1 to T2 Normalized by Dose"),
tr("AUCINTA", "AUCint (based on AUCall extrapolation)"),
tr("AUCINTAD", "AUCint (based on AUCall extrapolation, dose-aware)"),
tr("AUCINTIS", "AUCint (based on AUCinf,obs extrapolation)"),
tr("AUCINTID", "AUCint (based on AUCinf,obs extrapolation, dose-aware)"),
tr("AUCINTIP", "AUCint (based on AUCinf,pred extrapolation)"),
tr("AUCINTPD", "AUCint (based on AUCinf,pred extrapolation, dose-aware)"),
tr("CAVGINT", "Average Concentration from T1 to T2"),
tr("RCAMINT", "Amount Recovered from T1 to T2"),
tr("FREXINT", "Fraction Excreted from T1 to T2")
)
)
),
style = "unite",
right = TRUE,
icon = icon("question"),
status = "primary",
width = "600px"
)
)
),
reactableOutput(ns("int_parameters_table"))
),
accordion_panel(
title = "Flag Rule Sets",
fluidRow(
Expand Down Expand Up @@ -220,7 +229,7 @@ settings_ui <- function(id) {
tooltip = "Minimum required half-life span ratio for lambda-z related parameters"
)
),
open = c("General Settings", "Parameter Selection")
open = "General Settings"
)
)
}
Expand Down
Loading