feat: finalize end-to-end cabinet estimation and shop drawing pipeline for Projects 23-033 (Casa Familia) and 23-045 (Heritage Village)
@@ -1,9 +1,13 @@
|
||||
# Copy this file to .env and fill in your API keys
|
||||
# Never commit .env to version control
|
||||
|
||||
# ── AI API Keys ─────────────────────────────────────────────────────────────
|
||||
ANTHROPIC_API_KEY=sk-ant-...your-claude-key-here...
|
||||
OPENAI_API_KEY=sk-...your-openai-key-here...
|
||||
# ── AI Vision API Keys ───────────────────────────────────────────────────────
|
||||
# PRIMARY: Gemini 2.5 Pro (FREE — 25 req/day)
|
||||
# Get key at: https://aistudio.google.com → Get API Key → Create API Key
|
||||
GEMINI_API_KEY=AIza...your-gemini-key-here...
|
||||
|
||||
# OPTIONAL: Anthropic Claude (paid) — only if you prefer Claude
|
||||
ANTHROPIC_API_KEY=sk-ant-...your-anthropic-key-here...
|
||||
|
||||
# ── Currency Conversion ─────────────────────────────────────────────────────
|
||||
# EUR to USD exchange rate (update periodically)
|
||||
|
||||
@@ -252,7 +252,7 @@ endobj
|
||||
endobj
|
||||
28 0 obj
|
||||
<<
|
||||
/Author (ITALIAN KITCHEN AND BATH) /CreationDate (D:20260617184720+05'00') /Creator (AI Production Compiler v5.0) /Keywords () /ModDate (D:20260617184720+05'00') /Producer (ReportLab PDF Library - \(opensource\))
|
||||
/Author (ITALIAN KITCHEN AND BATH) /CreationDate (D:20260618192055+05'00') /Creator (AI Production Compiler v5.0) /Keywords () /ModDate (D:20260618192055+05'00') /Producer (ReportLab PDF Library - \(opensource\))
|
||||
/Subject (Kitchen & Vanity Shop Drawings) /Title (Shop Drawings \204 CASA FAMILIA \204 23-033) /Trapped /False
|
||||
>>
|
||||
endobj
|
||||
@@ -482,7 +482,7 @@ xref
|
||||
trailer
|
||||
<<
|
||||
/ID
|
||||
[<66330c45c13ba46acc17336c36047ae5><66330c45c13ba46acc17336c36047ae5>]
|
||||
[<5730d34add1109e51e498796b1244c1b><5730d34add1109e51e498796b1244c1b>]
|
||||
% ReportLab generated PDF document -- digest (opensource)
|
||||
|
||||
/Info 28 0 R
|
||||
|
||||
@@ -182,7 +182,7 @@ endobj
|
||||
endobj
|
||||
21 0 obj
|
||||
<<
|
||||
/Author (ITALIAN KITCHEN AND BATH) /CreationDate (D:20260617191917+05'00') /Creator (AI Production Compiler v1.0) /Keywords () /ModDate (D:20260617191917+05'00') /Producer (ReportLab PDF Library - \(opensource\))
|
||||
/Author (ITALIAN KITCHEN AND BATH) /CreationDate (D:20260618192121+05'00') /Creator (AI Production Compiler v1.0) /Keywords () /ModDate (D:20260618192121+05'00') /Producer (ReportLab PDF Library - \(opensource\))
|
||||
/Subject (Kitchen & Vanity Shop Drawings) /Title (Shop Drawings \204 HERITAGE VILLAGE \204 23-045) /Trapped /False
|
||||
>>
|
||||
endobj
|
||||
@@ -348,7 +348,7 @@ xref
|
||||
trailer
|
||||
<<
|
||||
/ID
|
||||
[<bbb300f4f07f6196c61db62d680b712f><bbb300f4f07f6196c61db62d680b712f>]
|
||||
[<1cb326d79c77bed28598378302a35b0a><1cb326d79c77bed28598378302a35b0a>]
|
||||
% ReportLab generated PDF document -- digest (opensource)
|
||||
|
||||
/Info 21 0 R
|
||||
|
||||
@@ -1,30 +1,21 @@
|
||||
"""
|
||||
===========================================================================
|
||||
core/ai_vision_classifier.py — Claude Vision Cabinet Classifier
|
||||
core/ai_vision_classifier.py — Groq Vision Cabinet Classifier
|
||||
===========================================================================
|
||||
THE MISSING PIECE: Integrates Claude 3.5 Sonnet Vision API to classify
|
||||
cabinets from architectural elevation drawings.
|
||||
|
||||
This is Layer 4 of the 5-layer extraction pipeline:
|
||||
Layer 1: PDF rendering (pdf_extractor.py)
|
||||
Layer 2: Region detection (region_detector.py)
|
||||
Layer 3: Dimension text extraction (dimension_parser.py)
|
||||
Layer 4: AI Vision spatial reasoning ← THIS FILE
|
||||
Layer 5: Rule-based validation (cabinet_validator.py)
|
||||
Uses Groq API (llama-3.2-90b-vision-preview) to classify cabinets from
|
||||
architectural elevation drawings. Groq is free, extremely fast, and
|
||||
llama-3.2-90b-vision is excellent at reading technical drawings.
|
||||
|
||||
Pipeline per elevation crop:
|
||||
1. Receive: PNG image bytes (400 DPI crop) + pre-extracted dims + rects
|
||||
2. Build: structured prompt with dimension context
|
||||
3. Call: Claude 3.5 Sonnet API with image
|
||||
3. Call: Groq API (llama-3.2-90b-vision-preview) with base64 image
|
||||
4. Parse: JSON response → list[CabinetItem]
|
||||
5. Retry: if JSON parse fails, request fix
|
||||
6. Optionally validate with GPT-4o (if confidence < threshold)
|
||||
5. Retry with fix prompt if JSON parse fails
|
||||
6. Exponential backoff on API errors
|
||||
|
||||
Error handling:
|
||||
- JSON parse failures: retry up to 3 times with "fix this JSON" prompt
|
||||
- API errors: exponential backoff with 3 retries
|
||||
- Low confidence: flag for human review (don't crash)
|
||||
- No API key: raise clear error with instructions
|
||||
Free tier: very generous (no hard daily limit on llama-3.2-90b-vision)
|
||||
Get key at: https://console.groq.com
|
||||
===========================================================================
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -36,11 +27,11 @@ import time
|
||||
from dataclasses import dataclass, field, asdict
|
||||
from typing import Optional
|
||||
|
||||
from core.config import (
|
||||
ANTHROPIC_API_KEY, OPENAI_API_KEY,
|
||||
CLAUDE_MODEL, CLAUDE_MAX_TOKENS, CLAUDE_TEMPERATURE,
|
||||
GPT4O_MODEL, AUTO_APPROVE_CONFIDENCE,
|
||||
)
|
||||
from core.config import GROQ_API_KEY, AUTO_APPROVE_CONFIDENCE
|
||||
|
||||
GROQ_MODEL = "meta-llama/llama-4-scout-17b-16e-instruct"
|
||||
GROQ_MAX_TOKENS = 4096
|
||||
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════════════
|
||||
@@ -260,7 +251,7 @@ Return ONLY the JSON array, nothing else."""
|
||||
class CabinetVisionClassifier:
|
||||
"""
|
||||
Classifies cabinets from architectural elevation drawing images
|
||||
using Claude 3.5 Sonnet Vision API.
|
||||
using Groq API (llama-3.2-90b-vision-preview) — free & fast.
|
||||
|
||||
Usage:
|
||||
classifier = CabinetVisionClassifier()
|
||||
@@ -272,37 +263,25 @@ class CabinetVisionClassifier:
|
||||
)
|
||||
"""
|
||||
|
||||
def __init__(self, use_gpt4o_backup: bool = False):
|
||||
"""
|
||||
Args:
|
||||
use_gpt4o_backup: If True, cross-validate low-confidence results
|
||||
with GPT-4o (requires OPENAI_API_KEY).
|
||||
"""
|
||||
self.use_gpt4o_backup = use_gpt4o_backup
|
||||
self._anthropic_client = None
|
||||
self._openai_client = None
|
||||
def __init__(self):
|
||||
self._groq_client = None
|
||||
self._validate_keys()
|
||||
|
||||
def _validate_keys(self):
|
||||
if not ANTHROPIC_API_KEY:
|
||||
if not GROQ_API_KEY:
|
||||
raise EnvironmentError(
|
||||
"ANTHROPIC_API_KEY is not set.\n"
|
||||
"1. Copy .env.example to .env\n"
|
||||
"2. Add your Anthropic API key\n"
|
||||
"3. Or use --skip-ai flag to use cached results"
|
||||
"GROQ_API_KEY is not set.\n"
|
||||
"1. Go to https://console.groq.com\n"
|
||||
"2. Create an API key\n"
|
||||
"3. Add to .env: GROQ_API_KEY=gsk_...\n"
|
||||
"4. Or use --skip-ai flag to skip AI extraction"
|
||||
)
|
||||
|
||||
def _get_anthropic(self):
|
||||
if self._anthropic_client is None:
|
||||
import anthropic
|
||||
self._anthropic_client = anthropic.Anthropic(api_key=ANTHROPIC_API_KEY)
|
||||
return self._anthropic_client
|
||||
|
||||
def _get_openai(self):
|
||||
if self._openai_client is None:
|
||||
import openai
|
||||
self._openai_client = openai.OpenAI(api_key=OPENAI_API_KEY)
|
||||
return self._openai_client
|
||||
def _get_groq(self):
|
||||
if self._groq_client is None:
|
||||
from groq import Groq
|
||||
self._groq_client = Groq(api_key=GROQ_API_KEY)
|
||||
return self._groq_client
|
||||
|
||||
# ── Main Classification ───────────────────────────────────────────────
|
||||
|
||||
@@ -353,138 +332,94 @@ class CabinetVisionClassifier:
|
||||
# Encode image for API
|
||||
image_b64 = base64.standard_b64encode(image_bytes).decode("utf-8")
|
||||
|
||||
# Call Claude with retries
|
||||
raw_json = self._call_claude(
|
||||
image_b64 = image_b64,
|
||||
# Call Groq with retries
|
||||
raw_json = self._call_groq(
|
||||
image_bytes = image_bytes,
|
||||
user_prompt = user_prompt,
|
||||
max_retries = max_retries,
|
||||
)
|
||||
result.api_calls += 1
|
||||
|
||||
if raw_json is None:
|
||||
result.review_flags.append("Claude API call failed after all retries")
|
||||
result.review_flags.append("Groq API call failed after all retries")
|
||||
return result
|
||||
|
||||
# Parse JSON response
|
||||
cabinets = self._parse_cabinet_json(raw_json, elevation_label)
|
||||
if cabinets is None:
|
||||
result.review_flags.append("Failed to parse Claude JSON response")
|
||||
# Retry with explicit JSON fix instruction
|
||||
fix_prompt = (
|
||||
f"{user_prompt}\n\nIMPORTANT: Return ONLY a valid JSON array. "
|
||||
"No explanation text, no markdown fences, just the raw JSON array."
|
||||
)
|
||||
raw_json2 = self._call_groq(image_bytes, fix_prompt, max_retries=1)
|
||||
if raw_json2:
|
||||
cabinets = self._parse_cabinet_json(raw_json2, elevation_label)
|
||||
|
||||
if cabinets is None:
|
||||
result.review_flags.append("Failed to parse Groq JSON response")
|
||||
return result
|
||||
|
||||
result.cabinets = cabinets
|
||||
|
||||
# Cross-validate with GPT-4o if confidence is low
|
||||
if self.use_gpt4o_backup and result.avg_confidence < AUTO_APPROVE_CONFIDENCE:
|
||||
gpt_cabinets = self._call_gpt4o(image_b64, user_prompt)
|
||||
result.api_calls += 1
|
||||
if gpt_cabinets:
|
||||
result.cabinets = self._merge_results(cabinets, gpt_cabinets)
|
||||
result.review_flags.append(
|
||||
f"GPT-4o cross-validation applied (avg confidence was {result.avg_confidence:.2f})"
|
||||
)
|
||||
|
||||
# Set auto-approve flag
|
||||
result.auto_approved = (
|
||||
result.avg_confidence >= AUTO_APPROVE_CONFIDENCE and
|
||||
len(result.cabinets) > 0
|
||||
)
|
||||
|
||||
if not result.auto_approved:
|
||||
result.review_flags.append(
|
||||
f"Requires human review: avg confidence {result.avg_confidence:.2f} < {AUTO_APPROVE_CONFIDENCE}"
|
||||
f"Requires review: avg confidence {result.avg_confidence:.2f} < {AUTO_APPROVE_CONFIDENCE}"
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
# ── Claude API Call ───────────────────────────────────────────────────
|
||||
# ── Groq API Call ────────────────────────────────────────────────────
|
||||
|
||||
def _call_claude(
|
||||
def _call_groq(
|
||||
self,
|
||||
image_b64: str,
|
||||
image_bytes: bytes,
|
||||
user_prompt: str,
|
||||
max_retries: int = 3,
|
||||
) -> Optional[str]:
|
||||
"""Call Claude 3.5 Sonnet Vision API. Returns raw text response or None."""
|
||||
client = self._get_anthropic()
|
||||
"""Call Groq llama-3.2-90b-vision API. Returns raw text or None."""
|
||||
client = self._get_groq()
|
||||
image_b64 = base64.standard_b64encode(image_bytes).decode("utf-8")
|
||||
system_prompt = _build_system_prompt()
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
response = client.messages.create(
|
||||
model = CLAUDE_MODEL,
|
||||
max_tokens = CLAUDE_MAX_TOKENS,
|
||||
system = _build_system_prompt(),
|
||||
messages = [
|
||||
response = client.chat.completions.create(
|
||||
model=GROQ_MODEL,
|
||||
max_tokens=GROQ_MAX_TOKENS,
|
||||
temperature=0.1,
|
||||
messages=[
|
||||
{"role": "system", "content": system_prompt},
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "image",
|
||||
"source": {
|
||||
"type": "base64",
|
||||
"media_type": "image/png",
|
||||
"data": image_b64,
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": f"data:image/png;base64,{image_b64}",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": user_prompt,
|
||||
},
|
||||
{"type": "text", "text": user_prompt},
|
||||
],
|
||||
}
|
||||
},
|
||||
],
|
||||
)
|
||||
return response.content[0].text
|
||||
return response.choices[0].message.content
|
||||
|
||||
except Exception as e:
|
||||
wait = 2 ** attempt # exponential backoff: 1s, 2s, 4s
|
||||
print(f" ⚠️ Claude API attempt {attempt+1}/{max_retries} failed: {e}")
|
||||
wait = 2 ** attempt
|
||||
print(f" [WARN] Groq attempt {attempt+1}/{max_retries} failed: {e}")
|
||||
if attempt < max_retries - 1:
|
||||
print(f" Retrying in {wait}s...")
|
||||
print(f" Retrying in {wait}s...")
|
||||
time.sleep(wait)
|
||||
else:
|
||||
print(" ❌ All Claude retries exhausted.")
|
||||
|
||||
print(" [FAIL] All Groq retries exhausted.")
|
||||
return None
|
||||
|
||||
# ── GPT-4o Backup Call ────────────────────────────────────────────────
|
||||
|
||||
def _call_gpt4o(
|
||||
self,
|
||||
image_b64: str,
|
||||
user_prompt: str,
|
||||
) -> Optional[list[CabinetItem]]:
|
||||
"""Call GPT-4o Vision as backup validator."""
|
||||
if not OPENAI_API_KEY:
|
||||
return None
|
||||
|
||||
try:
|
||||
client = self._get_openai()
|
||||
response = client.chat.completions.create(
|
||||
model = GPT4O_MODEL,
|
||||
max_tokens = CLAUDE_MAX_TOKENS,
|
||||
messages = [
|
||||
{"role": "system", "content": _build_system_prompt()},
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": f"data:image/png;base64,{image_b64}",
|
||||
"detail": "high",
|
||||
},
|
||||
},
|
||||
{"type": "text", "text": user_prompt},
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
raw = response.choices[0].message.content
|
||||
return self._parse_cabinet_json(raw, "GPT-4o")
|
||||
except Exception as e:
|
||||
print(f" ⚠️ GPT-4o backup call failed: {e}")
|
||||
return None
|
||||
|
||||
# ── JSON Parsing ──────────────────────────────────────────────────────
|
||||
|
||||
def _parse_cabinet_json(
|
||||
@@ -562,56 +497,12 @@ class CabinetVisionClassifier:
|
||||
quantity = int(item.get("quantity", 1)),
|
||||
is_ada = bool(item.get("is_ada", False)),
|
||||
notes = str(item.get("notes", "")),
|
||||
source = "claude",
|
||||
source = "groq",
|
||||
))
|
||||
|
||||
return cabinets
|
||||
|
||||
# ── Result Merging ────────────────────────────────────────────────────
|
||||
|
||||
def _merge_results(
|
||||
self,
|
||||
claude_cabinets: list[CabinetItem],
|
||||
gpt_cabinets: list[CabinetItem],
|
||||
) -> list[CabinetItem]:
|
||||
"""
|
||||
Merge Claude + GPT-4o results.
|
||||
Where both agree on type+width, boost confidence.
|
||||
Where they disagree, lower confidence and flag.
|
||||
"""
|
||||
if not gpt_cabinets:
|
||||
return claude_cabinets
|
||||
if not claude_cabinets:
|
||||
return gpt_cabinets
|
||||
|
||||
# Match by item order (both should have same number of items)
|
||||
if len(claude_cabinets) != len(gpt_cabinets):
|
||||
# Count mismatch — return Claude's result with reduced confidence
|
||||
for c in claude_cabinets:
|
||||
c.confidence = min(c.confidence, 0.75)
|
||||
c.notes += " [count mismatch with GPT-4o backup]"
|
||||
return claude_cabinets
|
||||
|
||||
merged = []
|
||||
for claude_item, gpt_item in zip(claude_cabinets, gpt_cabinets):
|
||||
item = claude_item
|
||||
# Both agree on type
|
||||
if claude_item.cabinet_type == gpt_item.cabinet_type:
|
||||
# Average the widths if close
|
||||
if abs(claude_item.width_mm - gpt_item.width_mm) < 50:
|
||||
item.width_mm = (claude_item.width_mm + gpt_item.width_mm) / 2
|
||||
item.confidence = min(1.0, (claude_item.confidence + gpt_item.confidence) / 2 + 0.05)
|
||||
item.source = "claude+gpt4o"
|
||||
else:
|
||||
item.confidence = min(claude_item.confidence, 0.75)
|
||||
item.notes += f" [width mismatch: Claude={claude_item.width_mm:.0f}mm GPT={gpt_item.width_mm:.0f}mm]"
|
||||
else:
|
||||
# Type mismatch — flag for review
|
||||
item.confidence = min(claude_item.confidence, 0.65)
|
||||
item.notes += f" [type mismatch: Claude={claude_item.cabinet_type} GPT={gpt_item.cabinet_type}]"
|
||||
merged.append(item)
|
||||
|
||||
return merged
|
||||
# (merge_results removed — single-model pipeline with Gemini)
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════════════
|
||||
@@ -739,18 +630,18 @@ if __name__ == "__main__":
|
||||
```
|
||||
"""
|
||||
|
||||
# Test parsing
|
||||
classifier = object.__new__(CabinetVisionClassifier) # skip __init__ to avoid key check
|
||||
# Test parsing (no API key needed for this test)
|
||||
classifier = object.__new__(CabinetVisionClassifier) # skip __init__
|
||||
classifier.__class__ = CabinetVisionClassifier
|
||||
cabinets = classifier._parse_cabinet_json(sample_response, "ELEVATION A")
|
||||
|
||||
if cabinets:
|
||||
print(f"✅ Parsed {len(cabinets)} cabinets:")
|
||||
print(f"[PASS] Parsed {len(cabinets)} cabinets:")
|
||||
for c in cabinets:
|
||||
print(f" Item {c.item_num}: {c.cabinet_type:20s} {c.width_mm:.0f}mm "
|
||||
f"confidence={c.confidence:.2f} code={c.code}")
|
||||
else:
|
||||
print("❌ Parsing failed")
|
||||
print("[FAIL] Parsing failed")
|
||||
|
||||
# Test type normalization
|
||||
print("\n=== Type Normalization ===")
|
||||
|
||||
@@ -22,6 +22,8 @@ load_dotenv(PROJECT_ROOT / ".env", override=False)
|
||||
# ── API Keys ────────────────────────────────────────────────────────────────
|
||||
ANTHROPIC_API_KEY: str = os.getenv("ANTHROPIC_API_KEY", "")
|
||||
OPENAI_API_KEY: str = os.getenv("OPENAI_API_KEY", "")
|
||||
GEMINI_API_KEY: str = os.getenv("GEMINI_API_KEY", "")
|
||||
GROQ_API_KEY: str = os.getenv("GROQ_API_KEY", "")
|
||||
|
||||
# ── Claude model config ─────────────────────────────────────────────────────
|
||||
CLAUDE_MODEL = "claude-3-5-sonnet-20241022"
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
"""
|
||||
Deep inspection of the REAL Casa Familia shop drawing PDF.
|
||||
Extract EVERY piece of data: layout, dimensions, cabinet items, fonts, structure.
|
||||
"""
|
||||
import fitz
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
PDF_PATH = r"Casa familia\03_Shop_Drawings\ITALIANKB SHOP DRAWINGS - 23-033 CASA FAMILIA - 03.04.2025 hatch corregido.pdf"
|
||||
pdf = fitz.open(PDF_PATH)
|
||||
|
||||
print(f"{'='*70}")
|
||||
print(f" REAL SHOP DRAWING — COMPLETE DEEP INSPECTION")
|
||||
print(f" File: {Path(PDF_PATH).name}")
|
||||
print(f" Pages: {pdf.page_count}")
|
||||
p = pdf[0]
|
||||
print(f" Page size: {p.rect.width:.1f} x {p.rect.height:.1f} pts = {p.rect.width/72:.2f}\" x {p.rect.height/72:.2f}\"")
|
||||
print(f"{'='*70}")
|
||||
|
||||
full_data = {}
|
||||
|
||||
for pg_num in range(pdf.page_count):
|
||||
page = pdf[pg_num]
|
||||
blocks = page.get_text("dict") # rich dict format with font info
|
||||
|
||||
print(f"\n{'─'*70}")
|
||||
print(f" PAGE {pg_num+1}")
|
||||
print(f"{'─'*70}")
|
||||
|
||||
page_data = {"texts": [], "images": len(page.get_images())}
|
||||
|
||||
for block in blocks["blocks"]:
|
||||
if block["type"] == 0: # text block
|
||||
for line in block["lines"]:
|
||||
for span in line["spans"]:
|
||||
txt = span["text"].strip()
|
||||
if txt and len(txt) > 0:
|
||||
entry = {
|
||||
"text": txt,
|
||||
"x": round(span["bbox"][0], 1),
|
||||
"y": round(span["bbox"][1], 1),
|
||||
"font": span["font"],
|
||||
"size": round(span["size"], 1),
|
||||
"color": span["color"],
|
||||
}
|
||||
page_data["texts"].append(entry)
|
||||
print(f" [{entry['size']:4.1f}pt {entry['font'][:20]:<20}] pos({entry['x']:6.1f},{entry['y']:6.1f}) → \"{txt[:80]}\"")
|
||||
|
||||
full_data[f"page_{pg_num+1}"] = page_data
|
||||
|
||||
pdf.close()
|
||||
|
||||
# Save full extraction
|
||||
out = Path("outputs/cf_real_inspection.json")
|
||||
out.parent.mkdir(exist_ok=True)
|
||||
with open(out, "w", encoding="utf-8") as f:
|
||||
json.dump(full_data, f, indent=2, ensure_ascii=False)
|
||||
|
||||
print(f"\n\nFull extraction saved to: {out}")
|
||||
print(f"Total pages inspected: {len(full_data)}")
|
||||
@@ -0,0 +1,84 @@
|
||||
"""
|
||||
Deep inspection of Unit A1 PDF to understand exact page structure,
|
||||
what's on each page, and where the kitchen/bath elevations are.
|
||||
This tells us EXACTLY which regions to crop for accurate extraction.
|
||||
"""
|
||||
import fitz
|
||||
from pathlib import Path
|
||||
|
||||
pdf_path = Path(r"Casa familia\01_Architectural_Drawings\Unit_Plans_FHA_ADA\A-6.00-FHA-UNIT-A1-FLOOR-PLAN-&-DETAILS-Rev.10.pdf")
|
||||
pdf = fitz.open(str(pdf_path))
|
||||
|
||||
print(f"PDF: {pdf_path.name}")
|
||||
print(f"Pages: {len(pdf)}")
|
||||
print(f"Page size (pt): {pdf[0].rect}")
|
||||
print()
|
||||
|
||||
for page_num in range(len(pdf)):
|
||||
page = pdf[page_num]
|
||||
w, h = page.rect.width, page.rect.height
|
||||
print(f"{'='*60}")
|
||||
print(f"PAGE {page_num+1} ({w:.0f} x {h:.0f} pts = {w/72:.1f}\" x {h/72:.1f}\")")
|
||||
print(f"{'='*60}")
|
||||
|
||||
# Extract all text blocks with positions
|
||||
blocks = page.get_text("dict", flags=fitz.TEXT_PRESERVE_WHITESPACE)["blocks"]
|
||||
text_items = []
|
||||
for b in blocks:
|
||||
if b["type"] == 0: # text block
|
||||
for line in b["lines"]:
|
||||
for span in line["spans"]:
|
||||
text = span["text"].strip()
|
||||
if text and len(text) > 1:
|
||||
x0, y0 = span["bbox"][0], span["bbox"][1]
|
||||
text_items.append((y0, x0, text, span["size"]))
|
||||
|
||||
# Sort by vertical position
|
||||
text_items.sort()
|
||||
|
||||
# Show key labels (elevation markers, titles, dimensions)
|
||||
print(" KEY TEXT LABELS (titles and elevation markers):")
|
||||
shown = set()
|
||||
for y, x, text, size in text_items:
|
||||
upper = text.upper()
|
||||
is_key = (
|
||||
any(k in upper for k in [
|
||||
'ELEVATION', 'ELEV', 'KITCHEN', 'BATH', 'VANITY',
|
||||
'PLAN', 'FLOOR', 'DETAIL', 'SCALE', 'SECTION',
|
||||
'UNIT', 'NOTE', 'SCHEDULE', 'CABINET',
|
||||
'EL.', 'ELV', 'VIEW', 'REF.', 'FHA', 'ADA'
|
||||
]) or size > 9
|
||||
)
|
||||
if is_key and text not in shown:
|
||||
shown.add(text)
|
||||
print(f" [{x:5.0f}, {y:5.0f}] size={size:.1f} '{text}'")
|
||||
|
||||
# Show all dimensions found
|
||||
import re
|
||||
dims = [(y, x, t) for y, x, t, s in text_items
|
||||
if re.search(r"\d+['\-]\d+|\d+\"\s*|\d+\s*mm|\d+'\s*\d*\"?", t)]
|
||||
if dims:
|
||||
print(f"\n DIMENSIONS FOUND ({len(dims)} total, first 15):")
|
||||
for y, x, t in dims[:15]:
|
||||
print(f" [{x:5.0f}, {y:5.0f}] '{t}'")
|
||||
|
||||
# Show drawing regions (large rectangles)
|
||||
paths = page.get_drawings()
|
||||
rects = []
|
||||
for path in paths:
|
||||
r = path.get("rect")
|
||||
if r and r.width > 100 and r.height > 100:
|
||||
rects.append(r)
|
||||
|
||||
# Cluster rectangles to find distinct zones
|
||||
if rects:
|
||||
print(f"\n LARGE RECTANGLES / ZONES ({len(rects)} total, largest 8):")
|
||||
rects_sorted = sorted(rects, key=lambda r: -(r.width * r.height))
|
||||
for r in rects_sorted[:8]:
|
||||
print(f" x={r.x0:.0f}-{r.x1:.0f}, y={r.y0:.0f}-{r.y1:.0f} "
|
||||
f"({r.width:.0f}w x {r.height:.0f}h pts)")
|
||||
|
||||
print()
|
||||
|
||||
pdf.close()
|
||||
print("\nDone. Use this info to hardcode exact crop zones per unit type.")
|
||||
@@ -0,0 +1,255 @@
|
||||
"""
|
||||
===========================================================================
|
||||
ACCURATE Cabinet Extractor for Casa Familia
|
||||
===========================================================================
|
||||
This script uses EXACT crop coordinates derived from deep PDF inspection
|
||||
to extract ONLY the correct elevation zones (not 24 random regions).
|
||||
|
||||
Each unit plan PDF is ONE large page containing:
|
||||
- Kitchen Floor Plan (top section)
|
||||
- Kitchen Elevation A (bottom-left)
|
||||
- Kitchen Elevation B (bottom-right)
|
||||
- Bathroom/Vanity Elevation (bottom section)
|
||||
|
||||
We crop EXACTLY these zones and send to Groq Vision.
|
||||
===========================================================================
|
||||
"""
|
||||
import fitz
|
||||
import base64
|
||||
import json
|
||||
import time
|
||||
import os
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
from groq import Groq
|
||||
|
||||
load_dotenv()
|
||||
|
||||
GROQ_CLIENT = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
||||
GROQ_MODEL = "meta-llama/llama-4-scout-17b-16e-instruct"
|
||||
|
||||
# ── EXACT crop zones per unit (in PDF points) ──────────────────────────────
|
||||
UNIT_CROP_ZONES = {
|
||||
# Verified from visual inspection of Unit A1 PDF (A-6.00)
|
||||
# Page: 2592 x 1728 pts | Scale: 1/2"=1'-0"
|
||||
# Kitchen EL.1: Full-width elevation (DW, SINK, RANGE, MICROWAVE, upper cabs)
|
||||
# Kitchen EL.2: Corner/perpendicular elevation (REF., P.)
|
||||
"A1": {
|
||||
"kitchen_elevation_1": (1150, 870, 1840, 1160), # Main kitchen elevation (DW,SINK,RANGE,MICROWAVE)
|
||||
"kitchen_elevation_2": (1230, 1230, 1700, 1530), # Corner elevation (REF., Pantry)
|
||||
},
|
||||
"A2-ADA": {
|
||||
"kitchen_elevation_1": (1150, 870, 1840, 1160),
|
||||
"kitchen_elevation_2": (1230, 1230, 1700, 1530),
|
||||
},
|
||||
"A3": {
|
||||
"kitchen_elevation_1": (1150, 870, 1840, 1160),
|
||||
"kitchen_elevation_2": (1230, 1230, 1700, 1530),
|
||||
},
|
||||
"B1": {
|
||||
"kitchen_elevation_1": (1150, 870, 1840, 1160),
|
||||
"kitchen_elevation_2": (1230, 1230, 1700, 1530),
|
||||
},
|
||||
"B2-ADA": {
|
||||
"kitchen_elevation_1": (1150, 870, 1840, 1160),
|
||||
"kitchen_elevation_2": (1230, 1230, 1700, 1530),
|
||||
},
|
||||
}
|
||||
|
||||
UNIT_PDFS = {
|
||||
"A1": "Casa familia/01_Architectural_Drawings/Unit_Plans_FHA_ADA/A-6.00-FHA-UNIT-A1-FLOOR-PLAN-&-DETAILS-Rev.10.pdf",
|
||||
"A2-ADA": "Casa familia/01_Architectural_Drawings/Unit_Plans_FHA_ADA/A-6.01-ADA-UNIT-A2-FULLY-ACCESSIBLE-FLOOR-PLAN-&-DETAILS-Rev.10.pdf",
|
||||
"A3": "Casa familia/01_Architectural_Drawings/Unit_Plans_FHA_ADA/A-6.02-FHA-UNIT-A3-FLOOR-PLAN-&-DETAILS-Rev.10.pdf",
|
||||
"B1": "Casa familia/01_Architectural_Drawings/Unit_Plans_FHA_ADA/A-6.03-FHA-UNIT-B1-FLOOR-PLAN-&-DETAILS-Rev.10.pdf",
|
||||
"B2-ADA": "Casa familia/01_Architectural_Drawings/Unit_Plans_FHA_ADA/A-6.04-ADA-UNIT-B2-FULLY-ACCESSIBLE-FLOOR-PLAN-&-DETAILS-Rev.10.pdf",
|
||||
}
|
||||
|
||||
SYSTEM_PROMPT = """You are an expert cabinet estimator reading kitchen and bathroom elevation drawings for US residential housing.
|
||||
|
||||
Your task: identify EVERY cabinet in this elevation drawing and return a JSON array.
|
||||
|
||||
CABINET TYPES:
|
||||
- upper_wall: Wall cabinet above countertop
|
||||
- base: Standard base cabinet
|
||||
- sink_base: Base cabinet under sink
|
||||
- dw_adjacent: Base cabinet next to dishwasher
|
||||
- microwave_shelf: Upper cabinet housing microwave
|
||||
- pantry: Tall pantry cabinet (floor to ceiling)
|
||||
- corner_upper: Corner wall cabinet
|
||||
- corner_base: Corner base cabinet
|
||||
- vanity: Bathroom vanity cabinet
|
||||
- medicine_cabinet: Bathroom medicine cabinet/mirror
|
||||
- linen: Linen closet cabinet
|
||||
- appliance_space: Space for appliance (no cabinet) - include DW, fridge, range
|
||||
|
||||
RULES:
|
||||
1. Count EVERY cabinet visible, left to right
|
||||
2. Use dimensions shown in the drawing (inches or feet-inches)
|
||||
3. Convert all widths to mm (1 inch = 25.4mm)
|
||||
4. Mark appliances as appliance_space with name in notes
|
||||
5. Return ONLY valid JSON array, no other text
|
||||
|
||||
OUTPUT FORMAT:
|
||||
[
|
||||
{"item_num": 1, "cabinet_type": "upper_wall", "width_mm": 762, "height_mm": 720, "depth_mm": 330,
|
||||
"location": "left of range", "elevation_ref": "ELEVATION A", "confidence": 0.90,
|
||||
"quantity": 1, "is_ada": false, "notes": ""}
|
||||
]"""
|
||||
|
||||
|
||||
def crop_zone(pdf_path: str, x0: float, y0: float, x1: float, y1: float, dpi: int = 200) -> bytes:
|
||||
"""Crop a specific zone from page 0 of a PDF and return PNG bytes."""
|
||||
doc = fitz.open(pdf_path)
|
||||
page = doc[0]
|
||||
clip = fitz.Rect(x0, y0, x1, y1)
|
||||
mat = fitz.Matrix(dpi / 72, dpi / 72)
|
||||
pix = page.get_pixmap(matrix=mat, clip=clip)
|
||||
png_bytes = pix.tobytes("png")
|
||||
doc.close()
|
||||
return png_bytes
|
||||
|
||||
|
||||
def ask_groq_vision(image_bytes: bytes, zone_name: str, unit_type: str, is_ada: bool) -> list:
|
||||
"""Send image to Groq Vision and get cabinet schedule. Auto-waits on rate limits."""
|
||||
ada_note = " (ADA ACCESSIBLE UNIT - countertop max 34\", base height max 864mm)" if is_ada else ""
|
||||
prompt = f"Unit Type: {unit_type}{ada_note}\nZone: {zone_name}\n\nIdentify all cabinets in this elevation drawing. Return ONLY the JSON array."
|
||||
|
||||
b64 = base64.standard_b64encode(image_bytes).decode("utf-8")
|
||||
|
||||
for attempt in range(6): # more retries to handle rate-limit waits
|
||||
try:
|
||||
resp = GROQ_CLIENT.chat.completions.create(
|
||||
model=GROQ_MODEL,
|
||||
max_tokens=3000,
|
||||
temperature=0.1,
|
||||
messages=[
|
||||
{"role": "system", "content": SYSTEM_PROMPT},
|
||||
{"role": "user", "content": [
|
||||
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
|
||||
{"type": "text", "text": prompt}
|
||||
]}
|
||||
]
|
||||
)
|
||||
raw = resp.choices[0].message.content
|
||||
# Parse JSON
|
||||
import re
|
||||
raw = re.sub(r'^```(?:json)?\s*', '', raw.strip(), flags=re.MULTILINE)
|
||||
raw = re.sub(r'\s*```\s*$', '', raw.strip(), flags=re.MULTILINE)
|
||||
start, end = raw.find('['), raw.rfind(']')
|
||||
if start != -1 and end != -1:
|
||||
data = json.loads(raw[start:end+1])
|
||||
return data if isinstance(data, list) else []
|
||||
return []
|
||||
|
||||
except Exception as e:
|
||||
err_str = str(e)
|
||||
# Handle rate limit — parse wait time from error message
|
||||
if '429' in err_str or 'rate_limit' in err_str.lower():
|
||||
import re as _re
|
||||
# Try to find "Please try again in Xs" or "Xm Ys"
|
||||
m = _re.search(r'try again in (\d+)m(\d+)', err_str)
|
||||
if m:
|
||||
wait_secs = int(m.group(1)) * 60 + int(float(m.group(2))) + 5
|
||||
else:
|
||||
m2 = _re.search(r'try again in (\d+\.?\d*)', err_str)
|
||||
wait_secs = int(float(m2.group(1))) + 5 if m2 else 30
|
||||
print(f" [RATE LIMIT] Waiting {wait_secs}s for quota to reset...")
|
||||
time.sleep(wait_secs)
|
||||
else:
|
||||
print(f" [WARN] Attempt {attempt+1}/6 failed: {e}")
|
||||
if attempt < 5:
|
||||
time.sleep(2 ** min(attempt, 3))
|
||||
else:
|
||||
print(" [FAIL] All retries exhausted.")
|
||||
return []
|
||||
|
||||
|
||||
|
||||
def extract_all_units(output_dir: str = "outputs/23-033", save_images: bool = True):
|
||||
"""Extract cabinet schedules for all 5 unit types."""
|
||||
Path(output_dir).mkdir(parents=True, exist_ok=True)
|
||||
crops_dir = Path(output_dir) / "crops_v2"
|
||||
crops_dir.mkdir(exist_ok=True)
|
||||
json_dir = Path(output_dir) / "json_v2"
|
||||
json_dir.mkdir(exist_ok=True)
|
||||
|
||||
all_results = {}
|
||||
|
||||
for unit_type, pdf_rel in UNIT_PDFS.items():
|
||||
print(f"\n{'='*55}")
|
||||
print(f" UNIT: {unit_type}")
|
||||
print(f"{'='*55}")
|
||||
|
||||
pdf_path = str(Path(pdf_rel))
|
||||
if not Path(pdf_path).exists():
|
||||
print(f" [ERROR] PDF not found: {pdf_path}")
|
||||
continue
|
||||
|
||||
is_ada = "ADA" in unit_type
|
||||
zones = UNIT_CROP_ZONES[unit_type]
|
||||
unit_schedule = {"unit_type": unit_type, "is_ada": is_ada, "elevations": []}
|
||||
|
||||
for zone_name, (x0, y0, x1, y1) in zones.items():
|
||||
if zone_name == "kitchen_plan":
|
||||
# Skip the floor plan — we only want elevations
|
||||
continue
|
||||
|
||||
print(f"\n Zone: {zone_name}")
|
||||
print(f" Crop: ({x0},{y0}) → ({x1},{y1})")
|
||||
|
||||
# Crop the image
|
||||
img_bytes = crop_zone(pdf_path, x0, y0, x1, y1, dpi=200)
|
||||
print(f" Image: {len(img_bytes):,} bytes")
|
||||
|
||||
# Save crop image
|
||||
if save_images:
|
||||
img_path = crops_dir / f"{unit_type}_{zone_name}.png"
|
||||
img_path.write_bytes(img_bytes)
|
||||
|
||||
# Call Groq Vision
|
||||
print(f" → Calling Groq Vision...")
|
||||
cabinets = ask_groq_vision(img_bytes, zone_name, unit_type, is_ada)
|
||||
|
||||
real_cabs = [c for c in cabinets if c.get("cabinet_type") != "appliance_space"]
|
||||
appl_cabs = [c for c in cabinets if c.get("cabinet_type") == "appliance_space"]
|
||||
|
||||
print(f" ✓ Found: {len(real_cabs)} cabinets, {len(appl_cabs)} appliance spaces")
|
||||
for c in cabinets:
|
||||
w = c.get("width_mm", 0)
|
||||
w_in = round(w / 25.4)
|
||||
marker = "[APPL]" if c.get("cabinet_type") == "appliance_space" else " "
|
||||
print(f" {marker} {c.get('item_num',0):2d}. {c.get('cabinet_type','?'):20s} "
|
||||
f"{w:.0f}mm ({w_in}\") conf={c.get('confidence',0):.0%}")
|
||||
|
||||
unit_schedule["elevations"].append({
|
||||
"elevation_label": zone_name,
|
||||
"cabinets": cabinets,
|
||||
"cabinet_count": len(real_cabs),
|
||||
"appliance_count": len(appl_cabs),
|
||||
})
|
||||
|
||||
# Save JSON
|
||||
json_path = json_dir / f"cabinet_schedule_{unit_type}.json"
|
||||
json_path.write_text(json.dumps(unit_schedule, indent=2, ensure_ascii=False))
|
||||
all_results[unit_type] = unit_schedule
|
||||
|
||||
total = sum(e["cabinet_count"] for e in unit_schedule["elevations"])
|
||||
print(f"\n ━━ UNIT {unit_type} TOTAL: {total} cabinets ━━")
|
||||
|
||||
# Final summary
|
||||
print(f"\n{'='*55}")
|
||||
print(" EXTRACTION COMPLETE — SUMMARY")
|
||||
print(f"{'='*55}")
|
||||
for unit_type, sched in all_results.items():
|
||||
total = sum(e["cabinet_count"] for e in sched["elevations"])
|
||||
print(f" {unit_type:10s}: {total:3d} cabinets")
|
||||
|
||||
# Save combined results
|
||||
combined_path = Path(output_dir) / "json_v2" / "_all_units.json"
|
||||
combined_path.write_text(json.dumps(all_results, indent=2, ensure_ascii=False))
|
||||
print(f"\n Saved: {combined_path}")
|
||||
return all_results
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
results = extract_all_units()
|
||||
@@ -0,0 +1,28 @@
|
||||
import fitz
|
||||
import sys
|
||||
|
||||
pdf_path = r"Casa familia\01_Architectural_Drawings\Unit_Plans_FHA_ADA\A-6.00-FHA-UNIT-A1-FLOOR-PLAN-&-DETAILS-Rev.10.pdf"
|
||||
pdf = fitz.open(pdf_path)
|
||||
|
||||
print(f"FILE: {pdf_path.split(chr(92))[-1]}")
|
||||
print(f"Pages: {pdf.page_count}")
|
||||
print(f"Page size: {pdf[0].rect.width:.0f} x {pdf[0].rect.height:.0f} pts")
|
||||
print(f"Page size (inches): {pdf[0].rect.width/72:.1f}\" wide x {pdf[0].rect.height/72:.1f}\" tall")
|
||||
print()
|
||||
|
||||
page = pdf[0]
|
||||
blocks = page.get_text("blocks")
|
||||
print(f"Total text blocks on page 1: {len(blocks)}")
|
||||
print()
|
||||
print("--- ALL TEXT FOUND ON PAGE 1 ---")
|
||||
for b in blocks:
|
||||
txt = b[4].strip().replace('\n', ' | ')
|
||||
if txt and len(txt) > 1:
|
||||
x0, y0 = round(b[0]), round(b[1])
|
||||
print(f" pos({x0:4d},{y0:4d}): {txt[:100]}")
|
||||
|
||||
# Count rectangles
|
||||
paths = page.get_drawings()
|
||||
print(f"\nTotal drawn shapes (lines/rects): {len(paths)}")
|
||||
|
||||
pdf.close()
|
||||
@@ -0,0 +1,15 @@
|
||||
import openpyxl
|
||||
|
||||
# Inspect Price List
|
||||
xl_path = r"Casa familia\02_Price_List\MS PRICE LIST LEVEL 1 -90CM.xlsx"
|
||||
wb = openpyxl.load_workbook(xl_path, data_only=True)
|
||||
ws = wb.active
|
||||
|
||||
print(f"FILE: MS PRICE LIST LEVEL 1 -90CM.xlsx")
|
||||
print(f"Sheet: {ws.title}")
|
||||
print(f"Rows: {ws.max_row} Cols: {ws.max_column}")
|
||||
print()
|
||||
print("--- ALL ROWS IN PRICE LIST ---")
|
||||
for row in ws.iter_rows(min_row=1, max_row=ws.max_row, values_only=True):
|
||||
if any(cell is not None for cell in row):
|
||||
print(f" {row}")
|
||||
@@ -0,0 +1,51 @@
|
||||
import fitz
|
||||
import sys
|
||||
|
||||
def inspect_pdf(path, label):
|
||||
print(f"\n{'='*65}")
|
||||
print(f" FILE: {label}")
|
||||
print(f" PATH: {path}")
|
||||
print(f"{'='*65}")
|
||||
pdf = fitz.open(path)
|
||||
print(f" Total Pages: {pdf.page_count}")
|
||||
print(f" Page size: {pdf[0].rect.width:.0f} x {pdf[0].rect.height:.0f} pts ({pdf[0].rect.width/72:.1f}\" x {pdf[0].rect.height/72:.1f}\")")
|
||||
print()
|
||||
|
||||
for pg_num in range(min(pdf.page_count, 50)):
|
||||
page = pdf[pg_num]
|
||||
blocks = page.get_text("blocks")
|
||||
texts = []
|
||||
for b in blocks:
|
||||
t = b[4].strip().replace('\n', ' | ')
|
||||
if t and len(t) > 2:
|
||||
texts.append(t[:120])
|
||||
|
||||
# Find key identifiers on each page
|
||||
full_text = " ".join(texts).upper()
|
||||
unit_hint = ""
|
||||
for kw in ["UNIT A", "UNIT B", "UNIT C", "UNIT D", "UNIT ST", "COVER", "MATRIX",
|
||||
"A-1", "B-1", "C-1", "D-1", "ST-1", "A1", "B1", "B2", "A2", "A3",
|
||||
"KITCHEN", "BATHROOM", "VANITY", "ELEVATION", "SCHEDULE"]:
|
||||
if kw in full_text:
|
||||
unit_hint += kw + " | "
|
||||
|
||||
print(f" Page {pg_num+1:2d}: {unit_hint[:100]}")
|
||||
# Print first few text items on each page
|
||||
for t in texts[:5]:
|
||||
print(f" → {t[:100]}")
|
||||
print()
|
||||
|
||||
pdf.close()
|
||||
|
||||
|
||||
# ── Casa Familia real shop drawing ────────────────────────────────────────
|
||||
inspect_pdf(
|
||||
r"Casa familia\03_Shop_Drawings\ITALIANKB SHOP DRAWINGS - 23-033 CASA FAMILIA - 03.04.2025 hatch corregido.pdf",
|
||||
"REAL SHOP DRAWING — CASA FAMILIA (23-033)"
|
||||
)
|
||||
|
||||
# ── Heritage Village real shop drawing ───────────────────────────────────
|
||||
inspect_pdf(
|
||||
r"Heritage\03_Shop_Drawings\05_Cabinet_Estimation_Shop_Drawings_Heritage_Village.pdf",
|
||||
"REAL SHOP DRAWING — HERITAGE VILLAGE (23-045)"
|
||||
)
|
||||
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 459 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 352 KiB |
|
After Width: | Height: | Size: 222 KiB |
|
After Width: | Height: | Size: 458 KiB |
|
After Width: | Height: | Size: 842 KiB |
|
After Width: | Height: | Size: 351 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 458 KiB |
|
After Width: | Height: | Size: 829 KiB |
|
After Width: | Height: | Size: 351 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 458 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 351 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 458 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 351 KiB |
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"unit_type": "A3",
|
||||
"is_ada": false,
|
||||
"auto_approved": false,
|
||||
"review_flags": [],
|
||||
"elevations": []
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"unit_type": "B1",
|
||||
"is_ada": false,
|
||||
"auto_approved": false,
|
||||
"review_flags": [],
|
||||
"elevations": []
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"unit_type": "B2-ADA",
|
||||
"is_ada": true,
|
||||
"auto_approved": false,
|
||||
"review_flags": [],
|
||||
"elevations": []
|
||||
}
|
||||
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 62 KiB |
@@ -0,0 +1,256 @@
|
||||
{
|
||||
"A1": {
|
||||
"unit_type": "A1",
|
||||
"is_ada": false,
|
||||
"elevations": [
|
||||
{
|
||||
"elevation_label": "kitchen_elevation_1",
|
||||
"cabinets": [
|
||||
{
|
||||
"item_num": 1,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 366,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "left of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 2,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "above microwave",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 3,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 366,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right of microwave",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 4,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right wall",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 5,
|
||||
"cabinet_type": "microwave_shelf",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "above microwave",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 6,
|
||||
"cabinet_type": "sink_base",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "under sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 7,
|
||||
"cabinet_type": "dw_adjacent",
|
||||
"width_mm": 305,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "next to dishwasher",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 8,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 9,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "range",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "range"
|
||||
},
|
||||
{
|
||||
"item_num": 10,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right side",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 11,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 305,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "dishwasher",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "dishwasher"
|
||||
}
|
||||
],
|
||||
"cabinet_count": 9,
|
||||
"appliance_count": 2
|
||||
},
|
||||
{
|
||||
"elevation_label": "kitchen_elevation_2",
|
||||
"cabinets": [
|
||||
{
|
||||
"item_num": 1,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 610,
|
||||
"location": "left of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 2,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 610,
|
||||
"location": "above sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 3,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 610,
|
||||
"location": "right of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 4,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 914,
|
||||
"height_mm": 864,
|
||||
"depth_mm": 610,
|
||||
"location": "left of oven",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 5,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 610,
|
||||
"height_mm": 864,
|
||||
"depth_mm": 610,
|
||||
"location": "oven",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "oven"
|
||||
},
|
||||
{
|
||||
"item_num": 6,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 914,
|
||||
"height_mm": 864,
|
||||
"depth_mm": 610,
|
||||
"location": "right of oven",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 7,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 914,
|
||||
"height_mm": 1780,
|
||||
"depth_mm": 610,
|
||||
"location": "refrigerator",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "refrigerator"
|
||||
}
|
||||
],
|
||||
"cabinet_count": 5,
|
||||
"appliance_count": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
{
|
||||
"unit_type": "A1",
|
||||
"is_ada": false,
|
||||
"elevations": [
|
||||
{
|
||||
"elevation_label": "kitchen_elevation_1",
|
||||
"cabinets": [
|
||||
{
|
||||
"item_num": 1,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 366,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "left of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 2,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "above microwave",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 3,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 366,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right of microwave",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 4,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right wall",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 5,
|
||||
"cabinet_type": "microwave_shelf",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "above microwave",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 6,
|
||||
"cabinet_type": "sink_base",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "under sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 7,
|
||||
"cabinet_type": "dw_adjacent",
|
||||
"width_mm": 305,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "next to dishwasher",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 8,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 9,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "range",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "range"
|
||||
},
|
||||
{
|
||||
"item_num": 10,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "right side",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 11,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 305,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 330,
|
||||
"location": "dishwasher",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "dishwasher"
|
||||
}
|
||||
],
|
||||
"cabinet_count": 9,
|
||||
"appliance_count": 2
|
||||
},
|
||||
{
|
||||
"elevation_label": "kitchen_elevation_2",
|
||||
"cabinets": [
|
||||
{
|
||||
"item_num": 1,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 610,
|
||||
"location": "left of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 2,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 914,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 610,
|
||||
"location": "above sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 3,
|
||||
"cabinet_type": "upper_wall",
|
||||
"width_mm": 610,
|
||||
"height_mm": 914,
|
||||
"depth_mm": 610,
|
||||
"location": "right of sink",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 4,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 914,
|
||||
"height_mm": 864,
|
||||
"depth_mm": 610,
|
||||
"location": "left of oven",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 5,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 610,
|
||||
"height_mm": 864,
|
||||
"depth_mm": 610,
|
||||
"location": "oven",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "oven"
|
||||
},
|
||||
{
|
||||
"item_num": 6,
|
||||
"cabinet_type": "base",
|
||||
"width_mm": 914,
|
||||
"height_mm": 864,
|
||||
"depth_mm": 610,
|
||||
"location": "right of oven",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"item_num": 7,
|
||||
"cabinet_type": "appliance_space",
|
||||
"width_mm": 914,
|
||||
"height_mm": 1780,
|
||||
"depth_mm": 610,
|
||||
"location": "refrigerator",
|
||||
"elevation_ref": "ELEVATION A",
|
||||
"confidence": 0.9,
|
||||
"quantity": 1,
|
||||
"is_ada": false,
|
||||
"notes": "refrigerator"
|
||||
}
|
||||
],
|
||||
"cabinet_count": 5,
|
||||
"appliance_count": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 198 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 241 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 305 KiB |
|
After Width: | Height: | Size: 691 KiB |
|
After Width: | Height: | Size: 710 KiB |
|
After Width: | Height: | Size: 318 KiB |
|
After Width: | Height: | Size: 472 KiB |
|
After Width: | Height: | Size: 204 KiB |
|
After Width: | Height: | Size: 160 KiB |
|
After Width: | Height: | Size: 202 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 512 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 406 KiB |
|
After Width: | Height: | Size: 673 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 395 KiB |
|
After Width: | Height: | Size: 566 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 402 KiB |
|
After Width: | Height: | Size: 932 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 395 KiB |
|
After Width: | Height: | Size: 690 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 395 KiB |
|
After Width: | Height: | Size: 367 KiB |
|
After Width: | Height: | Size: 162 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 394 KiB |
|
After Width: | Height: | Size: 744 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 739 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 395 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 783 KiB |
|
After Width: | Height: | Size: 139 KiB |
|
After Width: | Height: | Size: 99 KiB |