feat: enforce strict 4-point verification - MRN, Gender, DOB, and Age must all match exactly
This commit is contained in:
@@ -411,14 +411,20 @@ def match_patient(
|
||||
if p_dob != in_dob:
|
||||
continue
|
||||
|
||||
# If MRN, gender, and DOB all match, we have our matched patient
|
||||
# --- Age check (must match exactly) ---
|
||||
if in_age is not None:
|
||||
p_age = _calculate_age(p.dob or "")
|
||||
if p_age is None or p_age != in_age:
|
||||
continue
|
||||
|
||||
# If MRN, gender, DOB, and Age all match, we have our matched patient
|
||||
best_match = p
|
||||
break
|
||||
|
||||
if not best_match:
|
||||
return {
|
||||
"matched": False,
|
||||
"reason": "Patient verification failed. MRN, Gender, and DOB must match exactly."
|
||||
"reason": "Patient verification failed. MRN, Gender, DOB, and Age must match exactly."
|
||||
}
|
||||
|
||||
matched_patient = best_match
|
||||
|
||||
Reference in New Issue
Block a user