julee.domain.use_cases.extract_assemble_data ============================================ .. py:module:: julee.domain.use_cases.extract_assemble_data .. autoapi-nested-parse:: Use case logic for data assembly within the Capture, Extract, Assemble, Publish workflow. This module contains use case classes that orchestrate business logic while remaining framework-agnostic. Dependencies are injected via repository instances following the Clean Architecture principles. Attributes ---------- .. autoapisummary:: julee.domain.use_cases.extract_assemble_data.logger Classes ------- .. autoapisummary:: julee.domain.use_cases.extract_assemble_data.ExtractAssembleDataUseCase Module Contents --------------- .. py:class:: ExtractAssembleDataUseCase(document_repo, assembly_repo, assembly_specification_repo, knowledge_service_query_repo, knowledge_service_config_repo, knowledge_service, now_fn = lambda: datetime.now(timezone.utc)) Use case for extracting and assembling documents according to specifications. This class orchestrates the business logic for the "Extract, Assemble" phases of the Capture, Extract, Assemble, Publish workflow while remaining framework-agnostic. It depends only on repository protocols, not concrete implementations. In workflow contexts, this use case is called from workflow code with repository stubs that delegate to Temporal activities for durability. The use case remains completely unaware of whether it's running in a workflow context or a simple async context - it just calls repository methods and expects them to work correctly. Architectural Notes: - This class contains pure business logic with no framework dependencies - Repository dependencies are injected via constructor (dependency inversion) - All error handling and compensation logic is contained here - The use case works with domain objects exclusively - Deterministic execution is guaranteed by avoiding non-deterministic operations .. py:method:: assemble_data(document_id, assembly_specification_id, workflow_id) :async: Assemble a document according to its specification and create a new assembly. This method orchestrates the core assembly workflow: 1. Generates a unique assembly ID 2. Retrieves the assembly specification 3. Stores the initial assembly in the repository 4. Retrieves all knowledge service queries needed for the assembly 5. Retrieves all knowledge service instances needed for the assembly 6. Retrieves the input document and registers it with knowledge services 7. Performs the assembly iteration to create the assembled document 8. Adds the iteration to the assembly and returns it :param document_id: ID of the document to assemble :param assembly_specification_id: ID of the specification to use :param workflow_id: Temporal workflow ID that creates this assembly :returns: New Assembly with the assembled document iteration :raises ValueError: If required entities are not found or invalid :raises RuntimeError: If assembly processing fails .. py:attribute:: assembly_repo .. py:attribute:: assembly_specification_repo .. py:attribute:: document_repo .. py:attribute:: knowledge_service .. py:attribute:: knowledge_service_config_repo .. py:attribute:: knowledge_service_query_repo .. py:attribute:: now_fn .. py:data:: logger