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

472 Remove dm from main function #473

Merged
merged 19 commits into from
Apr 18, 2023
Merged

Conversation

BFalquet
Copy link
Contributor

@BFalquet BFalquet commented Mar 31, 2023

#472

close #472

remove dm from

  • pre
  • main
  • tests
  • vignette
  • documentation

This will cause breaking changes in citril that can be addressed by imply converting dm to list of data.frame with as.list.
The following functions from dunlin are now useless:

  • dm_explicit_na
  • dm_unite

corresponding PR in dunlin to be merged at the same time:
insightsengineering/dunlin#76

thank you for the review

@github-actions
Copy link
Contributor

github-actions bot commented Mar 31, 2023

🧪 $Test coverage: 97.46%$

Code Coverage Summary

Filename                     Stmts    Miss  Cover    Missing
-------------------------  -------  ------  -------  --------------------------------------------------------------
R/ael01_nollt.R                 26       2  92.31%   82-91
R/aet01_aesi.R                 185       7  96.22%   40, 42-46, 278
R/aet01.R                      342       5  98.54%   41, 253, 328, 334, 562
R/aet02.R                      235       1  99.57%   494
R/aet03.R                       83       0  100.00%
R/aet04.R                      106       2  98.11%   169, 186
R/aet10.R                       51       1  98.04%   102
R/assertions.R                  64       0  100.00%
R/checks.R                      20       0  100.00%
R/chevron_tlg-S4class.R         21       0  100.00%
R/chevron_tlg-S4methods.R      136      12  91.18%   410-482
R/cmt01a.R                     186       0  100.00%
R/cmt02_pt.R                    49       0  100.00%
R/dmt01.R                       30       0  100.00%
R/dst01.R                      290       0  100.00%
R/dtht01.R                      98       0  100.00%
R/egt01.R                       45       0  100.00%
R/egt02.R                       56       0  100.00%
R/egt03.R                      132       3  97.73%   118, 164, 322
R/egt05_qtcat.R                 57       0  100.00%
R/ext01.R                       71       4  94.37%   230-231, 235-236
R/lbt01.R                       94       0  100.00%
R/lbt04.R                       49       0  100.00%
R/lbt05.R                       68       5  92.65%   148-153
R/lbt07.R                       90       1  98.89%   171
R/lbt14.R                      188      24  87.23%   54, 56, 108-109, 111-117, 144, 257, 259, 311-312, 314-320, 347
R/mht01.R                       69       2  97.10%   33-34
R/mng01.R                       95      12  87.37%   114, 118-121, 130-138, 180
R/pdt01.R                       57       0  100.00%
R/pdt02.R                       65       0  100.00%
R/utils.R                       73       0  100.00%
R/vst01.R                       47       0  100.00%
R/vst02.R                       92       2  97.83%   109, 240
TOTAL                         3270      83  97.46%

Diff against main

Filename                     Stmts    Miss  Cover
-------------------------  -------  ------  --------
R/ael01_nollt.R                +26      +2  +92.31%
R/aet01_aesi.R                  -2      -1  +0.49%
R/aet01.R                      +14      -1  +0.37%
R/aet02.R                      +16      -1  +0.49%
R/aet04.R                       +1       0  +0.02%
R/aet10.R                      +51      +1  +98.04%
R/chevron_tlg-S4methods.R       +5      -1  +1.10%
R/cmt01a.R                      -3       0  +100.00%
R/cmt02_pt.R                    -2       0  +100.00%
R/dmt01.R                      -10       0  +100.00%
R/dst01.R                       +7       0  +100.00%
R/dtht01.R                      -4       0  +100.00%
R/egt02.R                       -2       0  +100.00%
R/egt03.R                       +2       0  +0.03%
R/egt05_qtcat.R                 +2       0  +100.00%
R/ext01.R                       -8      -4  +4.49%
R/lbt04.R                       -2      -1  +1.96%
R/lbt05.R                       -7      -5  +5.98%
R/lbt07.R                       +4       0  +0.05%
R/lbt14.R                      -12     -10  +4.23%
R/mht01.R                       -2       0  -0.08%
R/mng01.R                       +2       0  +0.27%
R/pdt01.R                       -3     -37  +61.67%
R/pdt02.R                       -2       0  +100.00%
R/utils.R                     -115    -130  +69.15%
R/vst02.R                       -8      -1  +0.83%
TOTAL                          -52    -189  +5.68%

Results for commit: 18fdb97cd2b9031f210e334e9dd4ab4e591c341f

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Mar 31, 2023

Unit Tests Summary

    1 files    32 suites   1m 47s ⏱️
174 tests 124 ✔️   50 💤 0
342 runs  228 ✔️ 114 💤 0

Results for commit 471ab21.

♻️ This comment has been updated with latest results.

