Spaces:
Sleeping
Sleeping
Download utils/db.py from RocketFarmStudios/CPS-API: direct link, hf CLI and curl.
- Browser
- Download file 700 Bytes
-
https://huggingface.co/spaces/RocketFarmStudios/CPS-API/resolve/97e2e8fa18770ccc046ebfe580a0a8d66522b279/utils/db.py
- Command line
-
hf download hf://spaces/RocketFarmStudios/CPS-API@97e2e8fa18770ccc046ebfe580a0a8d66522b279/utils/db.py
-
curl -L -o db.py https://huggingface.co/spaces/RocketFarmStudios/CPS-API/resolve/97e2e8fa18770ccc046ebfe580a0a8d66522b279/utils/db.py
700 Bytes
| 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 |