{% include "partials/sidebar.html" %}
{% if error == "line_count_mismatch" %}
Could not save reviewed OCR because line count did not match OCR layout. Expected {{ error_expected }}, got {{ error_actual }}.
{% elif error == "save_ocr_corrected_failed" %}
Could not save OCR-corrected PDF. Check that reviewed OCR line count matches raw OCR line count.
{% elif success == "rerun_ocr" %}
OCR rerun successfully.
{% elif success == "regenerated_line_items" %}
Line items regenerated successfully.
{% elif success == "saved_reviewed_ocr" %}
Reviewed OCR saved.
{% elif success == "saved_reviewed_ocr" %}
Reviewed OCR saved.
{% elif error == "rerun_ocr_failed" %}
OCR rerun failed.
{% elif error == "save_field_enriched_failed" %}
Could not save field-enriched PDF.
{% endif %}

{{ document.document_id }}

{{ document.original_filename or document.canonical_filename or document.document_type }}

{{ document.review_status }} {% if review_state and review_state.reviewed_at %} doc reviewed {% endif %} {% if review_state and review_state.is_approved %} approved {% endif %} {% if review_state and review_state.is_excluded %} excluded {% endif %} {{ document.document_type }} {{ document.mime_type }}
Uses the system path unless manually edited.
{% if prev_doc %} ← Previous {% endif %} {% if next_doc %} Next → {% endif %} {% if next_ocr_doc %} Next OCR review {% endif %} {% if next_fields_doc %} Next field extraction {% endif %}
{% if error == "storage_unavailable" %}
Storage mount unavailable. Please retry in a moment.
{% endif %}

Document preview

{% if not storage_available %}

Storage mount unavailable. Preview is temporarily unavailable.

{% elif file_url %} {% if document.mime_type == "application/pdf" %} {% elif document.mime_type in ["image/jpeg", "image/png"] %} Document image {% else %}

Open file

{% endif %} {% else %}

No preview available.

{% endif %}

Reviewed OCR

{% if current_text_version %}

Current OCR version: v{{ current_text_version.version_number }} — {{ current_text_version.version_type }} — {{ current_text_version.created_at }}

{% else %}

No OCR version available yet.

{% endif %}

Expected OCR lines: {{ expected_line_count }}
Current editor lines: {{ actual_line_count }}
Line count mismatch may affect corrected PDF layout.

{% for n in line_numbers %}{{ n }}
{% endfor %}
{% for flag in quality_flag_options %} {% endfor %}

Extracted fields

{% if current_extracted_version_number %} {% set current_extracted_meta = ( extracted_version_options | selectattr(0, "equalto", current_extracted_version_number) | list | first ) %}

Current extracted version: v{{ current_extracted_version_number }} {% if current_extracted_meta %}— {{ current_extracted_meta[1] }}{% endif %}

{% endif %} {% if current_extracted %} {% else %}

No extracted fields saved yet.

{% endif %}

Additional fields

{% if current_additional_version_number %}{% set current_additional_meta = ( additional_version_options | selectattr(0, "equalto", current_additional_version_number) | list | first ) %}

Current additional version: v{{ current_additional_version_number }} {% if current_additional_meta %}— {{ current_additional_meta[1] }}{% endif %}

{% endif %} {% if current_additional %} {% else %}

No additional fields saved yet.

{% endif %} {% if presets %}
Manage presets
{% else %} {% endif %}

Line Items

{% if current_line_item_version %}

Current line item version: v{{ current_line_item_version.version_number }} — {{ current_line_item_version.created_at }}

{% else %}

No line items saved yet.

{% endif %}
{% set base_count = line_items|length %} {% set row_count = base_count + 3 if base_count > 0 else 12 %}
{% for i in range(row_count) %} {% set item = line_items[i] if i < line_items|length else None %} {% endfor %}
# Date Description Qty Unit Total Tax Category Notes
{{ i + 1 }}

Document versions

{% if version_rows %}
{% for version, file_exists in version_rows %} {% endfor %}
Version Type Path Size Created Notes
v{{ version.version_number }} {{ version.version_type }} {{ version.file_path }}
{% if file_exists %} Available {% endif %}
{{ human_size(version.file_size_bytes) }} {{ version.created_at }} {{ version.notes or "" }}
{% else %}

No versions found.

{% endif %}

Source Options

File Source

Data Reset

OCR
Extracted fields
Additional fields
Line items

Raw OCR

{% if raw_ocr %}
Text versionv{{ raw_ocr.version_number }}
OCR engine{{ raw_ocr.ocr_engine or "unknown" }}
Engine version{{ raw_ocr.ocr_engine_version or "unknown" }}
Rerun source{{ raw_ocr.rerun_source or "unknown" }}
Quality score{{ raw_ocr.quality_score if raw_ocr.quality_score is not none else "not scored yet" }}
Quality note{{ raw_ocr.quality_note or "" }}

Quality flags: {{ raw_ocr.quality_flags if raw_ocr and raw_ocr.quality_flags else [] }}

{{ raw_ocr.text_content }}
{% else %}

No raw OCR text found.

{% endif %}

Metadata

Type{{ document.document_type }}
Review status{{ document.review_status }}
Source path{{ document.source_path }}
Current path{{ document.current_path }}
Original filename{{ document.original_filename }}
Canonical filename{{ document.canonical_filename }}
MIME type{{ document.mime_type }}
File size{{ human_size(document.file_size) }}
Page count{{ document.page_count }}
Share path{{ document.share_path or "" }}
Created at{{ document.created_at }}
Updated at{{ document.updated_at }}