TxAgent-Api / db /mongo.py
Ali2206's picture
Update db/mongo.py
1b22be4 verified
raw
history blame
433 Bytes
import os
from motor.motor_asyncio import AsyncIOMotorClient
# Get the MongoDB URI from Hugging Face secrets
MONGO_URI = os.environ.get("MONGODB_URI")
# Initialize the async MongoDB client
client = AsyncIOMotorClient(MONGO_URI)
# Automatically get the default database (from the URI)
db = client.get_default_database()
# Expose collections
patients_collection = db["patients"]
results_collection = db["patient_analysis_results"]