Metaviz AI
Construction Tech / AEC SaaS / AI Compliance

GPT-4o + RAG - 200+ code checks across five disciplines, every finding cited to a real FBC/IBC/NFPA section. Days of manual review cut to supervised hours.

AI Building-Code Compliance & Permit-Review SaaS

An AI-powered construction compliance platform that automates drawing reviews, verifies building codes, and generates audit-ready engineering reports with accurate citations.

Overview

Permit review means reading hundreds of pages of construction drawings against hundreds of code rules by hand. For AEC firms and Florida code-engineering practices, that process takes days per project, requires deep discipline expertise across Architectural, Structural, Mechanical, Electrical, and Plumbing trades, and leaves no structured audit trail for the permit file.

This platform cuts that from days to hours - and, critically, makes the AI auditable. Every finding the system raises is grounded in a real code passage retrieved by ChromaDB vector search from indexed FBC, IBC, and NFPA standards. The AI cannot invent a rule: it cites, it does not guess. Reviewers verify reasoning instead of trusting a black box, and the output is a fully cited, permit-ready compliance report in both PDF and JSON.

Built on FastAPI + Celery + PostgreSQL backend, Next.js 15 frontend, and a six-stage transparent processing pipeline with live progress, per-stage cost display, and a hard billing ceiling per document. Live in production for a Florida building-code engineering firm.

The platform ingests construction PDF drawings, runs AWS Textract OCR and GPT-4o per-page extraction, retrieves the exact relevant code passage via ChromaDB vector search (RAG), and runs 200+ checks per discipline across five trades: Architectural, Structural, Mechanical, Electrical, and Plumbing, plus NFPA fire and life-safety codes (NFPA 1, 70, 72, 101).

Every finding links to a real citation - for example, FBC Plumbing 2023, Section 712.1 - so the AI cannot hallucinate a rule. It must reference an indexed passage from the FBC, IBC, or NFPA standards stored in ChromaDB. The output is a fully cited, audit-ready compliance report in PDF for the permit file and JSON for BIM/PM tooling, with every page traceable to the source drawing.

The system is cost-aware by design: page, OCR, and LLM cost is estimated up front with a hard ceiling per document to prevent runaway spend. Reviewers operate in a full human-in-the-loop workflow - they can edit any extracted field and re-run checks before accepting the final report.

- Relevant keywords -
  • AI Permit Review SaaS
  • Building Code Compliance AI
  • GPT-4o RAG Construction
  • AWS Textract OCR PDF
  • ChromaDB Vector Search
  • FBC IBC NFPA Compliance
  • AEC AI Platform
  • FastAPI Celery Backend
  • Next.js 15 TypeScript
  • MEP Structural Architectural Checks
  • Audit-Ready Compliance Report
  • Zero-Hallucination AI
Challenge & Solution

Solving real problems with smart engineering

Six-Stage Transparent Processing Pipeline

Problem

Manual permit review takes days per project - reading hundreds of pages of construction drawings against hundreds of code rules by hand is the standard process at AEC firms and code-engineering practices. A single project review can take two to five days of senior engineer time, with no structured tracking of which rules were checked or why a finding was raised.

Solution

Documents move through a fully visible pipeline: Queued → OCR (AWS Textract) → Schedule Detection → Table Extraction → Equipment Parsing → Ready-for-Verification. Each stage shows live progress and its own cost, so reviewers always know exactly where processing is and what it is costing.

Audit-Ready PDF + JSON Export

Problem

No audit trail for the permit file - traditional review produces a marked-up PDF or a handwritten checklist, neither of which gives the permit office a structured, traceable record of which code sections were checked, which passed, and which failed. When a drawing is revised, the review process starts from scratch with no reference to what was previously verified.

Solution

Every report exports as a printable PDF for the permit file and a complete JSON record for BIM and PM tooling. Every finding links to its source drawing page, the extracted field, and the specific code citation - creating a full traceable chain from drawing to code section.

Zero-Hallucination RAG-Grounded AI

Problem

AI hallucination makes LLMs unusable for compliance without RAG - off-the-shelf LLMs cannot be trusted for code compliance because they generate plausible-sounding but unverified code citations. A building official cannot accept 'AI says this complies' without a reference to the actual code section. Without grounding every finding in a retrieved passage from an indexed code corpus, AI is a liability rather than an asset in permit review.

Solution

Every finding is grounded in a real code passage retrieved by ChromaDB vector search from indexed FBC, IBC, and NFPA standards. The AI cannot invent a rule; it must cite an indexed passage before raising any flag. This makes the output permit-ready and professionally defensible, not just a plausible LLM response.

200+ Discipline-Specific Code Checks Across Five Trades

Problem

Five disciplines require different expertise and rule sets - Architectural, Structural, Mechanical, Electrical, and Plumbing reviews each require a different body of knowledge, different sections of the FBC, IBC, and NFPA standards, and different extraction logic from construction drawings. A single generic AI cannot handle all five trades without discipline-specific prompts, rule sets, and structured output schemas.

