Enhancement/Expansion of TLG Catalog#1356
Conversation
…03/07/08/11, pkpl01/04)
…hten t_pkpt07_norm PARAMCD filter
…int, extract render helper
|
Hi, thanks for all the work on this. I wanted to share a few observations regarding the summary tables so far.
I'll continue going through the rest and follow up with anything else I find. |
| urine_specs = c("URINE", "Urine"), | ||
| listgroup_vars = c("PARAM", "PCSPEC"), | ||
| displaying_vars = NULL, | ||
| ... | ||
| ) { | ||
| if ("PCSPEC" %in% names(data)) { | ||
| data <- data[data$PCSPEC %in% urine_specs, , drop = FALSE] |
There was a problem hiding this comment.
suggestion: The expected value is URINE based on CDISC, but you can be more protective than this:
| urine_specs = c("URINE", "Urine"), | |
| listgroup_vars = c("PARAM", "PCSPEC"), | |
| displaying_vars = NULL, | |
| ... | |
| ) { | |
| if ("PCSPEC" %in% names(data)) { | |
| data <- data[data$PCSPEC %in% urine_specs, , drop = FALSE] | |
| urine_specs = c("URINE"), | |
| listgroup_vars = c("PARAM", "PCSPEC"), | |
| displaying_vars = NULL, | |
| ... | |
| ) { | |
| if ("PCSPEC" %in% names(data)) { | |
| data <- data[toupper(data$PCSPEC) %in% urine_specs, , drop = FALSE] |
…ordering, readable stat labels)
|
Thank you both for the feedback! I really appreciate it a lot 😄 I've addressed everything raised from the urine specimen filters now matching case-insensitively to making the summary tables more readable (split tables show a group header, rows are grouped by treatment arm and ordered by timepoint, and the statistic columns now use readable labels instead of the raw names). I've also added in new unit tests to cover these changes as well please let me know if there are any other changes/feedback you guys might have! thanks!! |
Issue
Closes #1343
Description
Expands the TLG catalog with new table, graph, and listing functions for PK reports, following the insightsengineering TLG catalog specifications.
New TLG functions (26 new entries in
tlg.yaml):t_pkct01(summary concentration table with 4 variants: by TRT, by dose, TAD, dose+TAD),t_pkpt03_col(summary PK parameters),t_pkpt03_MP_col(metabolite/parent ratios),t_pkpt07_norm(dose-normalized parameters),t_pkpt08_uri(urine amount/percent recovered),t_pkpt11_gmr(geometric mean ratio with CIs)g_pkcg01/02/03_sbs(side-by-side concentration plots),p_pkcg03_lin/log/sbs_dose(mean concentration by dose),p_pkpg01_cum/per(urine recovery profiles),p_pkpg02_doseprop(dose-proportionality scatter with power-model regression),p_pkpg03_boxp/p_pkpg04_boxp(PK parameter boxplots),p_pkpg06_mp(metabolite/parent ratio boxplots)l_pkcl01_tad(concentration listing by TAD),l_pkcl02_uri(urine concentration listing),l_pkpl01(individual PK parameters),l_pkpl01_mp(metabolite ratios),l_pkpl04_mp(treatment comparison)Shared helpers (
R/utils-tlg.R):split_and_apply— splits data by grouping variables and applies a function to each subset (used by all new TLG functions)filter_metabolite_rows— three-tier metabolite detection fallback (METABFL → PPCAT → PARAM).summarise_adpp— descriptive statistics for PK parameter values (n, Mean, SD, CV%, GeoMean, GeoCV%, Median, Min, Max).build_pkpp_table— deduplicates ADPP rows and applies summary statistics per stratum/parameter.get_var_label— label attribute lookup with column-name fallbackShiny wiring improvements:
type = "table"support totlg_module_server/tlg_module_ui(tables render viareactable)tab_nca_server→tab_tlg_server→ modules via a dedicatedadppreactive, avoiding recomputationfilter_tlg_excludedapplied once at thetab_tlgboundary (not per-module), and extended to handle ADPP'sPPSUMFLflag alongside ADNCA'sPKSUM1Ffilter_tlg_excluded— rows withNAin exclusion flag columns were silently dropped; now correctly preserved.build_tlg_panelshelper to eliminate copy-paste across table/graph/listingrenderUIblocksOther changes:
export_cdisc: carriesDOSEA/DOSEUcolumns through to ADPP for dose-proportionality TLGsg_pkcg02_sbsYAML entry pointing tog_pkcg02_loginstead ofg_pkcg02_sbsprint(tlg_order())debug statement intab_tlg.RDefinition of Done
tlg.yamltlg.yamlHow to test
reactablewidgets with paginationt_pkpt08_uri,p_pkpg01_cum/per,l_pkcl02_uri): test with a dataset containing urine specimens; verify thecondition: "URINE"auto-selects these entries when urine data is present (don't forget to click urine in NCA set-up tab like me :'))Contributor checklist
.scsschange was done, rundata-raw/compile_css.Rdata-raw/test_suggests_hidden.RNotes to reviewer
ggplot2(noterndependency), per Enhancement: Remove tern dependency from TLG plots #1319.t_pkct01summary function has its own.summarise_grouprather than reusing.summarise_adpp. This is intentional because concentration tables have BLQ-specific semantics (BLQ counting, differentndefinition that includes BLQ subjects) that don't map cleanly to the ADPP helper.t_pkpt08_uriwithcondition: "URINE") evaluates against ADNCA'sPCSPECcolumn, not ADPP'sPPSPEC. This works in practice (if ADNCA has urine specimens, ADPP should too) but could be tightened in a follow-up if needed.DOSEAcolumn is now carried throughexport_cdiscfor dose-proportionality graphs (p_pkpg02_doseprop,p_pkcg03_*_dose). IfDOSEAis absent from the source data, these TLGs will show an error message at render time (caught bytryCatchintlg_module_server). They are allis_default: falseso they won't be pre-selected.