← Back to project catalogue
GP-DA-03LVEUVData and AIReady

MSME invoice document processing

A document-intelligence workflow for extracting, validating, and reviewing structured fields from varied Indian MSME invoice layouts.

MSME invoice document processing project visual
GP-DA-03LVEUV · Data and AI
  • Python 3.12
  • Tesseract OCR 5
  • scikit-learn 1.9
  • pandas
  • NumPy
  • Pillow
  • Matplotlib
  • Docker

Project definition

Problem statement

MSME invoices can differ in layout and scan quality. Basic OCR returns text but does not reliably identify the required values or explain which predictions should be reviewed.

The engineering problem is to compare extraction methods under controlled image conditions, validate selected GST and arithmetic relationships, and calibrate confidence without using real invoice data.

Project objectives

  • Generate fictional invoice images across five layouts and six controlled image conditions.
  • Extract invoice number, date, seller and buyer GSTIN, subtotal, CGST, SGST, and total fields.
  • Compare text-only regular expressions with spatial anchor matching on the same test partition.
  • Validate GSTIN structure and checksum together with selected arithmetic relationships.
  • Calibrate field confidence and measure a selective human-review policy on held-out data.

Project structure

Project components

01

Synthetic invoice generator

Builds controlled fictional invoices across five layouts without real buyer, supplier, tax, phone, email, or bank information.

02

Image degradation pipeline

Creates clean, blurred, rotated, compressed, low-contrast, and noisy image conditions for reproducible testing.

03

Tesseract OCR pipeline

Reads each image locally and retains words, positions, and confidence values for downstream extraction.

04

Field extractors

Compares text-only regular expressions with spatial anchor matching across eight target invoice fields.

05

Validation engine

Checks GSTIN structure and checksum together with subtotal, tax, and total relationships under a documented rule set.

06

Calibration and review module

Calibrates field confidence on held-out data and applies a fixed threshold for selective human review.

Methodology

Project workflow

  1. 01
    Generate invoices

    The fixed experiment creates fictional invoice records and renders five layouts without real personal or tax information.

  2. 02
    Apply image conditions

    Each layout is tested under clean, blurred, rotated, compressed, low-contrast, and noisy conditions.

  3. 03
    Run local OCR

    Tesseract produces positioned words and confidence values for every prepared image.

  4. 04
    Extract and validate

    Two field extraction methods are compared and the selected GSTIN and arithmetic checks are applied.

  5. 05
    Calibrate and evaluate

    Held-out predictions determine the calibration model and review threshold before final test metrics are written.

Demonstration scenario

The student generates a small set of fictional MSME invoices, processes their images through Tesseract, and compares text-only and spatial extraction. The retained experiment then shows how scan condition affects exact match, how calibration changes confidence quality, and which fields are sent for review.

Engineering

Tools and method

Local package
Python 3.12 package and command-line entry points for generation, OCR processing, extraction, and retained experiments.
Document pipeline
Pillow-based invoice generation and degradation followed by local Tesseract OCR with positioned tokens.
Extraction methods
A shared field schema with text-only and spatial-anchor methods evaluated on exactly the same documents.
Confidence model
Logistic calibration on a held-out partition with threshold selection separated from final test evaluation.
Evidence layer
CSV and JSON outputs for document conditions, field predictions, selective review, validation cases, and summary metrics.
Delivery
Exact dependency lock, automated tests, Docker verification, complete documentation, and reproducible validation commands.

Testing

Evaluation

Evaluation measures

  • Field-level exact accuracy for both extraction methods
  • Mean character error rate for spatial predictions
  • Exact accuracy by invoice layout and image condition
  • Brier score and expected calibration error before and after calibration
  • Automatic coverage and accepted-field accuracy at the selected threshold
  • Exact agreement, precision, and recall across 600 validation mutation cases

Project boundaries

  • The included dataset uses synthetic or properly redacted invoices and contains no live buyer or supplier records.
  • The prototype validates a documented subset of invoice fields and rules and does not submit data to GST systems.
  • A successful check is not a legal, tax, accounting, or compliance approval.
  • Human review remains required before extracted data is used in a business process.

Included

  1. 01Installable Python package and command-line workflow
  2. 02120 synthetic invoices across five layouts and six image conditions
  3. 03Text-only and spatial field extraction with retained comparisons
  4. 04GSTIN structure, checksum, and invoice arithmetic validation
  5. 05Calibrated selective-review experiment with retained CSV and JSON evidence
  6. 0660 automated tests with 99.77 percent statement coverage
  7. 07Complete source code in a private GitHub repository
  8. 0872-page project report in PDF and editable Word formats
  9. 0918-page setup and usage guide in PDF and editable Word formats
  10. 1055 annotated references and two attributed literature images

Project record

No information is collected on this page.

Permanent project ID
GP-DA-03LVEUV
Catalogued
21 Aug 2026
Completed
27 Aug 2026
Verified
27 Aug 2026
Demonstration
Included in repository

Handover

After purchase

  1. 01
    Payment is confirmed

    The project is marked unavailable and cannot be purchased again.

  2. 02
    Repository access is granted

    The buyer's submitted GitHub account receives access to the private repository.

  3. 03
    The purchase record is delivered

    The certification sheet is prepared from the reviewed buyer details and sent privately by email.