Case Study

AI-Powered Branch Audit System for a 64-Location Retailer

A fully automated quality audit pipeline that uses computer vision AI to score branch compliance across Mexico — replacing manual inspections with intelligent, fraud-resistant automation.

64
Branches
<60s
AI Scoring
0
Manual Intervention
Client
Arellano Global
Industry
Automotive Retail
Scope
64 Branches · 14 Zones
Delivery
5 Workflows · 150+ Nodes
Built by
Del Rey Valmoria
// 01 — The Problem

Manual Audits Don't Scale

Arellano Global's end client operates 64 retail locations spread across 14 zones in Mexico. Maintaining consistent brand standards — from storefront signage to service area cleanliness — was impossible to enforce manually at scale.

Quality standards varied wildly by location. There was no systematic way to compare branch performance or enforce brand guidelines uniformly. Managers could submit recycled, downloaded, or outdated photos to pass audits — and without technical validation, there was no way to verify evidence authenticity.

Audit requests went unanswered for days. No automated follow-up, no escalation path for non-responders, no way to track who submitted on time. Leadership lacked consolidated reporting — no cross-branch rankings, zone comparisons, or trend data to inform strategic decisions about underperforming locations.

Four problems, one root cause: the audit process was manual, unverifiable, and invisible to leadership. We needed to automate everything — from the first email to the final executive PDF.
// 02 — The Vision

A Fully Automated AI Audit Pipeline

Five interconnected workflows on n8n that handle every stage of the audit lifecycle — from intelligent scheduling and evidence collection to AI-powered scoring, fraud detection, and executive reporting. The entire system is controlled from a single Google Sheet.

01
Daily Scheduler
Cron · 8 AM
12 nodes
02
Form Processor & AI
Webhook
77 nodes
03
Reminder System
Cron · 5 min
19 nodes
04
Report Generator
Cron · 14 days
26 nodes
05
Reference Refresh
Cron · 2 AM
16 nodes
Google Sheets (Config)
Google Drive (Evidence)
NocoDB (5 tables)
Postmark (Email)
Gemini Files (AI Cache)
// 03 — How It Works

Five Workflows, One Seamless System

Each workflow operates independently with its own trigger, but they share state through Google Sheets and NocoDB — making the system resilient, portable, and easy to maintain.

1
Daily Scheduler
⏰ Cron · 8:00 AM daily

Selects branches for daily auditing using a date-based dispatch guard with seeded LCG shuffle for fair rotation across 14-day cycles. Sends branded emails with personalized form links and a 30-minute deadline.

12 nodes
2
Form Processor & AI Engine
⚡ Webhook · On form submission

The core engine. Receives photo/video evidence via Formbricks webhook, runs 7-layer fraud detection, uploads to Google Drive, groups files by area, and sends each batch to Gemini Vision AI for scoring — all in under <60s.

77 nodes
3
Reminder & Escalation
🕑 Cron · Every 5 minutes

Monitors pending audits and sends up to 3 escalating reminders at 10-minute intervals. After 3 unanswered reminders, marks the audit as overdue and alerts the zone supervisor automatically.

19 nodes
4
Executive Report Generator
📅 Cron · Every 14 days

Aggregates all audit scores and generates a 7-section branded PDF report: KPIs, zone performance, branch rankings, score distributions, overdue tracking, and detailed per-branch breakdowns.

26 nodes
5
Reference Media Refresh
🕒 Cron · 2:00 AM daily

Downloads 21 branding reference files (17 images + 4 videos) from Google Drive, uploads them to the Gemini Files API one at a time to prevent memory issues, and caches the resulting URIs in NocoDB.

16 nodes
// 04 — The Shield

7-Layer Fraud Detection + Anti-Hallucination AI

A multi-layered fraud detection pipeline catches recycled photos, screenshots, tampered timestamps, and AI-generated images — before any scoring happens. Then 10 safeguards ensure the AI produces accurate, reproducible scores.

1

Camera EXIF Verification