Solution

Each discipline (Architectural, Structural, Mechanical, Electrical, Plumbing) gets its own prompts, extraction logic, rule set, and check library. Plumbing checks drainage slope, backflow prevention, and venting. Structural checks load paths, framing, and foundations. Electrical checks NEC compliance. Every check is traceable to a specific code section.

Streaming 500 MB Uploads with Deduplication

Problem

Large PDF processing is expensive and unpredictable - construction drawing sets can be hundreds of pages and hundreds of megabytes. Sending entire documents to an LLM is cost-prohibitive, technically unreliable, and produces unstructured outputs that cannot be audited. Without per-page processing, cost control, and structured JSON extraction, AI-assisted review is not viable at production scale.

Solution

Construction drawing PDFs are streamed to disk in 5 MB chunks with magic-byte validation and SHA-256 content hashing. Duplicate submissions are detected and rejected before any processing begins - preventing double-billing on resubmitted drawings and ensuring storage integrity.

Per-Page Structured GPT-4o Extraction with Confidence Scores

Problem

No human-in-the-loop means no professional accountability - code-compliance decisions carry professional and legal liability. A system that produces a report without allowing a licensed engineer to review, edit, and approve every extracted field and finding is not usable in a regulated permit-review workflow. Reviewers need to verify AI reasoning, not accept its output as final.

Solution

GPT-4o processes each page individually and outputs typed JSON with confidence scores for every extracted field. Reviewers can inspect, edit, and approve extraction results before checks run - full human-in-the-loop at the data layer, not just the output layer.

Cost-Aware Processing with Hard Ceilings

Problem

Billing surprises kill production AI tool adoption - AEC firms and code-engineering practices cannot adopt an AI tool that runs unpredictable LLM costs per document. Without up-front cost estimates, live per-stage cost display, and a hard ceiling per document, the tool is a financial risk rather than a productivity gain.

Solution

Page count, OCR cost, and LLM token cost are estimated up front before any processing begins. A hard cost ceiling per document prevents runaway spend. Live cost display per stage and per page gives practices complete financial visibility into every review job.

Features

What it does

Document Ingestion & Deduplication

  • Streaming upload handler for PDFs up to 500 MB - 5 MB chunk streaming to disk
  • Magic-byte MIME type validation - rejects non-PDF files regardless of extension
  • SHA-256 content hash deduplication - duplicate submissions rejected before any processing or billing
  • S3 storage with signed URL access control - no public document access
  • Cost estimate displayed and acknowledged before any Celery job is queued

OCR Pipeline (AWS Textract)

  • Per-page Textract processing returning structured blocks: lines, words, tables, key-value pairs
  • Block output stored as JSONB in PostgreSQL per page for downstream extraction stages
  • Textract cost tracked per page and accumulated against the per-document hard ceiling
  • Schedule and title block detection identifies drawing metadata for cross-referencing
  • Table rows parsed into typed JSON for equipment schedules and specification tables

AI Extraction (GPT-4o + PydanticAI)

  • Per-page structured extraction: typed JSON output with confidence scores for every field
  • Discipline-specific prompts for Architectural, Structural, Mechanical, Electrical, and Plumbing pages
  • Equipment parsing: mechanical schedules, panel schedules, fixture schedules, structural member tables
  • PydanticAI validates every GPT-4o output before database write - no unstructured LLM responses stored
  • Low-confidence fields automatically flagged for mandatory reviewer correction

RAG-Grounded Compliance Checks (ChromaDB)

  • FBC, IBC, and NFPA 1/70/72/101 standards indexed as OpenAI vector embeddings in ChromaDB
  • Top-k code passage retrieval before every GPT-4o compliance check - grounds every finding
  • 200+ discipline-specific checks: Architectural (occupancy, egress, accessibility), Structural (loads, framing, foundations), Mechanical (HVAC, ventilation), Electrical (NEC panels, circuits), Plumbing (drainage, backflow, venting)
  • NFPA fire and life-safety checks: NFPA 1 (Fire Code), NFPA 70 (NEC), NFPA 72 (Fire Alarm), NFPA 101 (Life Safety Code)
  • Every finding includes: code citation, retrieved passage excerpt, extracted drawing value, severity, and source page

Human-in-the-Loop Review

  • Per-page extraction review UI: inspect and edit any GPT-4o extracted field before checks run
  • Per-finding approval: accept, reject, or flag each compliance finding with reviewer comments
  • Reviewer corrections stored separately from raw AI output - checks always run against approved data
  • Full audit log: every edit, approval, and rejection timestamped with reviewer identity
  • Re-run checks on any corrected extraction without reprocessing the full pipeline

