Fix AI pipeline pricing bugs, standardise config schemas, resolve cache contract flaw, remove dead code, and clear outputs from tracking

This commit is contained in:
Atharv1705
2026-07-08 15:22:42 +05:30
parent 1074a112e8
commit 08083ff3f4
218 changed files with 3235 additions and 503956 deletions
+20 -3
View File
@@ -41,6 +41,23 @@ outputs/*.log
*.bak
scratch/
# Generated outputs are currently tracked for demo artifacts.
# Uncomment this line if generated artifacts should be excluded in future.
# outputs/
# Generated pipeline outputs (PDF / DXF / XLSX / CSV / crop PNGs / JSON schedules)
# These are reproducible by running pipeline.py — do not track them.
outputs/
# Excel lock files
~$*.xlsx
~$*.xls
# Scratch / one-off inspection scripts (kept on disk, not tracked)
debug.py
temp_*.py
temp_*.pdf
deep_inspect_*.py
inspect_*.py
# Scratch binary artifacts
test_merge*.pdf
test_dim.dxf
OUTPUT_ARCH_ANALYSIS.pdf
EXTRACTION_OUTPUT/
Binary file not shown.

Before

Width:  |  Height:  |  Size: 775 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+122 -58
View File
@@ -1,44 +1,99 @@
# AI Cabinet Estimation & Shop Drawing Automation
An AI-powered pipeline that reads architectural PDF drawings and automatically generates:
- Cabinet shop drawings (ItalianKB-style PDF)
- Project cabinet matrix (Excel)
- Material cost report (Excel)
- Final job costing & selling price quote (Excel)
An AI-assisted pipeline that reads architectural PDF drawings and automatically produces:
- **Cabinet shop drawings** — ItalianKB-style 17"×11" PDF + AutoCAD DXF
- **Cabinet estimation workbook** — multi-sheet Excel (matrix, library, job costing)
- **Material BOM takeoff** — CSV of sheet goods + hardware
- **Deliverable JSON schemas** — unit matrix, shop drawing, cost estimation
## Project: Casa Familia & Heritage Village
Client: Kitchen & bathroom cabinet supplier for large-scale US residential construction (FHA/ADA housing).
Client: Italian Kitchen & Bath — a kitchen/bath cabinet supplier for large-scale US
residential construction (FHA / ADA housing). Manual estimation + drafting takes days
per project; this system targets under 24 hours.
| Project | ID | Units | Status |
|---------|-----|-------|--------|
| Casa Familia | 23-033 | 25 units (A1, A2-ADA, A3, B1, B2-ADA) | Files in hand, pipeline runs |
| Heritage Village | 23-045 | ~14 unit types | In progress |
---
## Pipeline Overview
```
Architect PDF → PyMuPDF → Text + Geometry Extraction
↓
Region Detection (Kitchen / Bath / Elevation)
↓
400 DPI Crop → Claude Vision API
↓
Cabinet Schedule JSON
↓
ReportLab → Shop Drawing PDF
openpyxl → Matrix + Pricing Excel
Architect PDF
│ PyMuPDF — text spans + vector rects + rendered crops
▼
Stage-0 page classifier (UNIT PLAN / ELEVATION / RCP / DETAIL)
│
Region detection (KITCHEN / BATH / VANITY / ELEVATION)
│ 400 DPI crop
▼
AI Vision (Gemini 2.5 Flash → 2.5 Pro fallback, via OpenRouter)
│ CabinetItem[] + architectural-intent (walls, openings, fixtures)
▼
Validation + Confidence QA (catalog widths, ADA, confidence ≥ 0.70)
│
BIM-Lite model → Constraint Solver → Placement Engine → Layout Fingerprint (K#/V# typing)
│
Price match (EUR list → USD) → Job costing (freight/install/tax/GP%)
▼
Outputs: Shop Drawing PDF + DXF, Estimation Excel, BOM CSV, JSON schemas
```
---
## Scripts
## Running the Pipeline
| File | Description |
|------|-------------|
| `step1_crop_elevations.py` | Reads architect PDF → detects regions → crops at 400 DPI → outputs JSON |
| `read_arch_drawing_pymupdf.py` | Full PyMuPDF extraction demo — 4-page visual output PDF |
| `show_pymupdf_output_formats.py` | Shows exact data types returned by each PyMuPDF method |
| `generate_italiankb_shop_drawings.py` | Generates Casa Familia shop drawing PDF (ItalianKB style) |
| `generate_heritage_shop_drawings.py` | Generates Heritage Village shop drawing PDF |
| `generate_heritage_excel.py` | Generates Heritage Village cabinet matrix + pricing Excel |
| `run_cabinet_estimation.py` | Master runner script |
```bash
pip install -r requirements.txt
# Full run (calls the Vision API — requires OPENROUTER_API_KEY in .env)
python pipeline.py --project projects/casa_familia/project_config.json
# Reuse cached cabinet schedules instead of calling the Vision API
python pipeline.py --project projects/casa_familia/project_config.json --skip-ai
# Process a single unit type
python pipeline.py --project projects/casa_familia/project_config.json --unit A1
# Low-token demo mode (150 DPI, compact prompt) — ~85% cheaper Vision calls
python pipeline.py --project projects/casa_familia/project_config.json --demo
# Validate config only, no execution
python pipeline.py --project projects/casa_familia/project_config.json --dry-run
```
### Web app (dashboard)
```bash
uvicorn web_app.app:app --reload
# then open http://127.0.0.1:8000
```
FastAPI + single-page dashboard: create/manage projects, upload unit PDFs and price
lists, stream a live pipeline run (SSE), review cabinet schedules & job costing, and
download the generated PDF/Excel.
---
## Configuration
Each project is a folder under `projects/<slug>/` with a `project_config.json` that drives
everything (no hardcoded project data). Key fields:
| Field | Purpose |
|-------|---------|
| `project_id`, `project_name`, title-block metadata | Identity / drawing headers |
| `unit_plan_pdfs` | Map of unit code → architect PDF path |
| `floor_plan_pdfs`, `unit_counts` | Unit quantities across the building |
| `ada_units` | Which unit types are ADA |
| `price_list_path`, `price_list_tier`, `eur_usd_rate` | Vendor pricing inputs |
| `gp_target_pct`, `commission_pct`, `bond_pct` | Job-costing margins |
| `appliances_regular`, `appliances_ada` | Appliance schedule |
Global defaults and API keys load from `.env` via `core/config.py` — copy `.env.example`
to `.env` and set `OPENROUTER_API_KEY`.
---
@@ -46,48 +101,57 @@ Architect PDF → PyMuPDF → Text + Geometry Extraction
| Layer | Tool | Purpose |
|-------|------|---------|
| PDF Reading | PyMuPDF (fitz) | Extract text, geometry, render images |
| PDF Writing | ReportLab | Generate shop drawing PDFs |
| Excel Output | openpyxl | Generate matrix + pricing spreadsheets |
| AI Vision | Claude 3.5 Sonnet / GPT-4o | Classify cabinets from elevation images |
| Orchestration | Python | Pipeline runner |
| PDF reading | PyMuPDF (fitz) | Extract text, geometry, render crops |
| AI vision | Gemini 2.5 Flash / Pro via OpenRouter | Classify cabinets & extract intent |
| PDF writing | ReportLab | 17"×11" LEDGER shop-drawing PDF |
| CAD | ezdxf (+ matplotlib) | AutoCAD DXF plan/elevation views |
| Excel | openpyxl | Estimation workbook |
| Geometry | Shapely | Placement / constraint geometry |
| Web | FastAPI + Uvicorn | Dashboard & SSE pipeline runner |
---
## Project Understanding
## Repository Layout
See `_Project_Understanding/` folder:
- `01_Client_Understanding_Detailed.md` — Full client requirements
- `02_Simple_Summary_Input_Flow_Output.md` — 5-step workflow summary
- `03_Extraction_Deep_Dive_Research.md` — Technical research on extraction pipeline
---
## 5-Step Client Workflow
1. **Read elevations** → Identify every cabinet (type, W×H×D)
2. **Generate shop drawings** → Per unit type PDF (ItalianKB style)
3. **Build project matrix** → Count units per floor × cabinet totals
4. **Price materials** → Match to vendor price list (Euros → USD, mm → inches)
5. **Job costing** → Apply tax/freight/install/GP% → Final selling price
```
Albert_Project/
├── pipeline.py # Master orchestrator (start here)
├── core/ # Extraction, AI, validation, costing
│ ├── ai_vision_classifier.py # OpenRouter Gemini vision classifier
│ ├── pdf_extractor.py # PyMuPDF primitives
│ ├── region_detector.py, drawing_classifier.py, dimension_parser.py
│ ├── cabinet_validator.py, confidence_engine.py
│ ├── price_matcher.py, job_costing.py
│ ├── bimlite/ # Lightweight BIM object model + rules
│ └── engines/ # Constraint solver, placement, fingerprint,
│ # renderers, ADA, BOM, sheet composition
├── generators/ # shop_drawing_pdf, shop_drawing_dxf, cabinet_excel
├── data/ # cabinet_library.json + layout signatures
├── projects/ # Per-project config + drawings
├── web_app/ # FastAPI backend + static dashboard
└── outputs/ # Generated deliverables (git-ignored)
```
---
## Status
- [x] PyMuPDF extraction pipeline working
- [x] Region detection (Kitchen/Bath/Elevation)
- [x] 400 DPI crop images generated
- [x] Shop drawing PDF generator (Casa Familia + Heritage)
- [x] Excel generator (Heritage Village)
- [ ] Claude Vision API integration (Step 1B)
- [ ] Automated cabinet schedule JSON → PDF pipeline
- [ ] Project matrix builder from floor plans
- [x] PyMuPDF extraction + page/region classification
- [x] OpenRouter Gemini vision classification (schedules + architectural intent)
- [x] Validation + confidence QA
- [x] Price matching (EUR → USD) + job costing
- [x] Shop drawing PDF + DXF generators
- [x] Excel estimation + BOM CSV
- [x] Web dashboard with live SSE pipeline runner
- [ ] BIM-Lite placement engine integration (wired but not yet called with matching
signatures — currently a no-op in `--skip-ai` runs; see project notes)
- [ ] Kitchen layout signature store (`data/kitchen_signatures.json` still empty)
---
## Setup
## Project Understanding
```bash
pip install pymupdf reportlab openpyxl
```
See `_Project_Understanding/` for client requirements, workflow diagrams, and the
extraction research write-ups.
</content>
</invoke>
@@ -0,0 +1,176 @@
# Architecture & Code-Quality Review
_Deep-dive analysis of the AI Cabinet Estimation pipeline. Generated 2026-07-06._
---
## 1. System Purpose
Automates cabinet estimation + shop-drawing production for Italian Kitchen & Bath, a
supplier for large multi-family residential projects (FHA/ADA housing). Input is the
architect's PDF set; output is priced shop drawings, an estimation workbook, a BOM, and
JSON deliverables. Target: replace days of manual drafting/estimating with a <24h run.
---
## 2. Architecture
The system is a linear orchestration in [`pipeline.py`](../pipeline.py) with well-separated
layers. The guiding design principle is sound: **the AI proposes, deterministic engines
dispose** — vision output is treated as a hint, then re-derived from geometry + rules.
```
PDF ─▶ extraction ─▶ AI vision ─▶ validation/QA ─▶ BIM-lite + placement ─▶ pricing/costing ─▶ generators
```
| Layer | Modules | Role |
|-------|---------|------|
| Extraction | `pdf_extractor`, `drawing_classifier`, `region_detector`, `dimension_parser`, `ceiling_height_extractor`, `legend_extractor`, `opening_extractor` | PDF → typed geometry + text |
| AI vision | `ai_vision_classifier` | Gemini 2.5 Flash/Pro (OpenRouter) → `CabinetItem` + architectural intent |
| Validation | `cabinet_validator`, `confidence_engine` | Rule + confidence QA, auto-approve/flag |
| Geometry/typing | `bimlite/*`, `engines/constraint_solver`, `engines/placement_engine`, `engines/layout_fingerprint_engine`, `engines/unit_matrix_builder` | Re-place cabinets, hash layouts into stable K#/V# types |
| Costing | `price_matcher`, `job_costing`, `engines/material_takeoff_engine`, `engines/ada_engine` | EUR→USD match, selling price, BOM, ADA checks |
| Output | `generators/*`, `engines/{elevation,floor_plan,section,sheet_composer,title_block,...}` | PDF / DXF / Excel / JSON |
| Interface | `web_app/app.py` + static SPA | Project mgmt + live SSE pipeline runner |
**Strengths**
- Clean layering and a defensible "hint vs. source-of-truth" split.
- Fully config-driven and multi-project (`projects/<slug>/project_config.json`).
- Cost-aware AI usage: DEMO_MODE (150 vs 400 DPI, compact prompt) + JSON caching (`--skip-ai`).
- Good domain documentation in `_Project_Understanding/`.
---
## 3. Correctness Findings (audit)
### 3.1 🔴 HIGH — Placement engine is called with wrong signatures (crashes full AI runs)
In [`pipeline.py`](../pipeline.py) Step 2.5, the placement block calls:
```python
constraints = ConstraintExtractor.extract(wall) # 1 arg
runs = ConstraintSolver.solve(constraints)
placed_cabs = PlacementEngine.place_wall(length_in=wall.length,
available_runs=runs,
is_ada=room.is_ada)
```
But the actual APIs are:
- `ConstraintExtractor.extract(wall_name, wall_length, openings, appliances, fixtures, structural, is_ada=False)` — **5 required positional args missing** → `TypeError`.
- `PlacementEngine.place_wall(self, wc)` — an **instance method** taking a single
`WallConstraints`; called unbound with `length_in=/available_runs=/is_ada=` kwargs that
don't exist → `TypeError`.
**Why it hasn't surfaced:** the block only executes when `unit.rooms` has walls, and walls
are only built when `ElevationResult.walls` is populated — which happens **only on a live AI
run** (parsed at `ai_vision_classifier.py:511`). The cache serializer (`_save_schedule_json`)
does **not** persist `walls/openings/fixtures/structural/clearances`, so `--skip-ai` runs
have empty walls and the loop is a no-op. **All committed outputs were produced via
`--skip-ai`.** A fresh full-AI run will crash at Step 2.5 because the block is **not**
wrapped in try/except.
**Impact:** the "core IP" placement/constraint engine is effectively **not integrated** —
in cache mode it never runs; in AI mode it throws. Downstream, cabinets in the shop drawings
come from the AI output directly (or the re-mapping that never executes), not from the
deterministic engine.
**Fix direction:** either (a) correct the call site to build a `WallConstraints` via
`ConstraintExtractor.extract(wall.name, wall.length, wall.openings, wall.appliances,
wall.fixtures, wall.structural, room.is_ada)`, instantiate `PlacementEngine()` and call
`.place_wall(solved_wc)`; and (b) wrap Step 2.5 in try/except so a placement failure degrades
gracefully instead of aborting the run. Add an integration test that runs one unit with
`walls` present.
### 3.2 🟠 MEDIUM — Fallback pricing computes wrong cabinet codes (flat $100/cabinet)
In [`pipeline.py`](../pipeline.py) `compute_pricing()`, the no-price-list branch calls:
```python
code = _generate_code(cab.cabinet_type, cab.width_in) # passes INCHES
unit_cost += get_fallback_price_usd(code) * cab.quantity
```
But [`price_matcher._generate_code(cabinet_type, width_mm)`](../core/price_matcher.py) treats
its second arg as **millimeters**: `w_in = round(width_mm / 25.4)`. Passing inches (e.g. 36)
yields `round(36/25.4)=1` → code `"B1"`, which is absent from `FALLBACK_USD_CATALOG` →
`get_fallback_price_usd` returns its **$100 default for every cabinet**. So any project
without a price list is priced at a flat $100/cabinet regardless of type/size.
**Not triggered for Casa Familia** (its price list exists), but latent for any new project
run before a price list is attached. **Fix:** pass `cab.width_in * 25.4`, or add an
inches-based code helper.
### 3.3 🟠 MEDIUM — `PriceMatcher.price_schedule()` is broken (unused, but a trap)
`price_schedule()` calls `self.match(cabinet_type=..., width_mm=item.width_mm, ...)`, but
`match()`'s parameter is `width_in`, not `width_mm` → `TypeError` if ever called. The main
path (`compute_pricing`) uses `matcher.match(...)` directly and is fine, so this is currently
dead code — but it will bite whoever wires it up. **Fix:** rename to `width_in=` and convert,
or delete the method.
### 3.4 🟡 LOW — Type-blind FALLBACK price matching can mis-price silently
In `PriceMatcher.match()`, if no type-keyword match is found, the final loop matches purely
on **width**, ignoring cabinet type. A vanity with no vanity entry could be priced as a
same-width base cabinet. It's tagged `match_quality="FALLBACK"` (visible), but nothing blocks
it. Consider requiring a type match or flagging FALLBACK rows for review in the estimate.
### 3.5 🟢 Job costing math is correct
[`job_costing.calculate_selling_price`](../core/job_costing.py) is sound. Pre-margin =
material + tax + freight + delivery + install + warehousing + protection + insurance + misc;
`SP = pre_margin / (1 − GP% − commission% − bond%)`, with a guard for a non-positive
denominator. Because commission/bond/GP are % of selling price, the algebraic (non-iterative)
solve is valid; the `gp_check_pct` self-verification confirms it. No issues found.
### 3.6 🟢 Placement algorithm internals are reasonable
Within `placement_engine.py` the fill logic is coherent: exact-fit DP (fewest cabinets, then
most balanced) with a largest-first greedy fallback that refuses widths leaving an
un-fillable `< MIN_FILLER_WIDTH` gap, and end fillers absorbing slack. Minor nit: sink-base
width selection (`sw <= anchor.width or sw == 36`) biases to 36" for most anchors — worth
revisiting, but not a correctness bug. The engine just isn't reached (see 3.1).
---
## 4. Code-Quality / Structural Findings
| # | Area | Finding | Suggested action |
|---|------|---------|------------------|
| 4.1 | Repo hygiene | 157 generated artifacts (PDF/DXF/XLSX/CSV/PNG/JSON) + scratch scripts were tracked in git | **Done** — untracked (kept on disk) + `.gitignore` updated |
| 4.2 | Duplication | `_Project_Understanding/` exists at both repo root and inside `Albert_Project/` | De-duplicate; keep one canonical copy |
| 4.3 | Dead/legacy code | `config.py` keeps Claude/GPT-4o constants; `price_schedule()` broken; kitchen/vanity layout classifiers superseded by fingerprint engine but still imported | Prune or clearly mark legacy |
| 4.4 | Config schema drift | Web `create_project` writes `client_name`/`cabinet_finish`/`project_address`; committed configs use `owner`/`finish`/`address`. Read defensively via `.get()` but inconsistent | Unify on one schema; add a loader that normalizes |
| 4.5 | Empty signature store | `data/kitchen_signatures.json` is `{}`; fingerprint reuse only partially wired | Populate or document as future work |
| 4.6 | Placeholder logic | `engines/ada_engine.py` has stub/partial checks | Flag outputs as provisional until complete |
| 4.7 | Error handling | Step 2.5 unguarded (see 3.1); several `except Exception` swallow + `traceback.print_exc()` without failing the run | Make critical steps fail loud; keep generators soft-failing |
| 4.8 | Testing | `test_*.py` are standalone scripts, not a pytest suite; no CI | Convert to pytest; add an integration test that exercises a full-AI unit |
---
## 5. Prioritized Recommendations
1. **Fix the placement-engine integration (3.1)** — it's the system's differentiator and is
currently a no-op/crash. Correct the call site, guard the step, add an integration test.
2. **Fix fallback pricing code generation (3.2)** — one-line unit bug that silently flattens
pricing for any price-list-less project.
3. **Decide cache contract** — either persist architectural-intent (`walls`, etc.) in the
schedule JSON so `--skip-ai` and full runs behave identically, or explicitly scope the
placement engine to full runs.
4. **Unify config schema (4.4)** and prune legacy code (4.3, 3.3).
5. **Add pytest + a CI smoke test** running `pipeline.py --skip-ai --dry-run` and a single
unit end-to-end.
6. **De-duplicate docs (4.2)** and keep generated outputs out of git (**done**).
---
## 6. Summary
Architecturally this is a well-conceived, cleanly layered system with a correct costing core
and a sensible AI-as-hint design. The main gap between "looks complete" and "is complete" is
the **placement/constraint engine**, which is wired into the pipeline with mismatched
signatures and therefore never actually runs (no-op in cache mode, crash in AI mode). That
plus the fallback-pricing unit bug are the two findings worth fixing before the next live run.
Everything else is hygiene: untracking generated artifacts (done), unifying the config schema,
pruning legacy modules, and standing up a real test suite.
</content>
+222 -323
View File
@@ -58,10 +58,59 @@ DEMO_MAX_DIMS = 8 # vs 30 pre-extracted dims sent in context
DEMO_MAX_RECTS = 10 # vs 40 rectangle vectors sent in context
# ══════════════════════════════════════════════════════════════════════════
# DATA CLASSES
# DATA CLASSES — Architectural Intent (Phase 4, new)
# ══════════════════════════════════════════════════════════════════════════
# Valid cabinet types the AI can return
@dataclass
class WallIntent:
name: str
length_in: float
notes: str = ""
@dataclass
class OpeningIntent:
type: str
width_in: float
height_in: float
x_in: float
sill_height_in: float = 0.0
notes: str = ""
@dataclass
class ApplianceIntent:
type: str
width_in: float
height_in: float
x_in: float
notes: str = ""
@dataclass
class FixtureIntent:
type: str
width_in: float
x_in: float
notes: str = ""
@dataclass
class StructuralIntent:
type: str
width_in: float
depth_in: float
x_in: float
notes: str = ""
@dataclass
class ClearanceIntent:
type: str
radius_in: float
x_in: float
notes: str = ""
# ══════════════════════════════════════════════════════════════════════════
# DATA CLASSES — Legacy compatibility (used by pipeline, validators, tests)
# ══════════════════════════════════════════════════════════════════════════
# Valid cabinet types the AI can return (legacy — placement engine will generate these)
VALID_CABINET_TYPES = {
"upper_wall", # Standard wall cabinet (upper)
"base", # Standard base cabinet
@@ -82,7 +131,12 @@ VALID_CABINET_TYPES = {
@dataclass
class CabinetItem:
"""One cabinet identified in an elevation drawing."""
"""One cabinet identified in an elevation drawing.
LEGACY: This class is retained for backward compatibility with the existing
pipeline, validators, test suite, and cache deserialization. In Phase 4,
cabinet items are generated by the Placement Engine — not by AI extraction.
"""
item_num: int
cabinet_type: str # from VALID_CABINET_TYPES
width_in: float
@@ -94,7 +148,7 @@ class CabinetItem:
quantity: int = 1
is_ada: bool = False
notes: str = ""
source: str = "gemini" # "gemini" | "manual" | "fallback"
source: str = "gemini" # "gemini" | "manual" | "fallback" | "placement_engine"
cabinet_id: str = "" # keynote ID (e.g. U10, U3)
@property
@@ -128,32 +182,62 @@ class CabinetItem:
return asdict(self)
# ══════════════════════════════════════════════════════════════════════════
# ELEVATION RESULT
# ══════════════════════════════════════════════════════════════════════════
@dataclass
class ElevationResult:
"""Result of classifying one elevation section with detailed schema support."""
elevation_label: str # "ELEVATION A"
unit_type: str # "A1", "B1-ADA"
"""Result of classifying one elevation section.
Contains both the new architectural-intent fields (walls, openings, fixtures,
structural, clearances) and the legacy fields (cabinets, doors, windows,
fillers, panels, moldings, relationships) needed by the existing pipeline.
"""
elevation_label: str
unit_type: str
project_name: str
cabinets: list[CabinetItem] = field(default_factory=list)
total_width_in: Optional[float] = None
is_ada: bool = False
auto_approved: bool = False
review_flags: list[str] = field(default_factory=list)
api_calls: int = 0
confidence: float = 0.0
# Extended parsed details
appliances: list[dict] = field(default_factory=list)
doors: list[dict] = field(default_factory=list)
windows: list[dict] = field(default_factory=list)
fillers: list[str] = field(default_factory=list)
panels: list[str] = field(default_factory=list)
moldings: list[str] = field(default_factory=list)
relationships: list[dict] = field(default_factory=list)
ceiling_height_in: Optional[float] = None
soffit_present: bool = False
backsplash: str = ""
counter_material: str = ""
# Phase 4: Architectural Intent (new — populated by AI extraction)
walls: list[WallIntent] = field(default_factory=list)
openings: list[OpeningIntent] = field(default_factory=list)
fixtures: list[FixtureIntent] = field(default_factory=list)
structural: list[StructuralIntent] = field(default_factory=list)
clearances: list[ClearanceIntent] = field(default_factory=list)
# Legacy fields (populated by placement engine or cache deserialization)
cabinets: list[CabinetItem] = field(default_factory=list)
appliances: list[dict] = field(default_factory=list)
doors: list[dict] = field(default_factory=list)
windows: list[dict] = field(default_factory=list)
fillers: list[str] = field(default_factory=list)
panels: list[str] = field(default_factory=list)
moldings: list[str] = field(default_factory=list)
relationships: list[dict] = field(default_factory=list)
total_width_in: Optional[float] = None
@property
def min_confidence(self) -> float:
if self.cabinets:
return min(c.confidence for c in self.cabinets)
return self.confidence
@property
def avg_confidence(self) -> float:
if self.cabinets:
return sum(c.confidence for c in self.cabinets) / len(self.cabinets)
return self.confidence
@property
def kitchen_cabinets(self) -> list[CabinetItem]:
return [c for c in self.cabinets
@@ -164,18 +248,6 @@ class ElevationResult:
return [c for c in self.cabinets
if c.cabinet_type in ("vanity", "medicine_cabinet", "linen")]
@property
def min_confidence(self) -> float:
if not self.cabinets:
return 0.0
return min(c.confidence for c in self.cabinets)
@property
def avg_confidence(self) -> float:
if not self.cabinets:
return 0.0
return sum(c.confidence for c in self.cabinets) / len(self.cabinets)
# ══════════════════════════════════════════════════════════════════════════
# PROMPT BUILDER
@@ -184,128 +256,97 @@ class ElevationResult:
def _build_system_prompt(demo: bool = False) -> str:
if demo:
return (
"You are a cabinet estimator. Analyze this architectural elevation drawing and return "
"You are an architectural intent parser. Analyze this elevation drawing and return "
"a JSON object with the following schema:\n"
"{\n"
" \"ceiling_height_in\": 108,\n"
" \"soffit_present\": false,\n"
" \"backsplash\": \"4\\\" backsplash\",\n"
" \"counter_material\": \"Quartz\",\n"
" \"cabinets\": [\n"
" { \"item_num\": 1, \"cabinet_type\": \"upper_wall\", \"cabinet_id\": \"U10\", \"width_mm\": 762, \"height_mm\": 720, \"depth_mm\": 330, \"location\": \"Left of range\", \"confidence\": 0.95, \"quantity\": 1, \"is_ada\": false, \"notes\": \"\" }\n"
" ],\n"
" \"appliances\": [\n"
" { \"type\": \"REF\", \"width_in\": 36, \"height_in\": 70, \"x_in\": 0, \"notes\": \"\" }\n"
" ],\n"
" \"doors\": [\n"
" { \"width_in\": 36, \"height_in\": 80, \"x_in\": 120, \"notes\": \"\" }\n"
" ],\n"
" \"windows\": [\n"
" { \"width_in\": 36, \"height_in\": 48, \"x_in\": 60, \"sill_height_in\": 36, \"notes\": \"\" }\n"
" ],\n"
" \"fillers\": [\"F3\"],\n"
" \"panels\": [\"EP24\"],\n"
" \"moldings\": [\"CM96\"],\n"
" \"relationships\": [\n"
" { \"type\": \"above\", \"item_a\": \"MIC\", \"item_b\": \"RANGE\", \"notes\": \"\" }\n"
" ]\n"
" \"confidence\": 0.95,\n"
" \"walls\": [ { \"name\": \"Wall A\", \"length_in\": 120, \"notes\": \"\" } ],\n"
" \"openings\": [ { \"type\": \"window\", \"width_in\": 36, \"height_in\": 48, \"x_in\": 42, \"sill_height_in\": 36, \"notes\": \"\" } ],\n"
" \"appliances\": [ { \"type\": \"REF\", \"width_in\": 36, \"height_in\": 70, \"x_in\": 0, \"notes\": \"\" } ],\n"
" \"fixtures\": [ { \"type\": \"sink\", \"width_in\": 36, \"x_in\": 60, \"notes\": \"Center of sink\" } ],\n"
" \"structural\": [],\n"
" \"clearances\": []\n"
"}\n"
"Return ONLY valid JSON."
"Return ONLY valid JSON. DO NOT output cabinet IDs."
)
return """You are an expert cabinet estimator with 20+ years of experience reading architectural kitchen and bathroom elevation drawings for US residential construction projects (FHA/ADA housing).
return """You are an expert architectural intent parser analyzing kitchen and bathroom elevation drawings for US residential construction.
Your job is to analyze architectural elevation drawings and extract a precise, complete cabinet and appliance schedule with wall segmentation, ceiling details, opening dimensions, fillers, moldings, and spatial relationships.
Your job is strictly to extract raw Architectural Intent (walls, appliances, fixtures, openings, and clearances).
❌ DO NOT invent, guess, or assign cabinet IDs (e.g. do NOT output B36, SB36, W3030, etc).
Your output must purely describe the physical constraints of the room that a downstream engine will use to place cabinets deterministically.
You must return a single JSON object matching this schema:
{
"ceiling_height_in": 108, // Ceiling height in inches if visible or indicated, else null
"soffit_present": false, // true if a soffit (dropped ceiling bulkhead above cabinets) is present
"backsplash": "4\\" backsplash", // Wall finish backsplash description, or empty string
"soffit_present": false, // true if a soffit (dropped ceiling bulkhead) is present
"backsplash": "4\" backsplash", // Wall finish description, or empty string
"counter_material": "Quartz", // Countertop material description, or empty string
"cabinets": [
"confidence": 0.95, // Overall confidence in this extraction
"walls": [
{
"item_num": 1,
"cabinet_type": "upper_wall", // from cabinet types listed below
"cabinet_id": "U10", // Keynote code matching the KEYNOTE LEGEND MAPPING if specified
"width_mm": 762, // Width in mm
"height_mm": 720, // Height in mm
"depth_mm": 330, // Depth in mm
"location": "Left of range", // Position description
"confidence": 0.95, // Confidence score (0.0 to 1.0)
"quantity": 1,
"is_ada": false,
"name": "Wall A", // e.g. "Main Sink Wall", "Island"
"length_in": 168, // Total length of the wall run if discernible
"notes": ""
}
],
"openings": [
{
"type": "door", // "door" or "window" or "pass-through"
"width_in": 36,
"height_in": 80,
"x_in": 120, // Offset in inches from left wall/boundary
"sill_height_in": 0, // Sill height from floor (useful for windows)
"notes": ""
}
],
"appliances": [
{
"type": "REF", // Refrigerator (REF), Dishwasher (DW), Range (RANGE), Microwave (MIC), Hood (HOOD), Oven (OVEN)
"type": "REF", // Refrigerator (REF), Dishwasher (DW), Range (RANGE), Microwave (MIC), Hood (HOOD), Oven (OVEN)
"width_in": 36,
"height_in": 70,
"x_in": 0, // Approximate offset in inches from left wall/boundary
"x_in": 0, // Offset from left wall/boundary
"notes": "GE Model XYZ"
}
],
"fixtures": [
{
"type": "sink", // "sink", "toilet", "tub"
"width_in": 36, // Width of the fixture space
"x_in": 84, // Center-line offset from left wall/boundary
"notes": "Centered on window"
}
],
"structural": [
{
"type": "column", // "column", "chase", "pipe"
"width_in": 12,
"depth_in": 12,
"x_in": 48,
"notes": ""
}
],
"doors": [
"clearances": [
{
"width_in": 36,
"height_in": 80,
"x_in": 120, // Approximate offset in inches from left wall/boundary
"notes": ""
}
],
"windows": [
{
"width_in": 36,
"height_in": 48,
"x_in": 60, // Approximate offset in inches from left wall/boundary
"sill_height_in": 36, // Sill height in inches from floor
"notes": ""
}
],
"fillers": ["F3"], // Filler keynote codes (e.g. F3, F6) or dimensions (e.g. 3" Filler)
"panels": ["EP24"], // End panel keynote codes (e.g. EP24, WEP30)
"moldings": ["CM96"], // Crown molding/scribe keynote codes (e.g. CM, SCR)
"relationships": [
{
"type": "above", // "above" or "adjacent"
"item_a": "MIC", // item_num, appliance type, or cabinet_id (e.g., "MIC", "U10")
"item_b": "RANGE", // item_num, appliance type, or cabinet_id (e.g., "RANGE", "U12")
"notes": "Microwave above range"
"type": "ada_turning", // e.g. "ada_turning", "approach_clearance"
"radius_in": 30,
"x_in": 60,
"notes": "60-inch turning radius"
}
]
}
CABINET TYPES you must classify:
- upper_wall: Wall-mounted cabinet (above countertop)
- base: Standard floor base cabinet
- sink_base: Base cabinet under sink (open back or plumbing cutout)
- dw_adjacent: Base cabinet adjacent to dishwasher slot (not the DW itself)
- microwave_shelf: Upper cabinet housing a microwave above range
- pantry: Tall floor-to-ceiling pantry cabinet (usually 84" high)
- corner_upper: Corner wall cabinet (blind corner or lazy susan)
- corner_base: Corner base cabinet
- vanity: Bathroom vanity (lower cabinet with sink)
- medicine_cabinet: Bathroom medicine cabinet / mirror cabinet
- linen: Linen closet or storage cabinet in bathroom
- appliance_space: Space reserved for appliance (DW, fridge, range) — NO CABINET, just a placeholder
- filler: Filler panel (narrow strips between cabinets or walls)
- unknown: Cannot determine type with confidence
STANDARD DIMENSIONS (metric):
- Base cabinets: height 720mm, depth 600mm
- ADA base: height 864mm max, depth 600mm
- Wall/upper cabinets: height 300, 380, 460, 720, 900mm; depth 330mm
- Pantry: height 2130mm, depth 600mm
- Vanity: height 870mm, depth 530mm
- Standard widths: 150, 300, 350, 400, 450, 500, 550, 600, 762, 900, 1050, 1200mm
RULES:
1. Try to match each cabinet/appliance to the provided KEYNOTE LEGEND MAPPING if it matches description and dimensions. Set "cabinet_id" to the keynote code (e.g. "U10").
2. Mark appliance positions as type "appliance_space" with the appliance name in "notes". Also add them to the "appliances" list.
3. If the drawing shows ADA text or 34" countertop, set is_ada: true.
4. Return ONLY valid JSON — no markdown, no explanation text around the JSON.
1. Extract the physical constraints of the layout (walls, appliances, openings).
2. For fixtures like sinks, x_in should represent the center of the fixture.
3. Identify ADA requirements if noted (add ADA clearances).
4. DO NOT OUTPUT CABINETS.
5. Return ONLY valid JSON — no markdown, no explanation text around the JSON.
"""
@@ -320,11 +361,9 @@ def _build_user_prompt(
demo: bool = False,
) -> str:
"""Build the user message with pre-extracted context."""
ada_note = " (ADA — base h≤864mm, countertop≤34\")" if is_ada else ""
ada_note = " (ADA — check for clearances)" if is_ada else ""
# Demo mode: send fewer context items to save tokens
max_dims = DEMO_MAX_DIMS if demo else 30
max_rects = DEMO_MAX_RECTS if demo else 40
dims_str = ""
if pre_extracted_dims:
@@ -332,13 +371,6 @@ def _build_user_prompt(
for d in pre_extracted_dims[:max_dims]:
dims_str += f" [{d.get('type','?')}] '{d.get('text','')}' x={d.get('x',0):.0f} y={d.get('y',0):.0f}\n"
rects_str = ""
if pre_extracted_rects and not demo: # skip rect context in demo (saves ~300 tokens)
rects_str = "\nRECTANGLES (potential cabinet boxes):\n"
for i, r in enumerate(pre_extracted_rects[:max_rects]):
rects_str += (f" R{i+1}: W={r.get('w',0):.0f}pt H={r.get('h',0):.0f}pt "
f"@ ({r.get('x0',0):.0f},{r.get('y0',0):.0f})\n")
legend_str = ""
if legend_map:
legend_str = "\nKEYNOTE LEGEND MAPPING:\n"
@@ -347,31 +379,18 @@ def _build_user_prompt(
if demo:
return (f"Project:{project_name} Unit:{unit_type}{ada_note} Section:{elevation_label}\n"
f"{dims_str}\n{legend_str}\nIdentify all cabinets and features. Return ONLY a valid JSON object matching the requested schema.")
f"{dims_str}\n{legend_str}\nIdentify architectural intent. Return ONLY valid JSON.")
return f"""Project: {project_name}
Unit Type: {unit_type}{ada_note}
Section: {elevation_label}
I am showing you a cropped section of an architectural elevation drawing.
{dims_str}{rects_str}{legend_str}
Please identify EVERY cabinet and spatial feature in this elevation drawing.
For each cabinet shape visible:
1. Determine its type (upper_wall, base, sink_base, dw_adjacent, microwave_shelf, pantry, corner_upper, corner_base, vanity, medicine_cabinet, linen, appliance_space, filler, unknown)
2. Measure/estimate its width in mm (use pre-extracted dimensions if available)
3. Determine height and depth from standard sizes
4. Match it to a keynote code (cabinet_id) from the KEYNOTE LEGEND MAPPING above if applicable (e.g. U10, U3). If none match, leave blank.
5. Note its position and score confidence.
Also identify:
- Ceiling height if indicated, and whether a soffit is present.
- Doors and windows (with approximate widths/heights and offsets from left edge).
- Appliances (REF, DW, RANGE, MIC, HOOD, OVEN) with widths and offsets.
- Wall finishes (backsplash and countertop material).
- Accessories (fillers, end panels, moldings).
- Spatial relationship pairs (adjacent and above relationships).
{dims_str}{legend_str}
Please identify the ARCHITECTURAL INTENT of this space.
CRITICAL INSTRUCTION: Extract the exact physical properties (Walls, Appliances, Plumbing Fixtures, Openings, Structural Elements). Do NOT guess cabinets.
Measure the width and x_in offset (from the left boundary) of all features accurately using the provided dimensions.
Return ONLY the JSON object, nothing else."""
@@ -487,57 +506,64 @@ class CabinetVisionClassifier:
result.soffit_present = bool(data.get("soffit_present", False))
result.backsplash = str(data.get("backsplash", ""))
result.counter_material = str(data.get("counter_material", ""))
result.appliances = data.get("appliances", [])
result.doors = data.get("doors", [])
result.windows = data.get("windows", [])
result.fillers = data.get("fillers", [])
result.panels = data.get("panels", [])
result.moldings = data.get("moldings", [])
result.relationships = data.get("relationships", [])
result.confidence = float(data.get("confidence", 0.0))
# Process cabinet list
cabinets = []
raw_cabs = data.get("cabinets", [])
if not isinstance(raw_cabs, list):
raw_cabs = []
for i, item in enumerate(raw_cabs, 1):
if not isinstance(item, dict):
continue
cab_type = item.get("cabinet_type", "unknown").lower().strip()
if cab_type not in VALID_CABINET_TYPES:
cab_type = _normalize_cabinet_type(cab_type)
width_mm = float(item.get("width_mm", 0) or 0)
height_mm = float(item.get("height_mm", 0) or 0)
depth_mm = float(item.get("depth_mm", 0) or 0)
# Apply standard defaults if missing
if height_mm == 0:
height_mm = _default_height(cab_type)
if depth_mm == 0:
depth_mm = _default_depth(cab_type)
confidence = float(item.get("confidence", 0.7))
confidence = max(0.0, min(1.0, confidence))
cabinets.append(CabinetItem(
item_num = item.get("item_num", i),
cabinet_type = cab_type,
width_mm = width_mm,
height_mm = height_mm,
depth_mm = depth_mm,
location = str(item.get("location", "")),
elevation_ref = item.get("elevation_ref", elevation_label),
confidence = confidence,
quantity = int(item.get("quantity", 1)),
is_ada = bool(item.get("is_ada", False)),
notes = str(item.get("notes", "")),
source = "gemini",
cabinet_id = str(item.get("cabinet_id", "")),
# Parse walls
for w in data.get("walls", []):
result.walls.append(WallIntent(
name=w.get("name", "Wall"),
length_in=float(w.get("length_in", 0)),
notes=w.get("notes", "")
))
# Parse openings
for o in data.get("openings", []):
result.openings.append(OpeningIntent(
type=o.get("type", "opening"),
width_in=float(o.get("width_in", 0)),
height_in=float(o.get("height_in", 0)),
x_in=float(o.get("x_in", 0)),
sill_height_in=float(o.get("sill_height_in", 0)),
notes=o.get("notes", "")
))
# Parse appliances
for a in data.get("appliances", []):
result.appliances.append(ApplianceIntent(
type=a.get("type", "appliance"),
width_in=float(a.get("width_in", 0)),
height_in=float(a.get("height_in", 0)),
x_in=float(a.get("x_in", 0)),
notes=a.get("notes", "")
))
# Parse fixtures
for f in data.get("fixtures", []):
result.fixtures.append(FixtureIntent(
type=f.get("type", "fixture"),
width_in=float(f.get("width_in", 0)),
x_in=float(f.get("x_in", 0)),
notes=f.get("notes", "")
))
# Parse structural
for s in data.get("structural", []):
result.structural.append(StructuralIntent(
type=s.get("type", "structural"),
width_in=float(s.get("width_in", 0)),
depth_in=float(s.get("depth_in", 0)),
x_in=float(s.get("x_in", 0)),
notes=s.get("notes", "")
))
# Parse clearances
for c in data.get("clearances", []):
result.clearances.append(ClearanceIntent(
type=c.get("type", "clearance"),
radius_in=float(c.get("radius_in", 0)),
x_in=float(c.get("x_in", 0)),
notes=c.get("notes", "")
))
result.cabinets = cabinets
# Set auto-approve flag
result.auto_approved = (
@@ -644,18 +670,6 @@ class CabinetVisionClassifier:
start_obj = text.find('{')
start_arr = text.find('[')
if start_arr != -1 and (start_obj == -1 or start_arr < start_obj):
end_arr = text.rfind(']')
if end_arr != -1:
json_str = text[start_arr:end_arr+1]
json_str = re.sub(r',\s*([}\]])', r'\1', json_str) # trailing commas
try:
cabs = json.loads(json_str)
return {"cabinets": cabs}
except Exception as e:
# Fallback to object matching if array parse fails
pass
# Find JSON object
start = text.find('{')
end = text.rfind('}')
@@ -786,118 +800,3 @@ def _downscale_image_if_possible(image_bytes: bytes, target_dpi: int = 150) -> b
return image_bytes
# ══════════════════════════════════════════════════════════════════════════
# QUICK TEST (no API needed — tests JSON parsing logic)
# ══════════════════════════════════════════════════════════════════════════
if __name__ == "__main__":
print("Testing JSON parser (no API key needed)...")
sample_response = """
{
"ceiling_height_in": 108,
"soffit_present": false,
"backsplash": "4\\\" backsplash",
"counter_material": "Quartz",
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"cabinet_id": "U10",
"width_mm": 762,
"height_mm": 300,
"depth_mm": 330,
"location": "Left of range, Elevation A",
"confidence": 0.92,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 2,
"cabinet_type": "base",
"cabinet_id": "U3",
"width_mm": 900,
"height_mm": 720,
"depth_mm": 600,
"location": "Sink base, Elevation A",
"confidence": 0.88,
"quantity": 1,
"is_ada": false,
"notes": "sink base cabinet"
}
],
"appliances": [
{
"type": "REF",
"width_in": 36,
"height_in": 70,
"x_in": 0,
"notes": "Refrigerator space"
}
],
"doors": [],
"windows": [],
"fillers": ["F3"],
"panels": ["EP24"],
"moldings": ["CM96"],
"relationships": [
{
"type": "above",
"item_a": "MIC",
"item_b": "RANGE",
"notes": "Microwave above range"
}
]
}
"""
# Test parsing (no API key needed for this test)
classifier = object.__new__(CabinetVisionClassifier) # skip __init__
classifier.__class__ = CabinetVisionClassifier
data = classifier._parse_cabinet_json(sample_response, "ELEVATION A")
if data:
print("[PASS] Parsed JSON successfully:")
print(f" Ceiling Height: {data.get('ceiling_height_in')} in")
print(f" Soffit: {data.get('soffit_present')}")
print(f" Backsplash: {data.get('backsplash')}")
print(f" Countertop: {data.get('counter_material')}")
print(f" Fillers: {data.get('fillers')}")
print(f" Panels: {data.get('panels')}")
print(f" Moldings: {data.get('moldings')}")
print(f" Relationships: {data.get('relationships')}")
# Test mapping to CabinetItem
cabinets = []
raw_cabs = data.get("cabinets", [])
for i, item in enumerate(raw_cabs, 1):
cab_type = item.get("cabinet_type", "unknown").lower().strip()
if cab_type not in VALID_CABINET_TYPES:
cab_type = _normalize_cabinet_type(cab_type)
cabinets.append(CabinetItem(
item_num = item.get("item_num", i),
cabinet_type = cab_type,
width_mm = float(item.get("width_mm", 0)),
height_mm = float(item.get("height_mm", 0)),
depth_mm = float(item.get("depth_mm", 0)),
location = str(item.get("location", "")),
elevation_ref = item.get("elevation_ref", "ELEVATION A"),
confidence = float(item.get("confidence", 0.7)),
quantity = int(item.get("quantity", 1)),
is_ada = bool(item.get("is_ada", False)),
notes = str(item.get("notes", "")),
source = "gemini",
cabinet_id = str(item.get("cabinet_id", "")),
))
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} id={c.cabinet_id}")
else:
print("[FAIL] Parsing failed")
# Test type normalization
print("\n=== Type Normalization ===")
for raw in ["wall cabinet", "lower", "dishwasher", "tall_cabinet", "mirror"]:
print(f" '{raw}' -> '{_normalize_cabinet_type(raw)}'")
+4
View File
@@ -0,0 +1,4 @@
from .models import *
from .parser import *
from .engines import *
from .bom_engine import *
+43
View File
@@ -0,0 +1,43 @@
import pandas as pd
from typing import Dict, Any
from .models import ProjectModel
class BOMEngine:
@staticmethod
def generate_bom(project: ProjectModel) -> pd.DataFrame:
"""
Reads directly from the BIM-lite model (bypassing all Shop Drawing hashing logic)
to generate a flat Bill of Materials suitable for Excel/ERP export.
"""
rows = []
for building in project.buildings:
for floor in building.floors:
for unit in floor.units:
for room in unit.rooms:
for cab in room.cabinets:
rows.append({
"Building": building.name,
"Unit": unit.name,
"Quantity": unit.quantity,
"Room": room.name,
"Item Type": "Cabinet",
"Description": cab.node_type,
"Width": cab.width,
"Height": cab.height,
"Depth": cab.depth,
"Notes": cab.metadata.get("notes", "")
})
for ct in room.countertops:
rows.append({
"Building": building.name,
"Unit": unit.name,
"Quantity": unit.quantity,
"Room": room.name,
"Item Type": "Countertop",
"Description": "Countertop Run",
"Width": ct.width,
"Height": ct.height,
"Depth": ct.depth,
"Notes": ct.metadata.get("notes", "")
})
return pd.DataFrame(rows)
+142
View File
@@ -0,0 +1,142 @@
from typing import Dict, Any, List, Optional
import hashlib
import json
from .models import RoomModel, CabinetNode, ApplianceNode, CountertopNode
class CabinetRules:
@staticmethod
def apply(room: RoomModel):
# Example rule: Standard base cabinet height is 34.5"
for cab in room.cabinets:
if 'base' in cab.node_type.lower() and cab.height == 0.0:
cab.height = 34.5
cab.metadata['height_source'] = 'default'
class CountertopRules:
@staticmethod
def apply(room: RoomModel):
# Example rule: Standard countertop overhang is 1.5"
for ct in room.countertops:
if ct.overhang is None:
ct.overhang = 1.5
ct.metadata['overhang_source'] = 'default'
class ManufacturingRulesEngine:
@staticmethod
def apply_rules(room: RoomModel):
CabinetRules.apply(room)
CountertopRules.apply(room)
# ADARules.apply(room)
# ApplianceRules.apply(room)
return room
class DiagnosticReport:
def __init__(self):
self.diagnostics = []
self.is_valid = True
def add(self, level: str, message: str):
self.diagnostics.append({"level": level, "message": message})
if level == "ERROR":
self.is_valid = False
class ValidationEngine:
@staticmethod
def validate(room: RoomModel) -> DiagnosticReport:
report = DiagnosticReport()
# Check 1: Empty room
if not room.cabinets:
report.add("ERROR", "No cabinets found in room")
return report
# Check 2: Sink logic
has_sink_base = any('sink' in c.node_type.lower() or 'sb' in c.node_type.lower() for c in room.cabinets)
has_dishwasher = any('dw' in a.node_type.lower() or 'dishwasher' in a.node_type.lower() for a in room.appliances)
if room.name == "Kitchen" and not has_sink_base:
report.add("ERROR", "Kitchen missing sink base")
# Check 3: Check defaults
default_cts = sum(1 for ct in room.countertops if ct.metadata.get('overhang_source') == 'default')
if default_cts > 0:
report.add("WARN", f"Countertop overhang defaulted for {default_cts} runs")
# Add basic success
if report.is_valid:
report.add("INFO", "Room passes basic validation constraints")
return report
class ReviewEngine:
@staticmethod
def review(report: DiagnosticReport) -> bool:
# In a real system, this would halt and wait for human input if report.is_valid is False or has WARNs.
# For our automated pipeline, we'll auto-approve if valid.
return report.is_valid
class FingerprintBuilder:
@staticmethod
def build_canonical(room: RoomModel) -> Dict[str, Any]:
"""Separates Canonical Geometry from Canonical Metadata"""
geometry = {
"type": room.name,
"is_ada": room.is_ada,
"cabinets": [
{"type": c.node_type, "w": c.width, "h": c.height, "d": c.depth}
for c in room.cabinets
],
"appliances": [
{"type": a.node_type, "w": a.width, "h": a.height, "d": a.depth}
for a in room.appliances
],
"relationships": [
{"type": r.rel_type, "src": r.source_id, "tgt": r.target_id}
for r in room.relationships
]
}
metadata = {
"id": room.id,
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {c.id: c.metadata for c in room.cabinets}
}
return {
"canonical_geometry": geometry,
"canonical_metadata": metadata
}
class NormalizationEngine:
@staticmethod
def normalize(geometry: Dict[str, Any]) -> Dict[str, Any]:
"""Quantizes dimensions (e.g. 36.02 -> 36.0)"""
# Very simple recursive normalizer
if isinstance(geometry, dict):
return {k: NormalizationEngine.normalize(v) for k, v in geometry.items()}
elif isinstance(geometry, list):
return [NormalizationEngine.normalize(v) for v in geometry]
elif isinstance(geometry, float):
# Quantize to 0.125
return round(geometry * 8) / 8
elif isinstance(geometry, str):
return geometry.lower().strip()
else:
return geometry
class SimilarityEngine:
@staticmethod
def get_hash(normalized_geometry: Dict[str, Any]) -> str:
sig_str = json.dumps(normalized_geometry, sort_keys=True)
return hashlib.sha256(sig_str.encode()).hexdigest()
@staticmethod
def compare(hash_a: str, hash_b: str) -> Dict[str, Any]:
# For Phase 3, this is an exact match system.
# Future phases will implement actual structural diffing here.
if hash_a == hash_b:
return {"match_percent": 100, "diff": "Exact match"}
return {"match_percent": 0, "diff": "Hashes do not match"}
+134
View File
@@ -0,0 +1,134 @@
import uuid
from typing import List, Dict, Any, Optional
class PersistentObject:
def __init__(self, obj_id: Optional[str] = None):
self.id = obj_id or f"obj_{uuid.uuid4().hex[:8]}"
class Relationship(PersistentObject):
def __init__(self, rel_type: str, source_id: str, target_id: str, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.rel_type = rel_type
self.source_id = source_id
self.target_id = target_id
def to_dict(self):
return {
"type": self.rel_type,
"source_id": self.source_id,
"target_id": self.target_id
}
class GeometryNode(PersistentObject):
def __init__(self, node_type: str, width: float, height: float, depth: float, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.node_type = node_type
self.width = width
self.height = height
self.depth = depth
self.metadata = metadata or {}
class CabinetNode(GeometryNode):
def __init__(self, cab_type: str, width: float, height: float, depth: float, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__(cab_type, width, height, depth, metadata, obj_id)
class ApplianceNode(GeometryNode):
def __init__(self, app_type: str, width: float, height: float, depth: float, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__(app_type, width, height, depth, metadata, obj_id)
class CountertopNode(GeometryNode):
def __init__(self, width: float, depth: float, overhang: Optional[float] = None, splash: Optional[bool] = None, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__("Countertop", width, 0.0, depth, metadata, obj_id)
self.overhang = overhang
self.splash = splash
class OpeningNode(GeometryNode):
def __init__(self, opening_type: str, width: float, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__(opening_type, width, 0.0, 0.0, metadata, obj_id)
class PlumbingFixtureNode(GeometryNode):
def __init__(self, fixture_type: str, width: float, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__(fixture_type, width, 0.0, 0.0, metadata, obj_id)
class StructuralElementNode(GeometryNode):
def __init__(self, elem_type: str, width: float, depth: float, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__(elem_type, width, 0.0, depth, metadata, obj_id)
class ClearanceZoneNode(GeometryNode):
def __init__(self, zone_type: str, radius: float, metadata: Optional[Dict] = None, obj_id: Optional[str] = None):
super().__init__(zone_type, radius*2, 0.0, radius*2, metadata, obj_id)
class WallModel(PersistentObject):
def __init__(self, name: str, length: float, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.name = name
self.length = length
self.cabinets: List[CabinetNode] = []
self.appliances: List[ApplianceNode] = []
self.openings: List[OpeningNode] = []
self.fixtures: List[PlumbingFixtureNode] = []
self.structural: List[StructuralElementNode] = []
def to_dict(self):
return {
"id": self.id,
"name": self.name,
"length": self.length,
"cabinets": [{"id": c.id, "type": c.node_type, "width": c.width, "height": c.height, "depth": c.depth, "metadata": c.metadata} for c in self.cabinets],
"appliances": [{"id": a.id, "type": a.node_type, "width": a.width, "metadata": a.metadata} for a in self.appliances],
"openings": [{"id": o.id, "type": o.node_type, "width": o.width, "metadata": o.metadata} for o in self.openings],
"fixtures": [{"id": f.id, "type": f.node_type, "width": f.width, "metadata": f.metadata} for f in self.fixtures],
"structural": [{"id": s.id, "type": s.node_type, "width": s.width, "depth": s.depth, "metadata": s.metadata} for s in self.structural],
}
class RoomModel(PersistentObject):
def __init__(self, name: str, is_ada: bool = False, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.name = name
self.is_ada = is_ada
self.walls: List[WallModel] = []
self.clearances: List[ClearanceZoneNode] = []
self.relationships: List[Relationship] = []
def to_dict(self):
return {
"id": self.id,
"name": self.name,
"is_ada": self.is_ada,
"walls": [w.to_dict() for w in self.walls],
"clearances": [{"id": c.id, "type": c.node_type, "width": c.width, "metadata": c.metadata} for c in self.clearances],
"relationships": [r.to_dict() for r in self.relationships]
}
class KitchenModel(RoomModel):
def __init__(self, is_ada: bool = False, obj_id: Optional[str] = None):
super().__init__("Kitchen", is_ada, obj_id)
class VanityModel(RoomModel):
def __init__(self, is_ada: bool = False, obj_id: Optional[str] = None):
super().__init__("Vanity", is_ada, obj_id)
class UnitModel(PersistentObject):
def __init__(self, name: str, quantity: int = 1, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.name = name
self.quantity = quantity
self.rooms: List[RoomModel] = []
class FloorModel(PersistentObject):
def __init__(self, name: str, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.name = name
self.units: List[UnitModel] = []
class BuildingModel(PersistentObject):
def __init__(self, name: str, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.name = name
self.floors: List[FloorModel] = []
class ProjectModel(PersistentObject):
def __init__(self, name: str, obj_id: Optional[str] = None):
super().__init__(obj_id)
self.name = name
self.buildings: List[BuildingModel] = []
+76
View File
@@ -0,0 +1,76 @@
from typing import Dict, Any, List, Optional
from .models import (
ProjectModel, BuildingModel, FloorModel, UnitModel, KitchenModel, VanityModel,
WallModel, OpeningNode, ApplianceNode, PlumbingFixtureNode, StructuralElementNode, ClearanceZoneNode, Relationship
)
class GeometryParser:
"""Parses raw architectural data (simulated by JSON) into generic geometry nodes."""
@staticmethod
def parse(raw_data: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
return raw_data
class SemanticParser:
"""Assigns meaning to geometry nodes."""
@staticmethod
def parse(geometry_data: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
return geometry_data
class ModelBuilder:
"""Constructs the full BIM-lite hierarchy from Architectural Intent data."""
@staticmethod
def build_project(project_name: str, config: Dict[str, Any], units_schedules: Dict[str, Any], unit_totals: Dict[str, int]) -> ProjectModel:
project = ProjectModel(project_name)
buildings_config = config.get('buildings', {})
if not buildings_config:
buildings_config = {"Default Building": list(units_schedules.keys())}
for bldg_name, unit_names in buildings_config.items():
bldg = BuildingModel(bldg_name)
floor = FloorModel("Ground Floor") # default floor
bldg.floors.append(floor)
for unit_name in unit_names:
if unit_name in units_schedules:
schedule = units_schedules[unit_name]
unit = UnitModel(unit_name, quantity=unit_totals.get(unit_name, 1))
# Consolidate elevations into rooms
kitchen = KitchenModel(is_ada=schedule.is_ada)
for elevation in schedule.elevations:
for w_intent in elevation.walls:
wall = WallModel(name=w_intent.name, length=w_intent.length_in)
# Place openings
for o in elevation.openings:
wall.openings.append(OpeningNode(o.type, o.width_in, metadata={"height_in": o.height_in, "x_in": o.x_in, "sill_height_in": o.sill_height_in, "notes": o.notes}))
# Place appliances
for a in elevation.appliances:
wall.appliances.append(ApplianceNode(a.type, a.width_in, a.height_in, 24.0, metadata={"x_in": a.x_in, "notes": a.notes}))
# Place fixtures
for f in elevation.fixtures:
wall.fixtures.append(PlumbingFixtureNode(f.type, f.width_in, metadata={"x_in": f.x_in, "notes": f.notes}))
# Place structural
for s in elevation.structural:
wall.structural.append(StructuralElementNode(s.type, s.width_in, s.depth_in, metadata={"x_in": s.x_in, "notes": s.notes}))
kitchen.walls.append(wall)
# Place clearances at room level
for c in elevation.clearances:
kitchen.clearances.append(ClearanceZoneNode(c.type, c.radius_in, metadata={"x_in": c.x_in, "notes": c.notes}))
if len(kitchen.walls) > 0:
unit.rooms.append(kitchen)
floor.units.append(unit)
project.buildings.append(bldg)
return project
+2 -2
View File
@@ -166,12 +166,12 @@ class CabinetValidator:
for cab in cabinets:
if cab.cabinet_type in BASE_TYPES and cab.height_in > 0:
if is_ada and cab.height_in > BASE_CABINET_HEIGHT_ADA_IN + 50:
if is_ada and cab.height_in > BASE_CABINET_HEIGHT_ADA_IN + 2.0:
flags.append(
f"Item {cab.item_num} ADA base height {cab.height_in:.0f}in "
f"exceeds ADA max {BASE_CABINET_HEIGHT_ADA_IN:.0f}in"
)
elif not is_ada and abs(cab.height_in - BASE_CABINET_HEIGHT_STD_IN) > 80:
elif not is_ada and abs(cab.height_in - BASE_CABINET_HEIGHT_STD_IN) > 3.0:
warnings.append(
f"Item {cab.item_num} base height {cab.height_in:.0f}in "
f"differs from standard {BASE_CABINET_HEIGHT_STD_IN:.0f}in"
+36 -39
View File
@@ -72,7 +72,7 @@ _IMPERIAL_RE = re.compile(
# Valid cabinet width range in mm (2" to 72")
_MIN_CAB_IN = 2.0
_MAX_CAB_IN = 2000.0
_VALID_CM_RANGE = (5.0, 32.0) # 5cm to 350cm = 50mm to 3500mm
_VALID_CM_RANGE = (5.0, 350.0) # 5cm to 350cm = 50mm to 3500mm
# ══════════════════════════════════════════════════════════════════════════
@@ -117,7 +117,7 @@ class LabeledRect:
# PARSING FUNCTIONS
# ══════════════════════════════════════════════════════════════════════════
def parse_metric_in(text: str) -> Optional[float]:
def parse_metric_mm(text: str) -> Optional[float]:
"""
Parse a metric dimension text → value in mm.
Input is assumed to be in cm (the standard in these drawings).
@@ -145,7 +145,7 @@ def parse_metric_in(text: str) -> Optional[float]:
return val * 10.0 # cm → mm
def parse_imperial_in(text: str) -> Optional[float]:
def parse_imperial_mm(text: str) -> Optional[float]:
"""
Parse an imperial dimension text → value in mm.
Handles: "2' - 6\"", "3'-0\"", "7' - 6\"", "14'", "[2'-6\"]", "36\""
@@ -163,9 +163,8 @@ def parse_imperial_in(text: str) -> Optional[float]:
frac_den = int(bracket_m.group(4) or 1)
frac = frac_num / frac_den if frac_den else 0
total_inches = feet * 12 + inches + frac
val_in = total_inches
if _MIN_CAB_IN <= val_in <= _MAX_CAB_IN * 3:
return val_in
if _MIN_CAB_IN <= total_inches <= _MAX_CAB_IN * 3:
return total_inches * 25.4
return None
# Feet + inches form: "2' - 6\""
@@ -179,66 +178,64 @@ def parse_imperial_in(text: str) -> Optional[float]:
frac_den = int(fi_m.group(4) or 1)
frac = frac_num / frac_den if frac_den else 0
total_inches = feet * 12 + inches + frac
val_in = total_inches
if _MIN_CAB_IN <= val_in <= _MAX_CAB_IN * 2:
return val_in
if _MIN_CAB_IN <= total_inches <= _MAX_CAB_IN * 2:
return total_inches * 25.4
# Feet only: "14'"
feet_only = re.search(r'^(\d+)\s*[\'′]$', text)
if feet_only:
total_inches = int(feet_only.group(1)) * 12
val_in = total_inches
if _MIN_CAB_IN <= val_in <= _MAX_CAB_IN * 2:
return val_in
if _MIN_CAB_IN <= total_inches <= _MAX_CAB_IN * 2:
return total_inches * 25.4
# Inches only: "36\""
inches_only = re.search(r'^(\d+(?:\.\d+)?)\s*["″]$', text)
if inches_only:
mm = float(inches_only.group(1)) * 25.4
if _MIN_CAB_IN <= val_in <= _MAX_CAB_IN * 2:
return val_in
total_inches = float(inches_only.group(1))
if _MIN_CAB_IN <= total_inches <= _MAX_CAB_IN * 2:
return total_inches * 25.4
return None
def cross_validate(
metric_in: Optional[float],
imperial_in: Optional[float],
tolerance_in: float = 0.5,
metric_mm: Optional[float],
imperial_mm: Optional[float],
tolerance_mm: float = 10.0,
) -> DimensionPair:
"""
Cross-validate metric and imperial values for the same dimension.
Tolerance: ±10mm (accounts for rounding in cm vs imperial notation).
"""
if metric_in is not None and imperial_in is not None:
diff = abs(metric_in - imperial_in)
if diff <= tolerance_in:
if metric_mm is not None and imperial_mm is not None:
diff = abs(metric_mm - imperial_mm)
if diff <= tolerance_mm:
return DimensionPair(
value_in = metric_in, # prefer metric (exact)
metric_text = f"{metric_in/10:.2f}cm",
imperial_text = f"{imperial_in/25.4:.2f}\"",
value_in = metric_mm, # prefer metric (exact)
metric_text = f"{metric_mm/10:.2f}cm",
imperial_text = f"{imperial_mm/25.4:.2f}\"",
confidence = "HIGH",
)
else:
return DimensionPair(
value_in = metric_in,
metric_text = f"{metric_in/10:.2f}cm",
imperial_text = f"{imperial_in/25.4:.2f}\"",
value_in = metric_mm,
metric_text = f"{metric_mm/10:.2f}cm",
imperial_text = f"{imperial_mm/25.4:.2f}\"",
confidence = "MISMATCH",
mismatch_in = diff,
)
elif metric_in is not None:
elif metric_mm is not None:
return DimensionPair(
value_in = metric_in,
metric_text = f"{metric_in/10:.2f}cm",
value_in = metric_mm,
metric_text = f"{metric_mm/10:.2f}cm",
imperial_text = None,
confidence = "METRIC_ONLY",
)
elif imperial_in is not None:
elif imperial_mm is not None:
return DimensionPair(
value_in = imperial_in,
value_in = imperial_mm,
metric_text = None,
imperial_text = f"{imperial_in/25.4:.2f}\"",
imperial_text = f"{imperial_mm/25.4:.2f}\"",
confidence = "IMPERIAL_ONLY",
)
else:
@@ -286,13 +283,13 @@ def classify_spans(spans: list[TextSpan]) -> dict[str, list[TextSpan]]:
# Metric dimension: has decimal point and is in valid range
is_metric = False
if "." in t and len(t) < 12:
mv = parse_metric_in(t)
mv = parse_metric_mm(t)
is_metric = mv is not None
# Imperial dimension: contains foot or inch marks
is_imperial = False
if ("'" in t or '"' in t or "'" in t or "″" in t or "[" in t) and len(t) < 20:
iv = parse_imperial_in(t)
iv = parse_imperial_mm(t)
is_imperial = iv is not None
if is_label:
@@ -351,12 +348,12 @@ def associate_dims_to_rects(
# Sort by distance, try to assign widths and heights
nearby_dims.sort(key=lambda x: x[0])
for _, ds in nearby_dims[:4]:
mm = parse_metric_in(ds.text) or parse_imperial_in(ds.text)
mm = parse_metric_mm(ds.text) or parse_imperial_mm(ds.text)
if mm is None:
continue
if ds.is_horizontal and width_mm is None:
width_mm = mm
dim_conf = "METRIC_ONLY" if parse_metric_in(ds.text) else "IMPERIAL_ONLY"
dim_conf = "METRIC_ONLY" if parse_metric_mm(ds.text) else "IMPERIAL_ONLY"
elif not ds.is_horizontal and height_mm is None:
height_mm = mm
@@ -404,13 +401,13 @@ if __name__ == "__main__":
print("=== Metric Parsing ===")
for txt, expected in tests_metric:
result = parse_metric_in(txt)
result = parse_metric_mm(txt)
status = "✅" if (result == expected or (result is None and expected is None)) else "❌"
print(f" {status} '{txt}' → {result} (expected {expected})")
print("\n=== Imperial Parsing ===")
for txt, expected in tests_imperial:
result = parse_imperial_in(txt)
result = parse_imperial_mm(txt)
delta = abs((result or 0) - (expected or 0))
status = "✅" if (result is not None and expected is not None and delta < 1) else "❌"
print(f" {status} '{txt}' → {result:.1f if result else None} (expected {expected})")
@@ -0,0 +1,222 @@
"""
===========================================================================
core/engines/constraint_solver.py — Constraint Extraction & Solving
===========================================================================
Phase 4: Separates the "what is physically there" (Extraction) from
"what usable space remains" (Solving).
Constraint Extraction reads:
- Wall lengths
- Window positions and widths
- Door positions and widths
- Column/chase positions and widths
- Plumbing fixture positions (sink center)
- Appliance positions and widths
Constraint Solver creates:
- Available wall runs (wall minus all obstructions)
- Sink anchor point (center-line)
- Corner conditions (blind corner, L-shape)
- Required filler zones
- Appliance clearance zones
- Dead space (unusable runs too short for any catalog cabinet)
===========================================================================
"""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import List, Optional
# ── Standard catalog widths (inches) ─────────────────────────────────────
# These are the only widths the Placement Engine is allowed to use.
STANDARD_BASE_WIDTHS = [9, 12, 15, 18, 21, 24, 27, 30, 33, 36]
STANDARD_UPPER_WIDTHS = [9, 12, 15, 18, 21, 24, 27, 30, 33, 36]
STANDARD_SINK_BASE_WIDTHS = [30, 33, 36, 42]
STANDARD_DW_WIDTHS = [24] # Dishwasher opening is always 24"
MIN_FILLER_WIDTH = 1.5 # Minimum filler strip
MAX_FILLER_WIDTH = 6.0 # Maximum filler before it becomes a cabinet
MIN_CABINET_WIDTH = 9 # Smallest catalog base cabinet
@dataclass
class Obstruction:
"""Something on a wall that cabinets cannot occupy."""
type: str # "window", "door", "column", "chase", "pipe"
x_start: float # Left edge, inches from wall origin
x_end: float # Right edge, inches from wall origin
notes: str = ""
@dataclass
class Anchor:
"""A point on the wall that constrains placement (e.g. sink center)."""
type: str # "sink_center", "range_center", "corner"
x_center: float # Center-line position, inches from wall origin
width: float # Width of the anchored object (e.g. sink base = 36")
notes: str = ""
@dataclass
class ApplianceSlot:
"""A fixed-width slot reserved for an appliance."""
type: str # "REF", "RANGE", "DW", "MIC", "HOOD", "OVEN"
x_start: float
width: float
notes: str = ""
@property
def x_end(self) -> float:
return self.x_start + self.width
@dataclass
class AvailableRun:
"""A contiguous segment of wall available for cabinet placement."""
x_start: float
x_end: float
anchors: List[Anchor] = field(default_factory=list)
@property
def length(self) -> float:
return self.x_end - self.x_start
@dataclass
class WallConstraints:
"""Fully solved constraints for one wall."""
wall_name: str
wall_length: float
obstructions: List[Obstruction] = field(default_factory=list)
anchors: List[Anchor] = field(default_factory=list)
appliance_slots: List[ApplianceSlot] = field(default_factory=list)
available_runs: List[AvailableRun] = field(default_factory=list)
is_ada: bool = False
class ConstraintExtractor:
"""
Phase 1: Reads raw architectural intent and produces typed constraint objects.
Does NOT compute available space — just classifies what's on the wall.
"""
@staticmethod
def extract(
wall_name: str,
wall_length: float,
openings: list,
appliances: list,
fixtures: list,
structural: list,
is_ada: bool = False,
) -> WallConstraints:
wc = WallConstraints(
wall_name=wall_name,
wall_length=wall_length,
is_ada=is_ada,
)
# Openings → Obstructions
for o in openings:
x_in = float(getattr(o, 'x_in', 0) if hasattr(o, 'x_in') else o.get('x_in', 0))
w_in = float(getattr(o, 'width_in', 0) if hasattr(o, 'width_in') else o.get('width_in', 0))
o_type = getattr(o, 'type', '') if hasattr(o, 'type') else o.get('type', '')
notes = getattr(o, 'notes', '') if hasattr(o, 'notes') else o.get('notes', '')
wc.obstructions.append(Obstruction(
type=o_type,
x_start=x_in,
x_end=x_in + w_in,
notes=notes,
))
# Structural → Obstructions
for s in structural:
x_in = float(getattr(s, 'x_in', 0) if hasattr(s, 'x_in') else s.get('x_in', 0))
w_in = float(getattr(s, 'width_in', 0) if hasattr(s, 'width_in') else s.get('width_in', 0))
s_type = getattr(s, 'type', '') if hasattr(s, 'type') else s.get('type', '')
notes = getattr(s, 'notes', '') if hasattr(s, 'notes') else s.get('notes', '')
wc.obstructions.append(Obstruction(
type=s_type,
x_start=x_in,
x_end=x_in + w_in,
notes=notes,
))
# Fixtures → Anchors (sink center, etc.)
for f in fixtures:
x_in = float(getattr(f, 'x_in', 0) if hasattr(f, 'x_in') else f.get('x_in', 0))
w_in = float(getattr(f, 'width_in', 0) if hasattr(f, 'width_in') else f.get('width_in', 0))
f_type = getattr(f, 'type', '') if hasattr(f, 'type') else f.get('type', '')
notes = getattr(f, 'notes', '') if hasattr(f, 'notes') else f.get('notes', '')
wc.anchors.append(Anchor(
type=f"{f_type}_center",
x_center=x_in,
width=w_in,
notes=notes,
))
# Appliances → ApplianceSlots
for a in appliances:
x_in = float(getattr(a, 'x_in', 0) if hasattr(a, 'x_in') else a.get('x_in', 0))
w_in = float(getattr(a, 'width_in', 0) if hasattr(a, 'width_in') else a.get('width_in', 0))
a_type = getattr(a, 'type', '') if hasattr(a, 'type') else a.get('type', '')
notes = getattr(a, 'notes', '') if hasattr(a, 'notes') else a.get('notes', '')
wc.appliance_slots.append(ApplianceSlot(
type=a_type,
x_start=x_in,
width=w_in,
notes=notes,
))
return wc
class ConstraintSolver:
"""
Phase 2: Takes extracted constraints and computes available wall runs.
Subtracts all obstructions and appliance slots from the wall, producing
the contiguous free segments where cabinets can be placed.
"""
@staticmethod
def solve(wc: WallConstraints) -> WallConstraints:
# Build list of all occupied intervals [start, end]
occupied: list[tuple[float, float]] = []
for obs in wc.obstructions:
occupied.append((obs.x_start, obs.x_end))
for slot in wc.appliance_slots:
occupied.append((slot.x_start, slot.x_end))
# Sort by start position
occupied.sort(key=lambda x: x[0])
# Merge overlapping intervals
merged: list[tuple[float, float]] = []
for start, end in occupied:
if merged and start <= merged[-1][1]:
merged[-1] = (merged[-1][0], max(merged[-1][1], end))
else:
merged.append((start, end))
# Compute free segments
free_segments: list[tuple[float, float]] = []
cursor = 0.0
for occ_start, occ_end in merged:
if occ_start > cursor:
free_segments.append((cursor, occ_start))
cursor = max(cursor, occ_end)
if cursor < wc.wall_length:
free_segments.append((cursor, wc.wall_length))
# Build AvailableRun objects, attaching any anchors that fall within them
wc.available_runs = []
for seg_start, seg_end in free_segments:
run = AvailableRun(x_start=seg_start, x_end=seg_end)
for anchor in wc.anchors:
if seg_start <= anchor.x_center <= seg_end:
run.anchors.append(anchor)
wc.available_runs.append(run)
return wc
@@ -1,19 +1,49 @@
"""
===========================================================================
core/engines/layout_fingerprint_engine.py — Layout Fingerprint Builder
===========================================================================
Phase 4: Generates deterministic fingerprints for kitchen/vanity layouts.
CLASSIFICATION INVARIANT POLICY:
- Abutting cabinet widths are pinned to catalog-standard values.
- ONLY the filler absorbs wall-length variance.
- If standard catalog blocks change (e.g. B36 drops to B33 because
the catalog matched a different block), it IS a different kitchen type.
- If the catalog blocks remain identical, but a 2" filler becomes a 3"
filler to absorb variance, it is the SAME kitchen type.
Implementation:
The fingerprint includes:
- Layout topology (Straight, L-Shape, U-Shape)
- Ordered sequence of catalog cabinet types and widths (NOT fillers)
- Appliance sequence and widths
- Opening types and positions (relative, not absolute)
- ADA flag
The fingerprint EXCLUDES:
- Filler widths (absorbed variance)
- Filler positions
- Absolute x-coordinates (different wall lengths → same kitchen)
- Total wall length
Hash: SHA-256 (not MD5) for collision resistance.
===========================================================================
"""
import json
import hashlib
from typing import Dict, Any, List
from typing import Dict, Any, List, Optional
class LayoutFingerprintEngine:
"""
Engine to generate a deterministic, hierarchical architectural fingerprint
for kitchens and vanities. This signature is based on layout topology,
cabinet geometry, appliance placements, and ADA requirements.
Engine to generate a deterministic layout fingerprint that classifies
kitchens into types (K1, K2, ...) based on the invariant policy.
"""
@staticmethod
def _infer_layout_topology(cabinets: List[Dict[str, Any]]) -> str:
"""
Infer if the layout is Straight, L-Shape, U-Shape, etc.
based on corner cabinets and bounding boxes.
Infer if the layout is Straight, L-Shape, U-Shape, etc.
based on corner cabinets.
"""
corner_count = 0
for cab in cabinets:
@@ -21,7 +51,7 @@ class LayoutFingerprintEngine:
notes = cab.get('notes', '').lower()
if 'corner' in cab_type or 'blind' in cab_type or 'corner' in notes:
corner_count += 1
if corner_count == 0:
return "Straight"
elif corner_count == 1:
@@ -31,90 +61,144 @@ class LayoutFingerprintEngine:
return "Complex"
@staticmethod
def _extract_cabinets(cabinets: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Extract purely cabinet geometry and types."""
extracted = []
def _extract_canonical_cabinets(cabinets: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""
Extract the ORDERED sequence of catalog cabinet types and widths,
EXCLUDING fillers and appliance spaces.
This is the core of the invariant: if the catalog blocks are
identical in type and width, the fingerprint is the same —
regardless of filler width changes.
"""
canonical = []
for cab in cabinets:
cab_type = cab.get('cabinet_type', '')
if 'appliance' in cab_type or 'microwave' in cab_type:
cab_type = cab.get('cabinet_type', '').lower()
# SKIP fillers — they absorb variance, not identity
if cab_type == 'filler' or 'filler' in cab_type:
continue
extracted.append({
# SKIP appliance spaces — not cabinet identity
if cab_type == 'appliance_space':
continue
# SKIP microwave shelves treated as appliance slots
# (include only if it's a real cabinet)
canonical.append({
"type": cab_type,
"width": cab.get('width_in', 0.0),
"height": cab.get('height_in', 0.0),
"depth": cab.get('depth_in', 0.0),
"position_hint": cab.get('location', '')
"width": round(cab.get('width_in', 0.0)),
"height": round(cab.get('height_in', 0.0)),
})
return extracted
return canonical
@staticmethod
def _extract_appliances(cabinets: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Extract appliance spaces from the sequence."""
extracted = []
def _extract_canonical_appliances(cabinets: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Extract appliance sequence (type + width only, no position)."""
appliances = []
for cab in cabinets:
cab_type = cab.get('cabinet_type', '')
if 'appliance' in cab_type or 'microwave' in cab_type or 'ref' in cab.get('notes', '').lower() or 'range' in cab.get('notes', '').lower():
extracted.append({
cab_type = cab.get('cabinet_type', '').lower()
notes = cab.get('notes', '').lower()
if cab_type == 'appliance_space' or 'ref' in notes or 'range' in notes or 'dw' in notes:
appliances.append({
"type": cab_type,
"width": cab.get('width_in', 0.0),
"notes": cab.get('notes', '')
"width": round(cab.get('width_in', 0.0)),
})
return extracted
return appliances
@staticmethod
def _extract_openings(cabinets: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Extract explicit openings (windows/doors/columns) if mentioned."""
def _extract_canonical_openings(cabinets: List[Dict[str, Any]]) -> List[str]:
"""
Extract opening types (window/door/column) from notes.
Only the TYPE matters for classification, not the absolute position.
"""
openings = []
for cab in cabinets:
notes = cab.get('notes', '').lower()
if 'window' in notes:
openings.append({"type": "Window", "near": cab.get('location', '')})
openings.append("window")
if 'door' in notes:
openings.append({"type": "Door", "near": cab.get('location', '')})
openings.append("door")
if 'column' in notes:
openings.append({"type": "Column", "near": cab.get('location', '')})
openings.append("column")
return openings
@staticmethod
def generate_fingerprint(unit_elevation: Dict[str, Any]) -> str:
"""
Generates the MD5 hash of the hierarchical fingerprint for an elevation.
Generates the SHA-256 hash of the canonical fingerprint.
Two units with the same catalog cabinet sequence but different
filler widths will produce the SAME fingerprint.
Two units where a B36 changes to a B33 will produce DIFFERENT
fingerprints.
"""
cabinets = unit_elevation.get('cabinets', [])
is_ada = unit_elevation.get('is_ada', False)
# 1. Layout Topology
# 1. Layout Topology (Straight / L / U)
layout = LayoutFingerprintEngine._infer_layout_topology(cabinets)
# 2. Cabinets
cabs_fingerprint = LayoutFingerprintEngine._extract_cabinets(cabinets)
# 3. Appliances
apps_fingerprint = LayoutFingerprintEngine._extract_appliances(cabinets)
# 4. Openings
openings = LayoutFingerprintEngine._extract_openings(cabinets)
# 5. Overall dimensions
total_width = sum(c.get('width_in', 0.0) for c in cabinets if c.get('cabinet_type') not in ['upper_wall'])
# Build hierarchy
# 2. Canonical cabinet sequence (fillers excluded)
canonical_cabs = LayoutFingerprintEngine._extract_canonical_cabinets(cabinets)
# 3. Canonical appliance sequence
canonical_apps = LayoutFingerprintEngine._extract_canonical_appliances(cabinets)
# 4. Canonical openings (type only)
canonical_openings = LayoutFingerprintEngine._extract_canonical_openings(cabinets)
# Build the canonical dict — sorted keys for determinism
fingerprint_dict = {
"Layout": layout,
"Cabinets": cabs_fingerprint,
"Appliances": apps_fingerprint,
"Openings": openings,
"Countertop": {
"Topology": layout,
"CornerCount": sum(1 for c in cabinets if 'corner' in c.get('cabinet_type', '').lower())
},
"ADA": is_ada,
"Overall": {
"TotalBaseWidth": total_width
}
"layout": layout,
"cabinets": canonical_cabs,
"appliances": canonical_apps,
"openings": canonical_openings,
"ada": is_ada,
}
# Hash
sig_str = json.dumps(fingerprint_dict, sort_keys=True)
return hashlib.md5(sig_str.encode()).hexdigest()
# Hash with SHA-256
sig_str = json.dumps(fingerprint_dict, sort_keys=True, separators=(',', ':'))
return hashlib.sha256(sig_str.encode('utf-8')).hexdigest()
@staticmethod
def fingerprints_match(fp1: str, fp2: str) -> bool:
"""Check if two fingerprints classify as the same kitchen type."""
return fp1 == fp2
@staticmethod
def explain_difference(
unit_a: Dict[str, Any],
unit_b: Dict[str, Any],
) -> List[str]:
"""
Explain WHY two units have different fingerprints.
Returns a list of human-readable difference strings.
"""
diffs = []
cabs_a = LayoutFingerprintEngine._extract_canonical_cabinets(unit_a.get('cabinets', []))
cabs_b = LayoutFingerprintEngine._extract_canonical_cabinets(unit_b.get('cabinets', []))
if len(cabs_a) != len(cabs_b):
diffs.append(f"Cabinet count differs: {len(cabs_a)} vs {len(cabs_b)}")
else:
for i, (a, b) in enumerate(zip(cabs_a, cabs_b)):
if a['type'] != b['type']:
diffs.append(f"Cabinet {i+1} type differs: {a['type']} vs {b['type']}")
if a['width'] != b['width']:
diffs.append(f"Cabinet {i+1} width differs: {a['width']}\" vs {b['width']}\"")
topo_a = LayoutFingerprintEngine._infer_layout_topology(unit_a.get('cabinets', []))
topo_b = LayoutFingerprintEngine._infer_layout_topology(unit_b.get('cabinets', []))
if topo_a != topo_b:
diffs.append(f"Layout topology differs: {topo_a} vs {topo_b}")
if unit_a.get('is_ada', False) != unit_b.get('is_ada', False):
diffs.append(f"ADA flag differs")
if not diffs:
diffs.append("Fingerprints match — these are the SAME kitchen type (filler-only variance)")
return diffs
@@ -0,0 +1,389 @@
"""
===========================================================================
core/engines/placement_engine.py — Deterministic Cabinet Placement
===========================================================================
Phase 4: Given solved wall constraints (available runs + anchors),
deterministically places cabinets using Manufacturing Rules and Design
Rules. This is the core intellectual property of the system.
The engine CONSUMES rules — it does not own them.
Manufacturing Rules (physical constraints):
- Toe kick height: 4.5" standard, varies by manufacturer
- Filler width: 1.5" min, 6" max
- Standard catalog widths only (no arbitrary sizes)
- Corner cabinets require 3" filler pull
Design Rules (placement logic):
- Sink base is centered on the sink anchor
- Dishwasher is always adjacent to sink base
- Remaining space is filled with largest-first standard bases
- Fillers absorb fractional inches at wall ends
- ADA: max countertop height 34", knee clearance at sink
The engine produces CabinetItem objects (legacy-compatible) that the
downstream pipeline, fingerprint, BOM, and drawing generators consume.
===========================================================================
"""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import List, Optional, Tuple
from core.engines.constraint_solver import (
WallConstraints, AvailableRun, Anchor, ApplianceSlot,
STANDARD_BASE_WIDTHS, STANDARD_SINK_BASE_WIDTHS, STANDARD_DW_WIDTHS,
MIN_FILLER_WIDTH, MAX_FILLER_WIDTH, MIN_CABINET_WIDTH,
)
# ══════════════════════════════════════════════════════════════════════════
# MANUFACTURING RULES
# ══════════════════════════════════════════════════════════════════════════
@dataclass
class ManufacturingRules:
"""Physical constraints from the cabinet manufacturer."""
toe_kick_height: float = 4.5 # inches
base_height: float = 34.5 # inches (standard counter height)
ada_base_height: float = 34.0 # inches (ADA max)
base_depth: float = 24.0 # inches
upper_height: float = 30.0 # inches (default wall cabinet)
upper_depth: float = 12.0 # inches
standard_base_widths: List[int] = field(default_factory=lambda: list(STANDARD_BASE_WIDTHS))
standard_sink_widths: List[int] = field(default_factory=lambda: list(STANDARD_SINK_BASE_WIDTHS))
min_filler: float = MIN_FILLER_WIDTH
max_filler: float = MAX_FILLER_WIDTH
corner_filler_pull: float = 3.0 # inches
# ══════════════════════════════════════════════════════════════════════════
# DESIGN RULES
# ══════════════════════════════════════════════════════════════════════════
@dataclass
class DesignRules:
"""Placement logic rules."""
center_sink_on_anchor: bool = True
dw_adjacent_to_sink: bool = True
dw_side: str = "left" # "left" or "right" of sink
fill_largest_first: bool = True
filler_at_wall_ends: bool = True
ada_knee_clearance_at_sink: bool = True # ADA: open knee space under sink
# ══════════════════════════════════════════════════════════════════════════
# PLACED CABINET
# ══════════════════════════════════════════════════════════════════════════
@dataclass
class PlacedCabinet:
"""A cabinet placed at a specific position on a wall."""
cabinet_type: str # "base", "sink_base", "dw_adjacent", "filler"
width: int # inches (catalog standard)
x_start: float # inches from wall origin
is_filler: bool = False
filler_width: float = 0.0 # actual filler width if is_filler
notes: str = ""
@property
def x_end(self) -> float:
if self.is_filler:
return self.x_start + self.filler_width
return self.x_start + self.width
@property
def code(self) -> str:
if self.is_filler:
return f"F{self.filler_width:.1f}".rstrip('0').rstrip('.')
prefix_map = {
"base": "B",
"sink_base": "SB",
"dw_adjacent": "DW",
}
return f"{prefix_map.get(self.cabinet_type, 'B')}{self.width}"
# ══════════════════════════════════════════════════════════════════════════
# PLACEMENT ENGINE
# ══════════════════════════════════════════════════════════════════════════
class PlacementEngine:
"""
Deterministically fills available wall runs with cabinets.
Algorithm for a run with a centered sink anchor:
1. Place sink base centered on the anchor.
2. Place dishwasher (24") adjacent to sink base (per design rules).
3. Fill remaining space on each side with largest-first standard bases.
4. Absorb any fractional remainder as filler at the wall ends.
Algorithm for a run with no anchor:
1. Fill with largest-first standard bases from left to right.
2. Absorb remainder as filler at the right wall end.
"""
def __init__(
self,
mfg_rules: Optional[ManufacturingRules] = None,
design_rules: Optional[DesignRules] = None,
):
self.mfg = mfg_rules or ManufacturingRules()
self.design = design_rules or DesignRules()
def place_wall(self, wc: WallConstraints) -> List[PlacedCabinet]:
"""Place cabinets on all available runs of a wall."""
all_placed: List[PlacedCabinet] = []
for run in wc.available_runs:
placed = self._place_run(run, wc.is_ada)
all_placed.extend(placed)
return all_placed
def _place_run(self, run: AvailableRun, is_ada: bool = False) -> List[PlacedCabinet]:
"""Place cabinets in one contiguous available run."""
if run.length < MIN_CABINET_WIDTH:
# Too short for any cabinet — filler only
if run.length >= MIN_FILLER_WIDTH:
return [PlacedCabinet(
cabinet_type="filler", width=0, x_start=run.x_start,
is_filler=True, filler_width=run.length,
notes="Dead space filler"
)]
return []
# Check for a sink anchor in this run
sink_anchor = None
for a in run.anchors:
if "sink" in a.type.lower():
sink_anchor = a
break
if sink_anchor and self.design.center_sink_on_anchor:
return self._place_with_centered_sink(run, sink_anchor, is_ada)
else:
return self._place_fill_run(run.x_start, run.x_end)
def _place_with_centered_sink(
self,
run: AvailableRun,
anchor: Anchor,
is_ada: bool = False,
) -> List[PlacedCabinet]:
"""
Place cabinets with a centered sink base.
Strategy:
1. Pick the best sink base width from the catalog.
2. Center it on the anchor.
3. Place DW adjacent to sink (default: left side).
4. Fill remaining segments on each side.
"""
result: List[PlacedCabinet] = []
# Pick sink base width — use anchor width if it matches a standard, else 36"
sb_width = 36
for sw in sorted(self.mfg.standard_sink_widths, reverse=True):
if sw <= anchor.width or sw == 36:
sb_width = sw
break
# Center the sink base on the anchor
sb_center = anchor.x_center
sb_x_start = sb_center - sb_width / 2.0
# Clamp to run boundaries
if sb_x_start < run.x_start:
sb_x_start = run.x_start
if sb_x_start + sb_width > run.x_end:
sb_x_start = run.x_end - sb_width
sb_x_end = sb_x_start + sb_width
# Place sink base
result.append(PlacedCabinet(
cabinet_type="sink_base", width=sb_width,
x_start=sb_x_start, notes="Centered on sink"
))
# Place dishwasher adjacent to sink
dw_width = STANDARD_DW_WIDTHS[0] # 24"
if self.design.dw_adjacent_to_sink:
if self.design.dw_side == "left" and sb_x_start - dw_width >= run.x_start:
dw_x_start = sb_x_start - dw_width
result.append(PlacedCabinet(
cabinet_type="dw_adjacent", width=dw_width,
x_start=dw_x_start, notes="DW left of sink"
))
# Fill left of DW
left_cabs = self._place_fill_run(run.x_start, dw_x_start)
result.extend(left_cabs)
# Fill right of sink base
right_cabs = self._place_fill_run(sb_x_end, run.x_end)
result.extend(right_cabs)
elif self.design.dw_side == "right" and sb_x_end + dw_width <= run.x_end:
dw_x_start = sb_x_end
result.append(PlacedCabinet(
cabinet_type="dw_adjacent", width=dw_width,
x_start=dw_x_start, notes="DW right of sink"
))
# Fill left of sink base
left_cabs = self._place_fill_run(run.x_start, sb_x_start)
result.extend(left_cabs)
# Fill right of DW
right_cabs = self._place_fill_run(dw_x_start + dw_width, run.x_end)
result.extend(right_cabs)
else:
# DW doesn't fit on preferred side — try other side
if sb_x_end + dw_width <= run.x_end:
dw_x_start = sb_x_end
result.append(PlacedCabinet(
cabinet_type="dw_adjacent", width=dw_width,
x_start=dw_x_start, notes="DW right of sink (fallback)"
))
left_cabs = self._place_fill_run(run.x_start, sb_x_start)
result.extend(left_cabs)
right_cabs = self._place_fill_run(dw_x_start + dw_width, run.x_end)
result.extend(right_cabs)
elif sb_x_start - dw_width >= run.x_start:
dw_x_start = sb_x_start - dw_width
result.append(PlacedCabinet(
cabinet_type="dw_adjacent", width=dw_width,
x_start=dw_x_start, notes="DW left of sink (fallback)"
))
left_cabs = self._place_fill_run(run.x_start, dw_x_start)
result.extend(left_cabs)
right_cabs = self._place_fill_run(sb_x_end, run.x_end)
result.extend(right_cabs)
else:
# No room for DW at all — fill both sides
left_cabs = self._place_fill_run(run.x_start, sb_x_start)
result.extend(left_cabs)
right_cabs = self._place_fill_run(sb_x_end, run.x_end)
result.extend(right_cabs)
else:
# No DW rule — fill both sides
left_cabs = self._place_fill_run(run.x_start, sb_x_start)
result.extend(left_cabs)
right_cabs = self._place_fill_run(sb_x_end, run.x_end)
result.extend(right_cabs)
# Sort by x position
result.sort(key=lambda c: c.x_start)
return result
def _place_fill_run(
self,
x_start: float,
x_end: float,
) -> List[PlacedCabinet]:
"""
Fill a contiguous segment with standard base cabinets.
Strategy:
1. Try to find an exact-fit combination (no filler needed).
2. If no exact fit, use largest-first greedy with filler for remainder.
"""
result: List[PlacedCabinet] = []
total = x_end - x_start
if total < MIN_FILLER_WIDTH:
return result
if total < MIN_CABINET_WIDTH:
result.append(PlacedCabinet(
cabinet_type="filler", width=0, x_start=x_start,
is_filler=True, filler_width=total
))
return result
# Try exact-fit first (no filler)
exact = self._find_exact_fill(int(total)) if total == int(total) else None
if exact:
cursor = x_start
for w in exact:
result.append(PlacedCabinet(
cabinet_type="base", width=w, x_start=cursor
))
cursor += w
return result
# Greedy fallback: largest-first
cursor = x_start
widths = sorted(self.mfg.standard_base_widths, reverse=True)
while cursor < x_end:
space = x_end - cursor
if space < MIN_CABINET_WIDTH:
if space >= MIN_FILLER_WIDTH:
result.append(PlacedCabinet(
cabinet_type="filler", width=0, x_start=cursor,
is_filler=True, filler_width=space
))
break
placed = False
for w in widths:
if w <= space:
leftover = space - w
if 0 < leftover < MIN_FILLER_WIDTH:
continue
result.append(PlacedCabinet(
cabinet_type="base", width=w, x_start=cursor
))
cursor += w
placed = True
break
if not placed:
smallest = min((w for w in widths if w <= space), default=None)
if smallest:
result.append(PlacedCabinet(
cabinet_type="base", width=smallest, x_start=cursor
))
cursor += smallest
else:
if space >= MIN_FILLER_WIDTH:
result.append(PlacedCabinet(
cabinet_type="filler", width=0, x_start=cursor,
is_filler=True, filler_width=space
))
break
return result
def _find_exact_fill(self, total: int) -> Optional[List[int]]:
"""
Find a combination of standard base widths that sums exactly to `total`.
Prefers: (1) fewest cabinets, then (2) lowest max-width (most balanced).
Returns sorted list of widths, or None if no exact combination exists.
"""
widths = sorted(self.mfg.standard_base_widths, reverse=True)
# DP: best[s] = (cabinet_count, max_width, list_of_widths) or None
best: dict[int, Optional[tuple]] = {0: (0, 0, [])}
for s in range(1, total + 1):
best[s] = None
for w in widths:
if w <= s and best.get(s - w) is not None:
prev_count, prev_max, prev_list = best[s - w]
new_count = prev_count + 1
new_max = max(prev_max, w)
if best[s] is None:
best[s] = (new_count, new_max, prev_list + [w])
else:
cur_count, cur_max, _ = best[s]
# Prefer fewer cabinets, then lower max-width
if (new_count < cur_count) or (new_count == cur_count and new_max < cur_max):
best[s] = (new_count, new_max, prev_list + [w])
entry = best.get(total)
if entry is None:
return None
return sorted(entry[2])
def placed_to_codes(self, placed: List[PlacedCabinet]) -> List[str]:
"""Convert placed cabinets to a list of cabinet code strings."""
# Sort by position, then return codes
placed_sorted = sorted(placed, key=lambda c: c.x_start)
return [c.code for c in placed_sorted]
@@ -2,87 +2,162 @@ import json
import os
from typing import Dict, List, Any
from collections import defaultdict
from core.engines.layout_fingerprint_engine import LayoutFingerprintEngine
from core.bimlite import (
ModelBuilder, ManufacturingRulesEngine, ValidationEngine, ReviewEngine,
FingerprintBuilder, NormalizationEngine, SimilarityEngine
)
class UnitMatrixBuilder:
@staticmethod
def save_signatures(signatures_map: Dict[str, str], filepath: str = "data/layout_signatures.json"):
def save_version_store(signatures_map: Dict[str, Any], filepath: str):
os.makedirs(os.path.dirname(filepath), exist_ok=True)
with open(filepath, 'w') as f:
json.dump(signatures_map, f, indent=4)
@staticmethod
def load_signatures(filepath: str = "data/layout_signatures.json") -> Dict[str, str]:
def load_version_store(filepath: str) -> Dict[str, Any]:
if os.path.exists(filepath):
with open(filepath, 'r') as f:
return json.load(f)
return {}
@staticmethod
def build_unit_matrix(unit_data: List[Dict[str, Any]]) -> Dict[str, Any]:
"""Groups units into K1, K2 and V1, V2 signatures."""
kitchen_signatures = UnitMatrixBuilder.load_signatures("data/kitchen_signatures.json")
vanity_signatures = UnitMatrixBuilder.load_signatures("data/vanity_signatures.json")
def _stable_sort_and_assign(canonical_map: Dict[str, Any], prefix: str, existing_store: Dict[str, Any]) -> Dict[str, str]:
"""
Sorts the unique hashes by topology complexity (cabinet count, width)
to assign stable K1, K2, V1, V2 names.
Returns a mapping from Hash -> TypeName (e.g., 'hash123' -> 'K1')
"""
# Collect all unique canonicals
items = []
for h, data in canonical_map.items():
cab_count = len(data['canonical_geometry']['cabinets'])
total_w = sum(c['w'] for c in data['canonical_geometry']['cabinets'])
room_id = data['canonical_metadata']['id']
items.append((cab_count, total_w, room_id, h))
# Sort by Cabinet Count -> Total Width -> Room UUID (fallback)
items.sort(key=lambda x: (x[0], x[1], x[2]))
k_counter = len(kitchen_signatures) + 1
v_counter = len(vanity_signatures) + 1
assigned = {}
# First pass: map any that already exist in the existing_store
# We need a reverse map from existing_store hash -> TypeName
existing_hash_to_type = {}
for type_name, history in existing_store.items():
# Get latest version hash
latest_v = max(history.keys(), key=lambda k: int(k.replace('v', '')))
latest_hash = history[latest_v]['hash']
existing_hash_to_type[latest_hash] = type_name
counter = len(existing_store) + 1
for _, _, _, h in items:
if h in existing_hash_to_type:
assigned[h] = existing_hash_to_type[h]
else:
assigned[h] = f"{prefix}{counter}"
counter += 1
return assigned
@staticmethod
def build_unit_matrix(unit_data: List[Dict[str, Any]], project_config: Dict[str, Any]) -> Dict[str, Any]:
"""Runs the entire BIM-lite pipeline to generate the K/V matrix."""
k_store = UnitMatrixBuilder.load_version_store("data/kitchen_signatures.json")
v_store = UnitMatrixBuilder.load_version_store("data/vanity_signatures.json")
# 1. Build Model
project = ModelBuilder.build_project(project_config.get('name', 'Project'), project_config, unit_data)
results = []
k_canonicals = {}
v_canonicals = {}
for unit in unit_data:
unit_name = unit.get('name', 'Unknown')
unit_qty = unit.get('quantity', 1)
is_ada = unit.get('is_ada', False)
k_sig = "NONE"
if 'kitchen' in unit:
k_sig = LayoutFingerprintEngine.generate_fingerprint({'cabinets': unit['kitchen'], 'is_ada': is_ada})
# 2. Process each room
for building in project.buildings:
for unit in building.units:
k_type = "NONE"
v_type = "NONE"
is_ada = False
v_sig = "NONE"
if 'vanity' in unit:
v_sig = LayoutFingerprintEngine.generate_fingerprint({'cabinets': unit['vanity'], 'is_ada': is_ada})
k_type = "NONE"
if k_sig != "NONE":
# Reverse lookup
existing_type = None
for t, s in kitchen_signatures.items():
if s == k_sig:
existing_type = t
break
if not existing_type:
k_type = f"K{k_counter}"
kitchen_signatures[k_type] = k_sig
k_counter += 1
else:
k_type = existing_type
for room in unit.rooms:
if room.is_ada:
is_ada = True
# 3. Manufacturing Rules
room = ManufacturingRulesEngine.apply_rules(room)
# 4. Validation & Review
report = ValidationEngine.validate(room)
if not ReviewEngine.review(report):
continue # Skip invalid rooms
# 5. Fingerprint (Geometry vs Metadata)
canonical = FingerprintBuilder.build_canonical(room)
# 6. Normalize & Hash
norm_geom = NormalizationEngine.normalize(canonical['canonical_geometry'])
room_hash = SimilarityEngine.get_hash(norm_geom)
if room.name == "Kitchen":
k_canonicals[room_hash] = canonical
else:
v_canonicals[room_hash] = canonical
results.append({
"unit_name": unit.name,
"unit_qty": unit.quantity,
"kitchen_hash": list(k_canonicals.keys())[-1] if k_canonicals else None, # Temp reference
"vanity_hash": list(v_canonicals.keys())[-1] if v_canonicals else None,
"is_ada": is_ada
})
v_type = "NONE"
if v_sig != "NONE":
# Reverse lookup
existing_type = None
for t, s in vanity_signatures.items():
if s == v_sig:
existing_type = t
break
if not existing_type:
v_type = f"V{v_counter}"
vanity_signatures[v_type] = v_sig
v_counter += 1
else:
v_type = existing_type
# 7. Stable Sorting and Assignment
k_assignments = UnitMatrixBuilder._stable_sort_and_assign(k_canonicals, "K", k_store)
v_assignments = UnitMatrixBuilder._stable_sort_and_assign(v_canonicals, "V", v_store)
# 8. Update Version Stores
for h, t_name in k_assignments.items():
if t_name not in k_store:
k_store[t_name] = {}
# Check if this hash is already in the history
hash_exists = any(v['hash'] == h for v in k_store[t_name].values())
if not hash_exists:
next_v = f"v{len(k_store[t_name]) + 1}"
k_store[t_name][next_v] = {
"hash": h,
"canonical_geometry": k_canonicals[h]['canonical_geometry'],
"canonical_metadata": k_canonicals[h]['canonical_metadata']
}
results.append({
"unit_name": unit_name,
"unit_qty": unit_qty,
for h, t_name in v_assignments.items():
if t_name not in v_store:
v_store[t_name] = {}
hash_exists = any(v['hash'] == h for v in v_store[t_name].values())
if not hash_exists:
next_v = f"v{len(v_store[t_name]) + 1}"
v_store[t_name][next_v] = {
"hash": h,
"canonical_geometry": v_canonicals[h]['canonical_geometry'],
"canonical_metadata": v_canonicals[h]['canonical_metadata']
}
# 9. Finalize Results with assigned names
final_results = []
for r in results:
k_type = k_assignments.get(r['kitchen_hash'], "NONE") if r['kitchen_hash'] else "NONE"
v_type = v_assignments.get(r['vanity_hash'], "NONE") if r['vanity_hash'] else "NONE"
final_results.append({
"unit_name": r['unit_name'],
"unit_qty": r['unit_qty'],
"kitchen_type": k_type,
"vanity_type": v_type,
"is_ada": is_ada
"is_ada": r['is_ada']
})
UnitMatrixBuilder.save_signatures(kitchen_signatures, "data/kitchen_signatures.json")
UnitMatrixBuilder.save_signatures(vanity_signatures, "data/vanity_signatures.json")
return results
UnitMatrixBuilder.save_version_store(k_store, "data/kitchen_signatures.json")
UnitMatrixBuilder.save_version_store(v_store, "data/vanity_signatures.json")
return final_results
@staticmethod
def group_by_building(unit_matrix: List[Dict[str, Any]], project_config: Dict[str, Any]) -> Dict[str, List[Dict[str, Any]]]:
+1 -1
View File
@@ -301,7 +301,7 @@ class PriceMatcher:
continue # no price for appliances
result = self.match(
cabinet_type = item.cabinet_type,
width_mm = item.width_mm,
width_in = item.width_in,
quantity = item.quantity,
tier = tier,
)
+1 -4
View File
@@ -1,4 +1 @@
{
"K1": "af03461580dcef194124a51ad1f3a329",
"K2": "53346be807b8a6380437803c0b0a4877"
}
{}
+630 -2
View File
@@ -1,4 +1,632 @@
{
"V1": "6b441dd38d7a568334689994cf729b49",
"V2": "1d2899eb249fef8aa8627102687f3f88"
"V1": {
"v1": {
"hash": "5b55dd200cd03c47498026618cdfa1dac224ad9b9e798496c7c5b9cf84d86cf2",
"canonical_geometry": {
"type": "Vanity",
"is_ada": true,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.02,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_bd663fcf",
"tgt": "obj_5299562c"
}
]
},
"canonical_metadata": {
"id": "obj_0ceb787f",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_bd663fcf": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_5299562c": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V2": {
"v1": {
"hash": "f1486972fb903652875067d816f8d40e4923b0947e9755398ec885de50e89961",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_003e390a",
"tgt": "obj_80e0134c"
}
]
},
"canonical_metadata": {
"id": "obj_12dc6525",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_003e390a": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_80e0134c": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V3": {
"v1": {
"hash": "eb2a475c83b1999fede2a3490fa0c1027f52df4657a396f1858432a42fddf02f",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_3d856226",
"tgt": "obj_70612fe3"
}
]
},
"canonical_metadata": {
"id": "obj_17b06030",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_3d856226": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_70612fe3": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V4": {
"v1": {
"hash": "8cf63a3b8d1cf623a1b8c3b35d1b698ef5f9899b2b096950d58eec89055bf5ec",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_d27b8d0c",
"tgt": "obj_7f589ec1"
}
]
},
"canonical_metadata": {
"id": "obj_18450b46",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_d27b8d0c": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_7f589ec1": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V5": {
"v1": {
"hash": "23cf43660b8232092858a759233ddb6769f122e98fedb0e75aef40182f17a747",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_0eeabe78",
"tgt": "obj_0487888a"
}
]
},
"canonical_metadata": {
"id": "obj_339b4985",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_0eeabe78": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_0487888a": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V6": {
"v1": {
"hash": "3f7f2accc3333bf520faacf5d8b0e8635efb38aaea5df1b04b6fdea4263b4cf6",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_8b77a33e",
"tgt": "obj_233a7898"
}
]
},
"canonical_metadata": {
"id": "obj_3deeb5ea",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_8b77a33e": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_233a7898": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V7": {
"v1": {
"hash": "9dbddc12bc646183c3e014945c6a7c6edfec589254eee175e63885714a803691",
"canonical_geometry": {
"type": "Vanity",
"is_ada": true,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.02,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_536cd642",
"tgt": "obj_a303cd08"
}
]
},
"canonical_metadata": {
"id": "obj_62a7c9e3",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_536cd642": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_a303cd08": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V8": {
"v1": {
"hash": "d38b6b8cf3e62f312db9ce419c6dec4ce72e5fae0b1ed2b7f9457bcb8996a2eb",
"canonical_geometry": {
"type": "Vanity",
"is_ada": true,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.02,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_4bfb7fd7",
"tgt": "obj_9bcb30fb"
}
]
},
"canonical_metadata": {
"id": "obj_886b856e",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_4bfb7fd7": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_9bcb30fb": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V9": {
"v1": {
"hash": "89c0172932649536e3ffc9d1a605f2dd1188062647cd88eea52aa968dc20fa43",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_22325bf9",
"tgt": "obj_e3c5606c"
}
]
},
"canonical_metadata": {
"id": "obj_95aeb626",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_22325bf9": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_e3c5606c": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V10": {
"v1": {
"hash": "83f12ddafa2c37694ff30aaf8aebe50bc37542df5b840fc3312b980c2146ed72",
"canonical_geometry": {
"type": "Vanity",
"is_ada": true,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.02,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_2596c7b9",
"tgt": "obj_c619c8d6"
}
]
},
"canonical_metadata": {
"id": "obj_abfd160b",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_2596c7b9": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_c619c8d6": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V11": {
"v1": {
"hash": "9800954655dc8c0cb2b1d5e33b5c30f5e3d3c4dddaa91b63012880bdea5d1622",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_35df92b3",
"tgt": "obj_8ce46977"
}
]
},
"canonical_metadata": {
"id": "obj_c0042787",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_35df92b3": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_8ce46977": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V12": {
"v1": {
"hash": "1684ebaaa9291a93cb987ae29ed5f1b311550e4aa6ef7a20d1b9cb74985bde25",
"canonical_geometry": {
"type": "Vanity",
"is_ada": false,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.25,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_2ea3b3f8",
"tgt": "obj_24e6a863"
}
]
},
"canonical_metadata": {
"id": "obj_e1d4d5ce",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_2ea3b3f8": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_24e6a863": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V13": {
"v1": {
"hash": "40e446d134683c4464964a8ca9db3426472b9d4e81ebc006d63ab924b499f290",
"canonical_geometry": {
"type": "Vanity",
"is_ada": true,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.02,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_6128dec6",
"tgt": "obj_905273de"
}
]
},
"canonical_metadata": {
"id": "obj_ed7d06cf",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_6128dec6": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_905273de": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
},
"V14": {
"v1": {
"hash": "a3e30d3ad945faeedd220d04d5abb743d1dcf7c5af2832e0280b50b43c80553e",
"canonical_geometry": {
"type": "Vanity",
"is_ada": true,
"cabinets": [
{
"type": "vanity",
"w": 74.02,
"h": 34.02,
"d": 20.87
},
{
"type": "linen",
"w": 23.62,
"h": 83.86,
"d": 23.62
}
],
"appliances": [],
"relationships": [
{
"type": "touches",
"src": "obj_64e9cbe9",
"tgt": "obj_993ee8eb"
}
]
},
"canonical_metadata": {
"id": "obj_fd8284f3",
"schema_version": "2.0",
"parser_version": "1.5",
"normalizer_version": "1.2",
"cabinet_metadata": {
"obj_64e9cbe9": {
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth."
},
"obj_993ee8eb": {
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions."
}
}
}
}
}
}
-60
View File
@@ -1,60 +0,0 @@
"""
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)}")
-84
View File
@@ -1,84 +0,0 @@
"""
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.")
+73
View File
@@ -0,0 +1,73 @@
import sys
import os
from pathlib import Path
import argparse
import ezdxf
try:
from ezdxf.addons.drawing.matplotlib import qsave
from ezdxf.addons.drawing.config import Configuration, BackgroundPolicy, ColorPolicy
except ImportError:
print("Error: Missing required dependencies. Please install ezdxf and matplotlib.")
print("pip install ezdxf matplotlib")
sys.exit(1)
def convert_dxf_to_pdf(dxf_path: str, pdf_path: str = None):
dxf_path = Path(dxf_path)
if not dxf_path.exists():
print(f"Error: File not found: {dxf_path}")
return False
if pdf_path is None:
pdf_path = dxf_path.with_suffix('.pdf')
else:
pdf_path = Path(pdf_path)
try:
print(f"Loading {dxf_path}...")
doc = ezdxf.readfile(dxf_path)
msp = doc.modelspace()
# Configure for printing (white background, black lines)
config = Configuration(
background_policy=BackgroundPolicy.WHITE,
color_policy=ColorPolicy.BLACK
)
print(f"Converting to PDF...")
# Save to PDF with high DPI for clarity
qsave(msp, str(pdf_path), bg='#FFFFFF', config=config, dpi=300)
print(f"Success: Saved to {pdf_path}")
return True
except Exception as e:
print(f"Error converting {dxf_path}: {e}")
return False
def main():
parser = argparse.ArgumentParser(description="Convert DXF files to PDF")
parser.add_argument("input", help="Path to input DXF file or directory")
parser.add_argument("--output", "-o", help="Path to output PDF file (only used if input is a single file)", default=None)
args = parser.parse_args()
input_path = Path(args.input)
if input_path.is_file():
convert_dxf_to_pdf(input_path, args.output)
elif input_path.is_dir():
dxf_files = list(input_path.glob('*.dxf'))
if not dxf_files:
print(f"No DXF files found in {input_path}")
return
print(f"Found {len(dxf_files)} DXF files in {input_path}")
success_count = 0
for dxf in dxf_files:
if convert_dxf_to_pdf(dxf):
success_count += 1
print(f"\nCompleted: {success_count}/{len(dxf_files)} files converted successfully.")
else:
print(f"Error: Invalid input path: {input_path}")
if __name__ == "__main__":
main()
-28
View File
@@ -1,28 +0,0 @@
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()
-15
View File
@@ -1,15 +0,0 @@
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}")
-52
View File
@@ -1,52 +0,0 @@
import sys
sys.stdout.reconfigure(encoding="utf-8")
import fitz
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)"
)
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 678 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -1,191 +0,0 @@
{
"unit_type": "A1",
"is_ada": false,
"auto_approved": false,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9",
"Requires review: avg confidence 0.89 < 0.9",
"Requires review: avg confidence 0.88 < 0.9",
"Requires review: avg confidence 0.89 < 0.9"
],
"elevations": [
{
"elevation_label": "KITCHEN",
"unit_type": "A1",
"is_ada": false,
"auto_approved": false,
"avg_confidence": 0.8944444444444445,
"review_flags": [
"Requires review: avg confidence 0.89 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "microwave_shelf",
"width_in": 30.0,
"height_in": 14.96,
"depth_in": 12.99,
"location": "Above range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 2'-6\" range space below",
"source": "gemini"
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 30.0,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Right of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, similar to item 1",
"source": "gemini"
},
{
"item_num": 4,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 35.43,
"depth_in": 23.62,
"location": "Range space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": false,
"notes": "Space for 'FULL SIZE RANGE' (U4)",
"source": "gemini"
},
{
"item_num": 5,
"cabinet_type": "base",
"width_in": 35.43,
"height_in": 28.35,
"depth_in": 23.62,
"location": "Left of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 6,
"cabinet_type": "base",
"width_in": 30.0,
"height_in": 28.35,
"depth_in": 23.62,
"location": "Right of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, similar to item 2",
"source": "gemini"
},
{
"item_num": 7,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 66.93,
"depth_in": 23.62,
"location": "Refrigerator space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": false,
"notes": "Space for 'REF.' (Refrigerator)",
"source": "gemini"
},
{
"item_num": 8,
"cabinet_type": "pantry",
"width_in": 11.81,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Right of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.8,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated, height 7'-6\" (2286mm) from drawing, depth 'CABINET OVER REF. TO BE 24\" DEPTH' implies 24\" depth for tall cabinets as well. U9 indicates 12\" width, 24\" depth, which could be this cabinet.",
"source": "gemini"
},
{
"item_num": 9,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.85,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension. Height estimated to match adjacent upper cabinets.",
"source": "gemini"
}
]
},
{
"elevation_label": "BATHROOM",
"unit_type": "A1",
"is_ada": false,
"auto_approved": false,
"avg_confidence": 0.75,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "vanity",
"width_in": 74.02,
"height_in": 34.25,
"depth_in": 20.87,
"location": "Bathroom, left wall",
"elevation_ref": "A-6.00A",
"confidence": 0.8,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth.",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "linen",
"width_in": 23.62,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Bathroom, right of vanity",
"elevation_ref": "A-6.00A",
"confidence": 0.7,
"quantity": 1,
"is_ada": false,
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions.",
"source": "gemini"
}
]
}
]
}
@@ -1,191 +0,0 @@
{
"unit_type": "A2-ADA",
"is_ada": true,
"auto_approved": false,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9",
"Requires review: avg confidence 0.89 < 0.9",
"Requires review: avg confidence 0.88 < 0.9",
"Requires review: avg confidence 0.89 < 0.9"
],
"elevations": [
{
"elevation_label": "KITCHEN",
"unit_type": "A2-ADA",
"is_ada": true,
"auto_approved": false,
"avg_confidence": 0.8944444444444445,
"review_flags": [
"Requires review: avg confidence 0.89 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "microwave_shelf",
"width_in": 30.0,
"height_in": 14.96,
"depth_in": 12.99,
"location": "Above range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 2'-6\" range space below",
"source": "gemini"
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 30.0,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Right of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, similar to item 1",
"source": "gemini"
},
{
"item_num": 4,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 35.43,
"depth_in": 23.62,
"location": "Range space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": true,
"notes": "Space for 'FULL SIZE RANGE' (U4)",
"source": "gemini"
},
{
"item_num": 5,
"cabinet_type": "base",
"width_in": 35.43,
"height_in": 34.02,
"depth_in": 23.62,
"location": "Left of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 6,
"cabinet_type": "base",
"width_in": 30.0,
"height_in": 34.02,
"depth_in": 23.62,
"location": "Right of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, similar to item 2",
"source": "gemini"
},
{
"item_num": 7,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 66.93,
"depth_in": 23.62,
"location": "Refrigerator space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": true,
"notes": "Space for 'REF.' (Refrigerator)",
"source": "gemini"
},
{
"item_num": 8,
"cabinet_type": "pantry",
"width_in": 11.81,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Right of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.8,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated, height 7'-6\" (2286mm) from drawing, depth 'CABINET OVER REF. TO BE 24\" DEPTH' implies 24\" depth for tall cabinets as well. U9 indicates 12\" width, 24\" depth, which could be this cabinet.",
"source": "gemini"
},
{
"item_num": 9,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.85,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 3'-0\" dimension. Height estimated to match adjacent upper cabinets.",
"source": "gemini"
}
]
},
{
"elevation_label": "BATHROOM",
"unit_type": "A2-ADA",
"is_ada": true,
"auto_approved": false,
"avg_confidence": 0.75,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "vanity",
"width_in": 74.02,
"height_in": 34.02,
"depth_in": 20.87,
"location": "Bathroom, left wall",
"elevation_ref": "A-6.00A",
"confidence": 0.8,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth.",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "linen",
"width_in": 23.62,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Bathroom, right of vanity",
"elevation_ref": "A-6.00A",
"confidence": 0.7,
"quantity": 1,
"is_ada": true,
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions.",
"source": "gemini"
}
]
}
]
}
@@ -1,191 +0,0 @@
{
"unit_type": "A3",
"is_ada": false,
"auto_approved": false,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9",
"Requires review: avg confidence 0.89 < 0.9",
"Requires review: avg confidence 0.88 < 0.9",
"Requires review: avg confidence 0.89 < 0.9"
],
"elevations": [
{
"elevation_label": "KITCHEN",
"unit_type": "A3",
"is_ada": false,
"auto_approved": false,
"avg_confidence": 0.8944444444444445,
"review_flags": [
"Requires review: avg confidence 0.89 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "microwave_shelf",
"width_in": 30.0,
"height_in": 14.96,
"depth_in": 12.99,
"location": "Above range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 2'-6\" range space below",
"source": "gemini"
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 30.0,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Right of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, similar to item 1",
"source": "gemini"
},
{
"item_num": 4,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 35.43,
"depth_in": 23.62,
"location": "Range space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": false,
"notes": "Space for 'FULL SIZE RANGE' (U4)",
"source": "gemini"
},
{
"item_num": 5,
"cabinet_type": "base",
"width_in": 35.43,
"height_in": 28.35,
"depth_in": 23.62,
"location": "Left of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 6,
"cabinet_type": "base",
"width_in": 30.0,
"height_in": 28.35,
"depth_in": 23.62,
"location": "Right of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, similar to item 2",
"source": "gemini"
},
{
"item_num": 7,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 66.93,
"depth_in": 23.62,
"location": "Refrigerator space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": false,
"notes": "Space for 'REF.' (Refrigerator)",
"source": "gemini"
},
{
"item_num": 8,
"cabinet_type": "pantry",
"width_in": 11.81,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Right of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.8,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated, height 7'-6\" (2286mm) from drawing, depth 'CABINET OVER REF. TO BE 24\" DEPTH' implies 24\" depth for tall cabinets as well. U9 indicates 12\" width, 24\" depth, which could be this cabinet.",
"source": "gemini"
},
{
"item_num": 9,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.85,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension. Height estimated to match adjacent upper cabinets.",
"source": "gemini"
}
]
},
{
"elevation_label": "BATHROOM",
"unit_type": "A3",
"is_ada": false,
"auto_approved": false,
"avg_confidence": 0.75,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "vanity",
"width_in": 74.02,
"height_in": 34.25,
"depth_in": 20.87,
"location": "Bathroom, left wall",
"elevation_ref": "A-6.00A",
"confidence": 0.8,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth.",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "linen",
"width_in": 23.62,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Bathroom, right of vanity",
"elevation_ref": "A-6.00A",
"confidence": 0.7,
"quantity": 1,
"is_ada": false,
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions.",
"source": "gemini"
}
]
}
]
}
@@ -1,191 +0,0 @@
{
"unit_type": "B1",
"is_ada": false,
"auto_approved": false,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9",
"Requires review: avg confidence 0.89 < 0.9",
"Requires review: avg confidence 0.88 < 0.9",
"Requires review: avg confidence 0.89 < 0.9"
],
"elevations": [
{
"elevation_label": "KITCHEN",
"unit_type": "B1",
"is_ada": false,
"auto_approved": false,
"avg_confidence": 0.8944444444444445,
"review_flags": [
"Requires review: avg confidence 0.89 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "microwave_shelf",
"width_in": 30.0,
"height_in": 14.96,
"depth_in": 12.99,
"location": "Above range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 2'-6\" range space below",
"source": "gemini"
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 30.0,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Right of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, similar to item 1",
"source": "gemini"
},
{
"item_num": 4,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 35.43,
"depth_in": 23.62,
"location": "Range space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": false,
"notes": "Space for 'FULL SIZE RANGE' (U4)",
"source": "gemini"
},
{
"item_num": 5,
"cabinet_type": "base",
"width_in": 35.43,
"height_in": 28.35,
"depth_in": 23.62,
"location": "Left of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 6,
"cabinet_type": "base",
"width_in": 30.0,
"height_in": 28.35,
"depth_in": 23.62,
"location": "Right of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, similar to item 2",
"source": "gemini"
},
{
"item_num": 7,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 66.93,
"depth_in": 23.62,
"location": "Refrigerator space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": false,
"notes": "Space for 'REF.' (Refrigerator)",
"source": "gemini"
},
{
"item_num": 8,
"cabinet_type": "pantry",
"width_in": 11.81,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Right of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.8,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated, height 7'-6\" (2286mm) from drawing, depth 'CABINET OVER REF. TO BE 24\" DEPTH' implies 24\" depth for tall cabinets as well. U9 indicates 12\" width, 24\" depth, which could be this cabinet.",
"source": "gemini"
},
{
"item_num": 9,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.85,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from drawing, 3'-0\" dimension. Height estimated to match adjacent upper cabinets.",
"source": "gemini"
}
]
},
{
"elevation_label": "BATHROOM",
"unit_type": "B1",
"is_ada": false,
"auto_approved": false,
"avg_confidence": 0.75,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "vanity",
"width_in": 74.02,
"height_in": 34.25,
"depth_in": 20.87,
"location": "Bathroom, left wall",
"elevation_ref": "A-6.00A",
"confidence": 0.8,
"quantity": 1,
"is_ada": false,
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth.",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "linen",
"width_in": 23.62,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Bathroom, right of vanity",
"elevation_ref": "A-6.00A",
"confidence": 0.7,
"quantity": 1,
"is_ada": false,
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions.",
"source": "gemini"
}
]
}
]
}
@@ -1,191 +0,0 @@
{
"unit_type": "B2-ADA",
"is_ada": true,
"auto_approved": false,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9",
"Requires review: avg confidence 0.89 < 0.9",
"Requires review: avg confidence 0.88 < 0.9",
"Requires review: avg confidence 0.89 < 0.9"
],
"elevations": [
{
"elevation_label": "KITCHEN",
"unit_type": "B2-ADA",
"is_ada": true,
"auto_approved": false,
"avg_confidence": 0.8944444444444445,
"review_flags": [
"Requires review: avg confidence 0.89 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "microwave_shelf",
"width_in": 30.0,
"height_in": 14.96,
"depth_in": 12.99,
"location": "Above range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 2'-6\" range space below",
"source": "gemini"
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 30.0,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Right of microwave shelf, top row, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, similar to item 1",
"source": "gemini"
},
{
"item_num": 4,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 35.43,
"depth_in": 23.62,
"location": "Range space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": true,
"notes": "Space for 'FULL SIZE RANGE' (U4)",
"source": "gemini"
},
{
"item_num": 5,
"cabinet_type": "base",
"width_in": 35.43,
"height_in": 34.02,
"depth_in": 23.62,
"location": "Left of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 3'-0\" dimension",
"source": "gemini"
},
{
"item_num": 6,
"cabinet_type": "base",
"width_in": 30.0,
"height_in": 34.02,
"depth_in": 23.62,
"location": "Right of range, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.9,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, similar to item 2",
"source": "gemini"
},
{
"item_num": 7,
"cabinet_type": "appliance_space",
"width_in": 30.0,
"height_in": 66.93,
"depth_in": 23.62,
"location": "Refrigerator space, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.95,
"quantity": 1,
"is_ada": true,
"notes": "Space for 'REF.' (Refrigerator)",
"source": "gemini"
},
{
"item_num": 8,
"cabinet_type": "pantry",
"width_in": 11.81,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Right of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.8,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated, height 7'-6\" (2286mm) from drawing, depth 'CABINET OVER REF. TO BE 24\" DEPTH' implies 24\" depth for tall cabinets as well. U9 indicates 12\" width, 24\" depth, which could be this cabinet.",
"source": "gemini"
},
{
"item_num": 9,
"cabinet_type": "upper_wall",
"width_in": 35.43,
"height_in": 30.0,
"depth_in": 12.99,
"location": "Left of refrigerator, Elevation 1",
"elevation_ref": "UNIT A1 KITCHEN EL.",
"confidence": 0.85,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from drawing, 3'-0\" dimension. Height estimated to match adjacent upper cabinets.",
"source": "gemini"
}
]
},
{
"elevation_label": "BATHROOM",
"unit_type": "B2-ADA",
"is_ada": true,
"auto_approved": false,
"avg_confidence": 0.75,
"review_flags": [
"Requires review: avg confidence 0.75 < 0.9"
],
"cabinets": [
{
"item_num": 1,
"cabinet_type": "vanity",
"width_in": 74.02,
"height_in": 34.02,
"depth_in": 20.87,
"location": "Bathroom, left wall",
"elevation_ref": "A-6.00A",
"confidence": 0.8,
"quantity": 1,
"is_ada": true,
"notes": "Width estimated from 6'-2\" dimension for the counter, assuming a standard vanity depth.",
"source": "gemini"
},
{
"item_num": 2,
"cabinet_type": "linen",
"width_in": 23.62,
"height_in": 83.86,
"depth_in": 23.62,
"location": "Bathroom, right of vanity",
"elevation_ref": "A-6.00A",
"confidence": 0.7,
"quantity": 1,
"is_ada": true,
"notes": "Labeled 'LN.', assuming standard pantry/linen dimensions.",
"source": "gemini"
}
]
}
]
}
@@ -1,234 +0,0 @@
[
{
"unit_type": "A1",
"cabinets": [
{
"code": "B30",
"qty": 1
},
{
"code": "B35",
"qty": 1
},
{
"code": "LIN24",
"qty": 1
},
{
"code": "MW30-15",
"qty": 1
},
{
"code": "T12-84",
"qty": 1
},
{
"code": "VAN74",
"qty": 1
},
{
"code": "W30-30",
"qty": 1
},
{
"code": "W35-30",
"qty": 2
}
],
"countertop_lf": 11.6,
"upper_cabinet_lf": 10.8,
"fillers": [],
"panels": [],
"moldings": [],
"special_items": [
"Pantry"
],
"installation_complexity": "medium"
},
{
"unit_type": "A2-ADA",
"cabinets": [
{
"code": "B30-ADA",
"qty": 1
},
{
"code": "B35-ADA",
"qty": 1
},
{
"code": "LIN24-ADA",
"qty": 1
},
{
"code": "MW30-15-ADA",
"qty": 1
},
{
"code": "T12-84-ADA",
"qty": 1
},
{
"code": "VAN74-ADA",
"qty": 1
},
{
"code": "W30-30-ADA",
"qty": 1
},
{
"code": "W35-30-ADA",
"qty": 2
}
],
"countertop_lf": 11.6,
"upper_cabinet_lf": 10.8,
"fillers": [],
"panels": [],
"moldings": [],
"special_items": [
"ADA",
"Pantry"
],
"installation_complexity": "high"
},
{
"unit_type": "A3",
"cabinets": [
{
"code": "B30",
"qty": 1
},
{
"code": "B35",
"qty": 1
},
{
"code": "LIN24",
"qty": 1
},
{
"code": "MW30-15",
"qty": 1
},
{
"code": "T12-84",
"qty": 1
},
{
"code": "VAN74",
"qty": 1
},
{
"code": "W30-30",
"qty": 1
},
{
"code": "W35-30",
"qty": 2
}
],
"countertop_lf": 11.6,
"upper_cabinet_lf": 10.8,
"fillers": [],
"panels": [],
"moldings": [],
"special_items": [
"Pantry"
],
"installation_complexity": "medium"
},
{
"unit_type": "B1",
"cabinets": [
{
"code": "B30",
"qty": 1
},
{
"code": "B35",
"qty": 1
},
{
"code": "LIN24",
"qty": 1
},
{
"code": "MW30-15",
"qty": 1
},
{
"code": "T12-84",
"qty": 1
},
{
"code": "VAN74",
"qty": 1
},
{
"code": "W30-30",
"qty": 1
},
{
"code": "W35-30",
"qty": 2
}
],
"countertop_lf": 11.6,
"upper_cabinet_lf": 10.8,
"fillers": [],
"panels": [],
"moldings": [],
"special_items": [
"Pantry"
],
"installation_complexity": "medium"
},
{
"unit_type": "B2-ADA",
"cabinets": [
{
"code": "B30-ADA",
"qty": 1
},
{
"code": "B35-ADA",
"qty": 1
},
{
"code": "LIN24-ADA",
"qty": 1
},
{
"code": "MW30-15-ADA",
"qty": 1
},
{
"code": "T12-84-ADA",
"qty": 1
},
{
"code": "VAN74-ADA",
"qty": 1
},
{
"code": "W30-30-ADA",
"qty": 1
},
{
"code": "W35-30-ADA",
"qty": 2
}
],
"countertop_lf": 11.6,
"upper_cabinet_lf": 10.8,
"fillers": [],
"panels": [],
"moldings": [],
"special_items": [
"ADA",
"Pantry"
],
"installation_complexity": "high"
}
]
@@ -1,462 +0,0 @@
[
{
"unit": "A1",
"kitchen_type": "K1",
"layout": "single_wall",
"ceiling_height": 108.0,
"walls": [
{
"name": "A",
"length": 137,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "B35",
"x": 30,
"width": 35,
"height": 28
},
{
"id": "B30",
"x": 65,
"width": 30,
"height": 28
},
{
"id": "T12-84",
"x": 125,
"width": 12,
"height": 84
},
{
"id": "W35-30",
"x": 0,
"width": 35,
"height": 30
},
{
"id": "MW30-15",
"x": 35,
"width": 30,
"height": 15
},
{
"id": "W30-30",
"x": 65,
"width": 30,
"height": 30
},
{
"id": "W35-30",
"x": 95,
"width": 35,
"height": 30
}
]
},
{
"name": "BATHROOM",
"length": 98,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "VAN74",
"x": 0,
"width": 74,
"height": 34
},
{
"id": "LIN24",
"x": 74,
"width": 24,
"height": 84
}
]
}
],
"appliances": [
{
"type": "RANGE",
"wall": "A",
"x": 0,
"width": 30
},
{
"type": "REF",
"wall": "A",
"x": 95,
"width": 30
}
]
},
{
"unit": "A2-ADA",
"kitchen_type": "K1",
"layout": "single_wall",
"ceiling_height": 108.0,
"walls": [
{
"name": "A",
"length": 137,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "B35-ADA",
"x": 30,
"width": 35,
"height": 34
},
{
"id": "B30-ADA",
"x": 65,
"width": 30,
"height": 34
},
{
"id": "T12-84-ADA",
"x": 125,
"width": 12,
"height": 84
},
{
"id": "W35-30-ADA",
"x": 0,
"width": 35,
"height": 30
},
{
"id": "MW30-15-ADA",
"x": 35,
"width": 30,
"height": 15
},
{
"id": "W30-30-ADA",
"x": 65,
"width": 30,
"height": 30
},
{
"id": "W35-30-ADA",
"x": 95,
"width": 35,
"height": 30
}
]
},
{
"name": "BATHROOM",
"length": 98,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "VAN74-ADA",
"x": 0,
"width": 74,
"height": 34
},
{
"id": "LIN24-ADA",
"x": 74,
"width": 24,
"height": 84
}
]
}
],
"appliances": [
{
"type": "RANGE",
"wall": "A",
"x": 0,
"width": 30
},
{
"type": "REF",
"wall": "A",
"x": 95,
"width": 30
}
]
},
{
"unit": "A3",
"kitchen_type": "K1",
"layout": "single_wall",
"ceiling_height": 108.0,
"walls": [
{
"name": "A",
"length": 137,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "B35",
"x": 30,
"width": 35,
"height": 28
},
{
"id": "B30",
"x": 65,
"width": 30,
"height": 28
},
{
"id": "T12-84",
"x": 125,
"width": 12,
"height": 84
},
{
"id": "W35-30",
"x": 0,
"width": 35,
"height": 30
},
{
"id": "MW30-15",
"x": 35,
"width": 30,
"height": 15
},
{
"id": "W30-30",
"x": 65,
"width": 30,
"height": 30
},
{
"id": "W35-30",
"x": 95,
"width": 35,
"height": 30
}
]
},
{
"name": "BATHROOM",
"length": 98,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "VAN74",
"x": 0,
"width": 74,
"height": 34
},
{
"id": "LIN24",
"x": 74,
"width": 24,
"height": 84
}
]
}
],
"appliances": [
{
"type": "RANGE",
"wall": "A",
"x": 0,
"width": 30
},
{
"type": "REF",
"wall": "A",
"x": 95,
"width": 30
}
]
},
{
"unit": "B1",
"kitchen_type": "K1",
"layout": "single_wall",
"ceiling_height": 108.0,
"walls": [
{
"name": "A",
"length": 137,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "B35",
"x": 30,
"width": 35,
"height": 28
},
{
"id": "B30",
"x": 65,
"width": 30,
"height": 28
},
{
"id": "T12-84",
"x": 125,
"width": 12,
"height": 84
},
{
"id": "W35-30",
"x": 0,
"width": 35,
"height": 30
},
{
"id": "MW30-15",
"x": 35,
"width": 30,
"height": 15
},
{
"id": "W30-30",
"x": 65,
"width": 30,
"height": 30
},
{
"id": "W35-30",
"x": 95,
"width": 35,
"height": 30
}
]
},
{
"name": "BATHROOM",
"length": 98,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "VAN74",
"x": 0,
"width": 74,
"height": 34
},
{
"id": "LIN24",
"x": 74,
"width": 24,
"height": 84
}
]
}
],
"appliances": [
{
"type": "RANGE",
"wall": "A",
"x": 0,
"width": 30
},
{
"type": "REF",
"wall": "A",
"x": 95,
"width": 30
}
]
},
{
"unit": "B2-ADA",
"kitchen_type": "K1",
"layout": "single_wall",
"ceiling_height": 108.0,
"walls": [
{
"name": "A",
"length": 137,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "B35-ADA",
"x": 30,
"width": 35,
"height": 34
},
{
"id": "B30-ADA",
"x": 65,
"width": 30,
"height": 34
},
{
"id": "T12-84-ADA",
"x": 125,
"width": 12,
"height": 84
},
{
"id": "W35-30-ADA",
"x": 0,
"width": 35,
"height": 30
},
{
"id": "MW30-15-ADA",
"x": 35,
"width": 30,
"height": 15
},
{
"id": "W30-30-ADA",
"x": 65,
"width": 30,
"height": 30
},
{
"id": "W35-30-ADA",
"x": 95,
"width": 35,
"height": 30
}
]
},
{
"name": "BATHROOM",
"length": 98,
"doors": [],
"windows": [],
"cabinets": [
{
"id": "VAN74-ADA",
"x": 0,
"width": 74,
"height": 34
},
{
"id": "LIN24-ADA",
"x": 74,
"width": 24,
"height": 84
}
]
}
],
"appliances": [
{
"type": "RANGE",
"wall": "A",
"x": 0,
"width": 30
},
{
"type": "REF",
"wall": "A",
"x": 95,
"width": 30
}
]
}
]
@@ -1,128 +0,0 @@
[
{
"building": "Building A",
"floor": 1,
"unit_type": "A1",
"count": 5,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 2,
"unit_type": "A1",
"count": 5,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 3,
"unit_type": "A1",
"count": 4,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 1,
"unit_type": "A2-ADA",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V2",
"is_ada": true
},
{
"building": "Building A",
"floor": 2,
"unit_type": "A2-ADA",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V2",
"is_ada": true
},
{
"building": "Building A",
"floor": 3,
"unit_type": "A2-ADA",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V2",
"is_ada": true
},
{
"building": "Building A",
"floor": 1,
"unit_type": "A3",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 2,
"unit_type": "A3",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 1,
"unit_type": "B1",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 2,
"unit_type": "B1",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 3,
"unit_type": "B1",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V1",
"is_ada": false
},
{
"building": "Building A",
"floor": 1,
"unit_type": "B2-ADA",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V2",
"is_ada": true
},
{
"building": "Building A",
"floor": 2,
"unit_type": "B2-ADA",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V2",
"is_ada": true
},
{
"building": "Building A",
"floor": 3,
"unit_type": "B2-ADA",
"count": 1,
"kitchen_type": "K1",
"bathroom_type": "V2",
"is_ada": true
}
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

@@ -1,256 +0,0 @@
{
"A1": {
"unit_type": "A1",
"is_ada": false,
"elevations": [
{
"elevation_label": "kitchen_elevation_1",
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"width_in": 14.41,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "above microwave",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 14.41,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 35.98,
"height_in": 35.98,
"depth_in": 12.99,
"location": "right wall",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 5,
"cabinet_type": "microwave_shelf",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "above microwave",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 6,
"cabinet_type": "sink_base",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "under sink",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 7,
"cabinet_type": "dw_adjacent",
"width_in": 12.01,
"height_in": 35.98,
"depth_in": 12.99,
"location": "next to dishwasher",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 8,
"cabinet_type": "base",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "range",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "range"
},
{
"item_num": 10,
"cabinet_type": "base",
"width_in": 35.98,
"height_in": 35.98,
"depth_in": 12.99,
"location": "right side",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 11,
"cabinet_type": "appliance_space",
"width_in": 12.01,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 35.98,
"height_in": 35.98,
"depth_in": 24.02,
"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_in": 35.98,
"height_in": 35.98,
"depth_in": 24.02,
"location": "above sink",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 24.02,
"location": "right of sink",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 4,
"cabinet_type": "base",
"width_in": 35.98,
"height_in": 34.02,
"depth_in": 24.02,
"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_in": 24.02,
"height_in": 34.02,
"depth_in": 24.02,
"location": "oven",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "oven"
},
{
"item_num": 6,
"cabinet_type": "base",
"width_in": 35.98,
"height_in": 34.02,
"depth_in": 24.02,
"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_in": 35.98,
"height_in": 70.08,
"depth_in": 24.02,
"location": "refrigerator",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "refrigerator"
}
],
"cabinet_count": 5,
"appliance_count": 2
}
]
}
}
@@ -1,254 +0,0 @@
{
"unit_type": "A1",
"is_ada": false,
"elevations": [
{
"elevation_label": "kitchen_elevation_1",
"cabinets": [
{
"item_num": 1,
"cabinet_type": "upper_wall",
"width_in": 14.41,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "above microwave",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 14.41,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 35.98,
"height_in": 35.98,
"depth_in": 12.99,
"location": "right wall",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 5,
"cabinet_type": "microwave_shelf",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "above microwave",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 6,
"cabinet_type": "sink_base",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "under sink",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 7,
"cabinet_type": "dw_adjacent",
"width_in": 12.01,
"height_in": 35.98,
"depth_in": 12.99,
"location": "next to dishwasher",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 8,
"cabinet_type": "base",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 24.02,
"height_in": 35.98,
"depth_in": 12.99,
"location": "range",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "range"
},
{
"item_num": 10,
"cabinet_type": "base",
"width_in": 35.98,
"height_in": 35.98,
"depth_in": 12.99,
"location": "right side",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 11,
"cabinet_type": "appliance_space",
"width_in": 12.01,
"height_in": 35.98,
"depth_in": 12.99,
"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_in": 35.98,
"height_in": 35.98,
"depth_in": 24.02,
"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_in": 35.98,
"height_in": 35.98,
"depth_in": 24.02,
"location": "above sink",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 3,
"cabinet_type": "upper_wall",
"width_in": 24.02,
"height_in": 35.98,
"depth_in": 24.02,
"location": "right of sink",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": ""
},
{
"item_num": 4,
"cabinet_type": "base",
"width_in": 35.98,
"height_in": 34.02,
"depth_in": 24.02,
"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_in": 24.02,
"height_in": 34.02,
"depth_in": 24.02,
"location": "oven",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "oven"
},
{
"item_num": 6,
"cabinet_type": "base",
"width_in": 35.98,
"height_in": 34.02,
"depth_in": 24.02,
"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_in": 35.98,
"height_in": 70.08,
"depth_in": 24.02,
"location": "refrigerator",
"elevation_ref": "ELEVATION A",
"confidence": 0.9,
"quantity": 1,
"is_ada": false,
"notes": "refrigerator"
}
],
"cabinet_count": 5,
"appliance_count": 2
}
]
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

Some files were not shown because too many files have changed in this diff Show More