JP Sámano

All work

Legal document pipelines

Delivered

Organized and extracted metadata from two confidential legal archives with Claude vision and the Batch API: 13,288 documents for a telecom operator and 903 notarial records for a security-services group.

Role
Engineer, LegalShelf
Period
Jun – Jul 2026
Status
Delivered
Reconcile01Plan02Copy03Read04Extract05Verify06Deliver07
Text when legible, Claude vision when scanned, all through the Batch API. Copy-only, hash-verified.
documents processed
14,191
files hash-verified
903/903
fields per document
10
first archive, build and run
3 days

Figures as of 11 September 2026.

Problem

A telecom operator's legal department had more than 13,000 scanned contracts, corporate instruments and regulatory filings, indexed by a spreadsheet nobody trusted. A second client kept its notarial deeds and corporate-book entries on a USB drive, with duplicates and no structure.

Constraints

  • Confidential client documents: nothing may be moved or modified, only copied.
  • Most pages are scans with no text layer.
  • The client's own index was unreliable but still useful as a hint.
  • A fixed budget per document, and a pipeline that can stop and resume at any point.

Decisions

  1. A hybrid reader instead of a separate OCR step

    Pages with legible text are read as text; scans are rendered and sent to Claude vision. It removed a whole OCR stage and its error modes.

  2. The Batch API, and the client's index as a prior

    Batching halved the cost, and passing the client's existing index as a hint let the model verify and correct it instead of starting blind.

  3. Copy-only, with a hash gate before anything is touched

    The organizer only ever copies, and a verification gate compares every file by hash. For the notarial archive it passed 903 of 903 with zero mismatches.

Outcome

The telecom archive was organized into 12 legal areas with 10 fields extracted per document, delivered with a reconciled master workbook. The notarial archive was classified into notarized, corporate and spare documents with five fields each and delivered through a linked workbook. When the first client flagged annex handling, I traced the cause and designed a second phase that reconciles every annex one to one.

Evidence

  • 13,288 documents extracted; a QA audit found zero mismatches between folder tree, plan and workbook.
  • 903 of 903 notarial files verified by hash before delivery.
  • Client names and documents are confidential; the pipeline design is available to walk through.

Stack

PythonClaude APIBatch APIPyMuPDFopenpyxlGoogle Apps Script