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

add shinyvalidate to tmg #498

Merged
merged 75 commits into from
Jan 11, 2023
Merged

add shinyvalidate to tmg #498

merged 75 commits into from
Jan 11, 2023

Conversation

mhallal1
Copy link
Collaborator

@mhallal1 mhallal1 commented Dec 22, 2022

closes #420

@mhallal1 mhallal1 added the core label Dec 22, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2022

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  ----------------------------------------------
R/tm_a_pca.R                    821     821  0.00%    73-1023
R/tm_a_regression.R             710     710  0.00%    93-887
R/tm_data_table.R               171     171  0.00%    59-282
R/tm_file_viewer.R              172     172  0.00%    39-241
R/tm_front_page.R               127     116  8.66%    64-206
R/tm_g_association.R            327     327  0.00%    90-476
R/tm_g_bivariate.R              649     489  24.65%   125-700, 748, 754, 758, 869, 886, 904, 924-946
R/tm_g_distribution.R          1000    1000  0.00%    111-1234
R/tm_g_response.R               346     346  0.00%    86-496
R/tm_g_scatterplot.R            712     712  0.00%    143-946
R/tm_g_scatterplotmatrix.R      278     259  6.83%    79-374, 428, 442
R/tm_missing_data.R            1034    1034  0.00%    59-1229
R/tm_outliers.R                 940     940  0.00%    73-1135
R/tm_t_crosstable.R             251     251  0.00%    82-371
R/tm_variable_browser.R         815     810  0.61%    62-1294
R/utils.R                       122     122  0.00%    74-352
R/zzz.R                           1       1  0.00%    2
TOTAL                          8476    8281  2.30%

Diff against main

Filename                      Stmts    Miss  Cover
--------------------------  -------  ------  --------
R/tm_a_pca.R                    +39     +39  +100.00%
R/tm_a_regression.R              +2      +2  +100.00%
R/tm_data_table.R                +5      +5  +100.00%
R/tm_g_association.R            +11     +11  +100.00%
R/tm_g_bivariate.R              +38     +38  -1.53%
R/tm_g_distribution.R           +44     +44  +100.00%
R/tm_g_response.R               +27     +27  +100.00%
R/tm_g_scatterplot.R            +30     +30  +100.00%
R/tm_g_scatterplotmatrix.R       +8      +8  -0.20%
R/tm_missing_data.R             +22     +22  +100.00%
R/tm_outliers.R                  +6      +6  +100.00%
R/tm_t_crosstable.R             +19     +19  +100.00%
TOTAL                          +251    +251  -0.07%

Results for commit: 961b22e

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2022

Unit Tests Summary

  1 files    5 suites   0s ⏱️
16 tests 16 ✔️ 0 💤 0
49 runs  49 ✔️ 0 💤 0

Results for commit e39ec80.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@nikolas-burkoff nikolas-burkoff left a comment

Choose a reason for hiding this comment

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

