diff --git a/app/routes/documents.py b/app/routes/documents.py index ae3f3a2..9a5a114 100644 --- a/app/routes/documents.py +++ b/app/routes/documents.py @@ -20,8 +20,6 @@ from pypdf import PdfReader from app.core.storage_settings import get_default_save_root from app.db.deps import get_db from app.logic.document_outputs import ( - create_field_enriched_pdf_version, - create_ocr_corrected_pdf_version, save_field_enriched_pdf_current, save_ocr_corrected_pdf_current, ) diff --git a/app/templates/documents/detail.html.bak.20260404_073442 b/app/templates/documents/detail.html.bak.20260404_073442 deleted file mode 100644 index 085f84d..0000000 --- a/app/templates/documents/detail.html.bak.20260404_073442 +++ /dev/null @@ -1,383 +0,0 @@ - - - - - {{ document.document_id }} - - - -

- Back to documents | - Open review queue | - Open trash -

- -

{{ document.document_id }}

- - {% 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 error == "rerun_ocr_failed" %} -
- OCR rerun failed. -
- {% elif error == "save_field_enriched_failed" %} -
- Could not save field-enriched PDF. -
- {% endif %} - -
- -
- -
-

Document metadata

- -
- -
-

Saved PDF outputs

-
- -
-
- -
-
- -
-
-
-

Document preview

-
- {% if 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 %} -
-
- -
-

Document versions

- {% if document.versions %} - - - - - - - - - - - - {% for version in document.versions %} - - - - - - - - {% endfor %} - -
VersionTypePathCreatedNotes
v{{ version.version_number }}{{ version.version_type }}{{ version.file_path }}{{ version.created_at }}{{ version.notes or "" }}
- {% else %} -

No versions found.

- {% endif %} -
-
- -
-
-

Raw OCR

-
- -
- - {% if raw_ocr %} -

- Text version: v{{ raw_ocr.version_number }}
- OCR engine: {{ raw_ocr.ocr_engine or "unknown" }}
- OCR 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 flags: {{ raw_ocr.quality_flags if raw_ocr.quality_flags else [] }}
- Quality note: {{ raw_ocr.quality_note or "" }} -

- {% else %} -

No raw OCR text found.

- {% endif %} -
- -
-

Reviewed OCR

- {% if reviewed_ocr %} -

- Current reviewed version saved at {{ reviewed_ocr.created_at }} — - v{{ reviewed_ocr.version_number }} -

- {% else %} -

No reviewed OCR saved 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 %}
- -
- -

Quality flags

-
- {% for flag in quality_flag_options %} - - {% endfor %} -
- -

Quality note

-
- -
- -
- -
-
-
- -
-

Extracted fields

- - {% if current_extracted %} -

Current extracted fields last updated at {{ current_extracted.updated_at }}

- {% else %} -

No extracted fields saved yet.

- {% endif %} - -
- - -
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
- -
-
-
-
-
- - - - diff --git a/app/templates/documents/detail.html.bak_sidebar b/app/templates/documents/detail.html.bak_sidebar deleted file mode 100644 index a3293f6..0000000 --- a/app/templates/documents/detail.html.bak_sidebar +++ /dev/null @@ -1,362 +0,0 @@ - - - - - {{ document.document_id }} - - - -
- - -
- {% 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 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 }} - {{ document.document_type }} - {{ document.mime_type }} -
-
- -
-
-
- -
-
- -
-
- -
-
- -
-
- -
- {% 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 %} -
-
-
- -
-
-
-

Document preview

- {% if 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 reviewed_ocr %} -

Current reviewed version saved at {{ reviewed_ocr.created_at }} — v{{ reviewed_ocr.version_number }}

- {% else %} -

No reviewed OCR saved 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 %} -

Current extracted fields last updated at {{ current_extracted.updated_at }}

- {% else %} -

No extracted fields saved yet.

- {% endif %} - -
- - -
- -
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
- -
-
-
- -
-

Document versions

- {% if document.versions %} -
- - - - - - - - - - - - {% for version in document.versions %} - - - - - - - - {% endfor %} - -
VersionTypePathCreatedNotes
v{{ version.version_number }}{{ version.version_type }}{{ version.file_path }}{{ version.created_at }}{{ version.notes or "" }}
-
- {% else %} -

No versions found.

- {% endif %} -
- -
-

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{{ document.file_size }}
-
Page count{{ document.page_count }}
-
Share path{{ document.share_path or "" }}
-
Created at{{ document.created_at }}
-
Updated at{{ document.updated_at }}
-
-
-
-
- - - - diff --git a/app/templates/documents/list.html.bak_sidebar b/app/templates/documents/list.html.bak_sidebar deleted file mode 100644 index f0de017..0000000 --- a/app/templates/documents/list.html.bak_sidebar +++ /dev/null @@ -1,95 +0,0 @@ - - - - - Documents - - - -
- - -
-
-
-

Documents

-

Active documents available for review and processing.

-
-
- - - -
-

All documents

- {% if documents %} -
- - - - - - - - - - - - {% for doc in documents %} - - - - - - - - {% endfor %} - -
DocumentTypeReview statusCurrent pathUpdated
{{ doc.document_id }}{{ doc.document_type }}{{ doc.review_status }}{{ doc.current_path }}{{ doc.updated_at }}
-
- {% else %} -

No documents found.

- {% endif %} -
-
-
- - - - diff --git a/app/templates/ingest/index.html.bak_sidebar b/app/templates/ingest/index.html.bak_sidebar deleted file mode 100644 index 83b4e29..0000000 --- a/app/templates/ingest/index.html.bak_sidebar +++ /dev/null @@ -1,105 +0,0 @@ - - - - - Ingest - - - -
- - -
-
-
-

