Add text validation and choice consistency checks#11
Merged
Conversation
Implements metadata-driven validation for REDCap text fields and choice values. Adds new validation.R module with parsers for supported text validation types: integers, decimals, dates, datetimes, times, emails, and phone numbers. Consistency checks now detect invalid choice codes in radio, dropdown, Yes/No, and True/False fields, and invalid formats in validated text fields. Enhances data import to request raw codes with type guessing disabled, ensuring choice values like '0' and '1' remain character rather than being coerced to logical. Adds caching for validation parsing and form applicability to improve performance. Removes orphaned_branching_reference check in favor of stricter validation and choice enforcement. Updates quality report documentation and test coverage.
rsh52
marked this pull request as ready for review
July 16, 2026 16:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This update expands
build_quality_report()with metadata-driven validation findings, corrects several false-positive scenarios, and improves report execution performance.Changes
invalid_choice_valuefindings for radio, dropdown, Yes/No, and True/False fields using raw REDCap values and metadata-defined choice codes.invalid_validation_formatfindings for supported text validation types configured throughtext_validation_type_or_show_slider_number.text_validation_minandtext_validation_maxbounds throughoutside_validation_range..850and-.850.YYYY-MM-DD.YYYY-MM-DD HH:MMorYYYY-MM-DD HH:MM:SS.orphaned_branching_referencebecause valid cross-form, event-qualified, and smart-variable references could not be reliably distinguished from missing references.invalid_choice_value:0/1values.checkbox_no_values_selectedandcheckbox_none_with_otherfindings remain.Performance
Documentation
build_quality_report()documentation with supported validation behavior.Testing
styler,lintr, pkgdown build, and package check.R CMD check: 0 errors, 0 warnings, 0 notes.