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

module()$datanames : unify combined_datanames no matter what's the length of transformers #1344

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

m7pr
Copy link
Contributor

@m7pr m7pr commented Sep 13, 2024

module()$datanames are affected by datanames parameter and datanames coming out of transformers.
So far this is not unified, and the outcome $datanames depend on the length of input of the transformers.
They are different if the transformer has length 1.

# 0 transformers
example_module("mod-1", transformers = 
                 list(
                   
                 ), 
               datanames = c("ADSL", "ADTTE"))$datanames
# > [1] "ADSL"  "ADTTE" "all" 



# 1 transformer
example_module("mod-1", transformers = 
                 list(
                   teal_transform_module(ui = function(id) NULL, server = function(id, data) NULL)
                  ), 
               datanames = c("ADSL", "ADTTE"))$datanames
[1] "all" 



# 2 transformers
example_module("mod-1", transformers = 
                 list(
                   teal_transform_module(ui = function(id) NULL, server = function(id, data) NULL),
                   teal_transform_module(ui = function(id) NULL, server = function(id, data) NULL)
                 ), 
               datanames = c("ADSL", "ADTTE"))$datanames
# [1] "ADSL"  "ADTTE" "all" 

The solution is up to discussion, but for now I plan to unify to return union(datanames, transformers$datanames) as a result.
So if

  • modules(datanames = "all" and transfomers(datanames = "all" we get "all"
  • modules(datanames = "custom" and transfomers(datanames = "all" we get c("custom", "all")
  • modules(datanames = "all" and transfomers(datanames = "custom" we get "all"
  • modules(datanames = "custom" and transfomers(datanames = "custom2" we get c("custom", "custom2")

The main reason for this change is to unify and to have custom datanames returned in module()$datanames if any custom names are passed via module(datanames = parameter.

@m7pr m7pr added the core label Sep 13, 2024
@m7pr m7pr requested a review from gogonzo September 13, 2024 14:30
R/modules.R Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Sep 13, 2024

badge

Code Coverage Summary

Filename                          Stmts    Miss  Cover    Missing
------------------------------  -------  ------  -------  ----------------------------------------------------------------------------------------------------------------------------------------
R/checkmate.R                        24       0  100.00%
R/dummy_functions.R                  49      11  77.55%   30, 32, 44, 55-62
R/get_rcode_utils.R                  12       0  100.00%
R/include_css_js.R                   22      17  22.73%   12-38, 76-82
R/init.R                            110      51  53.64%   107-114, 163-172, 174, 186-207, 232-235, 242-249, 252-253, 255
R/landing_popup_module.R             25      25  0.00%    61-87
R/module_bookmark_manager.R         158     127  19.62%   47-68, 88-138, 143-144, 156, 203, 238-315
R/module_data_summary.R             193      68  64.77%   24-52, 94, 192, 232-272
R/module_filter_data.R               53       2  96.23%   22-23
R/module_filter_manager.R           230      57  75.22%   56-62, 73-82, 90-95, 108-112, 117-118, 291-314, 340, 367, 379, 386-387
R/module_init_data.R                107      11  89.72%   44-53, 67
R/module_nested_tabs.R              167      70  58.08%   33-121, 150, 200, 258, 297
R/module_snapshot_manager.R         216     146  32.41%   89-95, 104-113, 121-133, 152-153, 170-180, 184-199, 201-208, 215-230, 234-238, 240-246, 249-262, 265-273, 304-318, 321-332, 335-341, 355
R/module_teal_data.R                114      21  81.58%   42-48, 87-90, 114-123
R/module_teal_with_splash.R          12      12  0.00%    22-38
R/module_teal.R                     141      92  34.75%   42-145, 182-183, 191
R/module_transform_data.R            56      32  42.86%   17-51
R/modules.R                         181      32  82.32%   166-170, 225-228, 326-327, 359-373, 411, 423-431
R/reporter_previewer_module.R        19       2  89.47%   30, 34
R/show_rcode_modal.R                 24      24  0.00%    17-42
R/tdata.R                            14      14  0.00%    19-61
R/teal_data_module-eval_code.R       24       0  100.00%
R/teal_data_module-within.R           7       0  100.00%
R/teal_data_module.R                 43       0  100.00%
R/teal_data_utils.R                  39       0  100.00%
R/teal_lockfile.R                    56      22  60.71%   34-38, 43-51, 72, 91, 94-102, 109
R/teal_reporter.R                    68       6  91.18%   69, 77, 125-126, 129, 146
R/teal_slices-store.R                29       0  100.00%
R/teal_slices.R                      63       0  100.00%
R/TealAppDriver.R                   353     353  0.00%    52-735
R/utils.R                           198       0  100.00%
R/validate_inputs.R                  32       0  100.00%
R/validations.R                      58      37  36.21%   110-377
R/zzz.R                              12       8  33.33%   3-15
TOTAL                              2909    1240  57.37%

Diff against main

Filename      Stmts    Miss  Cover
----------  -------  ------  --------
TOTAL             0       0  +100.00%

Results for commit: 7212eb0

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

github-actions bot commented Sep 13, 2024

Unit Tests Summary

  1 files   25 suites   9m 16s ⏱️
254 tests 248 ✅ 6 💤 0 ❌
525 runs  519 ✅ 6 💤 0 ❌

Results for commit 7212eb0.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Sep 13, 2024

Unit Test Performance Difference

Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
modules 👶 $+0.00$ module_datanames_is_set_to_all_if_any_transformer_datanames_is_all_
modules 💀 $0.00$ $-0.00$ module_datanames_is_set_to_all_if_transformer_datanames_is_all_

Results for commit fe89e64

♻️ This comment has been updated with latest results.

Copy link
Contributor

@gogonzo gogonzo left a comment

Choose a reason for hiding this comment

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

In module_nested_tabs there is if (identical(modules$datanames, "all")) - c("ADSL", "ADTTE", "all") will not satisfy this condition.

Please be aware that output of the module$datanames should:

  • determine datanames used for module to work
  • determine datanames for transform to work

Please search for every "all" phrase in a code and see how is it handled.

@m7pr
Copy link
Contributor Author

m7pr commented Sep 16, 2024

@gogonzo Then I guess we should go the other way and pick the solution from my suggestion
#1344 (comment)
This way the possible scenarios plays as follow

  • modules(datanames = "all" and transfomers(datanames = "all" we get "all"
  • modules(datanames = "custom" and transfomers(datanames = "all" we get "all"
  • modules(datanames = "all" and transfomers(datanames = "custom" we get "all"
  • modules(datanames = "custom" and transfomers(datanames = "custom2" we get c("custom", "custom2")

@gogonzo
Copy link
Contributor

gogonzo commented Sep 16, 2024

@gogonzo Then I guess we should go the other way and pick the solution from my suggestion #1344 (comment) This way the possible scenarios plays as follow

  • modules(datanames = "all" and transfomers(datanames = "all" we get "all"
  • modules(datanames = "custom" and transfomers(datanames = "all" we get "all"
  • modules(datanames = "all" and transfomers(datanames = "custom" we get "all"
  • modules(datanames = "custom" and transfomers(datanames = "custom2" we get c("custom", "custom2")

Yes, but transformers doesn't have datanames entry. Transformers is a list where each have datanames property/. This means that:

module$datanames = "all" or ANY transformer$datanames = "all" -> "all"
otherwise unique combination of all transformer$datanames and module$datanames

@m7pr m7pr requested a review from gogonzo September 17, 2024 10:03
tests/testthat/test-modules.R Outdated Show resolved Hide resolved
tests/testthat/test-modules.R Outdated Show resolved Hide resolved
@gogonzo gogonzo self-assigned this Sep 17, 2024
m7pr and others added 2 commits September 17, 2024 13:36
Co-authored-by: Dawid Kałędkowski <[email protected]>
Signed-off-by: Marcin <[email protected]>
Co-authored-by: Dawid Kałędkowski <[email protected]>
Signed-off-by: Marcin <[email protected]>
@m7pr m7pr requested a review from gogonzo September 17, 2024 11:36
@m7pr m7pr merged commit ec16ae9 into main Sep 17, 2024
25 checks passed
@m7pr m7pr deleted the combined_datanames@main branch September 17, 2024 13:17
@github-actions github-actions bot locked and limited conversation to collaborators Sep 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.

2 participants