feat: filter slope selector plots to show only flagged profiles#1267
Draft
Gero1999 wants to merge 10 commits into
Draft
feat: filter slope selector plots to show only flagged profiles#1267Gero1999 wants to merge 10 commits into
Gero1999 wants to merge 10 commits into
Conversation
Add r.squared to the PPTESTCD filter in .merge_conc_with_nca_results so it is available alongside adj.r.squared and span.ratio in the per-profile data returned by get_halflife_plots(). Co-authored-by: Ona <no-reply@ona.com>
Store the data output from get_halflife_plots in a new plot_profile_data reactiveVal alongside plot_outputs. Update handle_hl_adj_change, handle_interval_change, and update_plots_with_pknca to pass through and return both plots and data so profile-level NCA results (adj.r.squared, r.squared, span.ratio) are available for filtering. Co-authored-by: Ona <no-reply@ona.com>
Extract flag_rules reactive from settings() in nca_setup.R and pass it to slope_selector_server. Update the function signature to accept the new parameter with a default of reactive(NULL). Co-authored-by: Ona <no-reply@ona.com>
…1265) Place the checkbox in the plot-widgets-container row next to the plots-per-page and search-subject controls. Co-authored-by: Ona <no-reply@ona.com>
Add .get_flagged_profile_ids() helper that evaluates per-profile NCA results (adj.r.squared, r.squared, span.ratio) against checked flag rules. Profiles with lambda.z = NA (failed fit) are always shown. Add filtered_plot_outputs reactive in slope_selector_server that applies the filter when the checkbox is checked. Pagination and search now operate on the filtered set. Show a specific message when all profiles pass the flag rules. Co-authored-by: Ona <no-reply@ona.com>
The function was referenced in slope_selector.R but its definition was not included in the previous commit. Add it to utils-slope_selector.R.
The function was referenced in slope_selector.R but its definition was not included in the earlier commit.
Bring in latest main changes (CI workflow updates, merged PRs). Co-authored-by: Ona <no-reply@ona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Closes #1265
Description
When a study has hundreds of profiles, finding the ones that need manual half-life adjustment is tedious. This PR adds a "Show only flagged profiles" checkbox to the slope selector that filters plots to only show profiles violating the flag rules defined in NCA Settings (R2ADJ, R2, LAMZSPN). Profiles where lambda.z failed entirely are always shown.
Changes
R/get_halflife_plots.R: Addr.squaredto the PPTESTCD filter in.merge_conc_with_nca_resultsso it's available in the per-profile data alongsideadj.r.squaredandspan.ratio.inst/shiny/functions/utils-slope_selector.R:handle_hl_adj_change,handle_interval_change, andupdate_plots_with_pkncato pass through and return bothplotsanddata(previously only plots were returned)..get_flagged_profile_ids()helper that evaluates per-profile NCA results against checked flag rules.inst/shiny/modules/tab_nca/setup/slope_selector.R:plot_profile_datareactiveVal to capture thedataoutput fromget_halflife_plots().filtered_plot_outputsreactive that applies the flag filter before pagination/search.flag_rulesparameter.inst/shiny/modules/tab_nca/nca_setup.R: Extractflag_rulesreactive fromsettings()and pass it toslope_selector_server.Definition of Done
lambda.z = NA(failed fit) are always shown when filter is activeHow to test
Contributor checklist
.scsschange was done, rundata-raw/compile_css.Rdata-raw/test_suggests_hidden.RNotes to reviewer
The
dataoutput fromget_halflife_plots()was already computed but discarded by the caller. This PR captures it with minimal overhead. The flag evaluation uses the same NCA results that annotate the plots (R²adj, span ratio in the subtitle), so the filter is consistent with what the user sees.AUCPEO and AUCPEP flags are intentionally excluded — they are AUC extrapolation metrics not available in the slope selector data."