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
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
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
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.