From 94ac81d2b838775eec452ec264609ded79193eac Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Wed, 16 Apr 2025 16:30:33 +0300 Subject: [PATCH] (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. --- .../patientidentifiertypes/patientidentifiertypes-core_demo.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/backend_configuration/patientidentifiertypes/patientidentifiertypes-core_demo.csv b/configuration/backend_configuration/patientidentifiertypes/patientidentifiertypes-core_demo.csv index f67c3a5..3dfc208 100644 --- a/configuration/backend_configuration/patientidentifiertypes/patientidentifiertypes-core_demo.csv +++ b/configuration/backend_configuration/patientidentifiertypes/patientidentifiertypes-core_demo.csv @@ -2,4 +2,4 @@ Uuid,Void/Retire,Name,Description,Required,Format,Format description,Validator,L 05a29f94-c0ed-11e2-94be-8c13b969e334,,OpenMRS ID,"OpenMRS patient identifier, with check-digit",TRUE,,,org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator,NOT_USED,UNIQUE 22348099-3873-459e-a32e-d93b17eda533,,Legacy ID,Identifier type to record optional previous identifers ,FALSE,,,,NOT_USED, b4143563-16cd-4439-b288-f83d61670fc8,,ID Card,ID Card,FALSE,,,,NOT_USED,UNIQUE -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 +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