A few comments here - (don't forget the NEWS as well)

R/tm_g_bivariate.R Outdated Show resolved Hide resolved
R/tm_g_scatterplot.R Outdated Show resolved Hide resolved
R/tm_g_scatterplot.R Outdated Show resolved Hide resolved
R/tm_g_scatterplot.R Show resolved Hide resolved
R/tm_data_table.R Outdated Show resolved Hide resolved
R/tm_g_bivariate.R Outdated Show resolved Hide resolved
R/tm_g_bivariate.R Outdated Show resolved Hide resolved
R/tm_g_bivariate.R Outdated Show resolved Hide resolved
R/tm_g_association.R Outdated Show resolved Hide resolved
R/tm_g_association.R Outdated Show resolved Hide resolved
R/tm_outliers.R Outdated Show resolved Hide resolved
@mhallal1 mhallal1 removed the blocked label Dec 24, 2022
mhallal1 and others added 2 commits December 29, 2022 15:28
some more modules

Signed-off-by: Aleksander Chlebowski <[email protected]>
Co-authored-by: Mahmoud Hallal <[email protected]>
@asbates
Copy link

asbates commented Dec 29, 2022

Should the test selection validation use shinyvalidate?

@asbates

This comment was marked as outdated.

@chlebowa
Copy link
Contributor

Should the test selection validation use shinyvalidate?

I believe this initial validation should be left as is.

@chlebowa

This comment was marked as off-topic.

Copy link
Contributor

@chlebowa chlebowa left a comment

Choose a reason for hiding this comment

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

tm_g_bivariate:
add this to example app:

      row_facet = data_extract_spec(
        dataname = "ADSL",
        select = select_spec(
          label = "Select variable:",
          choices = variable_choices(ADSL),
          selected = "ARM",
          fixed = FALSE
        )
      ),
      col_facet = data_extract_spec(
        dataname = "ADSL",
        select = select_spec(
          label = "Select variable:",
          choices = variable_choices(ADSL),
          selected = "COUNTRY",
          fixed = FALSE
        )
      )

tm_g_scatterplot:
Marginal density check should be added to validator. Use condition method or crule function, whichever works.

R/tm_data_table.R Outdated Show resolved Hide resolved
R/tm_data_table.R Outdated Show resolved Hide resolved
R/tm_data_table.R Outdated Show resolved Hide resolved
R/tm_data_table.R Outdated Show resolved Hide resolved
R/tm_g_association.R Outdated Show resolved Hide resolved
R/tm_missing_data.R Outdated Show resolved Hide resolved
}
)
iv_summary_table$add_rule(
"variables_select",
Copy link
Contributor

Choose a reason for hiding this comment

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

One variable must not be validated by multiple validators as conflicts may ensue. (I'm not sure if this includes children.) I suggest using crule here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A condition is set for iv_summary_table:
iv_summary_table$condition(~ input$summary_type == "By Variable Levels")

Copy link
Contributor

Choose a reason for hiding this comment

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

What I mean is there is a rule for variables_select in iv AND in iv_summary_table. Even though this is a child, it is another validator. shinyvalidate strongly discourages putting rules for one input in several validators. If it works here, I don't mind much.

R/tm_outliers.R Outdated
),
filter_validation_rule = list(
categorical_var = shinyvalidate::compose_rules(
~ if (length(selector_list()$categorical_var()$select) > 0 && length(.) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This checks length of categorical_var twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not really, the first is for the selection of the variable and the second is for the levels.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't selector_list()$categorical_var()$select the value of the categorical_var input, just like .?

Copy link
Contributor

Choose a reason for hiding this comment

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

alas no...
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Right. I changed the rule here but I cannot formulate the proper assertions in categorical_var.

R/tm_outliers.R Outdated Show resolved Hide resolved
R/tm_t_crosstable.R Outdated Show resolved Hide resolved
gogonzo and others added 2 commits January 5, 2023 10:04
closes #505 

Some methods (two way) require `strata_var` arg which is optional. I've
excluded these tests from choices
R/tm_outliers.R Outdated Show resolved Hide resolved
gogonzo
gogonzo previously requested changes Jan 5, 2023
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.

Whole outliers module is rerendered when anything is changed in the encoding panel. One can't change encodings being in the "Density Plot" tab or in the "CD Plot" without being forced back to the first tab after rerender.

Aleksander Chlebowski and others added 4 commits January 5, 2023 15:15
NEWS.md Outdated Show resolved Hide resolved
Signed-off-by: Nikolas Burkoff <[email protected]>
@nikolas-burkoff nikolas-burkoff linked an issue Jan 6, 2023 that may be closed by this pull request
3 tasks
R/tm_a_pca.R Outdated Show resolved Hide resolved
Copy link
Contributor

@nikolas-burkoff nikolas-burkoff left a comment

Choose a reason for hiding this comment

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

Once @gogonzo is happy with outliers and #509 is merged in then this can be merged in

Nikolas Burkoff and others added 3 commits January 6, 2023 14:33
The only place `extract_input` is used is now in the outliers modules so
if it's removed there then the function can be deleted

Note found issue
#510 -
which is on main as well
- turn `categorical_var` to use generic data-extract-spec instead of
handling filter_spec only. Removed custom handling of the NA in the
module. Theoretically, this NA problem could exist in every module where
user could provide similar settings.
- No validation on the filter - we can't expect specific filter
selection in the data_extract_spec - consequently we could do the same
in the rest of the modules.
@mhallal1 mhallal1 merged commit c106336 into main Jan 11, 2023
@mhallal1 mhallal1 deleted the 420_shinyvalidate@main branch January 11, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
8 participants