Skip to content

Commit 94ac81d

Browse files
committed
(fix) Add regex anchors to SSN identifier format validation
The regex for the SSN identifier format was missing the anchors (^ and $), which caused the validation to fail for identifiers that did not exactly match the required format of one uppercase letter, followed by a dash and exactly 7 digits (e.g., "A-0010902"). Without these anchors, the pattern could match invalid formats like "X-A-1234567-Y" (extra characters), or "A-123456789" (too many digits), leading to potential data quality issues. This PR adds start and end anchors to ensure the identifier strictly follows the required format. It also updates the regex description to be more descriptive and accurate.
1 parent 4c1b880 commit 94ac81d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

configuration/backend_configuration/patientidentifiertypes/patientidentifiertypes-core_demo.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Uuid,Void/Retire,Name,Description,Required,Format,Format description,Validator,L
22
05a29f94-c0ed-11e2-94be-8c13b969e334,,OpenMRS ID,"OpenMRS patient identifier, with check-digit",TRUE,,,org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator,NOT_USED,UNIQUE
33
22348099-3873-459e-a32e-d93b17eda533,,Legacy ID,Identifier type to record optional previous identifers ,FALSE,,,,NOT_USED,
44
b4143563-16cd-4439-b288-f83d61670fc8,,ID Card,ID Card,FALSE,,,,NOT_USED,UNIQUE
5-
a71403f3-8584-4289-ab41-2b4e5570bd45,,SSN,Social Security Number,FALSE,[A-Z]{1}-[0-9]{7},"Identifier should be 1 letter, followed by a dash and 7 numerical characters. Eg, A-0010902",,NOT_USED,UNIQUE
5+
a71403f3-8584-4289-ab41-2b4e5570bd45,,SSN,Social Security Number,FALSE,^[A-Z]{1}-[0-9]{7}$,"Identifier must be exactly one uppercase letter, followed by a dash and exactly 7 digits. Example: A-0010902",,NOT_USED,UNIQUE

0 commit comments

Comments
 (0)