Ali2206 commited on
Commit
1b22be4
·
verified ·
1 Parent(s): ab172ce

Update db/mongo.py

Browse files
Files changed (1) hide show
  1. db/mongo.py +6 -0
db/mongo.py CHANGED
@@ -1,9 +1,15 @@
1
  import os
2
  from motor.motor_asyncio import AsyncIOMotorClient
3
 
 
4
  MONGO_URI = os.environ.get("MONGODB_URI")
 
 
5
  client = AsyncIOMotorClient(MONGO_URI)
 
 
6
  db = client.get_default_database()
7
 
 
8
  patients_collection = db["patients"]
9
  results_collection = db["patient_analysis_results"]
 
1
  import os
2
  from motor.motor_asyncio import AsyncIOMotorClient
3
 
4
+ # Get the MongoDB URI from Hugging Face secrets
5
  MONGO_URI = os.environ.get("MONGODB_URI")
6
+
7
+ # Initialize the async MongoDB client
8
  client = AsyncIOMotorClient(MONGO_URI)
9
+
10
+ # Automatically get the default database (from the URI)
11
  db = client.get_default_database()
12
 
13
+ # Expose collections
14
  patients_collection = db["patients"]
15
  results_collection = db["patient_analysis_results"]