Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorators: Accepts new snapshot from testthat::test() #1304

Merged

Conversation

averissimo
Copy link
Contributor

@averissimo averissimo commented Dec 16, 2024

Pull Request

Part of insightsengineering/teal#1371 (comment)

Changes description

  • Tracks changes in the template code of the decorators feature branch
  • Renames variables to be plot, table or (in case of multiple decoratable elements) <name>_plot and <name>_table

Workflow

Manually triggered: https://github.com/insightsengineering/teal.modules.clinical/actions/runs/12359120026

Check 🛠

@@ -50,7 +50,6 @@
1), decreasing = TRUE) %>% sort_at_path(path = c("AEBODSYS",
"*", "AEDECOD"), scorefun = cont_n_onecol(length(levels(adsl$ACTARM)) +
1), decreasing = TRUE)
pruned_and_sorted_result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, where did this go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the object is decorated.

See code in server function, where the expr = table is the step that "prints" the table.

Note that the objects now have a standardized name when possible (plot and table), allowing for easier re-use of the decorators.

table_renamed_q <- reactive({
within(table_q(), table <- pruned_and_sorted_result)
})
decorated_table_q <- srv_decorate_teal_data(
id = "decorator",
data = table_renamed_q,
decorators = select_decorators(decorators, "table"),
expr = table
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now I understand! thanks @averissimo . in the future, if we consider a series of post processing with tables, will this be captured in a list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I fully understand the question, do you mean:

  1. Add this post-processing after the template generation and decoration?
  2. As part of the decoration?
  3. Other?

For 1. this can be done either on top of decorated_table_q with eval_code/within or via the argument expr that supports any kind of expression just like the within.

For 2. a list of decorators will allow for a series of post-processing applied to the respective object (table in this case).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant 1. Thanks @averissimo

@m7pr
Copy link
Contributor

m7pr commented Dec 17, 2024

Copy link
Contributor

@m7pr m7pr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one R CMD CHECK note needs to be satisified to get this merged

@averissimo
Copy link
Contributor Author

I'll fix the rlang issue on the feature branch, let's wait for @shajoezhu to reply here before merging this PR.

I'm so used to using rlang that didn't notice we removed that dependency from tmc

Copy link
Contributor

@shajoezhu shajoezhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks @averissimo

@averissimo averissimo merged commit 19e8752 into 1187_decorate_output@main Dec 17, 2024
22 of 24 checks passed
@averissimo averissimo deleted the snapshots@1187_decorate_output@main branch December 17, 2024 12:39
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants