-
Notifications
You must be signed in to change notification settings - Fork 7
Units table hides PCSPEC groups when no parameters are flagged TRUE for that specimen #1144
Description
Problem
When a dataset contains two specimen types (e.g., PLASMA and URINE) and URINE has only a single time point per subject, adding URINE to the PCSPEC selector in NCA Setup and then opening the Parameter Units table shows no rows for URINE. The URINE rows exist in the underlying data but are hidden via CSS because no NCA parameters are flagged TRUE in the intervals for that specimen.
Root cause
In inst/shiny/modules/tab_nca/units_table.R, the rows_to_hide_units_table reactive determines which rows to display:
params_to_keep— parameters where at least one interval has that parameter set toTRUE.groups_to_keep— group column values (includingPCSPEC) from intervals that have at least oneTRUEparameter.- An
inner_joinbetween the units table andgroups_to_keepkeeps only matching rows.
If no excretion parameters (e.g., ae, fe) end up TRUE for the URINE intervals — either because the study type detection didn't classify them as "Excretion Data" or because the study_types_df ↔ intervals join produced NA types — then all URINE unit rows are hidden.
The fix should decouple the units table visibility from parameter flags. The units table should show rows for all PCSPEC values present in the filtered intervals, regardless of whether any parameters are currently selected for that specimen.
Reproducible example
# Minimal dataset: PLASMA has full profile, URINE has 1 time point at Day 10
df <- data.frame(
STUDYID = "STUDY001",
PCSPEC = c(rep("PLASMA", 6), "URINE"),
ROUTE = "extravascular",
DOSETRT = "DrugA",
USUBJID = "SUBJ001",
ATPTREF = c(rep("Day 1", 6), "Day 10"),
PARAM = "AnalyteA",
AVAL = c(0, 5, 10, 7, 3, 1, 200),
AVALU = c(rep("ng/mL", 6), "ng/mL"),
DOSEA = 100,
DOSEU = "mg",
AFRLT = c(0, 1, 2, 3, 4, 6, 240),
ARRLT = c(0, 1, 2, 3, 4, 6, 0),
NFRLT = c(0, 1, 2, 3, 4, 6, 240),
ADOSEDUR = 0,
RRLTU = "h",
DOSNOA = c(rep(1, 6), 10),
VOLUME = c(rep(NA, 6), 50),
VOLUMEU = c(rep(NA, 6), "mL"),
METABFL = "N"
)
pknca_data <- PKNCA_create_data_object(df)
# After selecting both PLASMA and URINE in the app:
# - Intervals are created for both specimens
# - But if no excretion parameters are TRUE for URINE intervals,
# rows_to_hide_units_table hides all URINE rows from the units modalExpected behavior
The units table should display rows for all specimen types present in the active intervals, even if no parameters are currently selected for that specimen type.
Steps to reproduce in the app
- Upload a dataset with PLASMA and URINE specimens (URINE having only 1 time point).
- Go to NCA Setup → Settings.
- Add URINE to the PCSPEC selector.
- Click "Parameter Units" button.
- Observe: no URINE rows appear in the units table.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status