Ali2206 commited on
Commit
85d52f6
·
verified ·
1 Parent(s): 50aeac3

Update db/mongo.py

Browse files
Files changed (1) hide show
  1. db/mongo.py +5 -15
db/mongo.py CHANGED
@@ -1,19 +1,9 @@
1
- import motor.motor_asyncio
2
  import os
3
- from fastapi import HTTPException
4
- from bson.objectid import ObjectId
5
 
6
- # Load MongoDB URI from Hugging Face Space secrets
7
- MONGODB_URI = os.environ.get("MONGODB_URI")
8
- if not MONGODB_URI:
9
- raise HTTPException(status_code=500, detail="MONGODB_URI not set in environment")
10
 
11
- # Create MongoDB client
12
- client = motor.motor_asyncio.AsyncIOMotorClient(MONGODB_URI)
13
-
14
- # Access the database (you can change the DB name here if needed)
15
- db = client.get_default_database()
16
-
17
- # Access collections
18
  patients_collection = db["patients"]
19
-
 
1
+ from motor.motor_asyncio import AsyncIOMotorClient
2
  import os
 
 
3
 
4
+ MONGODB_URI = os.getenv("MONGODB_URI") # Make sure it's added to your Hugging Face Space secrets
5
+ client = AsyncIOMotorClient(MONGODB_URI)
6
+ db = client["cps_db"] # Adjust if your database name is different
 
7
 
 
 
 
 
 
 
 
8
  patients_collection = db["patients"]
9
+ results_collection = db["txagent_results"]