felicity-lims/felicity/lims/seeds/setup_person.py
Aurthur Musendame ad14d5f12f iter 2 done
2024-07-23 22:30:01 +02:00

23 lines
707 B
Python

import logging
from felicity.apps.patient import schemas
from felicity.core.config import get_settings
from felicity.apps.patient.services import IdentificationService
from .data import get_seeds
settings = get_settings()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
async def seed_person() -> None:
logger.info("Setting up person .....")
data = get_seeds("person")
identification_service = IdentificationService()
for id_type in data.get("identifiers"):
if not (await identification_service.get(name=id_type)):
inst_type_in = schemas.IdentificationCreate(name=id_type)
await identification_service.create(inst_type_in)