Cost Control & Observability

  • Up-front cost estimate (page count + Textract + LLM tokens) before processing begins
  • Live per-stage cost display on the pipeline progress UI
  • Configurable hard cost ceiling per document - enforced by Celery task gating
  • Cost ceiling alert via Sentry notification if threshold is reached mid-pipeline
  • Sentry error tracking + structlog JSON logs with per-request trace IDs across all pipeline stages

Report Generation (PDF + JSON)

  • Branded PDF compliance report rendered by ReportLab for the permit file
  • Every finding links to: source drawing page, extracted field value, retrieved code citation, reviewer approval
  • Complete JSON export for BIM and PM tooling with full finding metadata
  • Both outputs stored to S3 with signed URL download links
  • Immutable report versions: any post-approval change creates a new versioned report record

Processing Pipeline UI

  • Six-stage progress view: Queued / OCR / Schedule Detection / Table Extraction / Equipment Parsing / Ready
  • Per-stage status indicators with timing and cumulative cost display
  • TanStack Query polling for live async Celery pipeline updates without page refresh
  • Document history view: all past submissions with processing status, cost totals, and report access
  • Duplicate submission alert: shows original submission date and cost if SHA-256 match detected
Tech Stack

Built with

Web Console (Next.js)

  • Next.js 15 + React 19 - reviewer console
  • TypeScript - end-to-end type safety
  • Tailwind CSS - styling
  • TanStack Query - live pipeline polling
  • Sentry - client-side error tracking

Backend (FastAPI)

  • FastAPI on Python 3.11 - async API with uvicorn + gunicorn
  • Pydantic v2 - typed schemas and validation
  • PydanticAI - structured LLM outputs
  • async SQLAlchemy + asyncpg + Alembic - ORM and migrations

Processing Pipeline

  • Celery - six-stage document pipeline as task chains
  • Redis - broker and result backend
  • Horizontal Celery scaling - throughput on demand
  • Per-stage progress and cost tracking

OCR & Extraction

  • AWS Textract - per-page OCR blocks, tables and key-value pairs
  • Per-page JSONB storage in PostgreSQL
  • Structured extraction with confidence scores

AI Engine

  • OpenAI GPT-4o - vision and structured output per page
  • PydanticAI - model routing and output validation
  • OpenAI text-embedding-3-small - embeddings for retrieval

RAG & Vector Store

  • ChromaDB - FBC, IBC and NFPA 1/70/72/101 embeddings
  • OpenAI Embeddings - code-passage indexing
  • Top-k retrieval per compliance check - every finding cited

Database

  • PostgreSQL - primary store
  • JSONB columns - OCR blocks, extractions and findings
  • asyncpg + Alembic - async driver and migrations

Storage & Security

  • AWS S3 - PDFs, OCR outputs and reports
  • Pre-signed multipart upload - 500 MB streaming
  • Signed-URL access control with configurable expiry
  • Per-reviewer audit logging

Observability & Reporting

  • Sentry - error tracking across backend and frontend
  • structlog - JSON logs with trace IDs
  • Per-stage cost logging to PostgreSQL
  • ReportLab - branded compliance report PDFs

DevOps & Infrastructure

  • Docker - containerised builds
  • GitHub Actions - CI/CD
  • Coolify on DigitalOcean - managed Docker Compose
  • Traefik - reverse proxy
  • Cloudflare + Let’s Encrypt - DNS and TLS
Results & Value

What actually changed

  • Delivered a production AI permit-review platform (Next.js 15 SPA, FastAPI backend, six-stage Celery pipeline) for a live Florida code-engineering firm
  • Zero-hallucination compliance findings: ChromaDB RAG retrieves real FBC/IBC/NFPA citations before every GPT-4o check - the AI cites, it does not guess
  • 200+ discipline-specific checks across Architectural, Structural, MEP (Mechanical, Electrical, Plumbing), and NFPA fire/life-safety codes in one codebase
  • Full human-in-the-loop workflow: per-page extraction review, per-finding approval, and immutable report versioning for professional accountability
  • Cost-aware architecture: up-front estimates, live per-stage tracking, and configurable hard ceilings prevent billing surprises at production document volumes
  • Streaming 500 MB upload with SHA-256 dedup and signed S3 URLs - production-grade data handling for large construction drawing sets
  • End-to-end observability: Sentry + structlog across backend and frontend with per-request trace IDs and per-stage cost logging to PostgreSQL
  • Horizontal Celery scaling with zero code changes - worker replicas add capacity without architectural changes
01Headline outcome
⚡Days → Hours on Every Project
02
🔒
Zero-Hallucination, Permit-Ready Output
03
📐
200+ Checks Across Five Disciplines in One Platform
04
💰
No Billing Surprises, Ever
05
📈
Production-Grade at Scale
06
🤝
Human Accountability at Every Step
07
📄
Audit-Ready Permit File Output

Have a similar project in mind?

Let's talk about how AI can transform your service business.

Discuss Your Idea Today