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 #91 length attribute from max data length #213

Merged
merged 43 commits into from
Feb 11, 2024
Merged

Closes #91 length attribute from max data length #213

merged 43 commits into from
Feb 11, 2024

Conversation

cpiraux
Copy link
Collaborator

@cpiraux cpiraux commented Jan 10, 2024

Thank you for your Pull Request!

We have developed a Pull Request template to aid you and our reviewers. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the xportr codebase remains robust and consistent.

The scope of {xportr}

{xportr}'s scope is to enable R users to write out submission compliant xpt files that can be delivered to a Health Authority or to downstream validation software programs. We see labels, lengths, types, ordering and formats from a dataset specification object (SDTM and ADaM) as being our primary focus. We also see messaging and warnings to users around applying information from the specification file as a primary focus. Please make sure your Pull Request meets this scope of {xportr}. If your Pull Request moves beyond this scope, please get in touch with the {xportr} team on slack or create an issue to discuss.

Please check off each task box as an acknowledgment that you completed the task. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the devel branch until you have checked off each task.

Changes Description

  • Add a function argument to get the length either from metadata or data.
  • Add a utility function to get the maximum data length per variable, facilitating the automation of metadata length updates.

Task List

  • The spirit of xportr is met in your Pull Request
  • Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
  • Summary of changes filled out in the above Changes Description. Can be removed or left blank if changes are minor/self-explanatory.
  • Code is formatted according to the tidyverse style guide. Use styler package and functions to style files accordingly.
  • Updated relevant unit tests or have written new unit tests. See our Wiki for conventions used in this package.
  • Creation/updated relevant roxygen headers and examples. See our Wiki for conventions used in this package.
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately
  • Run pkgdown::build_site() and check that all affected examples are displayed correctly and that all new/updated functions occur on the "Reference" page.
  • Update NEWS.md if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers)
  • Make sure that the pacakge version in the NEWS.md and DESCRIPTION file is same. Don't worry about updating the version because it will be auto-updated using the vbump.yaml CI.
  • Address any updates needed for vignettes and/or templates
  • Link the issue Development Panel so that it closes after successful merging.
  • Fix merge conflicts
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8f5fc66) 100.00% compared to head (98c075f) 100.00%.
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #213   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           14        14           
  Lines          636       664   +28     
=========================================
+ Hits           636       664   +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cpiraux cpiraux linked an issue Jan 10, 2024 that may be closed by this pull request
2 tasks
@cpiraux cpiraux marked this pull request as ready for review January 11, 2024 13:11
@EeethB EeethB self-requested a review January 11, 2024 16:39
@bms63
Copy link
Collaborator

bms63 commented Jan 16, 2024

Hi @cpiraux going to have to resolve merge conflicts - a big PR was just merged. Let me know if you need help

@EeethB EeethB requested a review from bms63 January 18, 2024 16:37
Copy link
Collaborator

@averissimo averissimo left a comment

Choose a reason for hiding this comment

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

Great job on this ❤️

Some minor comments on parameter assertion

R/length.R Outdated Show resolved Hide resolved
R/utils-xportr.R Show resolved Hide resolved
R/messages.R Show resolved Hide resolved
R/utils-xportr.R Outdated Show resolved Hide resolved
cpiraux and others added 4 commits January 26, 2024 09:46
Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
@bms63
Copy link
Collaborator

bms63 commented Jan 28, 2024

@cpiraux I was missing around with this PR. I noticed that one line had match.args and not match.arg which was causing the R-CMD checks to fail.

Now this new one is showing up. I ran out of time to investigate. Hoping you see the underlying issue!!

image

Merge remote-tracking branch 'origin/main' into 91-max-length

# Conflicts:
#	R/length.R
#	man/metadata.Rd
#	man/xportr_length.Rd
@bms63
Copy link
Collaborator

bms63 commented Jan 29, 2024

@averissimo could you take a look at how we are using match.arg I am not able to get it to work.

@cpiraux I had to put in your argument into the vignettes and update the example for xportr_length() and things are working again!! yay!

Some thoughts:

  1. Does xportr_lenght(lenght = "metadata") need to be integrated into xportr_metadata and xportr_write_all() functions? @EeethB something for us to ponder (lets address in separate issue/PR if we think it needs to be updated.)

  2. @cpiraux probably shoudl build an example in the documents (function and vignettes) that allows the user to specify length = "data" and show user how it works (let's create separate issue/PR for this one - can you please create the issue)

  3. I think the length argument should be re-visited as I found it a bit confusing. Maybe variable_source_length or source_length, length_source?

Okay!! this one is almost to the finish line. Way to go!!

@averissimo
Copy link
Collaborator

🤦 I had a typo on the suggestion, sorry about the match.args -> match.args

@bms63 Traced the issue to the "new" order of parameters. vignettes, have variations of the snippet below where they assume that the 3rd element is the verbose instead of metadata.

adsl %>%
  xportr_type(var_spec, "ADSL", "message") %>%
  xportr_length(var_spec, "ADSL", "message")
#...

R/length.R Outdated Show resolved Hide resolved
NEWS.md Outdated Show resolved Hide resolved
R/length.R Outdated
@@ -56,12 +68,14 @@
#' length = c(10, 8)
#' )
#'
#' adsl <- xportr_length(adsl, metadata, domain = "adsl")
#' adsl <- xportr_length(adsl, metadata, domain = "adsl", length = "metadata")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#' adsl <- xportr_length(adsl, metadata, domain = "adsl", length = "metadata")
#' adsl <- xportr_length(adsl, metadata, domain = "adsl", length_source = "metadata")

Copy link
Collaborator

Choose a reason for hiding this comment

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

All these will need to have the argument updated to length_source

@@ -194,7 +194,7 @@ To help reduce these repetitive calls, we have created `xportr_metadata()`. A us
adsl %>%
xportr_metadata(var_spec, "ADSL") %>%
xportr_type() %>%
xportr_length() %>%
xportr_length(length = "metadata") %>%
Copy link
Collaborator

Choose a reason for hiding this comment

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

wondering if this can be removed since metadata is default??

Copy link
Collaborator

@bms63 bms63 left a comment

Choose a reason for hiding this comment

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

Very close!! Just need to update where ever length is used to length_source

Copy link
Collaborator

@bms63 bms63 left a comment

Choose a reason for hiding this comment

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

@cpiraux You are amazing!! Thanks for seeing this one through for us.

@bms63 bms63 merged commit de2beba into main Feb 11, 2024
13 checks passed
@bms63 bms63 deleted the 91-max-length branch February 11, 2024 16:30
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.

Allotted length: maximum length of the variable
3 participants