fix: remove auto-registration that bypassed strict matching - patients must come from monitor data only
This commit is contained in:
@@ -377,21 +377,8 @@ def match_patient(
|
||||
in_age = age
|
||||
now = datetime.now(timezone.utc)
|
||||
|
||||
# Auto-register/insert patient if they don't exist yet (essential for Render cloud SQLite persistence)
|
||||
matched_patient = db.query(Patient).filter(Patient.mrn == in_mrn).first()
|
||||
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
|
||||
# Fetch all patients from monitor database (populated ONLY by monitor HL7/push-vitals)
|
||||
# Do NOT auto-register — patients must exist from actual monitor data
|
||||
all_patients = db.query(Patient).all()
|
||||
best_match = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user