Skip to content

Use ui_transform_data on tm_gtsummary #994

Merged
llrs-roche merged 12 commits intomainfrom
ui_decorators@main
Mar 5, 2026
Merged

Use ui_transform_data on tm_gtsummary #994
llrs-roche merged 12 commits intomainfrom
ui_decorators@main

Conversation

@llrs-roche
Copy link
Contributor

Pull Request

tm_gtsummary() didn't use the exported helpers from teal to handle decorators.
This should fix it. I also updated the NEWS to mention it (and a chore commit about pkgdown)

@llrs-roche llrs-roche added the core label Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Unit Tests Summary

    1 files   38 suites   4m 14s ⏱️
  684 tests 565 ✅ 119 💤 0 ❌
1 033 runs  914 ✅ 119 💤 0 ❌

Results for commit 2bbd945.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Unit Test Performance Difference

Test suite performance difference
Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
examples 💚 $5.31$ $-4.68$ $0$ $+41$ $0$ $0$
shinytest2-tm_a_pca 💚 $226.26$ $-225.17$ $-38$ $+11$ $0$ $0$
shinytest2-tm_a_regression 💚 $90.29$ $-89.65$ $-24$ $+7$ $0$ $0$
shinytest2-tm_data_table 💚 $37.24$ $-36.86$ $-6$ $+4$ $0$ $0$
shinytest2-tm_file_viewer 💚 $44.81$ $-43.51$ $-9$ $+4$ $0$ $0$
shinytest2-tm_front_page 💚 $33.42$ $-32.89$ $-6$ $+3$ $0$ $0$
shinytest2-tm_g_association 💚 $47.59$ $-47.05$ $-9$ $+4$ $0$ $0$
shinytest2-tm_g_bivariate 💚 $102.88$ $-102.52$ $-40$ $+4$ $0$ $0$
shinytest2-tm_g_distribution 💚 $118.40$ $-118.15$ $-17$ $+3$ $0$ $0$
shinytest2-tm_g_response 💚 $50.12$ $-49.78$ $-13$ $+4$ $0$ $0$
shinytest2-tm_g_scatterplot 💚 $141.76$ $-141.29$ $-30$ $+5$ $0$ $0$
shinytest2-tm_g_scatterplotmatrix 💚 $47.40$ $-46.82$ $-5$ $+4$ $0$ $0$
shinytest2-tm_missing_data 💚 $69.20$ $-68.38$ $-18$ $+4$ $0$ $0$
shinytest2-tm_outliers 💚 $176.31$ $-175.30$ $-51$ $+10$ $0$ $0$
shinytest2-tm_t_crosstable 💚 $50.75$ $-50.00$ $-5$ $+4$ $0$ $0$
shinytest2-tm_variable_browser 💚 $98.14$ $-97.50$ $-17$ $+6$ $0$ $0$
tm_file_viewer 💔 $2.78$ $+1.10$ $0$ $0$ $0$ $0$
tm_g_distribution 💔 $20.18$ $+1.62$ $0$ $0$ $0$ $0$
tm_gtsummary 💔 $9.28$ $+2.97$ $+3$ $0$ $0$ $0$
tm_outliers 💔 $50.02$ $+2.71$ $0$ $0$ $0$ $0$
variable_browser 💔 $66.48$ $+1.20$ $0$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
examples 💚 $2.03$ $-2.00$ example_add_facet_labels.Rd
shinytest2-tm_a_pca 💚 $15.81$ $-15.72$ e2e_tm_a_pca_Changing_output_encodings_for_plot_type_does_not_generate_errors.
shinytest2-tm_a_pca 💚 $10.94$ $-10.85$ e2e_tm_a_pca_Changing_output_encodings_of_NA_action_does_not_generate_errors.
shinytest2-tm_a_pca 💚 $73.95$ $-73.87$ e2e_tm_a_pca_Changing_output_encodings_of_font_size_does_not_generate_errors.
shinytest2-tm_a_pca 💚 $34.35$ $-34.26$ e2e_tm_a_pca_Changing_output_encodings_of_plot_type_hides_and_shows_options.
shinytest2-tm_a_pca 💚 $15.41$ $-15.33$ e2e_tm_a_pca_Changing_output_encodings_of_standardization_does_not_generate_errors.
shinytest2-tm_a_pca 💚 $11.41$ $-11.33$ e2e_tm_a_pca_Changing_output_encodings_of_tables_display_does_not_generate_errors.
shinytest2-tm_a_pca 💚 $12.46$ $-12.37$ e2e_tm_a_pca_Changing_output_encodings_of_theme_does_not_generate_errors.
shinytest2-tm_a_pca 💚 $14.64$ $-14.56$ e2e_tm_a_pca_Color_by_columns_data_extract_must_be_from_non_selected_variable_set.
shinytest2-tm_a_pca 💚 $11.26$ $-11.16$ e2e_tm_a_pca_Eigenvector_table_should_have_data_extract_selection_Murder_Assault_on_header.
shinytest2-tm_a_pca 💚 $14.29$ $-14.21$ e2e_tm_a_pca_Eigenvector_table_should_have_data_extract_selection_Murder_UrbanPop_on_header.
shinytest2-tm_a_pca 💚 $11.75$ $-11.53$ e2e_tm_a_pca_Module_is_initialised_with_the_specified_defaults_in_function_call.
shinytest2-tm_a_regression 💚 $9.69$ $-9.57$ e2e_tm_a_regression_Data_extract_spec_elements_are_initialized_with_the_default_values_specified_by_response_and_regressor_arg.
shinytest2-tm_a_regression 💚 $9.76$ $-9.66$ e2e_tm_a_regression_Data_parameter_and_module_label_is_passed_properly.
shinytest2-tm_a_regression 💚 $14.08$ $-14.00$ e2e_tm_a_regression_Outlier_definition_and_label_are_visible_by_default.
shinytest2-tm_a_regression 💚 $9.84$ $-9.75$ e2e_tm_a_regression_Outlier_definition_and_label_have_default_values_and_label_text.
shinytest2-tm_a_regression 💚 $20.05$ $-19.96$ e2e_tm_a_regression_Plot_type_has_7_specific_choices_changing_choices_does_not_throw_errors.
shinytest2-tm_a_regression 💚 $11.66$ $-11.57$ e2e_tm_a_regression_Plot_type_is_set_properly.
shinytest2-tm_a_regression 💚 $15.22$ $-15.14$ e2e_tm_a_regression_Unchecking_display_outlier_hides_outlier_label_and_definition.
shinytest2-tm_data_table 💚 $8.28$ $-8.18$ e2e_tm_data_table_Initializes_without_errors
shinytest2-tm_data_table 💚 $8.30$ $-8.20$ e2e_tm_data_table_Verify_checkbox_displayed_over_data_table
shinytest2-tm_data_table 💚 $9.29$ $-9.20$ e2e_tm_data_table_Verify_default_variable_selection_and_set_new_selection
shinytest2-tm_data_table 💚 $11.37$ $-11.27$ e2e_tm_data_table_Verify_module_displays_data_table
shinytest2-tm_file_viewer 💚 $9.70$ $-9.19$ e2e_tm_file_viewer_Initializes_without_errors_and_shows_files_tree_specified_in_input_path_argument
shinytest2-tm_file_viewer 💚 $11.67$ $-11.41$ e2e_tm_file_viewer_Shows_selected_image_file
shinytest2-tm_file_viewer 💚 $11.76$ $-11.50$ e2e_tm_file_viewer_Shows_selected_text_file
shinytest2-tm_file_viewer 💚 $11.68$ $-11.42$ e2e_tm_file_viewer_Shows_selected_url
shinytest2-tm_front_page 💚 $8.02$ $-7.87$ e2e_tm_front_page_Initializes_without_errors_and_check_html_elements
shinytest2-tm_front_page 💚 $13.09$ $-12.85$ e2e_tm_front_page_Verify_the_module_displays_metadata
shinytest2-tm_front_page 💚 $12.31$ $-12.17$ e2e_tm_front_page_Verify_the_module_displays_tables
shinytest2-tm_g_association 💚 $13.24$ $-13.12$ e2e_tm_g_association_Check_and_set_default_values_for_radio_buttons.
shinytest2-tm_g_association 💚 $12.56$ $-12.43$ e2e_tm_g_association_Data_extract_spec_elements_are_initialized_with_the_default_values_specified_by_ref_and_vars_arguments.
shinytest2-tm_g_association 💚 $9.83$ $-9.67$ e2e_tm_g_association_Data_parameter_and_module_label_is_passed_properly.
shinytest2-tm_g_association 💚 $11.96$ $-11.84$ e2e_tm_g_association_Module_plot_is_visible.
shinytest2-tm_g_bivariate 💚 $24.48$ $-24.39$ e2e_tm_g_bivariate_Coloring_options_are_hidden_when_coloring_is_toggled_off.
shinytest2-tm_g_bivariate 💚 $28.63$ $-28.54$ e2e_tm_g_bivariate_Facetting_options_are_hidden_when_facet_is_toggled_off.
shinytest2-tm_g_bivariate 💚 $10.98$ $-10.88$ e2e_tm_g_bivariate_Module_is_initialised_with_the_specified_defaults.
shinytest2-tm_g_bivariate 💚 $38.78$ $-38.70$ e2e_tm_g_bivariate_Setting_encoding_inputs_produces_outputs_without_validation_errors.
shinytest2-tm_g_distribution 💚 $24.09$ $-24.00$ e2e_tm_g_distribution_Histogram_encoding_inputs_produce_output_without_validation_errors.
shinytest2-tm_g_distribution 💚 $77.99$ $-77.91$ e2e_tm_g_distribution_Module_is_initialised_with_the_specified_defaults.
shinytest2-tm_g_distribution 💚 $16.32$ $-16.24$ e2e_tm_g_distribution_QQ_plot_encoding_inputs_produce_output_without_validation_errors.
shinytest2-tm_g_response 💚 $10.32$ $-10.24$ e2e_tm_g_response_deselecting_response_produces_validation_error.
shinytest2-tm_g_response 💚 $10.51$ $-10.43$ e2e_tm_g_response_deselecting_x_produces_validation_error.
shinytest2-tm_g_response 💚 $19.29$ $-19.19$ e2e_tm_g_response_encoding_inputs_produce_output_without_validation_errors.
shinytest2-tm_g_response 💚 $10.00$ $-9.92$ e2e_tm_g_response_module_is_initialised_with_the_specified_defaults.
shinytest2-tm_g_scatterplot 💚 $14.08$ $-13.98$ e2e_tm_g_scatterplot_Base_for_the_log_transformation_can_be_applied.
shinytest2-tm_g_scatterplot 💚 $12.12$ $-12.04$ e2e_tm_g_scatterplot_Get_validation_error_when_facetting_with_the_same_row_col_variable.
shinytest2-tm_g_scatterplot 💚 $10.52$ $-10.43$ e2e_tm_g_scatterplot_Module_is_initialised_with_the_specified_defaults.
shinytest2-tm_g_scatterplot 💚 $90.42$ $-90.33$ e2e_tm_g_scatterplot_The_encoding_inputs_are_set_without_validation_errors.
shinytest2-tm_g_scatterplot 💚 $14.61$ $-14.52$ e2e_tm_g_scatterplot_The_log_transform_is_only_possible_for_positive_numeric_vars.
shinytest2-tm_g_scatterplotmatrix 💚 $14.03$ $-13.89$ e2e_tm_g_scatterplotmatrix_Change_plot_settings
shinytest2-tm_g_scatterplotmatrix 💚 $9.90$ $-9.74$ e2e_tm_g_scatterplotmatrix_Initializes_without_errors
shinytest2-tm_g_scatterplotmatrix 💚 $11.37$ $-11.23$ e2e_tm_g_scatterplotmatrix_Verify_default_values_and_settings_data_extracts_for_data_selection
shinytest2-tm_g_scatterplotmatrix 💚 $12.11$ $-11.96$ e2e_tm_g_scatterplotmatrix_Verify_module_displays_data_table
shinytest2-tm_missing_data 💚 $19.76$ $-19.56$ e2e_tm_missing_data_Check_default_settings_and_visibility_of_the_combinations_graph_and_encodings
shinytest2-tm_missing_data 💚 $19.73$ $-19.52$ e2e_tm_missing_data_Default_settings_and_visibility_of_the_summary_graph
shinytest2-tm_missing_data 💚 $10.60$ $-10.39$ e2e_tm_missing_data_Initializes_without_errors
shinytest2-tm_missing_data 💚 $19.11$ $-18.91$ e2e_tm_missing_data_Validate_functionality_and_UI_response_for_By_Variable_Levels_
shinytest2-tm_outliers 💚 $16.55$ $-16.44$ e2e_tm_outliers_Data_extract_spec_elements_are_initialized_with_the_default_values_specified_by_outlier_var_and_categorical_var_argument.
shinytest2-tm_outliers 💚 $11.88$ $-11.78$ e2e_tm_outliers_Data_parameter_and_module_label_is_passed_properly.
shinytest2-tm_outliers 💚 $16.51$ $-16.41$ e2e_tm_outliers_Default_radio_buttons_are_set_properly.
shinytest2-tm_outliers 💚 $12.18$ $-12.08$ e2e_tm_outliers_Method_parameters_are_set_properly.
shinytest2-tm_outliers 💚 $12.25$ $-12.15$ e2e_tm_outliers_Module_is_divided_into_3_tabs.
shinytest2-tm_outliers 💚 $34.13$ $-34.03$ e2e_tm_outliers_Outlier_definition_text_and_range_are_displayed_properly_depending_on_method.
shinytest2-tm_outliers 💚 $16.03$ $-15.92$ e2e_tm_outliers_Outlier_table_is_displayed_with_proper_content.
shinytest2-tm_outliers 💚 $18.87$ $-18.77$ e2e_tm_outliers_Outliers_summary_table_is_displayed_with_proper_content.
shinytest2-tm_outliers 💚 $14.34$ $-14.25$ e2e_tm_outliers_Plot_type_is_correctly_set_by_default_and_has_appropriate_possible_options.
shinytest2-tm_outliers 💚 $23.58$ $-23.48$ e2e_tm_outliers_Plot_type_is_hidden_when_Boxplot_tab_is_not_selected.
shinytest2-tm_t_crosstable 💚 $15.29$ $-15.17$ e2e_tm_t_crosstable_Change_plot_settings
shinytest2-tm_t_crosstable 💚 $10.09$ $-9.71$ e2e_tm_t_crosstable_Initializes_without_errors
shinytest2-tm_t_crosstable 💚 $12.86$ $-12.74$ e2e_tm_t_crosstable_Verify_default_values_and_settings_data_extracts_for_data_selection
shinytest2-tm_t_crosstable 💚 $12.51$ $-12.39$ e2e_tm_t_crosstable_Verify_module_displays_data_table
shinytest2-tm_variable_browser 💚 $14.47$ $-14.36$ e2e_tm_variable_browser_Selecting_treat_variable_as_factor_changes_the_table_headers.
shinytest2-tm_variable_browser 💚 $16.51$ $-16.40$ e2e_tm_variable_browser_changing_display_density_encoding_doesn_t_show_errors.
shinytest2-tm_variable_browser 💚 $19.39$ $-19.28$ e2e_tm_variable_browser_changing_outlier_definition_encoding_doesn_t_show_errors.
shinytest2-tm_variable_browser 💚 $22.07$ $-21.97$ e2e_tm_variable_browser_changing_plot_setting_encodings_doesn_t_show_errors.
shinytest2-tm_variable_browser 💚 $13.05$ $-12.94$ e2e_tm_variable_browser_content_is_displayed_correctly.
shinytest2-tm_variable_browser 💚 $12.64$ $-12.54$ e2e_tm_variable_browser_selection_of_categorical_variable_has_a_table_with_level_header.
tm_gtsummary 💔 $2.07$ $+2.03$ tm_gtsummary_module_server_behavior_with_decorators_one_decorator_executes_successfully
variable_browser 💔 $11.06$ $+1.34$ UI_switches_and_controls_server_handles_different_outlier_definition_thresholds
variable_browser 💚 $5.00$ $-1.08$ testServer_for_data_exceptions_server_function_handles_different_ggplot_themes

