{% extends "base.html" %} {% block title %}Review Item #{{ item.id }} — NFR{% endblock %} {% block content %} {% if item.operator_status != "pending" %}
This item has already been actioned: {{ item.operator_status }} by {{ item.operator_id or "operator" }} on {{ item.operator_action_at.strftime("%Y-%m-%d %H:%M") if item.operator_action_at else "—" }} {% if item.operator_notes %} — "{{ item.operator_notes }}"{% endif %}
{% endif %}
{# ── File details ─────────────────────────────────────────────────────── #}
File Details
{% if item.reason_detail %} {% endif %} {% if ingest_record and ingest_record.clickup_task_id %} {% endif %}
Filename {{ ingest_record.original_filename if ingest_record else "—" }}
Source {{ ingest_record.ingest_source if ingest_record else "—" }}
Review reason {{ item.review_reason }}
Detail{{ item.reason_detail }}
Content type {{ ingest_record.content_type if ingest_record else "—" }}
Queued at {{ item.created_at.strftime("%Y-%m-%d %H:%M UTC") if item.created_at else "—" }}
ClickUp Task {{ ingest_record.clickup_task_id }} ↗
{% if item.review_nas_path %}
Review queue path:
{{ item.review_nas_path }}
{% endif %}
{# ── Proposed routing ─────────────────────────────────────────────────── #}
Proposed Routing
{% if proposed_project %} {% endif %} {% if item.proposed_destination %}
Destination subfolder: {{ item.proposed_destination }}
{% endif %} {% if item.proposed_confidence %}
Confidence: {% set pct = (item.proposed_confidence * 100) | int %} {% if pct >= 80 %} {{ pct }}% {% elif pct >= 60 %} {{ pct }}% {% else %} {{ pct }}% {% endif %}
{% endif %} {# ── Routing reasoning ── #}
Why this routing?
{# Match signal from IngestRecord #} {% if ingest_record and ingest_record.match_signal %}
Project match signal: {{ ingest_record.match_signal }} {% if ingest_record.match_confidence %} ({{ (ingest_record.match_confidence * 100) | int }}% confidence) {% endif %}
{% endif %} {# Sender info #} {% if ingest_record and ingest_record.sender_type %}
Sender identified as: {{ ingest_record.sender_type }} {% if ingest_record.sender_type_signal %} (via {{ ingest_record.sender_type_signal }}) {% endif %}
{% endif %} {# RoutingDecision details #} {% if routing_decision %} {% if routing_decision.winning_rule %}
Winning rule: {{ routing_decision.winning_rule }} {% if routing_decision.winning_layer %} (layer: {{ routing_decision.winning_layer }}) {% endif %}
{% endif %} {% if routing_decision.ai_used %}
AI used: Yes {% if routing_decision.ai_model %} ({{ routing_decision.ai_model }}) {% endif %}
{% endif %} {% if routing_decision.rules_evaluated %}
Rules evaluated ({{ routing_decision.rules_evaluated | length }})
{{ routing_decision.rules_evaluated | tojson(indent=2) }}
{% endif %} {% endif %} {# No routing info at all #} {% if not (ingest_record and ingest_record.match_signal) and not routing_decision %}
No routing reasoning data available for this item.
{% endif %}
{% if item.candidate_projects %}
Other candidate projects
{{ item.candidate_projects | tojson(indent=2) }}
{% endif %}
{# ── File preview ───────────────────────────────────────────────────────────── #}
File Preview Download
{% set ct = ingest_record.content_type if ingest_record else '' %} {% if ct and ct.startswith('application/pdf') %} {% elif ct and ct.startswith('image/') %}
{{ ingest_record.original_filename }}
{% else %}

Preview not available for this file type ({{ ct or 'unknown' }}).

Download file
{% endif %}
{% if item.operator_status == "pending" %} {# ── Action forms ─────────────────────────────────────────────────────────── #}
{# Accept #} {% if item.proposed_destination and item.proposed_project_id %}
Accept Proposed Routing

Write file to proposed NAS destination. Requires confirmation.

{% endif %} {# Reroute #}
Choose Different Project / Folder

Override the proposed routing with a custom project and subfolder.

{# Reject #}
Reject

Mark item as rejected. The file is not deleted from the review queue path.

{% endif %} {# ── ClickUp task context ────────────────────────────────────────────────── #} {% if clickup_task %}
ClickUp Task Context Open in ClickUp ↗
{# Task name #}
Task Name
{{ clickup_task.name or '—' }}
{# List / Folder info #}
{% if clickup_task.list %}
List: {{ clickup_task.list.name or clickup_task.list.id }}
{% endif %} {% if clickup_task.folder %}
Folder: {{ clickup_task.folder.name or clickup_task.folder.id }}
{% endif %} {% if clickup_task.status %}
Status: {{ clickup_task.status.status if clickup_task.status is mapping else clickup_task.status }}
{% endif %} {% if clickup_task.tags %}
Tags: {% for tag in clickup_task.tags %} {{ tag.name if tag is mapping else tag }} {% endfor %}
{% endif %}
{# Description #} {% if clickup_task.description %}
Description
{{ clickup_task.description }}
{% endif %} {# Assignees #} {% if clickup_task.assignees %}
Assignees: {% for a in clickup_task.assignees %} {{ a.username or a.email or a.id }}{% if not loop.last %},{% endif %} {% endfor %}
{% endif %} {# Comments #} {% if clickup_comments %}
Comments ({{ clickup_comments|length }})
{% for comment in clickup_comments %}
{{ comment.user.username if comment.user else 'Unknown' }} {{ comment.date | int // 1000 | int }}
{%- set comment_text = [] -%} {%- for item in (comment.comment or []) -%} {%- if item is mapping and item.text is defined -%} {%- if comment_text.append(item.text) -%}{%- endif -%} {%- endif -%} {%- endfor -%} {{ comment_text | join('') or '(no text content)' }}
{% endfor %}
{% endif %}
{% endif %} {% endblock %}