cwicr-takeoff-helper
Assist with quantity takeoff using CWICR data. Calculate quantities from dimensions, apply waste factors, and suggest related work items.
git clone --depth 1 https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction /tmp/cwicr-takeoff-helper && cp -r /tmp/cwicr-takeoff-helper/1_DDC_Toolkit/CWICR-Database/cwicr-takeoff-helper ~/.claude/skills/cwicr-takeoff-helperSKILL.md
# CWICR Takeoff Helper
## Business Case
### Problem Statement
Quantity takeoff requires:
- Accurate calculations from dimensions
- Correct unit conversions
- Waste factor application
- Complete scope coverage
### Solution
Assist takeoff process with CWICR-based calculations, automatic waste factors, unit conversions, and related item suggestions.
### Business Value
- **Accuracy** - Validated calculations
- **Completeness** - Related items suggested
- **Speed** - Quick quantity calculations
- **Consistency** - Standard approaches
## Technical Implementation
```python
import pandas as pd
import numpy as np
from typing import Dict, Any, List, Optional, Tuple
from dataclasses import dataclass
from enum import Enum
import math
class TakeoffType(Enum):
"""Types of takeoff calculations."""
LINEAR = "linear" # Length
AREA = "area" # Square measure
VOLUME = "volume" # Cubic measure
COUNT = "count" # Each/number
WEIGHT = "weight" # By weight
class UnitSystem(Enum):
"""Unit systems."""
METRIC = "metric"
IMPERIAL = "imperial"
@dataclass
class TakeoffItem:
"""Single takeoff item."""
work_item_code: str
description: str
takeoff_type: TakeoffType
gross_quantity: float
waste_factor: float
net_quantity: float
unit: str
dimensions: Dict[str, float]
calculation: str
@dataclass
class TakeoffResult:
"""Complete takeoff result."""
items: List[TakeoffItem]
total_items: int
related_suggestions: List[str]
# Unit conversion factors
CONVERSIONS = {
# Length
('m', 'ft'): 3.28084,
('ft', 'm'): 0.3048,
('m', 'in'): 39.3701,
('in', 'm'): 0.0254,
# Area
('m2', 'sf'): 10.7639,
('sf', 'm2'): 0.0929,
# Volume
('m3', 'cf'): 35.3147,
('cf', 'm3'): 0.0283,
('m3', 'cy'): 1.30795,
('cy', 'm3'): 0.7646,
# Weight
('kg', 'lb'): 2.20462,
('lb', 'kg'): 0.453592,
('ton', 'kg'): 1000,
('kg', 'ton'): 0.001
}
# Standard waste factors
WASTE_FACTORS = {
'concrete': 0.05,
'rebar': 0.08,
'formwork': 0.10,
'brick': 0.10,
'block': 0.08,
'drywall': 0.12,
'tile': 0.15,
'lumber': 0.12,
'roofing': 0.10,
'paint': 0.10,
'pipe': 0.05,
'wire': 0.05,
'duct': 0.08,
'default': 0.05
}
# Related work items by category
RELATED_ITEMS = {
'concrete': ['formwork', 'rebar', 'curing', 'finishing'],
'masonry': ['mortar', 'reinforcement', 'ties', 'lintels'],
'drywall': ['framing', 'insulation', 'taping', 'painting'],
'roofing': ['underlayment', 'flashing', 'ventilation', 'insulation'],
'flooring': ['underlayment', 'adhesive', 'trim', 'transitions']
}
class CWICRTakeoffHelper:
"""Assist with quantity takeoff using CWICR data."""
def __init__(self, cwicr_data: pd.DataFrame = None):
self.cwicr = cwicr_data
if cwicr_data is not None:
self._index_cwicr()
def _index_cwicr(self):
"""Index CWICR data."""
if 'work_item_code' in self.cwicr.columns:
self._cwicr_index = self.cwicr.set_index('work_item_code')
else:
self._cwicr_index = None
def convert_unit(self, value: float, from_unit: str, to_unit: str) -> float:
"""Convert between units."""
if from_unit == to_unit:
return value
key = (from_unit.lower(), to_unit.lower())
if key in CONVERSIONS:
return value * CONVERSIONS[key]
# Try reverse
reverse_key = (to_unit.lower(), from_unit.lower())
if reverse_key in CONVERSIONS:
return value / CONVERSIONS[reverse_key]
return value
def get_waste_factor(self, work_item_code: str) -> float:
"""Get waste factor for work item."""
code_lower = work_item_code.lower()
for material, factor in WASTE_FACTORS.items():
if material in code_lower:
return factor
return WASTE_FACTORS['default']
def calculate_area(self,
length: float,
width: float,
deductions: List[Tuple[float, float]] = None) -> Dict[str, float]:
"""Calculate area with deductions."""
gross_area = length * width
deduction_area = 0
if deductions:
for d_length, d_width in deductions:
deduction_area += d_length * d_width
net_area = gross_area - deduction_area
return {
'gross_area': round(gross_area, 2),
'deductions': round(deduction_area, 2),
'net_area': round(net_area, 2),
'calculation': f"{length} x {width} = {gross_area}, minus {deduction_area} deductions"
}
def calculate_volume(self,
length: float,
width: float,
depth: float) -> Dict[str, float]:
"""Calculate volume."""
volume = length * width * depth
return {
'volume': round(volume, 3),
'calculation': f"{length} x {width} x {depth} = {volume}"
}
def calculate_perimeter(self,
length: float,
width: float) -> Dict[str, float]:
"""Calculate perimeter."""
perimeter = 2 * (length + width)
return {
'perimeter': round(perimeter, 2),
'calculation': f"2 x ({length} + {width}) = {perimeter}"
}
def calculate_concrete(self,
length: float,
width: float,
thickness: float,
work_item_code: str = "CONC-001") -> TakeoffItem:
"""Calculate concrete quantity with related items."""
volume = length * width * thickness
waste = self.get_waste_factor(work_item_code)
net_qty = volume * (1 + waste)
return TakeoffItem(
work_Generate automated daily progress reports from site data. Track work completed, labor hours, equipment usage, and weather conditions.
Analyze labor productivity from site data. Compare planned vs actual, identify trends, benchmark against industry standards.
Create interactive KPI dashboards for construction projects. Track schedule, cost, quality, and safety metrics in real-time.
Detect and analyze geometric clashes in BIM models. Identify MEP, structural, and architectural conflicts before construction.
Classify BIM elements using AI and standard classification systems. Map elements to UniFormat, MasterFormat, OmniClass, and CWICR codes.
Generate comprehensive BIM model validation reports. Check data quality, completeness, and compliance with standards.
Calculate CO2 emissions and carbon footprint from BIM model data. Analyze embodied carbon by material, element, and building system.
Extract quantities from IFC/Revit models for quantity takeoff. Uses DDC converters to get element counts, areas, volumes, lengths with grouping and reporting.