OptimizeConsulting
All case studies
AI Build · In DevelopmentStartupsAI BuildGovernment

Building Code Wizard

Optimize Consulting — AI Product

Optimize Consulting — AI Product

Result

In active development · 68+ jurisdictions · 100+ code tables · 1M+ permit records · full-stack AI built end to end

Situation

A homeowner asking 'can I build an ADU on my property?' cannot get a straight answer from any existing tool. The real answer requires knowing which jurisdiction the parcel falls under, what base zone applies, whether the property sits in a coastal overlay, fire hazard zone, or flood plain, what the current ADU setback and height rules are in that specific city or county, what state law supersedes local rules, and what fees to expect. The rules are spread across municipal codes, state statutes, city Information Bulletins, ADU handbooks, utility service standards, and fire safety guidelines — each published in a different format, on a different platform, updated on a different schedule. Navigating this correctly takes hours even for professionals. Getting it wrong is expensive.

Task

Design and build a full-stack AI assistant capable of answering specific, cited building code questions for any property in San Diego County — with enough domain structure to be trustworthy, not just plausible. That meant solving four problems simultaneously: acquiring and structuring the source material across 68+ jurisdictions, handling the wide variety of document formats (PDFs, HTML tables, scanned images, JS-rendered pages), building a jurisdiction-aware AI pipeline that never mixes rules from different cities, and designing an ingestion architecture that could scale as coverage expanded.

Action

  • Built the entire product hands-on — product definition, data architecture, content ingestion pipeline, AI orchestration, and front end.
  • Content acquisition spans 68+ jurisdictions: the City of San Diego (primary), 13 incorporated cities with their own ADU ordinances (Carlsbad, Chula Vista, Oceanside, La Mesa, Escondido, Poway, National City, Santee, Coronado, Del Mar, Imperial Beach, Lemon Grove, Solana Beach), San Diego County unincorporated areas, and the full California state code stack (CBC, CRC, CMC, CPC, CEC, CFC, CALGreen/Title 24). The City of San Diego alone required 30 DSD Information Bulletins, the 2024 HCD ADU Handbook, California Government Code sections, HOA restriction statutes, utility service standards from SDG&E and the City water/sewer authority, and CAL FIRE wildland-urban interface guidelines.
  • Table extraction was one of the hardest technical challenges. Building codes are full of data tables — setbacks, fee schedules, parking ratios, use regulation matrices — expressed in HTML, embedded in PDFs, or scanned as images with no text layer. Developed a three-tier pipeline: HTML DOM extraction for clean server-rendered tables; PDF text extraction via pdfjs-dist for born-digital documents; and OCR for scanned sources, which required processing 89 images across 20 documents. Many municipal code platforms blocked automated clients with Cloudflare interstitials or JavaScript-rendered iframes — those required manual screenshot capture and a separate processing path.
  • Over 100 structured code tables are now queryable, including the 189-row SDMC Use Regulations matrix, 14 parking ratio tables, 8 landscape requirement tables, fee schedule tables from four bulletins, and the Environmental Sensitive Lands applicability matrix.
  • The data ingestion pipeline runs in seven stages: document catalog seeding (with applicability rules as JSON-AST logic trees), DSD Information Bulletin ingestion, city permit history streaming (1M+ rows from the City of San Diego open-data CSV plus 236,000+ county permits), HTML and PDF content extraction into chunk-level RAG storage, structured table extraction, OCR processing, and a coverage reconciliation pass that flags deferred or blocked sources.
  • The AI pipeline uses Claude with a deterministic applicability engine in front of it. When a user asks about a specific address, the system resolves the parcel through ArcGIS — APN, jurisdiction, base zone, community — then runs a polygon overlay scan against 15 regulatory layers (coastal zone, fire hazard severity, MHPA, steep hillsides, FEMA flood zones, airport approach, Alquist-Priolo fault zones, and more). The deterministic engine selects exactly which documents apply to that combination of jurisdiction and project type — without AI judgment, so the same project always gets the same documents. Claude then uses five tools in a loop: property lookup, applicable-document listing, permit history search, document chunk search, and code table lookup. Every numeric standard the assistant states must come from a tool result — it cannot infer or estimate.

Result

In active development with full-stack functionality working end to end. The product currently covers 68+ jurisdictions, has ingested over 100 structured code tables, streams and queries 1M+ permit records, and resolves any San Diego County parcel against 15 regulatory overlay layers. A working demonstration that the bridge from business strategy to technical execution is real -- including the parts of AI product development that never show up in demos: the messy data, the blocked sources, the scanned PDFs, and the jurisdiction edge cases.

Have a project like this one?

Tell me what you're trying to accomplish and where things are stuck. I'll give you a straight read on what kind of solution fits.