Enhancement/Expansion of TLG Catalog - #1356
Conversation
…03/07/08/11, pkpl01/04)
…p to 0.1.0.9182
|
thanks so much for the review @Gero1999! 😄 ive gone through everything from the last round:
all of this has new unit tests so lmk if there's anything else, thanks again!! 🙏 |
Gero1999
left a comment
There was a problem hiding this comment.
Oleeeee this looks amazing 😍
Sorry to keep asking, but can we actually also included something for the user to choose which statistics columns to show? (i.e, "n", "Number BLQ", "Mean", "SD", "CV%"...). Ifyou think is easy/clean feel free to do it direclty here
Regarding the code I just catched 1 relevant thing so far:
| filter_tlg_excluded <- function(data) { | ||
| if ("PKSUM1F" %in% names(data)) { | ||
| data[data$PKSUM1F != "Y", , drop = FALSE] | ||
| } else { | ||
| data | ||
| data <- data[is.na(data$PKSUM1F) | data$PKSUM1F != "Y", , drop = FALSE] | ||
| } | ||
| if ("PPSUMFL" %in% names(data)) { | ||
| data <- data[is.na(data$PPSUMFL) | data$PPSUMFL != "Y", , drop = FALSE] | ||
| } | ||
| data | ||
| } |
There was a problem hiding this comment.
issue: maybe is better to be more specific for each (ADPP, ADNCA)
Imagine that someone annotates in their ADNCA some records for profile N, because they consider for that profile you cannot run NCA (PPSUMFL = Y). But they still want to produce representations with those plots (PKSUMFL = Y). This process will filter them anyway...
Hope this makes sense!
…nd-tlg-catalog # Conflicts: # DESCRIPTION
Gero1999
left a comment
There was a problem hiding this comment.
Thanks for the changes it works as expected!
There is only one thing I am not sure if I am missing. But right now I can see that by default pkpt03 is not separating the statistics by profile. Statistics only separate by using TRT01A, but not considering PARAM (which is relevant if we have for the same treatment more than 1 analyte) or PCSPEC (specimen collected). The best would be to allow this input to be multiple choice and by default select all grouping variables but USUBJID in the PKNCA obj.
On the other hand, for the Tables, I think we should try to figure out a way to make everything have the same inputs structure... Something more homogenous. An example, in pkpt03 we have "Columns - Parameter variable: PARAM, Value variable: AVAL"... but is actually the same as doing Stratify by (rows): TRT01A PARAM.
We also need for Tables to figure out a way to filter Stratify by (rows) values in a clean way, specially for PARAM (pkct03) and NFRLT (pkct01)
But all these we could either keep working here or create an issue and think about it together. So far, great job! 😉
…nd-tlg-catalog # Conflicts: # inst/shiny/modules/tab_tlg/tlg_module.R
…ARAM into strat and adding PARAM/timepoint value filters
… grouping vars (except USUBJID)
… and boundary label restoration
|
thanks @Gero1999! i went ahead and did all three of these in the PR, plus the sidebar consistency thing that was mentioned, but here's a quick rundown:
one heads up: the "by Dose" concentration tables can only group by whats actually in the conc data, and DOSEA is dose-event level (mostly NA per sample), so those tables just warn and group by the rest instead of erroring. can make a follow up issue if you want a cleaner way to do dose grouping. but thanks again this was very helpful for me!! 🙏 lmk if anything else needs tweaking ^_^ |
|
@h5hoang great job! Points to mention:
Otherwise I don't find anything else to comment, we can proceed with a merge 😉
|
|
Tables:
With dummy data: Listings: All good :)
With dummy data: Plots:
General comment:
I think we should merge this one and then create 3 PRs: one of listings, one plots, one tables :) |
As agreed let's for now not use it, if we see that the users are not satisfied with the current options then we can consider including a new dependency
Why not simply dividing by PARAM? All metabolites and drugs can be distinguished that way right?
Isn't in the ADPP? Maybe is because of AVISIT, which is the proper one for CDISC? Maybe we need to check that and add it indeed
@h5hoang USUBJID has its own column in the PKNCA obj in case you want a clean way to remove it |
I don't understand; give me a proper example, please.
I didn't find it when I opened ADPP in the app, Indeed we need AVISIT or ATPTREF, we need to check what is standard. |

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.