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
Branch audit analytics — zone performance and score trends

ANALYTICS — ZONE PERFORMANCE & SCORE TRENDS

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
Fraud detection dashboard — real-time integrity monitoring

FRAUD DETECTION DASHBOARD

n8n workflow orchestration dashboard

N8N WORKFLOW ORCHESTRATION

Live Command Center Dashboard
AI Branch Audit System — Command Center dashboard showing dispatch control, cycle progress, and zone summary

Desktop — Dispatch center, cycle stats & zone summary

AI Branch Audit System — mobile view showing branch management list with 70 branches on iPhone

Mobile (iPhone) — 70-branch management list

LIVE PRODUCTION — auditoria.grupoavante.org

// 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.

User & Role Management
User management table with numbered annotations showing role-based access control for 64 branch managers

Role-based user management — superadmin, admin & branch-user tiers with annotated controls

Reporting
PDF report generation interface

AUTOMATED PDF REPORTS

Email notification with audit result

EMAIL DELIVERY — AUDIT RESULTS

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.

SCREENSHOT PROOF

Live System — Full UI Evidence

Every screen, every role, every feature — in production.

AUTH — LOGIN & KEYCLOAK SSO

Login screen

AVANTE LOGIN PORTAL

Keycloak SSO

KEYCLOAK SSO — BRANDED THEME

DASHBOARD — COMMAND CENTER

Command center dashboard

LIVE COMMAND CENTER — 64 BRANCHES MONITORED

AUDIT CYCLE MANAGEMENT

Audit cycle board

AUDIT CYCLE BOARD

Branch list

64 BRANCHES — LIVE STATUS

ANALYTICS & SCORING

Analytics dashboard

ANALYTICS — ZONE PERFORMANCE, SCORE TRENDS, COMPLETION RATES

7-LAYER FRAUD DETECTION

Fraud detection

FRAUD DETECTION SYSTEM

Audit criteria

AUDIT CRITERIA CONFIGURATION

AUTOMATED REPORTS

Automated PDF reports

AUTOMATED PDF REPORTS — DELIVERED TO ZONE MANAGERS

USER & ADMIN MANAGEMENT

User management

USER MANAGEMENT

Admin management

ADMINISTRATOR PANEL

SYSTEM CONFIGURATION

Config panel

CONFIGURATION PANEL

Mobile dashboard

MOBILE-RESPONSIVE DASHBOARD

DESKTOP VIEWS — UI WALKTHROUGH

Desktop view 1
Desktop view 2
Desktop view 3
Desktop view 4
Desktop view 5
Desktop view 6
Desktop view 7
Desktop view 8
Desktop view 9
Desktop view 10
Desktop view 11
Desktop view 12
Desktop view 13
Desktop view 14
Desktop view 15
Desktop view 16
Desktop view 17
Desktop view 18
Desktop view 19
Desktop view 20
Desktop view 21
Desktop view 22
Desktop view 23
Desktop view 24

MOBILE VIEWS — FIELD STAFF UX

Mobile view 1
Mobile view 2
Mobile view 3
Mobile view 4
Mobile view 5
Mobile view 6
Mobile view 7
Mobile view 8
Mobile view 9
Mobile view 10
Mobile view 11
Mobile view 12
Mobile view 13
Mobile view 14

FULL UI WALKTHROUGH — ALL ROLES

Landing

LANDING

Cycle board

CYCLE BOARD

Branch list

BRANCH LIST

Branch detail

BRANCH DETAIL

Cycle history

CYCLE HISTORY

Reports

REPORTS

Zone dashboard

ZONE DASHBOARD

Analytics

ANALYTICS

Admin sidebar

ADMIN SIDEBAR

Config

CONFIG

User management

USER MGMT

Admin panel

ADMIN PANEL

Fraud integrity

FRAUD INTEGRITY

Feature flags

FEATURE FLAGS

Zone Chiapas

ZONE — CHIAPAS

Zone Nuevo Leon

ZONE — NUEVO LEÓN

Login form

LOGIN FORM

2FA

2FA AUTH

Sidebar

SIDEBAR NAV

QA TEST MEDIA — REAL AUDIT PHOTO SUBMISSIONS

Actual photos submitted through the form during QA testing — processed by Gemini Vision, hash-deduplicated, GPS-verified.

QA banos
QA banos general
QA counter
QA synthetic
QA senalizacion
QA taza
QA banos 2
QA banos 3

BUILD ARCHIVE — 57 BUILD SCREENSHOTS

Development build progression captured from Feb–Apr 2026.

Build Feb 28
Build Mar 02
Build Mar 02 b
Build Mar 02 c
// 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 →
View Live → auditoria.grupoavante.org