maborak.com~/work/platform/legalaisoftware & infrastructure engineering
All case studies

Maborak product engineering · LegalAI / PactoLegal

Ingesting legal documents and retrieving cited sources

The engineering challenge

Legal research depends on locating relevant material and retaining its source. The system must ingest heterogeneous documents, retrieve useful passages and connect generated answers to the underlying legal corpus.

Keep retrieval separate from generation

A dedicated retrieval layer makes source material available to the answer pipeline, but requires maintaining ingestion quality and index freshness. Citations aid verification; they do not replace professional review.

Platform architecture

Application, data and infrastructure.

Legal corpus ingestion, document processing, retrieval, model integration, research interfaces and supporting infrastructure.

System architectureLegalAI / PactoLegalApplication and processing components
  • IngestionLegal sources and document OCR
  • RetrievalEmbeddings and Qdrant search
  • GenerationLanguage-model adapters
  • ApplicationResearch, documents and accounts

Data flow

  1. Legal sources
  2. Ingestion / OCR
  3. Search indexes
  4. Retrieval
  5. Cited responses

Corpus and documents

Source adapters ingest legal norms and court decisions. Document ingestion and OCR services turn source material into content for indexing and research.

Retrieval and model orchestration

Retrieval services connect to Qdrant vector search. Separate embedding and language-model adapters keep retrieval, model selection and response generation behind explicit application interfaces.

Application infrastructure

The research application includes authenticated accounts, document workflows, subscriptions and notifications. The container stack separates the API and interface from PostgreSQL, connection pooling, Redis and Qdrant.

  • FastAPI
  • React / TypeScript
  • PostgreSQL
  • Qdrant
  • Redis
  • OCR / model adapters

The resulting system

An integrated research system for Bolivian legal material, combining corpus processing, source retrieval and a citation-oriented research interface.

Scope: Legal corpus ingestion, document processing, retrieval, model integration, research interfaces and supporting infrastructure.

Technologies we work with

  • Argo CD
  • Kubernetes
  • Docker
  • Podman
  • Ansible
  • Jenkins
  • Chef
  • Proxmox VE
  • Google Cloud
  • Linux
  • Red Hat
  • CentOS
  • NGINX
  • Apache
  • Traefik
  • Prometheus
  • Grafana
  • PostgreSQL
  • MySQL
  • MariaDB
  • Redis
  • etcd
  • Qdrant
  • Elasticsearch
  • Logstash
  • Kibana
  • PagerDuty
  • Go
  • Python
  • FastAPI
  • PHP
  • TypeScript
  • React