// Package documentclean provides document cleaning functionality. // Note: Text extraction pipeline has been removed. The document processing // pipeline now ends after cleaning. See remove_texttract_and_mocks_plan.md. package documentclean import ( "context" "fmt" "github.com/google/uuid" ) // CleanResult contains the result of the clean operation. // // Fields: // - Passed: true if the document passed all validation checks // - FailReason: the specific failure reason if Passed is false, nil otherwise type CleanResult struct { Passed bool FailReason *string } // Clean processes a document by cleaning it. Previously this also triggered // text extraction, but that feature has been removed. // // Parameters: // - ctx: request context // - documentId: the document UUID to clean // // Returns: // - *CleanResult: result indicating whether validation passed and any failure reason // - error: only for infrastructure errors (DB, S3). Validation failures are // returned via CleanResult.Passed=false, not as errors. func (s *Service) Clean(ctx context.Context, documentId uuid.UUID) (*CleanResult, error) { isclean, err := s.cfg.GetDBQueries().HasDocumentCleanEntry(ctx, documentId) if err != nil { return nil, fmt.Errorf("unable to verify if document has been cleaned: %w", err) } if !isclean { result, err := s.clean(ctx, documentId) if err != nil { return nil, fmt.Errorf("unable to clean document: %w", err) } return result, nil } // Note: Text extraction has been removed. Document pipeline ends here. return &CleanResult{Passed: true}, nil }