A single-file, zero-dependency web app that predicts which warehouse a parcel belongs to — from a barcode scan, a tracking code, or a camera photo of a shipping label. Runs entirely in the browser; no backend, no installation.
- Exact code lookup — instant match against a trained dataset of known tracking IDs
- Prefix / pattern matching — rule-based engine that reads code structure (e.g.
BE…KESS→ Kess Berlin → POZ2) - Merchant keyword extraction — scans the tracking code itself for embedded merchant tokens (e.g.
KESS,JACKS) and maps them to the correct warehouse - Merchant hint lookup — type or scan a merchant name for direct routing
- Base-rate fallback — when no signal is found, uses historical warehouse distribution as a prior
- All layers are combined with confidence scoring; the highest-confidence signal wins
| Method | Desktop | Mobile |
|---|---|---|
| USB / Bluetooth HID barcode scanner | ✅ | — |
| Manual keyboard entry | ✅ | ✅ |
| Camera barcode scan (BarcodeDetector API) | ✅ | ✅ |
| Camera OCR label scan (Tesseract.js) | ✅ | ✅ |
- Create a session on the desktop to generate a 6-character code
- Scan the QR code shown in the sidebar to connect a phone instantly
- Both devices share the same prediction results in real time via PeerJS (WebRTC)
Upload two CSV files to replace the built-in dataset at runtime — no page reload needed:
| File | Required columns |
|---|---|
| Merchant lookup | Merchant, Warehouse |
| Tracking ID dataset | TrackingID, Merchant, Warehouse |
Click 🔄 Train new model after uploading to rebuild the prediction engine with your data.
- Live warehouse split bars (BER3 / POZ1 / POZ2 / other)
- Merchant breakdown table — predicted merchant name, count, and percentage
- Recent scans log with warehouse badge, confidence, and timestamp
- Session stats counter strip (mobile-friendly)
- 🌙 / ☀️ Dark / light theme toggle
- ⚙️ Settings panel (desktop only) for dataset management
- Fully responsive — switches to a focused mobile scan view automatically
- QWERTZ → QWERTY remapping for HID scanners on German keyboard layouts — scans
(Y)#13796correctly even when the OS layout produces)Z=§13796 - Strips leading
(Y)prefix automatically before prediction
No build step. Just open the file.
# Clone and open
git clone https://github.com/YOUR_USERNAME/warehouse-routing-intelligence.git
open warehouse_predictor_app.htmlOr host it anywhere static — GitHub Pages, Netlify, a local file server.
- Open the app and click ⚙️ (bottom-left of the sidebar)
- Upload your Merchant lookup CSV (
Merchant, Warehouse) - Upload your Tracking ID dataset CSV (
TrackingID, Merchant, Warehouse) - Click 🔄 Train new model
- Start scanning
Both comma (,) and semicolon (;) delimiters are supported. Column headers are case-insensitive.
warehouse_predictor_app.html ← entire app (HTML + CSS + JS, single file)
README.md
Input code
│
├─ Exact match in EXACT{}? → warehouse (100% confidence)
│
├─ Prefix / pattern rule match? → warehouse + confidence score
│
├─ Merchant hint provided?
│ └─ MERCHANT_PURE / MIXED lookup → warehouse + confidence
│
├─ Merchant token found in code?
│ └─ Substring scan of code body → warehouse + confidence (85%)
│
└─ None of the above? → base-rate warehouse (BER3 ~73%)
Multiple signals → highest confidence wins
Ties → merchant signal preferred over base rate
| Library | Purpose |
|---|---|
| PeerJS | WebRTC multi-device sync |
| QRCode.js | QR code generation for session joining |
| Tesseract.js | OCR for camera label scanning |
| Syne + JetBrains Mono | Typography |
All loaded from CDN. The app works offline after first load (fonts and Tesseract model cached by the browser).
All processing happens in your browser. No tracking codes, merchant names, or session data are sent to any server. PeerJS uses a public signalling server only to establish the WebRTC connection — the scan data itself flows peer-to-peer.
- Single HTML file — edit CSS in
<style>, logic in<script> - Prediction data lives in
const EXACT,const MERCHANT_PURE,const MERCHANT_MIXEDnear the top of the script — replace with your own or load via CSV upload - To add a new warehouse, add entries to those objects and update the warehouse stat tiles in the HTML
MIT — use freely, attribution appreciated.