Spaces:
Sleeping
Sleeping
| from db.mongo import patients_collection | |
| import logging | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| async def create_indexes(): | |
| try: | |
| # Create indexes for patients_collection | |
| await patients_collection.create_index("fhir_id", unique=True) | |
| await patients_collection.create_index("full_name", background=True) | |
| await patients_collection.create_index("date_of_birth", background=True) | |
| await patients_collection.create_index("source", background=True) | |
| logger.info("Indexes created successfully for patients_collection") | |
| except Exception as e: | |
| logger.error(f"Failed to create indexes: {str(e)}") | |
| raise |