From fb291062de4916098099aaec5e690c96bcdc4d94 Mon Sep 17 00:00:00 2001 From: prathiyuman Date: Wed, 15 Jul 2026 12:21:46 +0530 Subject: [PATCH] feat: enforce strict 4-point verification - MRN, Gender, DOB, and Age must all match exactly --- fiveparaminte-main/routers/dashboard.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fiveparaminte-main/routers/dashboard.py b/fiveparaminte-main/routers/dashboard.py index fc6aaf9..826b921 100644 --- a/fiveparaminte-main/routers/dashboard.py +++ b/fiveparaminte-main/routers/dashboard.py @@ -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