Skip to content

Skip unique key detection for contacts#280

Merged
sbfnk merged 6 commits intomainfrom
fix-contact-merge-duplicates
Feb 4, 2026
Merged

Skip unique key detection for contacts#280
sbfnk merged 6 commits intomainfrom
fix-contact-merge-duplicates

Conversation

@sbfnk
Copy link
Collaborator

@sbfnk sbfnk commented Feb 4, 2026

Summary

Fixes #278

  • Skip unique key detection for contacts entirely in load_survey()
  • If merging creates duplicate contact rows, the merge is rejected (conservative approach)
  • We don't have methodology for longitudinal contacts, so this is the appropriate behaviour

This fix prevents load_survey() from failing when contact files lack a cont_id column.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed load_survey() failing when merging contact files without a cont_id column
    • Enhanced handling of duplicate entries in longitudinal survey data with stricter validation
    • Improved participant key detection with more robust fallback mechanisms for invalid keys
  • Documentation

    • Added new package author to acknowledgments

sbfnk and others added 5 commits January 19, 2026 17:25
- Update version to 0.5.0
- Add release summary and acknowledgments to NEWS.md

Co-authored-by: sbfnk-bot <242615673+sbfnk-bot@users.noreply.github.com>
Co-authored-by: sbfnk-bot <242615673+sbfnk-bot@users.noreply.github.com>
Co-authored-by: sbfnk-bot <242615673+sbfnk-bot@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This PR adds Nicholas Tierney as a package author to the DESCRIPTION file and fixes a bug in load_survey() where contact files lacking a cont_id column caused failures by improving duplicate handling and key detection logic in the file merging process.

Changes

Cohort / File(s) Summary
Metadata & Documentation
DESCRIPTION, NEWS.md
Added Nicholas Tierney as author with email and ORCID identifier; documented bug fix for missing cont_id column handling.
Survey Loading Logic
R/load-survey-utils.R
Tightened duplicate handling in try_merge_additional_files to reject contact file merges with duplicates; adjusted base key determination to consistently use "part_id"; enhanced participant_key validation to check column existence and duplicates; generalized final_detected_key assignment beyond participant-only types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 A contact without ID? No fret!
We'll detect the key, the safest bet.
With Nicholas aboard to guide the way,
Survey loading brightens this fine day!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Skip unique key detection for contacts' accurately reflects the main code change in R/load-survey-utils.R where contacts are now excluded from unique key detection.
Linked Issues check ✅ Passed The PR directly addresses issue #278 by preventing load_survey() from failing when contact files lack cont_id, implementing the solution to skip unique key detection for contacts.
Out of Scope Changes check ✅ Passed All changes are within scope: DESCRIPTION adds a new author, NEWS.md documents the fix, and R/load-survey-utils.R implements the core fix for issue #278.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-contact-merge-duplicates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sbfnk sbfnk linked an issue Feb 4, 2026 that may be closed by this pull request
@sbfnk sbfnk added this pull request to the merge queue Feb 4, 2026
Merged via the queue into main with commit 28e4a93 Feb 4, 2026
13 checks passed
@sbfnk sbfnk deleted the fix-contact-merge-duplicates branch February 4, 2026 11:33
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.

US healthcare survey missing cont_id column Survey Check Failure - 2025-10-24

1 participant