Universal Field Validator

Universal Field Validator

A REDCap external module that validates fields as they are typed: check-character IDs, regex formats, cross-field constraints, conditional required fields, cross-record uniqueness and dynamic choice filtering.

A mistyped participant ID costs hours of reconciliation later. This REDCap external module catches it while the person who typed it is still looking at the field — no page reload, no batch Data Quality run afterwards.

Rules are configured through REDCap's own settings screen or as field annotations. There is no code to paste and no JavaScript Injector dependency.

The five action tags

Each tag is one kind of rule. They compose — a single field may carry several, and all must pass, each with its own independent save-block state.

TagWhat it checksGap it closes in stock REDCap
@UVALIDATE Check character or regex format Custom regex validation types need a server-wide admin change
@UVASSERT A condition across other fields Branching only hides; range checks only warn
@UVREQUIRED Required, but only while a condition holds The native required flag is unconditional and only warns
@UVUNIQUE No duplicate values across records REDCap has no field-level uniqueness at all
@UVCHOICES Which choices of a field are visible @HIDECHOICE hides options statically

Two validation families, one engine

Check-character IDs — participant and specimen IDs minted with ISO/IEC 7064, Damm, Verhoeff or Luhn check characters. Recomputing the check catches virtually every typo and mis-scan, including the ones a regex can never see, such as a 3 typed as an 8.

Any structured value — study codes, lab numbers, device serials or legacy IDs matched against a regex pattern set per rule by a project designer, with progressive "what's still missing" guidance instead of a bare error.

Enforcement levels

Every rule is set to one of three levels:

What Compulsory does and does not cover. It blocks human form saves in the browser. It cannot stop an API or Data Import write. A redcap_save_record hook re-checks saved values on the server with the same rule semantics and logs violations, but it fires after the write — treat it as detection and audit, not a hard reject. A rule is also never allowed to trap a read-only field the user cannot fix.

Pooled fields

A single box holding several IDs — space-separated, comma-separated, or jammed together with no separator at all — is split into individual IDs at the boundaries where the check character verifies. Each member gets its own chip, with warnings for leftover junk, duplicates and wrong pool size.

Methods supported

ISO/IEC 7064 Mod 37,36 (the default), Mod 11,10, Mod 97,10, Mod 11,2, Mod 37,2 and two letters-only variants; Damm, Verhoeff and Luhn; four digit-only weighted-modulus schemes (GS1 Mod-10, ABA Mod-10, ICAO MRZ Mod-10 and ISBN-10 weighted Mod-11); and none for format-only validation. The method must match how the IDs were originally minted.

The three Mod-10 schemes catch every single-digit error at any length but miss adjacent swaps of digits differing by 5. weighted_mod11 catches every single-digit error and every adjacent swap only up to 9 digits — at 10 or more digits the position carrying weight 11 goes blind to substitutions, so prefer Mod 11,2 or Mod 97,10 for longer numbers.

How it works

A REDCap administrator installs the module once. Each project then enables it and adds rules on its own settings screen. On every form and survey the module reads its settings, builds a config object and injects the verified engine. Nothing is hard-coded per project and no third-party module is required.

REDCap settings  →  UniversalValidator.php  →  window.INSPIRE_VALIDATOR_CONFIG
                                           →  js/engine.js (verified engine)
                    redcap_save_record      →  php/CheckCharacter.php (server guard)

The same verified engine backs the companion QR/ID generator, so an ID minted there validates identically here, in Excel, and in the browser.

Requirements

See the install page to get started.