FOSSredder 0.5.0
Loading...
Searching...
No Matches
ImportPipelineHelpers.h
Go to the documentation of this file.
1
5
6#pragma once
7
14#include "core/jobs/Scheduler.h"
18
19#include <atomic>
20#include <filesystem>
21#include <functional>
22#include <memory>
23#include <mutex>
24#include <string>
25#include <vector>
26
28
29using ProgressReporter = std::function<void(double, const std::string&)>;
30
41
43 size_t pagesWithTable = 0;
44 size_t totalOcrWords = 0;
45 double maxPageSec = 0.0;
46 double sumPageSec = 0.0;
47 double sumOcrSec = 0.0;
48};
49
50std::vector<uint8_t> readImportBytes(const std::filesystem::path& path);
51std::vector<uint8_t> readImportBytes(const std::filesystem::path& path, core::ports::diagnostics::IErrorReporter* errorReporter);
52
53PageWork processImportPage(size_t pageIndex,
54 size_t totalPages,
55 const ImportRequest& req,
58 const std::shared_ptr<core::ports::document_image_processing::IDocumentImageProcessor>& documentImageProcessor,
59 const std::shared_ptr<core::ports::text_recognition::ITextRecognizer>& tesseract,
60 core::jobs::SlotLimiter* ocrLimiter,
61 const ProgressReporter& report,
62 std::atomic<size_t>& doneUnits,
63 size_t totalUnits,
65 ImportResult& out,
66 std::mutex& artifactsMutex);
67
69 const std::vector<PageWork>& pages,
70 const std::shared_ptr<core::ports::document_image_processing::IDocumentImageProcessor>& documentImageProcessor,
71 ImportResult& out,
72 std::vector<core::application::importing::draft::TransactionDraft>& all,
73 std::string& carriedBookingDate,
74 int& nextTxIndex,
76 const ProgressReporter& report,
77 std::mutex& artifactsMutex);
78
79}
Result types for document image processing operations.
Document image processing port for import workflows.
Declares the structured diagnostics reporting port.
Text recognition port.
Result types for PDF rendering operations.
Declares a bounded worker queue and a simple slot limiter for import tasks.
Result types for text recognition operations.
Draft transaction model used by import finalization and core application flow.
Declares the import execution request contract.
Declares the import execution result contract.
Limits concurrent access to a bounded number of slots.
Definition Scheduler.h:27
Port for reporting structured diagnostic error events.
PageWork processImportPage(size_t pageIndex, size_t totalPages, const ImportRequest &req, const poppler::RenderResult &renderRes, const poppler::ExtractResult &extractRes, const std::shared_ptr< core::ports::document_image_processing::IDocumentImageProcessor > &documentImageProcessor, const std::shared_ptr< core::ports::text_recognition::ITextRecognizer > &tesseract, core::jobs::SlotLimiter *ocrLimiter, const ProgressReporter &report, std::atomic< size_t > &doneUnits, size_t totalUnits, core::ports::diagnostics::IErrorReporter *errorReporter, ImportResult &out, std::mutex &artifactsMutex)
FinalizeStats finalizeParsedPages(const ImportRequest &req, const std::vector< PageWork > &pages, const std::shared_ptr< core::ports::document_image_processing::IDocumentImageProcessor > &documentImageProcessor, ImportResult &out, std::vector< core::application::importing::draft::TransactionDraft > &all, std::string &carriedBookingDate, int &nextTxIndex, core::ports::diagnostics::IErrorReporter *errorReporter, const ProgressReporter &report, std::mutex &artifactsMutex)
std::function< void(double, const std::string &)> ProgressReporter
std::vector< uint8_t > readImportBytes(const std::filesystem::path &path)
core::ports::text_recognition::ExtractResult ocr
core::ports::document_image_processing::Table table