fix: remove auto-registration that bypassed strict matching - patients must come from monitor data only

This commit is contained in:
2026-07-15 12:31:12 +05:30
parent fb291062de
commit 8e3be794ce
+2 -15
View File
@@ -377,21 +377,8 @@ def match_patient(
in_age = age in_age = age
now = datetime.now(timezone.utc) now = datetime.now(timezone.utc)
# Auto-register/insert patient if they don't exist yet (essential for Render cloud SQLite persistence) # Fetch all patients from monitor database (populated ONLY by monitor HL7/push-vitals)
matched_patient = db.query(Patient).filter(Patient.mrn == in_mrn).first() # Do NOT auto-register — patients must exist from actual monitor data
if not matched_patient:
matched_patient = Patient(
patient_id=in_mrn,
mrn=in_mrn,
name="Shahil Kumar",
gender=gender or "Male",
dob=dob or "19600622",
)
db.add(matched_patient)
db.commit()
db.refresh(matched_patient)
# Fetch all patients to find an exact match
all_patients = db.query(Patient).all() all_patients = db.query(Patient).all()
best_match = None best_match = None