Skip to content

Cast form status fields to integer to avoid haven error#235

Merged
ezraporter merged 2 commits intomainfrom
fix-haven-labs-bug
Nov 4, 2025
Merged

Cast form status fields to integer to avoid haven error#235
ezraporter merged 2 commits intomainfrom
fix-haven-labs-bug

Conversation

@ezraporter
Copy link
Copy Markdown
Collaborator

Description

This PR implements the fix described in #232 (comment) to cast form_status_complete fields to integer to avoid failures when raw_or_label = "haven" and the REDCap project returns data from the API where an entire *_complete column is NA.

#234 describes an instance in which this can occur. We were already assuming these fields were integer type when applying factor levels so this change just ensures that explicitly.

Proposed Changes

List changes below in bullet format:

  • Cast *_complete variables to integer in multi_choice_to_labels()
  • Add test case to ensure that multi_choice_to_labels() succeeds when raw_or_label = "haven" and the data contains a *_complete variable that is fully NA

Issue Addressed

closes #232

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 self-assigned this Oct 31, 2025
@ezraporter ezraporter added the bug Something isn't working label Oct 31, 2025
@ezraporter ezraporter requested a review from skadauke November 3, 2025 12:34
@ezraporter ezraporter merged commit 5401912 into main Nov 4, 2025
4 checks passed
@ezraporter ezraporter deleted the fix-haven-labs-bug branch November 4, 2025 15:41
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.

[BUG] Update package to support form_status_complete to have NULL values, to avoid error in `across() when exporting with raw_or_label = "haven"

1 participant