R/cmt01a.R Outdated Show resolved Hide resolved
R/cmt02_pt.R Outdated Show resolved Hide resolved
R/dmt01.R Outdated Show resolved Hide resolved
dm_update_zoomed()
db
adam_db$adsl <- adam_db$adsl %>%
mutate(DOMAIN = "ADSL")
Copy link
Contributor

Choose a reason for hiding this comment

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

"domain" is a required variable in adsl, no need to update it here? or we don't want to make it a factor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so we need to add one level to the tree so that punning doesn't cause a bug when some data are missing. That was an old dirty trick, we can probably refactor the code in another issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should create a issue in rtables of this bug

Copy link
Contributor

Choose a reason for hiding this comment

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

is split_rows_by("DOMAIN", split_fun = drop_split_levels, child_labels = "hidden") %>% used to create the indention previously? if so then we can safely remove that part

Copy link
Contributor

Choose a reason for hiding this comment

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

and if you have anything in mind that could lead to this issue, please provide a example so that we can furhter follow up with rtables team

R/dst01.R Show resolved Hide resolved
R/dtht01.R Outdated Show resolved Hide resolved
R/ext01.R Show resolved Hide resolved
@clarkliming
Copy link
Contributor

hi @BFalquet I think it is good chance to evaluate the checks we have for the templates, and unify a bit about creating "factors", and creating "no coding available" thing

@BFalquet BFalquet marked this pull request as draft April 4, 2023 10:02
@BFalquet BFalquet marked this pull request as ready for review April 4, 2023 11:17
@BFalquet
Copy link
Contributor Author

BFalquet commented Apr 4, 2023

Refrain from merging until we get clarification from @crazycatandy (on 2023-04-06)

@BFalquet BFalquet marked this pull request as draft April 4, 2023 14:55
@clarkliming clarkliming closed this Apr 5, 2023
@clarkliming clarkliming reopened this Apr 5, 2023
@clarkliming
Copy link
Contributor

i think in assert_all_tablenames finction, we make sure it is a named list of datasets, or a dm object. that won't break any code. the breaking change is in the filter system but we can try to mitigate it

@BFalquet
Copy link
Contributor Author

BFalquet commented Apr 6, 2023

i think in assert_all_tablenames finction, we make sure it is a named list of datasets, or a dm object. that won't break any code. the breaking change is in the filter system but we can try to mitigate it

Since there are operations downstream that are not supported by dm (such as adam_db$adsl <- adam_db$adsl %>% ...) it might be a bit risky, but we can include a as.list right after the assertion if this is ok. what do you think @clarkliming ?

@clarkliming
Copy link
Contributor

i think in assert_all_tablenames finction, we make sure it is a named list of datasets, or a dm object. that won't break any code. the breaking change is in the filter system but we can try to mitigate it

Since there are operations downstream that are not supported by dm (such as adam_db$adsl <- adam_db$adsl %>% ...) it might be a bit risky, but we can include a as.list right after the assertion if this is ok. what do you think @clarkliming ?

I think they are not in main function, only in preprocessing right? since preprocessing are printted out then probably it is fine

@clarkliming
Copy link
Contributor

let's not make it draft, so that actions can be done automatically. No worries on the retain merging as i can onhold approval

R/aet01.R Show resolved Hide resolved
#' iris = iris
#' )
#'
#' assert_one_tablenames(lsd, c("mtcars", "x", "y"), qualifier = "first test:")
#' }
assert_one_tablenames <- function(db, tab, null_ok = TRUE, qualifier = NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this qualifier for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not very important, it is just an argument to customize the error message. I don't think it is used anymore, we could remove it.

@BFalquet BFalquet marked this pull request as ready for review April 11, 2023 08:30
@clarkliming
Copy link
Contributor

please also update the news

R/aet02.R Show resolved Hide resolved
@BFalquet
Copy link
Contributor Author

sibling PR in dunlin to be merged at the same time: insightsengineering/dunlin#76

This was referenced Apr 13, 2023
Copy link
Contributor

@clarkliming clarkliming left a comment

Choose a reason for hiding this comment

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

In general it looks good. dm is removed. I did not look into every template, but since the tests passed it should be fine. However, I spotted that there are some inconsistency in the code styles/programming practices in these templates. Though it is fine now, we should better update it later. some findings are summarized into #476 . Let's also create an issue to address these inconsistencies later.

BFalquet added a commit to insightsengineering/dunlin that referenced this pull request Apr 18, 2023
the sibling PR of
insightsengineering/chevron#473

- deprecate `dm_unite` and add a new `ls_unite` performing essentially
the same on a list of data.frames.
- deprecate `dm_explicit_na`.
- change join_adsl_adsub into a method, deprecate its usage for dm and
create a method for list of data.frame.

- [x] adapt tests
- [x] adapt pkgdown

---------

Co-authored-by: benoit <benoit.falquet@roche.com>
@BFalquet BFalquet merged commit b8cd0e0 into main Apr 18, 2023
@BFalquet BFalquet deleted the 472-remove-dm-from-main-function@main branch April 18, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove dm from main function
2 participants