Spaces:
Runtime error
Runtime error
Download tests/debug_patient_search.py from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/debug_patient_search.py
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/tests/debug_patient_search.py
-
curl -L -o debug_patient_search.py https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/debug_patient_search.py
1.32 kB
| from flask import Flask | |
| from utils.db.db import init_db, mongo | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| app = Flask(__name__) | |
| app.config["MONGO_URI"] = os.environ.get("MONGO_URI") | |
| if app.config["MONGO_URI"] and "mongodb.net/?" in app.config["MONGO_URI"]: | |
| app.config["MONGO_URI"] = app.config["MONGO_URI"].replace("mongodb.net/?", "mongodb.net/swiftquery?") | |
| init_db(app) | |
| with app.app_context(): | |
| print("--- Checking Patients ---") | |
| patients = list(mongo.db.patient.find()) | |
| for p in patients: | |
| pid = p.get('id') | |
| sql_id = p.get('sql_id') | |
| print(f"Patient: Name={p.get('name')}, ID={pid} (Type: {type(pid)}), SQL_ID={sql_id} (Type: {type(sql_id)})") | |
| print("\n--- Checking Medical History (Sample) ---") | |
| history = mongo.db.medicalhistory.find_one() | |
| if history: | |
| hid = history.get('patient_id') | |
| print(f"History Record: ID={history.get('id')}, Patient_ID={hid} (Type: {type(hid)})") | |
| else: | |
| print("No medical history found.") | |
| print("\n--- Checking Consultation (Sample) ---") | |
| consult = mongo.db.consultation.find_one() | |
| if consult: | |
| cid = consult.get('patient_id') | |
| print(f"Consultation Record: ID={consult.get('id')}, Patient_ID={cid} (Type: {type(cid)})") | |
| else: | |
| print("No consultations found.") | |