Anass Benouhoud
← Work / GraphRAG
Case study · GraphRAG

A customs tariff an AI can read.

Du droit douanier non structuré à une base de connaissances versionnée.

PDFs, a portal and explanatory notes become a knowledge base: extracted, audited against the official source, enriched by AI and published as versions.

My roleArchitecture of the build pipeline and the reference store
DomainCustoms and tariff, transferable to any regulatory base
StackPostgreSQL · pgvector · Apache AGE · LLM · NestJS
SourcesAIextractPDFauditActiveversion
01 — THE CHALLENGE

A tariff written for people, not for machines.

The customs tariff organises its codes with dashes, groups that have no code, “other” lines and notes that include or exclude whole headings. The 13,611 ten-digit lines are readable only if you know that structure.

Sources sometimes contradict each other: truncated labels, words glued together by the PDF reader, stray codes. An AI that relies on them without a check repeats those errors with confidence.

02 — THE APPROACH

Four principles of construction.

1The official PDF prevailsThe published tariff is the reference. Other sources enrich it; they do not contradict it.
2A correction needs a proofEach gap is corrected with the PDF page that justifies it, accepted by a reviewer, and the previous value is kept.
3A sound version, or noneA new version replaces the active one only if the tree is consistent. Otherwise the previous one stays in service.
4Everything can be replayedModel replies are kept: the graph is rebuilt from the tables, without calling the AI again.
03 — THE ARCHITECTURE

30 components, from the PDF to search.

Official sourceExtractionReference storeControl and validationAI enrichmentKnowledge graphVersioned projectionSearch and toolsAssistant
Mini Map
Click a component
Click a component to see what it does.
Collection and qualityVision reading of the PDF, ADIL collection, note splitting, then audit and proven corrections.
IntelligenceConcepts, synonyms in three languages, distilled context per line, a knowledge graph and vectors.
ReadingA versioned projection, hybrid search and tools that cite only codes that exist.
04 — HOW IT RUNS

From official sources to the active version.

1
CollectionOfficial sources are collected: the tariff PDF, the ADIL portal and the explanatory notes.
2
ExtractionExtraction fills the nomenclature: codes, dashes, units, labels, taxes and notes.
3
AuditAn audit compares each chapter with the PDF; a reviewer accepts the corrections.
4
KnowledgeA model extracts, chapter by chapter, the concepts, the synonyms and the summaries.
5
ContextA distilled context is assembled for each 10-digit line, with its vector.
6
GraphThe knowledge graph loads the notes, the concepts and the terms.
7
BuildA build reads the master tables and constructs the tree, the notes and the indexes.
8
CheckThe integrity check decides: the version is activated, or it fails and the previous one stays.
9
ReadingHybrid search and the tools read the active version for the assistant.
05 — WHAT IT SHOWS

An AI that is reliable because its source is.

GraphRAGApache AGEpgvectorHybrid searchVision AIAuditVersioning

The model enriches the knowledge. Only the official source prevails.

The same approach applies to any regulatory base: statutes, standards, contracts or internal procedures.

CONTACT

A document base to make reliable?

A regulatory corpus, a GraphRAG project or an ingestion pipeline to design: describe it in a few lines.

Discuss a mission →