From bbd1e2e6f4c9ff12db325c6b8475eac94fb9530c Mon Sep 17 00:00:00 2001 From: Atharv1705 Date: Thu, 5 Nov 2026 12:28:39 +0530 Subject: [PATCH] docs: Add root project README and repository documentation --- .gitignore | 1 + README.md | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 README.md diff --git a/.gitignore b/.gitignore index ad7ce25..65e3552 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ _analysis/ .DS_Store Thumbs.db desktop.ini + diff --git a/README.md b/README.md new file mode 100644 index 0000000..1130ba6 --- /dev/null +++ b/README.md @@ -0,0 +1,141 @@ +# AI Cabinet Estimation & Shop Drawing Automation + +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: 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 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 +``` + +--- + +## Running the Pipeline + +From the `Albert_Project` directory: + +```bash +cd Albert_Project +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 +cd Albert_Project +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//` or `Albert_Project//` with a `project_config.json` that drives execution. 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`. + +--- + +## Tech Stack + +| Layer | Tool | Purpose | +|-------|------|---------| +| 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 | + +--- + +## Repository Layout + +``` +Albert_Project/ +├── pipeline.py # Master orchestrator +├── core/ # Extraction, AI, validation, costing, engines +│ ├── ai_vision_classifier.py # OpenRouter Gemini vision classifier +│ ├── pdf_extractor.py # PyMuPDF primitives +│ ├── opening_extractor.py # Architectural opening extractor +│ ├── yolo_extractor.py # YOLO extractor +│ ├── price_matcher.py # Price list matching +│ ├── bimlite/ # Lightweight BIM object model + rules +│ └── engines/ # Constraint solver, placement, elevation layout, +│ # renderers, ADA, BOM, sheet composition +├── generators/ # shop_drawing_pdf, shop_drawing_dxf, elevation_drawing_pages +├── models/ # YOLO weights (yolo_floor_plan) +├── projects/ # Per-project configs + drawings +├── scripts/ # Reorganized utility and validation scripts +├── tests/ # Core test suite +├── tools/ # Dataset audit, training, evaluation tools +├── web_app/ # FastAPI backend + static dashboard +└── outputs/ # Generated deliverables (git-ignored) +_Project_Understanding/ # Client requirements, workflow diagrams, gap analysis +``` + +--- + +## Project Understanding + +See `_Project_Understanding/` for client requirements, workflow diagrams, and deep-dive documentation.