File size: 573 Bytes
50aeac3 7e0e71d 50aeac3 c945f24 7e0e71d 1b22be4 5110903 c945f24 5110903 c945f24 5110903 c945f24 50aeac3 5110903 50aeac3 7e0e71d 5110903 c945f24 5110903 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import os
from motor.motor_asyncio import AsyncIOMotorClient
# MongoDB URI (must be set in Hugging Face Secrets)
MONGO_URI = os.environ.get("MONGODB_URI")
if not MONGO_URI:
raise ValueError("MONGODB_URI environment variable is not set.")
# Initialize MongoDB client
client = AsyncIOMotorClient(MONGO_URI)
# Use the correct database name explicitly
db = client["cps_db"]
# Collections
patients_collection = db["patients"]
results_collection = db["patient_analysis_results"]
# Optional utility function to reuse the client
def get_mongo_client():
return client
|