fix(ocr): sync workflow steps with process_with_ocr replacing legacy azure step
- Update _compute_processing_flow to recognize process_with_ocr as the OCR stage and remap legacy process_with_azure_document_intelligence log entries for backward compatibility - Normalize legacy OCR step name in _compute_step_summary log fallback - Add process_with_ocr to REAL_MAIN_STEPS/REAL_STEPS in step_manager, file_status, and file_queries (keeping legacy name for old DB entries) - Update retry logic in api/files.py to retry failed OCR via process_with_ocr (handles both step names as aliases) - Fix process_document.py to log process_with_ocr as skipped (not azure step) for the local text extraction path Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -21,9 +21,9 @@ def apply_status_filter(query: Query, db: Session, status: Optional[str]) -> Que
|
||||
processing status by examining associated FileProcessingStep entries.
|
||||
|
||||
Only tracks "real" processing steps that represent user-facing status:
|
||||
- Main steps: create_file_record, check_text, extract_text, process_with_azure_document_intelligence,
|
||||
extract_metadata_with_gpt, embed_metadata_into_pdf, finalize_document_storage,
|
||||
send_to_all_destinations
|
||||
- Main steps: create_file_record, check_text, extract_text, process_with_ocr,
|
||||
process_with_azure_document_intelligence (legacy), extract_metadata_with_gpt,
|
||||
embed_metadata_into_pdf, finalize_document_storage, send_to_all_destinations
|
||||
- Upload steps: queue_*, upload_to_*
|
||||
|
||||
Diagnostic/internal steps (poll_task, upload_file, set_custom_fields, etc.) are ignored
|
||||
@@ -58,6 +58,7 @@ def apply_status_filter(query: Query, db: Session, status: Optional[str]) -> Que
|
||||
"create_file_record",
|
||||
"check_text",
|
||||
"extract_text",
|
||||
"process_with_ocr",
|
||||
"process_with_azure_document_intelligence",
|
||||
"extract_metadata_with_gpt",
|
||||
"embed_metadata_into_pdf",
|
||||
|
||||
@@ -56,9 +56,9 @@ def get_files_processing_status(db: Session, file_ids: List[int]) -> Dict[int, D
|
||||
Get processing status for multiple files efficiently.
|
||||
|
||||
Only counts "real" processing steps that represent user-facing status:
|
||||
- Main steps: create_file_record, check_text, extract_text, process_with_azure_document_intelligence,
|
||||
extract_metadata_with_gpt, embed_metadata_into_pdf, finalize_document_storage,
|
||||
send_to_all_destinations
|
||||
- Main steps: create_file_record, check_text, extract_text, process_with_ocr,
|
||||
process_with_azure_document_intelligence (legacy), extract_metadata_with_gpt,
|
||||
embed_metadata_into_pdf, finalize_document_storage, send_to_all_destinations
|
||||
- Upload steps: upload_to_*
|
||||
|
||||
Diagnostic/internal steps (poll_task, upload_file, set_custom_fields, etc.) are ignored.
|
||||
@@ -83,6 +83,7 @@ def get_files_processing_status(db: Session, file_ids: List[int]) -> Dict[int, D
|
||||
"create_file_record",
|
||||
"check_text",
|
||||
"extract_text",
|
||||
"process_with_ocr",
|
||||
"process_with_azure_document_intelligence",
|
||||
"extract_metadata_with_gpt",
|
||||
"embed_metadata_into_pdf",
|
||||
|
||||
@@ -201,10 +201,13 @@ def get_file_overall_status(db: Session, file_id: int) -> Dict:
|
||||
|
||||
# Define which steps are "real" status-determining steps
|
||||
# Only high-level logical steps, not implementation sub-steps
|
||||
# Both process_with_ocr (current) and process_with_azure_document_intelligence (legacy)
|
||||
# are included to correctly count steps for files processed before the OCR abstraction.
|
||||
REAL_MAIN_STEPS = {
|
||||
"create_file_record",
|
||||
"check_text",
|
||||
"extract_text",
|
||||
"process_with_ocr",
|
||||
"process_with_azure_document_intelligence",
|
||||
"extract_metadata_with_gpt",
|
||||
"embed_metadata_into_pdf",
|
||||
@@ -286,10 +289,13 @@ def get_step_summary(db: Session, file_id: int) -> Dict:
|
||||
"""
|
||||
# Define which steps are "real" status-determining steps
|
||||
# Only high-level logical steps, not implementation sub-steps
|
||||
# Both process_with_ocr (current) and process_with_azure_document_intelligence (legacy)
|
||||
# are included to correctly count steps for files processed before the OCR abstraction.
|
||||
REAL_MAIN_STEPS = {
|
||||
"create_file_record",
|
||||
"check_text",
|
||||
"extract_text",
|
||||
"process_with_ocr",
|
||||
"process_with_azure_document_intelligence",
|
||||
"extract_metadata_with_gpt",
|
||||
"embed_metadata_into_pdf",
|
||||
|
||||
Reference in New Issue
Block a user