julee.domain.use_cases.validate_document ======================================== .. py:module:: julee.domain.use_cases.validate_document .. autoapi-nested-parse:: Use case logic for document validation 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.validate_document.logger Classes ------- .. autoapisummary:: julee.domain.use_cases.validate_document.ValidateDocumentUseCase Module Contents --------------- .. py:class:: ValidateDocumentUseCase(document_repo, knowledge_service_query_repo, knowledge_service_config_repo, policy_repo, document_policy_validation_repo, knowledge_service, now_fn) Use case for validating documents against policies. This class orchestrates the business logic for document validation within 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:: validate_document(document_id, policy_id) :async: Validate a document against a policy and return the validation result. This method orchestrates the core validation workflow: 1. Generates a unique validation ID 2. Retrieves the document and policy 3. Creates and stores the initial validation record 4. Retrieves all validation queries needed for the policy 5. Retrieves all knowledge services needed for validation 6. Registers the document with knowledge services 7. Executes validation queries and calculates scores 8. Determines pass/fail and updates validation record :param document_id: ID of the document to validate :param policy_id: ID of the policy to validate against :returns: DocumentPolicyValidation with validation results :raises ValueError: If required entities are not found or invalid :raises RuntimeError: If validation processing fails .. py:attribute:: document_policy_validation_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:attribute:: policy_repo .. py:data:: logger