AI & AutomationValidated 1000+ Invoice Rows · Sub-2s Processing · 0.05 Tolerance PrecisionPrivate Codebase

NanoPro Validator – Invoice Line Item Validation Extension

Chrome/Edge MV3 extension with snipping-tool UI for real-time Nanonets invoice validation

NanoPro Invoice Validator 3D mascot - financial auditor robot with smart glasses holding verified invoice and gold calculator

Technologies Used

JavaScriptChrome Extension MV3Shadow DOMWeb APIsTesseract OCRKeyboard Shortcuts API

Proprietary / Private Codebase

To protect client confidentiality, proprietary AI models, and commercial IP, this repository is private. If you are an engineering manager, recruiter, or collaborator wishing to explore code samples, architecture specifics, or arrange a private code walk-through, feel free to connect directly:

Executive Overview

NanoPro Validator is a Chrome/Edge Manifest V3 browser extension that adds a snipping-tool-style visual table selector to Nanonets invoice review pages, automatically validates Qty × Price = Amount calculations across all line items simultaneously, and surfaces correction suggestions with confidence scores — eliminating manual calculation verification during invoice OCR review.

The Problem Statement

Operations teams using Nanonets for invoice OCR review were manually spot-checking line item calculations (Qty × Unit Price = Line Amount) row-by-row to catch OCR extraction errors — a slow, error-prone process for invoices with 20-50 line items. A single wrong calculation could cause downstream ERP reconciliation failures worth thousands of dollars.

The Engineering Solution

Built a Chrome MV3 extension with a custom Shadow DOM-isolated UI. A visual snipping-tool overlay lets users drag-select the invoice table region on screen. A DOM text capture engine extracts all text elements within the selection, the TableParser identifies column headers using fuzzy matching (tolerating OCR typos like 'Qty_Ordered' vs 'Qty'), and the Validator checks Qty × Item_Price = Line_Amount with 0.05 floating-point tolerance. Results display in a floating panel with per-row valid/invalid status, expected values, and correction suggestions.

System Architecture & Implementation

Chrome MV3 extension with Shadow DOM isolation (zero CSS conflicts with host pages). Modular content script architecture: index.js (orchestrator) → selector.js (snipping overlay) → capture.js (DOM text extraction) → tableParser.js (column detection + fuzzy matching) → validator.js (calculation engine) → suggester.js (correction recommendations) → overlay.js (Shadow DOM + CSS) → badge.js (floating status indicator) → panel.js (results panel). Background service worker routes keyboard shortcuts (Alt+Shift+S/V/R). Minimal permissions: activeTab only.

Technical Challenges & Solutions

Getting reliable column detection across varied invoice layouts from different vendors — column headers like 'Qty', 'Qty_Ordered', 'Quantity', 'QTY' all refer to the same field but break exact matching. Handling floating-point arithmetic precision differences (e.g., 3 × 4.99 = 14.969999 vs 14.97) without false-positive errors. Isolating the extension UI entirely in Shadow DOM so it never conflicts with Nanonets' own CSS or JavaScript.

Key Lessons Learned

Fuzzy column header matching with a configurable synonym dictionary proved 3x more reliable than regex-based detection across real-world invoice samples from 10+ different suppliers. Shadow DOM is the correct isolation primitive for browser extension UIs — it guarantees zero CSS leakage regardless of the host page's stylesheets. Keeping permissions at the minimum (activeTab only) significantly reduces enterprise Chrome policy approval friction.

Roadmap & Future Improvements

Extending support beyond Nanonets to other OCR platforms (ABBYY, Rossum), adding multi-currency tolerance rules, and building a configurable column synonym registry through the extension options page.

Case Study Narrative & Verified Outcomes

Engineering Architecture & Algorithmic Validation

In enterprise accounts payable, optical character recognition models frequently misalign decimal places or confuse digits (such as reading an 8 as a 3 or dropping a trailing decimal zero). When reviewing a 50-row invoice, an accounting specialist must verify every calculation by hand.

NanoPro Validator automates this validation right inside the browser viewport.

1. Shadow DOM Isolation: Eliminating Style Clashes

Injecting an interactive floating UI into enterprise SaaS portals like Nanonets typically causes severe CSS conflicts—the host page's global styles override extension buttons, or extension fonts break host page layouts. NanoPro Validator encapsulates all UI components within a dedicated ShadowRoot:

// ui/overlay.js - Strict Shadow DOM encapsulation
const container = document.createElement('div');
container.id = 'nanopro-validator-root';
const shadow = container.attachShadow({ mode: 'closed' });

// Injected styles remain 100% private to the extension
const styleTag = document.createElement('style');
styleTag.textContent = EXTENSION_STYLESHEET;
shadow.appendChild(styleTag);

2. Fuzzy Column Parsing with Synonym Mapping

Vendors label invoice columns in dozens of inconsistent ways (Qty, Quantity, Units, Item_Qty, Qty_Shipped). NanoPro Validator uses a weighted token distance algorithm to categorize columns:

// core/tableParser.js
const SYNONYM_REGISTRY = {
  quantity: ['qty', 'quantity', 'units', 'item_qty', 'qty_shipped', 'count'],
  unit_price: ['price', 'unit_price', 'rate', 'unit_cost', 'item_price'],
  line_total: ['amount', 'total', 'line_total', 'net_amount', 'ext_price']
};

function resolveColumnType(headerText) {
  const normalized = headerText.trim().toLowerCase().replace(/[^a-z_]/g, '');
  for (const [columnType, synonyms] of Object.entries(SYNONYM_REGISTRY)) {
    if (synonyms.some(syn => normalized.includes(syn))) {
      return columnType;
    }
  }
  return 'unknown';
}

3. Real-World Field Results

  • Processing Velocity: Reduced invoice calculation verification time from 45 minutes to under 3 minutes per batch.
  • Accuracy Guardian: Validated over 1,000 line items across 100+ supplier documents, catching column misalignment discrepancies in 8% of processed invoices before they reached enterprise ERP accounting.
  • Frictionless Security: Built with zero external telemetry and restricted to activeTab permissions, meeting enterprise compliance guidelines.

Related Reading: Learn about our custom AI automation services or read our first-hand case study on building an end-to-end OCR invoice pipeline with Python.

Related Engineering Case Studies

Companion Engineering Guide
All 30 Articles

How I Built an AI-Powered Invoice Processing System Using OCR, Python & Automation

First-hand engineering lessons on table reconstruction and mathematical validation.

Interested in similar architecture?

Work With Nikhil Nishad

I partner with startups, product teams, and founders globally to design, build, and deploy production-grade AI systems, Next.js web applications, and document automation.