Ingest

-

Upload files or ingest from server-side paths.

-
-
- -
-

Upload files

-
-
- - -
-
- -
-
-
- -
-

Server-side ingest

- -
-
- - -
-
- -
-
- -
-
- - -
-
- -
-
- -
-
- -
-
- - -
-
- -
-
-
-
-
- - - - diff --git a/app/templates/line_items/list.html.bak_sidebar b/app/templates/line_items/list.html.bak_sidebar deleted file mode 100644 index b1f9f4e..0000000 --- a/app/templates/line_items/list.html.bak_sidebar +++ /dev/null @@ -1,161 +0,0 @@ - - - - - Line Items - - - -
- - -
-
-
-

Line Items

-

Search extracted purchase lines across documents

-
-
- -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- - Clear - Summary view -
-
-
- -
-

Results

- - {% if rows %} - {% for row in rows %} -
-
-
-
{{ row.transaction_date }} · {{ row.merchant }}
-

{{ row.description }}

-
{{ row.raw_description }}
-
-
- {% if row.category %} - {{ row.category }} - {% endif %} - {% if row.quantity %} - Qty {{ row.quantity }} - {% endif %} - {% if row.line_total %} - ${{ row.line_total }} - {% endif %} - {% if row.confidence %} - Conf {{ row.confidence }} - {% endif %} - {% if row.quality_rating %} - Rating {{ row.quality_rating }} - {% endif %} -
-
- -
- - - - - - - - -
-
- - -
-
- - -
-
- -
- - Open document -
-
-
- {% endfor %} - {% else %} -

No line items found for the current filters.

- {% endif %} -
-
-
- - - - diff --git a/app/templates/line_items/summary.html.bak_sidebar b/app/templates/line_items/summary.html.bak_sidebar deleted file mode 100644 index 79d358f..0000000 --- a/app/templates/line_items/summary.html.bak_sidebar +++ /dev/null @@ -1,110 +0,0 @@ - - - - - Line Item Summary - - - -
- - -
-
-
-

Line Item Summary

-

Aggregate prices and ratings across extracted line items

-
-
- -
-
-
-
- - -
-
-
- - Clear - Detailed view -
-
-
- -
-

Summary Results

- - {% if rows %} -
- - - - - - - - - - - - - - {% for row in rows %} - - - - - - - - - - {% endfor %} - -
ItemCountAvg PriceMin PriceMax PriceRated CountAvg Rating
{{ row.item }}{{ row.count }}{{ row.avg_price }}{{ row.min_price }}{{ row.max_price }}{{ row.rated_count }}{{ row.avg_rating }}
-
- {% else %} -

No summary rows found for the current search.

- {% endif %} -
-
-
- - - - diff --git a/app/templates/queue/index.html.bak_sidebar b/app/templates/queue/index.html.bak_sidebar deleted file mode 100644 index 3b97f40..0000000 --- a/app/templates/queue/index.html.bak_sidebar +++ /dev/null @@ -1,134 +0,0 @@ - - - - - Review Queue - - - -
- - -
-
-
-

Review Queue

-

Work through OCR review and field extraction in order.

-
-
- -
-
- {% if next_ocr %} - Next needing OCR review - {% endif %} - {% if next_fields %} - Next needing field extraction - {% endif %} -
-
- -
-

Needs OCR review ({{ needs_ocr_review|length }})

- {% if needs_ocr_review %} -
- - - - {% for doc in needs_ocr_review %} - - - - - - - {% endfor %} - -
DocumentTypeReview statusUpdated
{{ doc.document_id }}{{ doc.document_type }}{{ doc.review_status }}{{ doc.updated_at }}
-
- {% else %} -

No documents currently need OCR review.

- {% endif %} -
- -
-

Needs field extraction ({{ needs_field_extraction|length }})

- {% if needs_field_extraction %} -
- - - - {% for doc in needs_field_extraction %} - - - - - - - {% endfor %} - -
DocumentTypeReview statusUpdated
{{ doc.document_id }}{{ doc.document_type }}{{ doc.review_status }}{{ doc.updated_at }}
-
- {% else %} -

No reviewed documents are waiting on field extraction.

- {% endif %} -
- -
-

Recently updated

- {% if recently_updated %} -
- - - - {% for doc in recently_updated %} - - - - - - - - {% endfor %} - -
DocumentTypeReview statusCurrent pathUpdated
{{ doc.document_id }}{{ doc.document_type }}{{ doc.review_status }}{{ doc.current_path }}{{ doc.updated_at }}
-
- {% endif %} -
-
-
- - - - diff --git a/app/templates/trash/index.html.bak_sidebar b/app/templates/trash/index.html.bak_sidebar deleted file mode 100644 index ae68aca..0000000 --- a/app/templates/trash/index.html.bak_sidebar +++ /dev/null @@ -1,97 +0,0 @@ - - - - - Trash - - - -
- - -
-
-
-

Trash

-

Soft-deleted documents can be restored or removed permanently.

-
-
- -
- {% if documents %} -
- - - - - - - - - - - - - {% for doc in documents %} - - - - - - - - - {% endfor %} - -
DocumentTypeReview statusTrashed atCurrent pathActions
{{ doc.document_id }}{{ doc.document_type }}{{ doc.review_status }}{{ doc.trashed_at }}{{ doc.current_path }} -
-
- -
-
- -
-
-
-
- {% else %} -

Trash is empty.

- {% endif %} -
-
-
- - - -