flip_api.private_services.imaging_notifications =============================================== .. py:module:: flip_api.private_services.imaging_notifications .. autoapi-nested-parse:: Post-processing for completed CREATE_IMAGING tasks: persist status and email notifications. Functions --------- .. autoapisummary:: flip_api.private_services.imaging_notifications.handle_imaging_task_completed flip_api.private_services.imaging_notifications._get_latest_query_id flip_api.private_services.imaging_notifications._parse_imaging_result Module Contents --------------- .. py:function:: handle_imaging_task_completed(task: flip_api.db.models.main_models.TrustTask, db: sqlmodel.Session) -> None Post-process a successful CREATE_IMAGING task: persist status and send email notifications. Sends credential emails to newly created users, and project access notifications to existing users who were added to the project. Called after the task result has been committed to the database. Any exceptions are expected to be caught by the caller. :param task: The completed CREATE_IMAGING task with result data. :type task: TrustTask :param db: Database session. :type db: Session :raises ValueError: If the task has no result data. .. py:function:: _get_latest_query_id(project_id: uuid.UUID, db: sqlmodel.Session) -> uuid.UUID | None Get the most recent query ID for a project, or None. :param project_id: ID of the project. :type project_id: UUID :param db: Database session. :type db: Session :returns: The query ID, or None if no queries exist. :rtype: UUID | None .. py:function:: _parse_imaging_result(result_json: str) -> flip_api.domain.interfaces.trust.ICreatedImagingProject Parse the task result JSON into a structured imaging project response. :param result_json: JSON string from the task result. :type result_json: str :returns: Structured imaging project response. :rtype: ICreatedImagingProject :raises json.JSONDecodeError: If result_json is not valid JSON. :raises ValueError: If required fields (ID, name) are missing from the result.