Images must contain camera Make/Model EXIF tags. Rejects screenshots, crops, WhatsApp forwards, and downloaded images.

2

Timestamp Freshness

EXIF creation timestamp must be within 30 minutes of upload. Catches old photos and future-dated fakes.

3

Video Duration Check

Video evidence must be 30–120 seconds. Filters out trivially short clips and stock footage.

4

SHA-256 Hash Deduplication

Cycle-aware hash matching against NocoDB. Same file in a different cycle = fraud. Same cycle = re-submission (allowed).

5

Batch Rejection Gate

If any single file fails validation, the entire submission is rejected — saving API costs and preventing partial fraud.

6

AI Visual Fraud Analysis

Gemini Vision scans for 7 fraud categories: screen recordings, stock photos, photos of screens, AI-generated images, recycled media, wrong location, and static video.

7

Server-Side Score Override

Post-AI validation cross-checks scores vs. findings. Fraud with a positive score is forced to zero. Contradictions are flagged automatically.

Anti-Hallucination Safeguards

Schema-Locked Output

Gemini's response is constrained at the decode level with a strict JSON schema — types, enums, and required fields are enforced.

Grounding Rules

7 mandatory rules in every prompt: "only describe what you see", "don't copy criteria as findings." Forces factual analysis.

Description-First Scoring

The AI must write a factual description of each image before scoring. Chain-of-thought anchors scores to visual evidence.

Server-Side Recomputation

The final score is computed from individual criteria averages on the server — we never trust the AI's math.

Cross-Validation

High score + many negative findings? Score of 0 with no fraud? The system flags these contradictions automatically.

Reference Comparison

Each area is scored against branding reference images from a curated library. The AI sees what "good" looks like before evaluating.

Branch Self-Reference

The AI compares each submission to the same branch's previous audit — both text and images — for calibrated scoring over time.

Temperature 0.1

Near-deterministic output ensures the same photo receives the same score regardless of when the audit runs.

// 05 — Proof

267 Executions and Counting

All five workflows running in production on n8n Cloud with a 94.8% success rate. Here's the system in action.

64
Branches Audited
5
Workflows
150+
n8n Nodes
<60s
AI Analysis Time
Production Dashboard
267 runs 94.8% success 8.53s avg n8n Cloud dashboard showing 267 production executions across 5 workflows
n8n Cloud dashboard — 267 executions, 5.2% failure rate, 8.53s avg run time
Workflow Canvases
Configuration & Platform
Email Notifications
Fraud Detection in Action
Rejection email showing 4 files rejected with specific reasons
Automatic rejection email — 4 files caught by different fraud layers
// 06 — Impact

What We Delivered

A turnkey system that runs autonomously with zero daily intervention — from the first email to the final executive PDF.

Fraud-Proof Evidence Collection

7 validation layers catch recycled photos, screenshots, tampered timestamps, and AI-generated fakes before they ever reach the scoring engine.

Accurate, Reproducible AI Scores

10 anti-hallucination safeguards ensure the AI describes what it sees, not what it imagines. Server-side recomputation produces reliable 0–10 scores per area.

Executive-Ready Reporting

Bi-weekly branded PDF reports with KPI summaries, zone rankings, score distributions, and per-branch breakdowns generated and emailed automatically.

Self-Healing & Portable

All workflows fail-open on non-critical paths. Controlled from one Google Sheet, exportable as 5 JSON files — zero code changes to migrate.

Complete Accountability

Escalating reminders, automatic overdue classification, supervisor alerts, and end-to-end execution ID traceability ensure no audit falls through the cracks.

Built With
n8n (Cloud) Gemini 2.5 Flash Google Sheets Google Drive Google Docs Formbricks NocoDB Postmark ffmpeg Netlify SHA-256

Client endorsement pending verification.

// 07 — Get in Touch

Ready to Automate Your Operations?

I build intelligent automation systems that replace manual processes with reliable, AI-powered workflows. Let's talk about your project.

Get in Touch →