julee.domain.use_cases.extract_assemble_data¶
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¶
Classes¶
Use case for extracting and assembling documents according to |
Module Contents¶
- class julee.domain.use_cases.extract_assemble_data.ExtractAssembleDataUseCase(document_repo, assembly_repo, assembly_specification_repo, knowledge_service_query_repo, knowledge_service_config_repo, knowledge_service, now_fn=lambda : ...)[source]¶
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
- async assemble_data(document_id, assembly_specification_id, workflow_id)[source]¶
Assemble a document according to its specification and create a new assembly.
This method orchestrates the core assembly workflow:
Generates a unique assembly ID
Retrieves the assembly specification
Stores the initial assembly in the repository
Retrieves all knowledge service queries needed for the assembly
Retrieves all knowledge service instances needed for the assembly
Retrieves the input document and registers it with knowledge services
Performs the assembly iteration to create the assembled document
Adds the iteration to the assembly and returns it
- Parameters:
document_id (str) – ID of the document to assemble
assembly_specification_id (str) – ID of the specification to use
workflow_id (str) – 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
RuntimeError – If assembly processing fails
- Return type: