Skip to content
UiPath-LAB-TECPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LoopDoc

A high-performance Human-In-The-Loop (HITL) web interface for Intelligent Document Processing (IDP). LoopDoc minimizes cognitive load and reduces average document handling time by surfacing only low-confidence extractions, maintaining spatial context between extracted values and their source in the document, and supporting keyboard-first navigation for fast verification throughput.

Core UX Principles

  • Minimize Cognitive Load — Only surface what needs attention via confidence-driven workflow
  • Reduce Mouse Travel — Keyboard-first navigation and bi-directional spatial mapping
  • Spatial Context — Constant, synchronized link between extracted values and their source in the document

Features

Document Viewer

  • Hybrid PDF and image rendering via pdfjs-dist
  • SVG overlay layer with confidence-coded bounding boxes (red/yellow/green)
  • Focus Engine that auto-zooms and centers on the active field or table cell
  • Multi-page navigation with adaptive zoom (caps at 225%)

Extraction Panel

  • Dynamic field rendering from JSON schema (text, date, number, boolean)
  • Confidence-based filtering to show only items that need review
  • Inline field editing with rule summary chips

Table Validation Grid

  • Spreadsheet-like interface where every cell links to a bounding box in the document
  • Bi-directional sync — click a cell to zoom the document; click a region to highlight the grid
  • Column drag-and-drop, column resize (persisted per document type), and row deletion with confirmation
  • Context-column inference: automatically detects repeated columns (e.g., account numbers) and groups them as table context rather than reviewing each row

Validation Popover

  • Draggable inline editing card near the selected field or cell
  • Row-group popup mode: shows all fields in a horizontal row at once, including context columns
  • Keyboard shortcuts: Enter to accept/verify, M to mark missing, Ctrl+Z for undo

Business Rule Engine

  • Pluggable rule packs registered per document type:
    • Invoice — Total check (line amounts + tax - discount = total), Tax rate validation
    • Paystub — Gross/net earnings reconciliation (current + YTD)
    • Bank Statement — Balance reconciliation per account (beginning + deposits - withdrawals = ending)
  • Auto-confirmation: passed rules can auto-verify related fields and table cells

Unified Review Queue

  • Fields, table cells, and rule targets share a single ordered queue
  • Queue order is intentional: business rules needing review are visited first, then unverified document fields, then unverified reviewable table cells
  • When a business-rule item is first in the queue, the active selection resolves to the first actionable related field or cell so the validation popover opens on a concrete value while preserving rule context
  • Tab / Shift+Tab to navigate, Enter to accept and advance
  • Auto-selects the first unverified item on document load

Task Queue & Persistence

  • Per-task lifecycle: pending → in_progress → completed
  • Active review timer per task
  • Mid-review state persists across page reloads — resume exactly where you left off
  • All user preferences (theme, zoom level, focus mode, popup mode) saved to localStorage

Vendor Adapter System

  • Strategy pattern with auto-detection for plugging in different IDP providers
  • Currently supports UiPath Document Understanding out of the box
  • All coordinates normalized to [0, 1] for zoom-independence across file types

Appearance Customization

  • Light/dark color modes, compact/comfortable density
  • Font pairing options (system / humanist / technical)
  • Accent color selection (blue, teal, violet)

Tech Stack

Layer Technology
Framework Next.js 14+ (App Router) + TypeScript
Styling Tailwind CSS + Shadcn UI conventions
State Zustand (3 stores: document, queue, preferences)
PDF Rendering pdfjs-dist + HTML5 Canvas
Icons Lucide React

Project Structure

src/
├── app/                    # Next.js pages (/ = dashboard, /review = workspace)
├── components/
│   ├── viewer/             # DocumentViewer, BboxOverlay, ValidationPopover
│   ├── panel/              # ExtractionPanel, FieldItem, BusinessRulesPanel
│   ├── table/              # TableGrid with drag-drop and resize
│   ├── layout/             # SplitPane layout
│   ├── queue/              # TaskList, UserPrompt
│   └── settings/           # SettingsPanel (theme, thresholds)
├── hooks/                  # useKeyboardShortcuts, useActiveTimer
├── lib/
│   ├── adapters/           # VendorAdapter interface + UiPath adapter
│   └── businessRules/      # Rule engine core + invoice, paystub, bankStatement packs
├── store/                  # Zustand stores (document, queue, preferences)
└── types/                  # CanonicalDocument and related TypeScript interfaces

Getting Started

Prerequisites

  • Node.js 18+
  • npm or pnpm

Installation

git clone <repo-url>
cd loopdoc
npm install

Development

npm run dev

Open http://localhost:3000 in your browser.

Build & Lint

npm run build    # Production build + type-check
npm run lint     # ESLint

Adding a New IDP Vendor

  1. Create src/lib/adapters/<vendor>/index.ts implementing the VendorAdapter interface (detect() + normalize())
  2. Register it in src/lib/adapters/registry.ts
  3. Important: Normalize all bounding box coordinates to [0, 1] in your adapter

Keyboard Shortcuts

Shortcut Action
Tab / Shift+Tab Navigate next/previous in review queue
Enter Accept and verify current item, advance to next
Shift+Enter Confirm entire table row
M / Shift+M Mark as missing / mark and skip
Ctrl+Z Undo last change (restore original value)
[ / ] Navigate to previous/next page
F Toggle low-confidence filter in extraction panel

Architecture Notes

  • Canonical types (src/types/canonical.ts) define a vendor-agnostic model shared by all components
  • Normalized coordinates (x, y, w, h in [0, 1]) ensure consistency across zoom levels and file formats
  • Review queue is built dynamically from rule targets needing review, unverified fields, and unverified table cells — it rebuilds whenever document state changes. Rule targets take priority so cross-field math issues, such as paystub gross/net reconciliation, are reviewed before ordinary table order.
  • Table column profiling (src/lib/reviewProfile.ts) uses heuristics (name patterns, repeated value ratio) to classify columns as context vs. row-fact

License

Private

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages