No description
Multi-page PDF QC for AXA Ireland policy documents. Runs as a third mode alongside static + video, gated on profile.mode. New code isolated under backend/document_mode/ with new endpoints under /api/document/*. Phase 1 — Spine + 6 deterministic doc-scope checks ($0, runs in seconds): - Scope-aware dispatcher (document/targeted/page_sample/page_pair/page_each) - axa_font_inventory, axa_phone_inventory, axa_bold_words_definitions, axa_page_numbering, axa_print_code, axa_omg_versioning - Bootstrap bold-words dictionary extracted from Example 1 General Definitions Phase 3 — Old-vs-new diff (~$0.50/run, 3-5 min): - Page alignment via difflib SequenceMatcher (windowed fuzzy match) - Vision-LLM page-pair diff via Gemini 2.5 Pro (8 concurrent) - Two-slot upload UX, axa_policy_document_diff profile, mode=document_diff Phase 4 — PDF accessibility (PyMuPDF, $0): - 9 PDF/UA-1 aligned criteria (tagged structure, /MarkInfo, title, /Lang, encryption, font embedding, PDF version, XMP UA-conformance, alt-text) - _run_verapdf() stub for optional Java-based veraPDF integration later Phase 5 — Print preflight (PyMuPDF, $0): - 7 criteria (page geometry, bleed, image colour spaces, image DPI, transparency, PDF/X conformance, spot colours) Profile additions: - axa_policy_document — 8 deterministic checks, $0 cost - axa_policy_document_diff — 1 page-pair LLM check, ~$0.50/run API additions: - POST /api/document/start_analysis (single PDF) - POST /api/document/start_diff (old + new PDFs) Frontend additions: - Third profile.mode value (document_diff) in applyProfileMode() - Two-slot upload UX with PDF-only file pickers - checkFormValidity() branches by mode for the analyse-button gate Smoke-tested locally against Example 1 (Home Insurance V8, 86pp) and Example 2 (Landlord V1 vs V10, 68→74pp) with real findings caught including bold-words gaps, missing PDF/UA flag, transparency on press, V1→V10 bold-formatting fixes. Plan + integration map + gotchas in backend/AXA_DOCUMENT_MODE_PLAN.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| __pycache__ | ||
| backend | ||
| config | ||
| frontend | ||
| output | ||
| uploads | ||
| .gitignore | ||
| ai_qc.service | ||
| apache_config.conf | ||
| AUTH_FIX_GUIDE.md | ||
| backend_backup_20251206_153116.tar.gz | ||
| CLAUDE.md | ||
| CLAUDE_AMAZON.md | ||
| CLAUDE_BOOTS.md | ||
| CLAUDE_DOW_JONES.md | ||
| CLAUDE_LOREAL.md | ||
| CLEANUP_SUMMARY.md | ||
| config.env | ||
| debug_mode.txt | ||
| DEPLOYMENT_RESTRUCTURE.md | ||
| DEPLOYMENT_STEPS.md | ||
| DEV_PROD_SETUP.md | ||
| FOLDER_STRUCTURE.md | ||
| headless_curl_examples.sh | ||
| IMPLEMENTATION_SUMMARY.md | ||
| MIGRATION_CHECKLIST.md | ||
| MIGRATION_GUIDE.md | ||
| MIGRATION_SUMMARY.md | ||
| msal_pkce_flow.md | ||
| README.md | ||
| REORGANIZATION_COMPLETE.md | ||
| requirements.txt | ||
| server.log | ||
| server_debug.log | ||
| web_ui.html | ||
Visual AI QC - AI-Powered Quality Control Platform
AI-driven visual quality control for marketing materials and design assets using OpenAI GPT-4o and Google Gemini 2.5 Pro. Analyzes images and video against brand guidelines through 75 QC checks, 14 profiles, serving 8 clients.
Work in backend/ Directory
All development and production code is in the backend/ directory.
Directory Structure
ai_qc/
+-- backend/ # MAIN APPLICATION
| +-- api_server.py # Flask application
| +-- llm_config.py # LLM configuration (GPT-4o, Gemini 2.5 Pro)
| +-- ocr_measurement.py # Tesseract OCR layout measurements
| +-- profile_config.py # Profile management
| +-- client_config.py # Client configuration (8 clients)
| +-- pdf_processor.py # PDF brand guideline processing
| +-- media_plan_processor.py # Excel media plan parsing
| +-- usage_tracker.py # Usage tracking and cost estimation
| +-- visual_qc_apps/ # QC check modules (75 checks)
| +-- profiles/ # QC profile configurations (14 profiles)
| +-- brand_guidelines/ # Reference assets and guidelines DB
| +-- scripts/ # Deployment and testing scripts
| +-- config/ # Environment configs
| +-- uploads/ # File uploads (production)
| +-- output/ # Generated reports (production)
| +-- uploads-dev/ # File uploads (development)
| +-- output-dev/ # Generated reports (development)
| +-- usage_logs/ # Usage tracking JSONL logs
| +-- media_plans/ # Uploaded media plans
| +-- web_ui.html # Web interface
| +-- README.md # Full documentation
| +-- CLAUDE.md # Development guide
|
+-- frontend/ # Frontend-only deployment (optional)
+-- CLAUDE.md # Top-level development guide
+-- README.md # This file
Quick Start
Local Development
cd backend/
./scripts/run-local.sh
# Access at http://localhost:7183
Deploying to Dev / Prod
Code changes ship through Bitbucket branches (develop → dev server, tagged releases on main → prod server). Deploys are run manually on each server:
ssh <server>
cd /opt/ai_qc
backend/scripts/deploy.sh dev # dev — pulls latest develop
backend/scripts/deploy.sh prod v1.2.0 # prod — checks out a specific tag
backend/scripts/deploy.sh dev --dry-run # preview without applying
backend/scripts/rollback.sh last # revert the most recent deploy
backend/scripts/health-check.sh # quick "is it alive?"
See backend/CLAUDE.md for the full environment / branch / deploy reference.
Environments
| Env | URL | Branch | Status |
|---|---|---|---|
| Local | http://localhost:7183 |
any | For active development |
| Dev | https://optical-dev.oliver.solutions/ai_qc/ |
develop |
Live |
| Prod | https://optical-prod.oliver.solutions/ai_qc/ |
main (tagged) |
Not yet stood up |
Clients
Diageo, Unilever, L'Oreal, Amazon, Boots, Dow Jones, Honda, General
Capabilities
- Image QC: 75 checks across brand compliance, typography, layout, accessibility
- Video QC: Native Gemini video analysis (visual quality, brand consistency, text legibility, pacing)
- OCR Measurements: Tesseract pixel-level data for margin and alignment checks
- PDF Guidelines: Multi-page PDF upload with automatic LLM summarization
- Media Plans: Excel media plan parsing with asset spec validation
- Enterprise Auth: Azure AD with MSAL/PKCE and silent token refresh
- User Access Control: Default-deny per-user client access with admin grant/revoke and audit log
- Admin Panel: Usage analytics, user tracking, cost estimation, access management
- Profile Versioning: Automatic version control on profile edits
Documentation
- Full Documentation: See
backend/README.md - Development Guide: See
backend/CLAUDE.md - Deployment Guide: See
backend/DEV_PROD_SETUP.md