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

Fix failure when forms is used for projects with a stand-alone record id instrument #213

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

ezraporter
Copy link
Collaborator

Description

This PR fixes a bug causing read_redcap() to fail when:

  1. forms is supplied and doesn't include the instrument with the record ID AND
  2. the record ID instrument contains no other fields

This scenario results in an empty metadata df inside get_fields_to_drop(). The fix was including an early return if this occurs.

I also did some cleanup to resolve lingering warnings when tidyselect >=1.2.0 is installed.

Proposed Changes

  • Update get_fields_to_drop() to return early if metadata has no additional fields to drop
  • Add test case to cover this scenario
  • Fix tidyselect warnings

Issue Addressed

relates to #212

PR Checklist

Before submitting this PR, please check and verify below that the submission meets the below criteria:

  • New/revised functions have associated tests
  • New/revised functions that update downstream outputs have associated static testing files (.RDS) updated under inst/testdata/create_test_data.R
  • New/revised functions use appropriate naming conventions
  • New/revised functions don't repeat code
  • Code changes are less than 250 lines total
  • Issues linked to the PR using GitHub's list of keywords
  • The appropriate reviewer is assigned to the PR
  • The appropriate developers are assigned to the PR
  • Pre-release package version incremented using usethis::use_version()

Code Review

This section to be used by the reviewer and developers during Code Review after PR submission

Code Review Checklist

  • I checked that new files follow naming conventions and are in the right place
  • I checked that documentation is complete, clear, and without typos
  • I added/edited comments to explain "why" not "how"
  • I checked that all new variable and function names follow naming conventions
  • I checked that new tests have been written for key business logic and/or bugs that this PR fixes
  • I checked that new tests address important edge cases

@ezraporter ezraporter added the bug Something isn't working label Nov 25, 2024
@ezraporter ezraporter requested a review from rsh52 November 25, 2024 17:37
@ezraporter ezraporter self-assigned this Nov 25, 2024
Copy link
Collaborator

@rsh52 rsh52 left a comment

Choose a reason for hiding this comment

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

Works how we want, looks good, solution is succinct. What more could we ask for?

Thanks for the bonus tidyselect fixes!

Let #212 know if they want to use the dev version it will work now if you don't mind.

🚀

@ezraporter ezraporter merged commit 19b1241 into main Nov 25, 2024
4 checks passed
@ezraporter ezraporter deleted the fix-record-id-bug branch November 25, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants