From a3950f9a7ef65bbbd356c33835edb6769dba3988 Mon Sep 17 00:00:00 2001 From: Wang Zheng <269683008+wangzhengdna-lang@users.noreply.github.com> Date: Wed, 5 Aug 2026 12:18:45 +0800 Subject: [PATCH] fix: include offending values in mapping_section assertion error (#1367) The assertion in .column_mapping_section() threw a generic message when mapping_df contained zero or multiple mapping_section values, giving no clue about the actual content. The error now reports the count and the offending values, e.g.: mapping_df must contain exactly one unique mapping_section value, but found 2: PK, PD --- DESCRIPTION | 2 +- NEWS.md | 1 + inst/shiny/modules/tab_data/data_mapping.R | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index af052bd23..e72b84fac 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: aNCA Title: (Pre-)Clinical NCA in a Dynamic Shiny App -Version: 0.1.0.9188 +Version: 0.1.0.9189 Authors@R: c( person("Ercan", "Suekuer", email = "ercan.suekuer@roche.com", role = "aut", comment = c(ORCID = "0009-0001-1626-1526")), diff --git a/NEWS.md b/NEWS.md index 2be10a3cb..92ea4b676 100644 --- a/NEWS.md +++ b/NEWS.md @@ -67,6 +67,7 @@ * CMAX auto-selected in box plots if available (#890) ### Data & Mapping +* Mapping section assertion error now reports the count and offending `mapping_section` values for easier debugging (#1367) * ADNCA now includes `PKSUM1RS` column storing the general exclusion reason when `PKSUM1F = "Y"` (#1331) * Upload multiple input files, bound into a single ADNCA dataset (#821) * Optional mapping of AEFRLT for excretion rate parameters (ERTLST, ERTMAX) (#745) diff --git a/inst/shiny/modules/tab_data/data_mapping.R b/inst/shiny/modules/tab_data/data_mapping.R index d066459d3..f3446c75f 100644 --- a/inst/shiny/modules/tab_data/data_mapping.R +++ b/inst/shiny/modules/tab_data/data_mapping.R @@ -102,7 +102,10 @@ MAPPING_BY_SECTION <- MAPPING_BY_SECTION[sections_order] .column_mapping_section <- function(ns, mapping_df) { section_title <- unique(mapping_df$mapping_section) if (length(section_title) != 1) { - stop("mapping_df must contain exactly one unique mapping_section value.") + stop( + "mapping_df must contain exactly one unique mapping_section value, but found ", + length(section_title), ": ", paste(section_title, collapse = ", ") + ) } tags$section( h5(section_title),