File size: 700 Bytes
7026fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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