Results for commit 03a5d42

♻️ This comment has been updated with latest results.

averissimo
averissimo previously approved these changes Mar 4, 2026
Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

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

💯

@averissimo averissimo dismissed their stale review March 4, 2026 13:14

Missed something

@llrs-roche
Copy link
Contributor Author

Thanks for the review. I updated the server part too. Good catch.

I also took the PR to add some validation on the module output.
maybe on that call we could provide a class: validate(errorClass = "teal-error")?

Sorry for not providing an app to test this, here is one now:

tm_gtsummary(
  by = teal.transform::data_extract_spec(
    dataname = "test_data",
    select = teal.transform::select_spec(
      choices = "am",
      selected = "am",
      multiple = FALSE
    )
  ),
  include = teal.transform::data_extract_spec(
    dataname = "test_data",
    select = teal.transform::select_spec(
      choices = c("carb", "cyl"),
      selected = c("carb", "cyl"),
      multiple = TRUE,
      fixed = FALSE
    )
  ),
  decorators = list(table = list(teal_transform_module(), teal_transform_module()))
) |> 
  init(data = teal_data(test_data = mtcars), modules = _) |> runApp()

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
R/geom_mosaic.R                  73       0  100.00%
R/tm_a_pca.R                    852       0  100.00%
R/tm_a_regression.R             751     391  47.94%   497-524, 531-534, 541-542, 546-556, 560, 564-576, 581-596, 601-623, 626-634, 638-666, 671-681, 684-710, 717-741, 744-769, 776-783, 786-812, 819-847, 850-875, 882-901, 904-930, 937-951, 954-980, 1005, 1009
R/tm_data_table.R               204      11  94.61%   110, 115-120, 225, 325, 330, 349
R/tm_file_viewer.R              172      50  70.93%   141-152, 156-163, 165-167, 172-182, 184, 204, 229-235, 237-238, 240, 244-250
R/tm_front_page.R               143       0  100.00%
R/tm_g_association.R            320      72  77.50%   226-294, 319, 325, 474, 488
R/tm_g_bivariate.R              672     196  70.83%   332-471, 505, 511-514, 585, 590, 595, 616-618, 655-658, 668-682, 684-685, 712-721, 763, 829, 940, 987, 989, 991, 998-1008
R/tm_g_distribution.R          1106      60  94.58%   412-420, 426-429, 468-469, 471, 473, 482, 484, 488-491, 495-498, 501, 513-514, 569, 580, 594, 889, 1073-1077, 1146-1150, 1152-1158, 1289-1292, 1310-1312, 1398-1399
R/tm_g_response.R               345      87  74.78%   184-185, 192, 198, 259-325, 348-352, 425, 430, 447-453, 531, 537, 550
R/tm_g_scatterplot.R            709     259  63.47%   359-501, 534-537, 575, 624, 636, 650, 667, 672, 698-711, 787-798, 837, 845-882, 894-896, 906-912, 919-921, 932-940, 942-943, 945, 949, 983-996, 1040, 1060
R/tm_g_scatterplotmatrix.R      272     110  59.56%   246-293, 357, 371-379, 396-437, 486-494, 562, 576
R/tm_gtsummary.R                152       1  99.34%   258
R/tm_missing_data.R            1180     167  85.85%   129, 488, 494, 507, 512, 532-538, 547-553, 620-635, 676, 680, 721, 739-746, 771, 787-790, 848-927, 931-933, 964-971, 1104, 1241, 1280, 1332-1334, 1344-1364, 1472, 1474, 1477-1478
R/tm_outliers.R                1029     186  81.92%   400, 428, 438-439, 441-442, 517-531, 533, 613, 616, 654-706, 709-747, 759, 790, 809, 812-827, 888-891, 965-993, 1117, 1220-1223, 1227, 1230-1233, 1239-1248, 1250, 1254-1263, 1266-1267, 1269
R/tm_rmarkdown.R                159       0  100.00%
R/tm_t_crosstable.R             263      56  78.71%   227-269, 292-293, 309, 318, 425, 438-447
R/tm_variable_browser.R         887      27  96.96%   395, 597, 812-826, 956, 984, 986, 1058-1059, 1067, 1165, 1246, 1278, 1310
R/utils.R                       142      15  89.44%   146, 177, 227, 288-291, 300-306, 314, 350, 353
R/zzz.R                           2       2  0.00%    2-3
TOTAL                          9433    1690  82.08%

Diff against main

Filename               Stmts    Miss  Cover
-------------------  -------  ------  -------
R/tm_gtsummary.R        +152      +1  +99.34%
R/tm_missing_data.R       +8       0  +0.10%
R/utils.R                -47      -6  +0.55%
TOTAL                   +113      -5  +0.27%

Results for commit: 2bbd945

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

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

💯

@llrs-roche llrs-roche enabled auto-merge (squash) March 5, 2026 16:18
@llrs-roche llrs-roche merged commit f7325d0 into main Mar 5, 2026
27 checks passed
@llrs-roche llrs-roche deleted the ui_decorators@main branch March 5, 2026 17:38
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2026
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.

2 participants