Case Studies/CompanySpace
HR Tech · Document Intelligence · Case Study

CompanySpace

An AI-powered invoice processing and expense tracking system that eliminates manual data entry — extracting, classifying, and structuring financial documents automatically so finance teams know exactly where company money is going.

95%+

OCR Accuracy

<3s

Per-Document Processing

80%+

Reduction in Processing Time

0

Manual Data Entry

The Problem: The Hidden Cost of Manual Expense Management

Companies with dozens or hundreds of employees process hundreds of invoices, receipts, and financial documents every month. Finance teams spend days manually entering data — vendor names, amounts, dates, tax breakdowns, employee associations — into tracking systems. This work is slow, error-prone, and invisible to leadership until reports are compiled.

Without real-time structured data, companies lack visibility into spending patterns across departments, projects, and individual employees. A single misplaced decimal or misclassified expense can throw off quarterly reports. Meanwhile, employees wait days for reimbursements because their submitted documents sit in a queue waiting for manual review.

CompanySpace needed an intelligent layer that could ingest any financial document, extract the data that matters, and structure it for immediate use — without adding overhead to their finance team.

What Safe4AI Built: An Intelligent Document Processing Pipeline

Safe4AI designed and deployed an end-to-end AI pipeline that ingests any financial document — scanned invoices, PDFs, mobile photos of receipts — and outputs structured, validated data directly into CompanySpace's expense tracking system. The system handles the entire workflow: document ingestion, text extraction, intelligent classification, field extraction, validation, and structured storage.

  • Multi-format document ingestion: PDFs, scanned images, mobile camera photos — the system accepts any common document format without requiring templates or pre-defined layouts.
  • OCR text extraction: Handles rotated, skewed, and low-resolution documents. The preprocessing pipeline deskews, denoises, and enhances contrast before extraction to maximize accuracy.
  • LLM-powered field extraction: Understands document context to pull vendor name, invoice number, amounts, dates, line items, tax breakdowns, employee ID, and project or cost center codes — even when fields appear in different positions across document variants.
  • Automatic classification: Distinguishes invoices from receipts, utility bills, and contracts. Each document type triggers the appropriate extraction logic and validation rules.
  • Confidence scoring & validation: Flags low-confidence extractions and rule violations for human review. High-confidence results flow straight through to the database without manual touch.
  • Structured output: Extracted data is normalized and written directly into CompanySpace's HR/finance database, ready for reporting, reimbursement, and analysis.

The AI/OCR Pipeline: How It Works

The pipeline processes each document through five sequential stages, moving from raw input to structured, validated data:

1 — Document Ingestion & Preprocessing

Files are uploaded via web or mobile interface. Images are automatically deskewed, denoised, and contrast-enhanced. PDFs are rasterized and normalized to a standard resolution for consistent OCR performance.

2 — OCR Layer

Text is extracted from the entire document using an OCR engine combined with custom preprocessing. The layer handles multiple languages, mixed layouts, tabular data, and handwritten annotations.

3 — Document Classification

A lightweight classifier determines document type — invoice, receipt, utility bill, or contract — based on layout, vocabulary, and structural cues. This routes the document to the correct extraction logic.

4 — LLM Extraction & Structuring

A language model processes the OCR output together with document-type context to extract structured fields: vendor name, invoice number, issue date, due date, subtotal, tax amount, total, currency, line items with description/quantity/unit price, employee reference, and cost center.

5 — Validation & Output

Extracted data is validated against business rules: tax rate consistency, date plausibility, amount arithmetic checks. High-confidence results are written directly to the database. Edge cases and low-confidence extractions are flagged in a review queue for the finance team.

The entire pipeline completes in under three seconds per document, enabling real-time processing even during high-volume periods such as month-end close.

Infrastructure & Technical Specifications

The pipeline is deployed as a cloud-based API service integrated with CompanySpace's existing infrastructure:

OCR EngineOn-premise LLM OCR + custom preprocessing pipeline
LLMFine-tuned extraction model / GPT-4 via API
Document formatsPDF, PNG, JPEG, TIFF, HEIC
LanguagesSerbian, English, multi-language support
Processing latency<3 seconds per document
StoragePostgreSQL + S3-compatible object storage
DeploymentCloud-based with API access
IntegrationREST API + webhook callbacks
ValidationRule-based + confidence thresholding

The architecture is designed for horizontal scaling. As document volume grows, additional OCR and LLM worker nodes can be added without changing the API contract or client integration code.

Deployment Phases

Phase 1 — Document Analysis & Schema Design (Week 1)

Safe4AI analyzed over 200 real documents from CompanySpace's clients to identify common layouts, field variations, and edge cases. The structured output schema was designed to match CompanySpace's database exactly, ensuring zero friction on integration.

Phase 2 — OCR Pipeline Development (Weeks 2–3)

The preprocessing and OCR layer was built and optimized for the document types CompanySpace receives most frequently: vendor invoices, employee receipts, and utility bills. Custom preprocessing pipelines were tuned for mobile camera photos, which make up over 60% of submissions.

Phase 3 — LLM Extraction Engine (Weeks 4–5)

Extraction prompts and validation logic were developed for accurate field parsing across invoice variants. The system was tested against a holdout corpus of 150 documents, achieving >95% accuracy on all critical fields (vendor, amount, date, total).

Phase 4 — Integration & API Layer (Week 6)

The pipeline was connected to CompanySpace's existing HR/finance system via REST API. Webhook notifications were configured to alert the finance team only when human review is needed. A review dashboard was built for handling exceptions.

Phase 5 — Pilot & Refinement (Weeks 7–8)

The system processed live documents in parallel with the manual workflow for two weeks. Edge cases were identified and resolved. Extraction accuracy improved to 97% on the pilot corpus. Full rollout to all CompanySpace clients followed immediately.

Before & After: Expense Workflow

StepWithout AIWith Safe4AI Pipeline
Document receiptEmployee emails PDF/photo to financeEmployee uploads via app — any format accepted
Data entryManual typing into system, 3–5 min per documentAutomated extraction, <3 seconds per document
Error checkingHuman review of every fieldAI validation + flagging of exceptions only
Employee assignmentManual matching to employee/departmentExtracted from document or auto-matched
Spending visibilityWeekly or monthly manual reportsReal-time structured data, instant dashboards
Finance team workloadDays per month on data entryHours per month on exceptions only

Impact

The CompanySpace document processing pipeline has transformed how client companies handle financial documents. What was previously a multi-day manual process is now a real-time automated workflow.

  • 80%+ reduction in document processing time — what took days now takes hours
  • 95%+ field extraction accuracy on critical fields (vendor, amount, date, total)
  • Zero manual data entry for standard invoices — straight-through processing for high-confidence documents
  • Real-time spending visibility across companies, departments, and individual employees
  • Finance teams handle exceptions only, freeing time for analysis and strategy
  • Scalable across multiple companies on the CompanySpace platform simultaneously

The pipeline is now live and processing documents for CompanySpace clients daily. It handles invoices, receipts, and utility bills in both Serbian and English, with additional languages being added based on client demand.

OCRLLMDocument IntelligenceInvoice ProcessingExpense TrackingHR TechAI PipelineData ExtractionSerbian AIMulti-language