Spaces:
Sleeping
Sleeping
| # from motor.motor_asyncio import AsyncIOMotorClient | |
| # from app.core.config import settings | |
| # class Database: | |
| # client: AsyncIOMotorClient = None | |
| # db = Database() | |
| # async def connect_to_mongo(): | |
| # """Initialize the MongoDB connection pool.""" | |
| # db.client = AsyncIOMotorClient(settings.MONGO_URI) | |
| # print("✅ Connected to MongoDB") | |
| # async def close_mongo_connection(): | |
| # """Close the MongoDB connection pool.""" | |
| # if db.client: | |
| # db.client.close() | |
| # print("🛑 Closed MongoDB connection") | |
| # def get_database(): | |
| # """Dependency to retrieve the database instance.""" | |
| # return db.client[settings.DB_NAME] | |
| import os | |
| from motor.motor_asyncio import AsyncIOMotorClient | |
| # Defaulting to localhost, but update this with your MongoDB Atlas URI in production | |
| MONGO_URI = os.getenv("MONGO_URI", "mongodb+srv://sudhanp2004:root@cluster0.wsmrt.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0") | |
| client = AsyncIOMotorClient(MONGO_URI) | |
| db = client.medical_adjudication | |
| users_collection = db.users | |
| claims_collection = db.claims |