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 2661 - ignore_seconds_flag now defaults to TRUE. #2670

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

Conversation

jimrothstein
Copy link
Collaborator

@jimrothstein jimrothstein commented Feb 26, 2025

… Need to review vignettes.

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 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?
  • Review the Cheat Sheet. Make any required updates to it by editing the file inst/cheatsheet/admiral_cheatsheet.pptx and re-upload a PDF and a PNG version of it to the same folder. (The PNG version can be created by taking a screenshot of the PDF version.)
  • 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 (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). A Developer Notes section is available in NEWS.md for tracking developer-facing issues.
  • Build admiral 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!

@jimrothstein jimrothstein linked an issue Feb 26, 2025 that may be closed by this pull request
3 tasks
@jimrothstein jimrothstein self-assigned this Feb 26, 2025
@jimrothstein
Copy link
Collaborator Author

jimrothstein commented Mar 2, 2025

@bms63 @zdz2101

  • changed default ignore_seconds_flag to TRUE in derive_vars_dtm()
  • there are problems: first code example (approx line # 59) has non-zero seconds;
  • so error thrown at line # 752 in compute_tmf()
 if (any(!is.na(partial[["second"]]))) {

This is draft, not PR. The discussion has details. Any suggestions what I should do next?

@jimrothstein jimrothstein requested a review from zdz2101 March 2, 2025 21:45
@bms63 bms63 removed the request for review from zdz2101 March 2, 2025 22:05
@bms63
Copy link
Collaborator

bms63 commented Mar 2, 2025

Hi @jimrothstein as far as I know @zdz2101 is not involved in admiral anymore so no need to ping him or assign him as a reviewer.

@bms63
Copy link
Collaborator

bms63 commented Mar 2, 2025

Hi @jimrothstein I started to investigate each issue that was causing errors in the checks. Most are related to what the argument is checking. You can see how I adjusted things as I went in the files changed. I would start with understanding what the argument is doing originally and how I have changed it and what that is impacting on the examples, vignettes and tests. I left you the test to update.

We might need to re-visit how we present the examples and vignettes later, but for now I think you should focus on what has been updated in this one argument and how this minor changes percolates throughout admiral. Once the checks are all pass we can revisit if the examples and vignettes are coherent.

Also note we might want to alert the users that we have changed this default behavior...but not sure on that yet

@jimrothstein jimrothstein marked this pull request as ready for review March 3, 2025 04:50
@jimrothstein jimrothstein requested a review from jeffreyad as a code owner March 3, 2025 04:50
@jimrothstein
Copy link
Collaborator Author

@jeffreyad

Changes made:

  • default value for ignore_seconds_flag in derive_vars_dtm is NOW TRUE
  • several tests in testthat were removed because they contained seconds, which threw an error.

NEXT? If this much is ok, then will go through vignettes/examples etc.

Copy link
Collaborator

@bundfussr bundfussr left a comment

Choose a reason for hiding this comment

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

  • The default of ignore_seconds_flag in compute_tmf() should be updated as well to be consistent.
  • The change should added to the "Breaking Changes" section in NEWS.md.

@@ -58,7 +58,7 @@
#'
#' mhdt <- tribble(
#' ~MHSTDTC,
#' "2019-07-18T15:25:40",
#' "2019-07-18T15:25",
Copy link
Collaborator

Choose a reason for hiding this comment

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

The first and the second record are the same. One of them should be removed.

Further updates of the examples are required as the first and third example are the same.

  • The third example should be updated such that it shows the behaviour when ignore_seconds_flag = FALSE is used.
  • An example should be added to show that an error is issued if seconds are present in the DTC variable and ignore_seconds_flag is not set to FALSE. This should also be mentioned in the description of the ignore_seconds_flag argument.

Copy link
Collaborator Author

@jimrothstein jimrothstein Mar 3, 2025

Choose a reason for hiding this comment

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

@bundfussr
Working on the changes ... thanks

An example should be added to show that an error is issued if seconds are present in the DTC variable and >ignore_seconds_flag is not set to FALSE.

Meaning: "2019-07-18T15:25:40" will throw error when ignore_seconds_flag is DEFAULT (ie TRUE)?

  • By hand, I will work out a chart of what happens, given --DTF and various parameters.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Meaning: "2019-07-18T15:25:40" will throw error when ignore_seconds_flag is DEFAULT (ie TRUE)?

Yes

@@ -789,7 +782,7 @@ test_that("derive_vars_dtm Test 31: catch ignore_seconds_flag error", {
dtc = XXSTDTC,
ignore_seconds_flag = TRUE
),
error = TRUE
error = FALSE
Copy link
Collaborator

Choose a reason for hiding this comment

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

This unit test should test that an error is issued. I.e., the input data needs to be updated such that the error is thrown.

@@ -789,7 +782,7 @@ test_that("derive_vars_dtm Test 31: catch ignore_seconds_flag error", {
dtc = XXSTDTC,
ignore_seconds_flag = TRUE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be removed as it is the default now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The note in the "Imputation Flags" section needs to be updated.

@bms63
Copy link
Collaborator

bms63 commented Mar 3, 2025

@jimrothstein we discussed in today's core meeting. We want to try something new in admiral where we are first going to alert the users to this upcoming change in 1.3 and in 1.4 implement the change.

so i'll make a new issue messaging alert and then this change can be done much later

Copy link

github-actions bot commented Mar 3, 2025

Code Coverage

Package Line Rate Health
admiral 98%
Summary 98% (5316 / 5421)

@jimrothstein
Copy link
Collaborator Author

jimrothstein commented Mar 5, 2025

@bundfussr

  • not done, but made several changes
  • please take a quick look/feedback
  • next: vignette imputation
  • thx !

@bms63
Copy link
Collaborator

bms63 commented Mar 5, 2025

@jimrothstein we discussed in today's core meeting. We want to try something new in admiral where we are first going to alert the users to this upcoming change in 1.3 and in 1.4 implement the change.

so i'll make a new issue messaging alert and then this change can be done much later

Hi @jimrothstein just want to make sure you understand that we are not going to implement this change for 1.3 (June release). We are just going to alert users to the coming change which will be implemented in 1.4 (EOY release).

@jimrothstein
Copy link
Collaborator Author

@bms63
Please check slack - thanks.

@jeffreyad
Copy link
Collaborator

Hi @jimrothstein and @bundfussr for derive_vars_dtm() when time_imputation is set to a time value, the seconds are still required or there is a warning that it fails to parse. Do you think this should be updated to accept either values like "00:00" or "00:00:00"?

Warning message:
All formats failed to parse. No formats found. 

@jimrothstein
Copy link
Collaborator Author

@jeffreyad
I defer to @bundfussr (I will only be guessing)

@bundfussr
Copy link
Collaborator

Hi @jimrothstein and @bundfussr for derive_vars_dtm() when time_imputation is set to a time value, the seconds are still required or there is a warning that it fails to parse. Do you think this should be updated to accept either values like "00:00" or "00:00:00"?

Warning message:
All formats failed to parse. No formats found. 

I think we should check if the value specified for time_imputation is valid and issue an error if it is invalid. The current message is not helpful.

I'm not sure if we should accept "00:00". Even if ignore_seconds_flag = TRUE is specified, seconds are imputed. I.e., if we accept "00:00" or "23:59", we would need to decide which value for the seconds should be used. I would tend to keep it simple and require that the user provides this information.

@bms63 , @manciniedoardo , what do you think?

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.

General Issue: ignore_seconds_flag = TRUE is set as default
4 participants