← BACK TO PORTFOLIO

ORVIA

Intelligent Arabic document archive — OCR, in-content search, and result highlighting drawn directly on the scanned page.

RoleFull-stack Engineer
Stack.NET 10, React 19, PostgreSQL
OCRTesseract 5.5, PDFium, OpenCV
StatusActive development

OVERVIEW

ORVIA is an Arabic document archiving system built around a single loop: archive → OCR → search → retrieve. Its real value shows up in one moment — you feed it a scanned PDF, and minutes later you find the sentence “the employee Ahmed was transferred” on its seventh page, highlighted on the page image itself.

That last part is the whole point. Plenty of systems will tell you which document matched. Showing you where inside a scanned image, in Arabic, is a different problem.

THE ARABIC PROBLEM

To a database, أحمد, احمد and اَحْمَد are three completely different strings. The same goes for ة/ه, ى/ي, the tatweel ـ, and Arabic-Indic digits. Without unifying them, the index splits and search becomes useless.

One Source of Truth
A single normalizer feeds indexing, searching, and snippet building together — so the two sides can never drift apart.
Position Map
Normalization returns a map of every character back to its original offset. That is what allows a bare-letters search to highlight the fully vowelled original exactly as it appears.
Shared Contract Test
A guard test ties the client normalizer to the server one: change a rule on one side only, and a test fails.

FOUR DECISIONS WORTH DEFENDING

01OCR only when neededDigital PDFs carry a text layer more accurate than any OCR and thousands of times faster. Every page is checked first; only genuinely scanned pages get rendered to an image and read.
02Store the word boxesTesseract hands over per-word coordinates for free. Storing them is what makes highlighting possible on top of a scanned page image — without them, the headline feature only half works.
03Say where it did not readStamps, signatures, and handwriting come out of the OCR engine as rubble. Showing that as text fools the user into trusting it. A layout analyzer marks headings, tables, and unreadable regions, and the page carries an explicit count of what it could not trust.
04Logical delete that actually frees diskDeleted documents sit in a recycle bin for the retention period, then a maintenance job removes the file and its page images. Page images are the biggest item on disk — without this path, deleting freed nothing.

An honest limit: Arabic handwriting is not readable by Tesseract — its models are trained on print only. The system marks those regions rather than pretending to read them.

TWO DATABASE PROVIDERS, MEASURED

ORVIA runs on PostgreSQL or SQL Server, switched by one settings key. Rather than claim they are equivalent, I measured them on the same documents and the same queries:

PostgreSQL
Indexing inside the same transaction as OCR, indexed partial search via pg_trgm, weighted field ranking, and a 2ms median search time.
SQL Server
Identical result correctness, but asynchronous indexing, a table scan for partial search, single-rank ordering, and a 19ms median — 9.5× slower.

The difference is in immediacy and speed, not correctness. The settings screen states the running provider's capabilities explicitly instead of hiding the trade-off.

WHAT IS IN THE SYSTEM

  • Documents & viewer: table, grid, and list views; filters by category, department, and OCR state; a PDF viewer with zoom, rotation, and Arabic-normalized in-document search.
  • Search: in-content search with highlighting and page number, advanced search, and saved searches.
  • OCR processing: a live queue with per-document progress, retry for failures, and scheduled re-OCR of the whole archive when the pipeline improves.
  • File replacement with versions: replace a bad scan and keep the document number, metadata, and timeline intact — the old file stays downloadable.
  • Users & permissions: a permission-key matrix per role, editable from the UI without a redeploy.
  • Operations: scheduled backups, restore, reports exported to Arabic PDF and Excel, a persistent notification center, a recycle bin, and an audit log.

TESTING & SECURITY

104 Unit Tests
Arabic normalization and the position map, snippet building, layout analysis, OCR confidence, and the storage-path guard.
25 Integration Tests
Run against a real database, because half the search logic lives in SQL — computed tsvector, join ordering, trigram fallback — which unit tests never see. They fail rather than silently skip when the database is unreachable.
36 Client Tests
Including the shared-contract guard against the server normalizer.
Security Posture
BCrypt passwords, hashed and rotated refresh tokens in an HttpOnly cookie, access token in page memory rather than localStorage, permission keys instead of role names, and file validation by binary signature. Real file paths never leave the server.

DEPLOYMENT

One publish command produces a single folder that runs with nothing pre-installed — no .NET, no Node, no PostgreSQL. It carries the .NET runtime, the built client served from the same port, a portable PostgreSQL that creates its database inside the folder, and the OCR language models. Copy it to the machine and double-click.

The language models (~42MB) ship inside the repository on purpose: the requirement to work without internet access collapses if a fresh copy has to download something first.

Note: ORVIA is a private repository. This page describes the architecture and the engineering decisions behind it rather than linking to source.