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

Closes #23: ADVS template program #35

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

AndersAskeland
Copy link
Member

@AndersAskeland AndersAskeland commented Oct 5, 2024

Closes #23
Thank you for your Pull Request! We have developed this task checklist from the Development Process Guide to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral family codebase remains robust and consistent.

Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the main branch until you have checked off each task.

  • Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
  • Code is formatted according to the tidyverse style guide. Run styler::style_file() to style R and Rmd files
  • Updated relevant unit tests or have written new unit tests, which should consider realistic data scenarios and edge cases, e.g. empty datasets, errors, boundary cases etc. - See Unit Test Guide
  • If you removed/replaced any function and/or function parameters, did you fully follow the deprecation guidance?
  • Update to all relevant roxygen headers and examples, including keywords and families. Refer to the categorization of functions to tag appropriate keyword/family.
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately
  • Address any updates needed for vignettes and/or templates
  • Update NEWS.md under the header # admiral<ext> (development version) if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers)
  • Build site pkgdown::build_site() and check that all affected examples are displayed correctly and that all new functions occur on the Reference page.
  • Address or fix all lintr warnings and errors - lintr::lint_package()
  • Run R CMD check locally and address all errors and warnings - devtools::check()
  • Link the issue in the Development Section on the right hand side.
  • Address all merge conflicts and resolve appropriately
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

@AndersAskeland AndersAskeland changed the title Closes #23 ADVS template program Closes #23: ADVS template program Oct 5, 2024
@AndersAskeland AndersAskeland self-assigned this Oct 5, 2024
Copy link

github-actions bot commented Oct 5, 2024

Code Coverage

Package Line Rate Health
admiralmetabolic 100%
Summary 100% (3 / 3)

@AndersAskeland AndersAskeland marked this pull request as ready for review October 5, 2024 16:34
@AndersAskeland
Copy link
Member Author

Think it should be ready for review now. Feel free to review @pharmaverse/admiralmetabolic .

I've used a somewhat different layout/setup compared to the other admiral packages. For me it makes more sense, but please let me know if it appears strange.

Copy link
Collaborator

@manciniedoardo manciniedoardo left a comment

Choose a reason for hiding this comment

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

Thanks @AndersAskeland!

I did a quick review and left some initial comments - I haven't tired executing the template yet.

In general, I am wondering if we would benefit from building on the existing ADVS template from {admiral} (rather than starting afresh like here) and just adding our extra bits? It would make review easier as well. interested in your thoughts.

inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated
advs <- advs |>
derive_vars_merged(
dataset_add = adsl,
new_vars = exprs(TRTSDT, TRTEDT, TRT01P, TRT01A),
Copy link
Collaborator

Choose a reason for hiding this comment

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

exprs(TRTSDT, TRTEDT, TRT01P, TRT01A) should be stored as adsl_vars (see here) because you then re-use them on line 239 anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually disagree here. I personally believe that a template like this is often used nonsequential, where having arguments stored into objects can be confusing.

Furthermore, not having it stored in an object enables us to not use the injection operator (!!!) later in the code, which is in my opinion a fairly advanced feature which will confuse people.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see your point. I myself sometimes struggle with these operators myself!!

However:

  1. Within the {admiral} programming concepts and conventions sheet we specifically indicate that we use this style of quoting/unquoting, see here
  2. This is already used throughout all admiral templates so would be strange to vary within the extension package.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am still very hesitant about this change. I will implement it now, but I think it needs to be revisited in the future. I personally believe as Admiral becomes more widespread, we would need to lower the bar of entry. Especially considering many people coming in are coming from SAS with little to no experience in R.

Would also love the team (@pharmaverse/admiralmetabolic) to also give their input.

inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated
),
get_unit_expr = VSSTRESU,
filter = VSSTAT != "NOT DONE" | is.na(VSSTAT),
constant_by_vars = exprs(USUBJID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this required?

Copy link
Member Author

Choose a reason for hiding this comment

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

Which part? I am unsure about the filter, but it is based on our current vignette. Do you know why we have used a filter @Siddhesh2097 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is as per the BDS finding vignette. But it's not required in this case as per the vs_metabolic data.
I think we should remove it as it creates unnecessary confusion to the user.
@AndersAskeland @manciniedoardo

inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
Copy link

@starosto starosto left a comment

Choose a reason for hiding this comment

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

Hi @AndersAskeland , I have posted some comments. Well done!

inst/ad_advs.R Outdated
library(stringr)


# Define look-up tables ----
Copy link

Choose a reason for hiding this comment

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

I would place link to the function directly before using the function

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean? Would you place the library calls directly before using any functionalities within that package? I.e. that we load stringr() right before the code where we actually use it?

Copy link

Choose a reason for hiding this comment

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

I would place "https://pharmaverse.github.io/admiral/reference/derive_vars_merged_lookup.html" link directly before using the function derive_vars_merged_lookup(), same with derive_vars_cat()

Copy link
Member Author

@AndersAskeland AndersAskeland Oct 23, 2024

Choose a reason for hiding this comment

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

The lookup table creations were moved a bit around, where they now reside under their respective use places. That actually means that the functions are not referenced directly. Instead the respective BDS vignette part is referenced, which should have some description about lookup tables. I think this is adequate, do you agree?

inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
inst/ad_advs.R Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Template: ADVS
4 participants