From broker email chaosto a reliable revenue audit layer.
TMS Quality Validation Engine for Spotter: a production-ready, serverless validation system that verifies genuine Rate Confirmations, reconciles them against TMS records, and prevents silent revenue leakage without relying on fragile screen scraping or high-noise manual review.
The business problem is not “missing data.”It is a broken audit layer.
Dispatcher email threads contain the source of truth, but the TMS is not consistently reflecting it. In practice, the revenue leak is not random; it is structural. The existing automation cannot distinguish negotiation or irrelevant emails "ex:marketing.." from valid RCs without manual validation, which is why the audit team is drowning in noise.
Why the current architecture cannot scale
| Step | Implementation | Failure Point |
|---|---|---|
| Email Ingestion | Direct inbox scan via IMAP/library | No sender-domain filtering; ingests marketing, spam, and irrelevant threads |
| Content Extraction | Regex on email subject + body + attachment filename | Never opens PDFs; misses RCs embedded in email bodies or external links |
| Load ID Extraction | Generic keyword matching | Poor accuracy; misidentifies load numbers, causing false 'MISSING' flags |
| TMS Reconciliation | UI automation via simulated mouse clicks on pre-located screen coordinates | Breaks on any TMS layout change; partial extraction and no reliable error contract |
| Output | Google Sheet dump | Manual human review required; no structured API or audit trail |
UI Scraping as an Integration Strategy
The script extracts TMS data by clicking pre-located UI elements. This is not an integration — it is screen automation. If the TMS dev team changes a CSS class, button label, or scroll container, the extraction logic fails or returns partial data.
No Rate Confirmation Verification
The tool flags an email thread as a possible missing load if it sees a number that looks like a load ID. It does not verify whether a Rate Confirmation actually exists in the thread or if the load is simply under negotiation.
VM-Bound, Single-Threaded, Unobservable
The script runs on one virtual machine. There is no horizontal scaling, queue-based backpressure handling, structured logging, or rollback strategy when a deployment breaks extraction.
| Current State | Email Volume | Impact |
|---|---|---|
| Current | 50–600 emails/hr | 60–70% false positive rate |
| 2x Scale | 100–1,200 emails/hr | Same rate, 2x noise |
| 5x Scale | 250–3,000 emails/hr | Same rate, 5x noise |
| Patch Request | Reality |
|---|---|
| “Just make the regex smarter” | Regex cannot parse 3,000+ broker formats reliably and becomes a maintainability nightmare. |
| “Just update the UI click coordinates” | Every TMS UI change creates a new breakage cycle and no versioning or error contract. |
| “Just add more negative keywords” | Negative keyword lists grow infinitely and brokers change language constantly. |
| “Just put it on a bigger VM” | A bigger VM makes the false positives arrive faster; it does not improve accuracy or maintainability. |
3,000+ broker formats — no single communication pattern
Rate Confirmations are not delivered consistently across brokers. The engine must identify how an RC is provided, extract the relevant load or RC number, and determine which underlying load the confirmation belongs to before reconciling it against the TMS.
An RC may arrive as a standalone email with a blank subject and/or blank body, while the actual load agreement or negotiation exists in a different thread.
How brokers share RCs
Input variation- •PDF attachment
- •RC embedded in the email body
- •External broker portal link
- •Standalone RC email with little or no context
- •Broker-specific reference numbering
What the engine must determine
Rule sets- •Where to find the RC: PDF, body, link, or related thread
- •How to identify the load ID or RC number
- •How to associate a standalone RC with the correct load
- •Which metadata and patterns can be trusted
- •Broker-specific exceptions and validation rules
- •How to prevent unrelated load numbers from triggering a flag
Missing loads are slipping through
A broker sends a Rate Confirmation by email, but the dispatcher never enters it into TMS. The load is dispatched manually, billed late, or lost entirely.
The current system is too noisy to trust
The existing Python automation flags dozens of “possible” misses based on keyword matches, even when no Rate Confirmation exists. That creates a 60–70% false positive rate and overwhelms the audit team.
Broker variation is exploding
Each broker uses a different email template, PDF layout, subject pattern, and reference structure. The problem is no longer operational; it is an information architecture problem at scale.
The real rule is simple and strict
A load should only be pointed as missing when a genuine RC exists in the thread and the TMS record is absent. Everything else is noise, not a business risk.
A stack built for real operational risk — not a demo app.
This proposal is intentionally API-first, serverless, and production-oriented. The architecture is designed around the actual constraints of broker email variance, TMS integrity, and audit operational reliability.
Google Cloud Platform
The validation engine is designed to live inside the same Google Cloud ecosystem as the core TMS environment. That means lower integration friction, better identity model, and scalable serverless execution without a fragile VM footprint.
Gmail API + Domain Delegation
Instead of tailored scraping or password-sharing workarounds, the system uses the Gmail API to safely process booked broker threads, apply sender filtering, and analyze only the communication flows that matter.
TMS API as the source of truth
The validation layer treats the TMS as the system of record. Compliance checks happen through the official API, with CSV export used only as a fallback for historical backfill or operational recovery.
Next.js audit dashboard
The front end is not a spreadsheet replacement. It is a real operational desk: review queue, status tracking, audit trail, filters, escalation logic, and a working workflow built for a single auditor and growing teams.
The answer is a disciplined two-phase system.
I am not proposing a magic AI layer to solve everything on day one. The correct approach is to first get the validation rule right — RC exists, TMS missing — and then add intelligence only where the data demands it.
RC verification + TMS reconciliation
- Ingest relevant broker thread traffic via Gmail API and sender-domain filtering
- Verify whether a Rate Confirmation actually exists in the thread, not just a load number in a negotiation email
- Extract the RC identifier or load reference using broker-specific parsing rules
- Query TMS records through official API endpoints and compare against actual dispatch data
- Classify outcomes as MATCH, or MISSING with audit trail logging
Objective: reliably identify actual missing loads before they become financial losses.
Broker-specific extraction + learning loops
- Use broker-specific rule sets and LLM extraction for complex PDF and portal-based RC formats
- Normalize broker-specific reference numbers to a canonical TMS load identity
- Add confidence scoring and structured extraction validation for edge cases
- Route low-risk corrections for human approval before changes are triggered
- Visualize broker trends, exception rates, and operational performance
Goal: scale from a working audit layer to a broker-aware risk intelligence platform.
Why this order matters: Phase 1 solves the core auditing rule with high signal, low noise, and measurable ROI. Phase 2 is optional expansion after the foundation proves itself in production.
Proposed Architecture
Native to GCP. Decoupled. Observable. API-first. No infrastructure sprawl.
API vs. Database Direct: The TMS REST API is the primary integration path. It respects business logic, calculated fields, and access controls. Direct database queries bypass validation rules and risk reading stale or internal-only data. CSV export serves as a fallback for historical backfill or API downtime — not as the main pipeline.
Cloud Run
Serverless containers. Scales to zero. Runs on Spotter's GCP account. No server management.
Cloud SQL PostgreSQL
Relational audit trail: emails ↔ TMS records ↔ user actions ↔ timestamps. Supabase maps directly to Cloud SQL + Cloud Functions on GCP.
Why I Am the Right Fit
I understand the environment, constraints, and stakes. This project sits at the intersection of frontend craft, backend logic, and strategic restraint. That is exactly where I operate.
Frontend: React + Next.js + TypeScript
The audit dashboard is not a spreadsheet. It is a real-time operations tool. I build fast, accessible, stateful UIs with Next.js App Router, server components where appropriate, and clean TypeScript architecture that other developers can maintain.
Backend: Cloud SQL PostgreSQL
I have shipped production systems on Supabase and mapped that model directly to Cloud SQL + Cloud Functions on GCP. The mental model is identical; the migration path is trivial.
AI: Applied, Not Theoretical
I use LLMs as tools, not toys. For Phase 2, I will architect a pipeline that feeds broker PDFs to Vertex AI Gemini (native to GCP) or OpenAI with structured output schemas — not prompt engineering duct tape. I know when AI is necessary and when it is overhead.
Strategic Thinking: Phase Discipline
I will not sell Spotter a 6-month AI moonshot. I will deliver Phase 1 in 8 weeks that catches missing jobs immediately. Then I will ask for budget to build Phase 2. This protects Spotter's investment and proves ROI before scaling.
Phase 1 Timeline: 8 Weeks
A measured rollout that keeps the business stable while the new validation layer proves itself in production.
Parallel comparison and tuning against the legacy process.
Use the dashboard as the primary validation tool with auditor guidance.
Decommission the Python automation and Google Sheet workflow after confidence is proven.
GCP setup + Gmail API + Supabase + architecture docs
Provision GCP project, service accounts, Gmail API domain-wide delegation, Supabase project, and initial schema design. Document the architecture and validation rules before implementation begins.
TMS API + email ingestion + sender-domain filtering
Integrate TMS API credential access, add secure ingestion of Gmail messages, and implement sender-domain filtering so the system only processes relevant broker traffic.
Thread analysis + RC detection + Load ID extraction
Reconstruct email threads, detect a genuine Rate Confirmation, and map the RC number or load ID to the canonical TMS reference using extraction logic derived from broker-specific rules.
TMS integration + flagging logic + audit trail
Connect the TMS REST API, apply MISSING logic for RC exists but no TMS record, and build the audit trail needed to review and investigate each flagged event correctly.
Audit dashboard + filtering + status tracking
Build the React + Next.js dashboard with review queue, search, filters, status tracking, and clean operational flow for the audit team.
Slack + Email notifications + escalation workflow
Implement real-time notifications, email digests, escalation logic for overdue flags, and operational alerts that keep the team informed without creating noise.
Parallel run + accuracy comparison + performance tuning
Run the new system side-by-side with the legacy automation, compare outputs, tune false positives, and validate the logic against real-world broker behavior.
Bug fixes + documentation + handoff + decommission planning
Close gaps from the parallel run, finalize documentation, prepare the operational handoff, and plan the decommission of the legacy script and Google Sheet workflow.
| Phase | True Positive Rate | False Positive Rate | Coverage |
|---|---|---|---|
| Phase 1 (8 weeks) | >85% | <15% | Initial broker set |
| Phase 2 | >95% | <5% | 3,000+ brokers |
Risks & Mitigations
I will not pretend this is risk-free. Here is what can go wrong and how I prevent it.
🚧 Filename Matching Fails
If >10% of PDFs do not contain the load number in the filename, Phase 1 accuracy collapses.
Mitigation: Before writing code, I will test 200+ PDFs with regex heuristics. If the failure rate is unacceptable, I will pivot to email-subject + sender-domain matching as a fallback — still without LLM complexity.
🚧 TMS API Rate Limits
Hourly polling across all dispatcher inboxes may hit API throttling.
Mitigation: Implement exponential backoff and request batching. Cache TMS responses in Cloud SQL with a 30-minute TTL to avoid redundant API calls. Use CSV export for bulk historical reconciliation if needed.
🚧 Scope Creep to "Full AI"
Stakeholders may demand PDF content parsing in Week 2.
Mitigation: I will document the 3,000-format problem explicitly. I will show that LLM parsing requires training data, confidence thresholds, and human approval loops. Phase 2 is a separate budget and timeline. I will not compromise Phase 1 to chase it.
🚧 Sample Data Not Available
The project cannot be tuned properly without broker sample PDFs and communication examples.
Mitigation: The broker analysis team is responsible for collecting 50–100 sample PDFs and recurring communication patterns so filtering and extraction logic can be calibrated before production rollout.
Let's Build Phase 1
I understand the environment, the constraints, and the stakes. Give me 8 weeks and the access items below, and I will deliver a validation engine that catches missing jobs before they become invoice problems.
What I Need to Start:
- 1Gmail API domain-wide delegation (Workspace admin)
- 2TMS REST API credentials + endpoint documentation
- 350–100 sample PDFs (provided by broker analysis team)
Proposal prepared for Spotter.ai leadership — September 2026