feat: add log-points for NCA user input changes#1221
Draft
Gero1999 wants to merge 13 commits into1210-enhancement/replace-logger-with-consolefrom
Draft
feat: add log-points for NCA user input changes#1221Gero1999 wants to merge 13 commits into1210-enhancement/replace-logger-with-consolefrom
Gero1999 wants to merge 13 commits into1210-enhancement/replace-logger-with-consolefrom
Conversation
Log analyte, specimen, profile, method, min half-life points, and flag rule changes at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log the full list of selected parameters at DEBUG level alongside the existing INFO count message. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Upgrade slope rule add/remove from TRACE to INFO level. Add DEBUG summary of slope rules count on table changes. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log exclusion add (with row count, type, reason), removal, and settings restore at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log NCA profile changes, BLQ strategy changes, and C0 imputation toggle at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
9 tasks
Replace all glue-style log calls ({var}) with paste-style
(multiple arguments) to avoid parent.frame(2) scoping issues
in closures and observeEvent callbacks. Guard profile log
against NA values.
Co-authored-by: Ona <no-reply@ona.com>
Log analyte, specimen, profile, method, min half-life points, and flag rule changes at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log the full list of selected parameters at DEBUG level alongside the existing INFO count message. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Upgrade slope rule add/remove from TRACE to INFO level. Add DEBUG summary of slope rules count on table changes. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log exclusion add (with row count, type, reason), removal, and settings restore at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Log NCA profile changes, BLQ strategy changes, and C0 imputation toggle at INFO level. Closes #1219 (partial) Co-authored-by: Ona <no-reply@ona.com>
Replace all glue-style log calls ({var}) with paste-style
(multiple arguments) to avoid parent.frame(2) scoping issues
in closures and observeEvent callbacks. Guard profile log
against NA values.
Co-authored-by: Ona <no-reply@ona.com>
91ca90b to
893084b
Compare
…b.com/pharmaverse/aNCA into 1219-enhancement/nca-input-log-points
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds INFO/DEBUG logging across the Shiny NCA setup modules so exported session_log.txt captures user configuration changes (settings, imputation, parameter selection, slope rules, exclusions), improving post-hoc traceability of an NCA run.
Changes:
- Added log points for selection changes (analyte/specimen/profile, extrapolation method, min half-life points, flag rules).
- Added log points for BLQ and C0 imputation setting changes.
- Added more detailed logging for slope rule and exclusion add/remove/restore actions, plus DEBUG summaries.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| inst/shiny/modules/tab_nca/setup/slope_selector.R | Adds DEBUG summary log when manual slope rules table updates. |
| inst/shiny/modules/tab_nca/setup/settings.R | Adds INFO logs for key NCA settings and flag-rule changes. |
| inst/shiny/modules/tab_nca/setup/parameter_selection.R | Adds DEBUG log listing selected parameters per study type. |
| inst/shiny/modules/tab_nca/setup/manual_slopes_table.R | Upgrades add/remove slope rule logs from TRACE to INFO. |
| inst/shiny/modules/tab_nca/setup/general_exclusions.R | Adds INFO logs for exclusions restored/added/removed. |
| inst/shiny/modules/tab_nca/setup/data_imputation.R | Adds INFO logs for BLQ strategy and C0 imputation toggle changes. |
Comment on lines
+291
to
+293
| if (length(target_profile) > 0 && !anyNA(target_profile)) { | ||
| log_info("NCA profile selection changed: ", paste(target_profile, collapse = ", ")) | ||
| } |
Comment on lines
303
to
+307
| if (updating_filters()) return() | ||
| updating_filters(TRUE) | ||
| on.exit(updating_filters(FALSE)) | ||
|
|
||
| log_info("Analyte selection changed: ", paste(input$select_analyte, collapse = ", ")) |
Comment on lines
339
to
+343
| if (updating_filters()) return() | ||
| updating_filters(TRUE) | ||
| on.exit(updating_filters(FALSE)) | ||
|
|
||
| log_info("Specimen selection changed: ", paste(input$select_pcspec, collapse = ", ")) |
Comment on lines
+160
to
177
| rows_sel <- getReactableState("conc_table-table", "selected") | ||
| reason <- input$exclusion_reason | ||
| nca_checked <- isTRUE(input$cb_manual_nca) | ||
| tlg_checked <- isTRUE(input$cb_tlg) | ||
|
|
||
| if (length(rows_sel) > 0 && nzchar(reason) && (nca_checked || tlg_checked)) { | ||
| type_label <- if (nca_checked && tlg_checked) "NCA + TLG" | ||
| else if (nca_checked) "NCA" | ||
| else "TLG" | ||
| log_info( | ||
| "Exclusion added: ", length(rows_sel), " rows, type=", type_label, | ||
| ", reason='", reason, "'" | ||
| ) | ||
| } | ||
|
|
||
| .handle_add_exclusion( | ||
| input, session, exclusion_list, xbtn_counter | ||
| ) |
| # Add a new row to the table when the user clicks the add button | ||
| observeEvent(input$add_rule, { | ||
| log_trace("{id}: adding manual slopes row") | ||
| log_info("Slope selector: adding manual slope rule") |
| # Remove selected rows from the table when the user clicks the remove button | ||
| observeEvent(input$remove_rule, { | ||
| log_trace("{id}: removing manual slopes row") | ||
| log_info("Slope selector: removing manual slope rule") |
| n_rules <- nrow(manual_slopes()) | ||
| n_excl <- sum(manual_slopes()$TYPE == "Exclusion", na.rm = TRUE) | ||
| n_incl <- n_rules - n_excl | ||
| log_debug("Slope rules updated: ", n_rules, " total (", n_incl, " inclusions, ", n_excl, " exclusions)") |
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 #1219
Description
Adds INFO-level logging for user input changes across the NCA setup modules so that exported
session_log.txtfiles capture what configuration choices the user made — not just that a calculation happened.New log-points added:
Definition of Done
session_log.txtHow to test
aNCA::run_app()session_log.txtcontains the entriesContributor checklist
.scsschange was done, rundata-raw/compile_css.RNotes to reviewer
This PR targets
1210-enhancement/replace-logger-with-console(#1212), notmain. It will auto-retarget tomainonce #1212 is merged.All log calls use the same
log_info/log_debugfunctions introduced in #1212 — no new dependencies.Version bump and NEWS entry still needed before merge.