# Context — RAG Chunking Benchmarker Admin Dashboard ## Language **Dashboard**: A single-file React app (CDN-loaded, no build step) served by FastAPI at `/app`. Replaces Swagger as the primary UI for operating the RAG benchmarking platform. _Avoid_: Admin panel, web UI, frontend **Strategy**: One of the five chunking algorithms: fixed_size, recursive, semantic, contextual_retrieval, semantic_parent_child. _Avoid_: Method, approach, technique **Experiment**: A completed benchmark run — one document, N strategies, M questions, with per-question and aggregate metrics. _Avoid_: Run, trial, benchmark **Chunk Preview**: The ability to visualize what a specific strategy produces for a given document — the raw text blocks, their sizes, and hierarchy. _Avoid_: Chunk inspection, chunk view **Tab**: A persistent top-level navigation section of the Dashboard (Home, Documents, Query, Benchmarks, Admin, PDF). Tabs stay mounted when switching — state survives. _Avoid_: Page, route, view **PDF Workspace**: The PDF Tab’s end-to-end surface for Text PDF work: upload, process Strategies, Chunk Preview, query, run Experiments, and open reports — scoped to PDF documents only. Documents / Query / Benchmarks Tabs list Word documents only (`.doc`/`.docx`). Inside the Tab, features are collapsible accordion sections (Upload & Process open by default); Admin-only ops (health, Qdrant CRUD) stay on Admin. Built from shared Dashboard section components with a format filter — not a forked UI. _Avoid_: PDF page, PDF mode, PDF dashboard **Text PDF**: A PDF with a real, selectable text layer that can be extracted without OCR. In scope for PDF ingestion v1. _Avoid_: Digital PDF, native PDF, searchable PDF (ambiguous in ops talk) **Scanned PDF**: A PDF whose pages are images (or have a useless/empty text layer) and need OCR before chunking. Out of scope for PDF ingestion v1. _Avoid_: Image PDF, photo PDF, OCR PDF **Heading Reconstruction**: Inferring section/article boundaries from PDF signals in priority order — outline bookmarks, then font size/weight, then Farsi/English text heuristics — and emitting markdown `#` / `##` for Strategies. Later signals fill gaps; they do not override outline titles when an outline is present. _Avoid_: Heading detection, structure recovery, outline parsing (too narrow) **Text-layer Gate**: Upload-time check that a PDF has enough extractable text to count as a Text PDF; failure rejects the upload. Scanned PDFs never enter the benchmark corpus. _Avoid_: OCR check, PDF validation, empty-page filter **Table Flattening**: Turning table cells into sequential plain-text blocks in reading order (same contract for DOCX and Text PDF). Strategies never receive grid/markdown-table structure in v1. _Avoid_: Table extraction, table parsing, structured tables ## Architecture Decisions | # | Decision | Status | |---|----------|--------| ADR-0001 | Single-file React via CDN (no build step), served by FastAPI | Approved | ADR-0002 | New `/admin/` router for dashboard-specific backend ops (health, Qdrant CRUD, chunk preview, questions, cost) | Approved | ADR-0003 | Top-tab navigation (Home, Documents, Query, Benchmarks, Admin) — not sidebar | Approved | ADR-0004 | Babel-in-browser JSX: single index.html with inline