121 lines
4.3 KiB
HTML
121 lines
4.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>{{ document.document_id }}</title>
|
|
</head>
|
|
<body>
|
|
<p><a href="/documents/">Back to documents</a></p>
|
|
|
|
<h1>{{ document.document_id }}</h1>
|
|
|
|
<h2>Document metadata</h2>
|
|
<ul>
|
|
<li>Type: {{ document.document_type }}</li>
|
|
<li>Source path: {{ document.source_path }}</li>
|
|
<li>Current path: {{ document.current_path }}</li>
|
|
<li>Original filename: {{ document.original_filename }}</li>
|
|
<li>Canonical filename: {{ document.canonical_filename }}</li>
|
|
<li>MIME type: {{ document.mime_type }}</li>
|
|
<li>File size: {{ document.file_size }}</li>
|
|
<li>Page count: {{ document.page_count }}</li>
|
|
<li>Storage status: {{ document.storage_status }}</li>
|
|
<li>Review status: {{ document.review_status }}</li>
|
|
<li>Created at: {{ document.created_at }}</li>
|
|
<li>Updated at: {{ document.updated_at }}</li>
|
|
</ul>
|
|
|
|
<h2>Document preview</h2>
|
|
{% if file_url %}
|
|
{% if document.mime_type == "application/pdf" %}
|
|
<iframe src="{{ file_url }}" width="900" height="700"></iframe>
|
|
{% elif document.mime_type in ["image/jpeg", "image/png"] %}
|
|
<img src="{{ file_url }}" alt="Document image" style="max-width: 900px; max-height: 700px;">
|
|
{% else %}
|
|
<p><a href="{{ file_url }}" target="_blank">Open file</a></p>
|
|
{% endif %}
|
|
{% else %}
|
|
<p>No preview available.</p>
|
|
{% endif %}
|
|
|
|
<h2>Document versions</h2>
|
|
{% if document.versions %}
|
|
<ul>
|
|
{% for version in document.versions %}
|
|
<li>
|
|
v{{ version.version_number }} —
|
|
{{ version.version_type }} —
|
|
{{ version.file_path }} —
|
|
{{ version.created_at }}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
<p>No versions found.</p>
|
|
{% endif %}
|
|
|
|
<h2>Raw OCR</h2>
|
|
<form method="post" action="/documents/{{ document.document_id }}/rerun-ocr">
|
|
<button type="submit">Re-run OCR</button>
|
|
</form>
|
|
|
|
{% if raw_ocr %}
|
|
<p>
|
|
<strong>Text version:</strong> v{{ raw_ocr.version_number }}<br>
|
|
<strong>OCR engine:</strong> {{ raw_ocr.ocr_engine or "unknown" }}<br>
|
|
<strong>OCR engine version:</strong> {{ raw_ocr.ocr_engine_version or "unknown" }}<br>
|
|
<strong>Rerun source:</strong> {{ raw_ocr.rerun_source or "unknown" }}<br>
|
|
<strong>Quality score:</strong> {{ raw_ocr.quality_score if raw_ocr.quality_score is not none else "not scored yet" }}<br>
|
|
<strong>Quality flags:</strong> {{ raw_ocr.quality_flags if raw_ocr.quality_flags else [] }}<br>
|
|
<strong>Quality note:</strong> {{ raw_ocr.quality_note or "" }}
|
|
</p>
|
|
<pre>{{ raw_ocr.text_content }}</pre>
|
|
{% else %}
|
|
<p>No raw OCR text found.</p>
|
|
{% endif %}
|
|
|
|
<h2>Reviewed OCR</h2>
|
|
{% if reviewed_ocr %}
|
|
<p>
|
|
Current reviewed version saved at {{ reviewed_ocr.created_at }} —
|
|
v{{ reviewed_ocr.version_number }}
|
|
</p>
|
|
{% else %}
|
|
<p>No reviewed OCR saved yet.</p>
|
|
{% endif %}
|
|
|
|
<form method="post" action="/documents/{{ document.document_id }}/review-text">
|
|
<div>
|
|
<label for="reviewed_text">Edit reviewed OCR text:</label>
|
|
</div>
|
|
<div>
|
|
<textarea id="reviewed_text" name="reviewed_text" rows="20" cols="100">{{ review_text_value }}</textarea>
|
|
</div>
|
|
|
|
<h3>Quality flags</h3>
|
|
<div>
|
|
{% for flag in quality_flag_options %}
|
|
<label style="display:block;">
|
|
<input
|
|
type="checkbox"
|
|
name="quality_flags"
|
|
value="{{ flag }}"
|
|
{% if flag in current_quality_flags %}checked{% endif %}
|
|
>
|
|
{{ flag }}
|
|
</label>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<h3>Quality note</h3>
|
|
<div>
|
|
<textarea id="quality_note" name="quality_note" rows="4" cols="100">{{ current_quality_note }}</textarea>
|
|
</div>
|
|
|
|
<div style="margin-top: 1rem;">
|
|
<button type="submit">Save reviewed OCR</button>
|
|
</div>
|
|
</form>
|
|
</body>
|
|
</html>
|