SHAKE: Structured Handling and Automated Knowledge Extraction
Team Shake | Oltek Solutions Corp. Logistics Automation Hackathon 2026
A privacy-first, fully offline pipeline that converts ocean freight contract PDFs into structured, machine-readable data — JSON, Excel, and CSV — reducing manual encoding work.
Ocean freight contracts from carriers (MSC, CMA CGM, COSCO, etc.) arrive as unstructured PDFs and must be manually re-encoded into Oltek's internal Excel tracking system. This is slow, error-prone, and labour-intensive — especially across multiple contract formats and carriers.
Upload a PDF → Shake extracts all freight rates and arbitraries and outputs clean, structured files ready for immediate use.
Unlike naive text scrapers, Shake parses the Document Object Model (JSON AST) generated by OpenDataLoader, enabling it to perfectly stitch together tables split across multiple pages and intelligently carry context (like Scope, Origins, and Commodities) down the document.
- Offline-first — no data leaves the machine; NDA-safe by design.
- JSON-Native AST Extraction — Bypasses messy text parsing by navigating the PDF's structural JSON tree, guaranteeing perfect column alignment.
- Intelligent Context State Machine — A finite state machine reads the document in order, caching dangling labels, dates, and commodities, and retroactively "stamps" them onto the correct freight tables.
- Cross-Page Table Stitching — Instantly detects when a table spills onto the next page and seamlessly joins the rows without duplicating headers.
- Multi-section support — Extracts Rates, Origin Arbitraries, and Destination Arbitraries as isolated, correctly tagged output tables.
- Batch mode — Process a single file or an entire directory in one command.
- Unified output schema — One canonical format covers multiple Oltek carrier contract templates.
- Web API — Lightweight Flask API (
shake/frontend/web/) for programmatic access.
| Layer | Technology |
|---|---|
| PDF Conversion & DOM | opendataloader_pdf (Java/Hybrid modes generating rich JSON ASTs) |
| PDF Classification | PyMuPDF (fitz) |
| Extraction Engine | Python — JSON AST traversal & Regex State Machine (shake/core/extraction.py) |
| Data Mapping | Python — Dictionary standardisation (shake/core/mapping.py) |
| Output / Export | pandas, openpyxl (Flattened CSVs & Multi-sheet Excel) |
| Web API | Flask (shake/frontend/web/) |
| Config | config.py — single source for all paths, modes, and options |
git clone https://github.com/GReturn/Shake.git
cd Shakepython -m venv .venv
# Windows
.venv\Scripts\activate
# Mac/Linux
source .venv/bin/activatepip install -r requirements.txtNote:
opendataloader_pdfrequires Java to be installed and on your system PATH.
Shake now comes with a React-based web interface for easier use.
- Start the backend API:
# In the root project directory:
python -m shake.frontend.web.app- Start the frontend UI:
cd frontend
npm install # Only needed once
npm run dev- Open your browser to
http://localhost:5173(or the port specified by Vite in your terminal).
# Process a single file
python -m shake.frontend.cli input/data/digital/ATL0347N25.pdf
# Process an entire directory (outputs to ./output/ by default)
python -m shake.frontend.cli input/ -o results/CLI flags:
| Flag | Short | Description |
|---|---|---|
--output DIR |
-o |
Output directory (default: ./output) |
--quiet |
-q |
Suppress the per-file row-count summary table |
Shake/
├── shake/ # Core Package
│ ├── core/ # Pure Domain Logic (No UI)
│ │ ├── __init__.py
│ │ ├── models.py # Data classes & enums
│ │ ├── errors.py # Custom exceptions
│ │ ├── ingestion.py # PDF → OpenDataLoader JSON AST
│ │ ├── extraction.py # JSON AST → State Machine Payload
│ │ ├── mapping.py # Payload → Mapped payload
│ │ └── exporter.py # Mapped payload → Canonical Pandas Exports
│ │
│ ├── frontend/ # Presentation Layers
│ │ ├── cli/ # Terminal UI (ANSI colors, argparse)
│ │ │ ├── __main__.py
│ │ │ ├── main.py
│ │ │ └── display.py
│ │ └── web/ # Flask Web API
│ │ └── app.py
│ │
│ └── utils/ # Shared Helpers
│ ├── logger.py
│ └── patterns.py # Single source of truth for regex
│
├── input/ # Sample contract PDFs
│ └── data/digital/
├── config.py # Central config (OCR method, output paths, ports)
├── requirements.txt
└── README.md
| Name | Role |
|---|---|
| Rafael | Technical coordination |
| Kesha | Technical documentation |
| Jive | Lead pipeline development |
| Gil | Frontend development and pitching |
| Adrian | Frontend development |
Oltek's primary bottleneck is the manual transcription of carrier rate data from PDFs into Excel. Shake addresses that problem directly by converting freight contracts into structured outputs offline and deterministically, in a format that aligns with Oltek's existing templates while standardizing data across multiple carrier formats.
Oltek Solutions Corp. — From Paper to Data Hackathon 2026
