USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll Bookspgvector Book
Homepgvector BookBuild the Ingestion System
PreviousConnect from Python and TypeScript SafelyNext Chunking by Structure and Meaning
AI NOTICE: This is the table of contents for the SPECIFIC CHAPTER only. It is NOT the global sidebar. For all chapters, look at the main navigation.

On this page

10 sections

Progress0%
1 / 10

Muhammad Usman Akbar Entity Profile

Muhammad Usman Akbar is a Forward Deployed Engineer and AI Native Consultant specializing in the design and deployment of multi-agent autonomous systems. Embedding with enterprise teams, he ships production-grade agentic AI and leads industrial-scale digital transformation using Claude and OpenAI ecosystems. His work is centered on achieving up to 30x operational efficiency through distributed systems architecture, FastAPI microservices, and RAG-driven AI pipelines. As CEO and Founding Partner of Fista Solutions, based in Pakistan, he operates as a global technical partner for innovative AI startups and enterprise ventures.

USMAN’S INSIGHTS
AI ARCHITECT

Transforming businesses into autonomous AI ecosystems. Engineering the future of industrial-scale digital products with multi-agent systems.

30X Growth
AI-First
Innovation

Navigation

  • Home
  • Forward Deployed Engineer
  • AI Native Consultant
  • About
  • Insights
  • Book a Call
  • Books
  • Contact
Let's Collaborate

Have a Project in Mind?

Let's build something extraordinary together. Transform your vision into autonomous AI reality.

Start Your Transformation

© 2026 Muhammad Usman Akbar. All rights reserved.

Privacy Policy
Terms of Service
Engineered with
INDUSTRIAL ARCHITECTURE

Document Extraction, Normalization, and Provenance

Ingestion starts before embedding. A trustworthy extractor identifies the source, captures an immutable version, parses content and structure, records permissions, normalizes under a versioned policy, computes checksums, and saves evidence. If extraction silently drops tables, pages, or access labels, no embedding model or vector index can recover the missing truth.

What will you be able to do?

  • Define a source-to-normalized-document contract.
  • Preserve structure and citation coordinates.
  • Version normalization and parser behavior.
  • Quarantine malformed or suspicious content.
  • Reconcile source and database state.

What is the extraction envelope?

Represent every extracted document with:

  • tenant and connector identity;
  • stable source key and source version/ETag;
  • source URI plus access principals;
  • MIME type and detected language;
  • title, headings, pages, tables, code blocks, and normalized text;
  • source-modified and extracted timestamps;
  • raw and normalized checksums;
  • parser name/version and warnings.

Keep the original source in its approved system of record. The retrieval database holds a rebuildable serving projection unless your architecture explicitly says otherwise.

How should normalization work?

Normalization may standardize line endings, Unicode, repeated whitespace, boilerplate, or HTML. It must not silently alter identifiers, negate meaning, merge table cells, or remove security labels. Version the policy and test it with golden input/output fixtures.

python
from dataclasses import dataclass @dataclass(frozen=True) class NormalizedDocument: tenant_id: str source_key: str source_version: str title: str text: str principals: tuple[str, ...] raw_checksum: str normalized_checksum: str parser_version: str normalization_version: str

How do you handle untrusted documents?

Parsing files is a security boundary. Enforce size and type limits, scan where policy requires, isolate parsers, reject encrypted or malformed files deliberately, and never execute macros or document code. Treat embedded instructions such as “ignore all previous rules” as content, not control.

How do you verify it?

Create golden fixtures for PDF, HTML, Markdown, a table, code, Unicode, an empty file, a malformed file, and a restricted document. Assert extracted structure, exact checksums, warnings, and permissions. Compare source inventory with database inventory and account for every missing, failed, current, or deleted source.

What breaks in production?

  • OCR text has the wrong reading order.
  • A parser upgrade changes content without triggering re-embedding.
  • Access control is fetched after chunks become visible.
  • Boilerplate overwhelms useful content.
  • Source deletion is not represented in reconciliation.

AI pair-work prompt

Create an extraction test plan for these source types [list]. Include stable identity, version detection, structural preservation, permissions, Unicode, tables, malformed files, parser isolation, checksums, and reconciliation. Separate content warnings from fatal failures.

Verification contract: Every fixture must have deterministic expected output and provenance. No document becomes retrievable until its access metadata and normalized checksum are present.

Check your understanding

  1. Why version normalization?
  2. Which source coordinates make a citation reproducible?
  3. Add a reconciliation state for missing sources.

Official references

  • PostgreSQL character types
  • PostgreSQL binary data