cwicr-unit-converter
The CWICR Unit Converter normalizes construction measurements across metric and imperial systems, handling length, area, volume, weight, and time conversions for standardized data integration. Use this skill when importing BIM quantities, cost data, or project measurements from multiple sources or regions that require consistent unit representation for CWICR analysis and reporting.
git clone --depth 1 https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction /tmp/cwicr-unit-converter && cp -r /tmp/cwicr-unit-converter/1_DDC_Toolkit/CWICR-Database/cwicr-unit-converter ~/.claude/skills/cwicr-unit-converterSKILL.md
# CWICR Unit Converter
## Business Case
### Problem Statement
Construction data comes in various unit systems:
- Metric vs Imperial measurements
- Different unit conventions by trade
- BIM quantities need normalization
- Regional standards differ
### Solution
Comprehensive unit conversion for construction quantities, normalizing data for CWICR integration and analysis.
### Business Value
- **Accuracy** - Eliminate unit conversion errors
- **Consistency** - Standardize across projects
- **Integration** - BIM to cost data alignment
- **Global** - Support international projects
## Technical Implementation
```python
import pandas as pd
import numpy as np
from typing import Dict, Any, List, Optional, Tuple, Union
from dataclasses import dataclass
from enum import Enum
class UnitCategory(Enum):
"""Categories of measurement units."""
LENGTH = "length"
AREA = "area"
VOLUME = "volume"
WEIGHT = "weight"
TIME = "time"
QUANTITY = "quantity"
class UnitSystem(Enum):
"""Unit systems."""
METRIC = "metric"
IMPERIAL = "imperial"
MIXED = "mixed"
@dataclass
class UnitConversion:
"""Unit conversion result."""
original_value: float
original_unit: str
converted_value: float
target_unit: str
conversion_factor: float
category: UnitCategory
# Conversion factors to base units
# Base units: meter (length), m² (area), m³ (volume), kg (weight), hour (time)
CONVERSIONS = {
# Length to meters
'm': {'factor': 1.0, 'category': UnitCategory.LENGTH, 'base': 'm'},
'meter': {'factor': 1.0, 'category': UnitCategory.LENGTH, 'base': 'm'},
'meters': {'factor': 1.0, 'category': UnitCategory.LENGTH, 'base': 'm'},
'cm': {'factor': 0.01, 'category': UnitCategory.LENGTH, 'base': 'm'},
'mm': {'factor': 0.001, 'category': UnitCategory.LENGTH, 'base': 'm'},
'km': {'factor': 1000.0, 'category': UnitCategory.LENGTH, 'base': 'm'},
'ft': {'factor': 0.3048, 'category': UnitCategory.LENGTH, 'base': 'm'},
'feet': {'factor': 0.3048, 'category': UnitCategory.LENGTH, 'base': 'm'},
'foot': {'factor': 0.3048, 'category': UnitCategory.LENGTH, 'base': 'm'},
'in': {'factor': 0.0254, 'category': UnitCategory.LENGTH, 'base': 'm'},
'inch': {'factor': 0.0254, 'category': UnitCategory.LENGTH, 'base': 'm'},
'inches': {'factor': 0.0254, 'category': UnitCategory.LENGTH, 'base': 'm'},
'yd': {'factor': 0.9144, 'category': UnitCategory.LENGTH, 'base': 'm'},
'yard': {'factor': 0.9144, 'category': UnitCategory.LENGTH, 'base': 'm'},
'yards': {'factor': 0.9144, 'category': UnitCategory.LENGTH, 'base': 'm'},
'mi': {'factor': 1609.344, 'category': UnitCategory.LENGTH, 'base': 'm'},
'mile': {'factor': 1609.344, 'category': UnitCategory.LENGTH, 'base': 'm'},
'lf': {'factor': 0.3048, 'category': UnitCategory.LENGTH, 'base': 'm'}, # Linear foot
# Area to m²
'm2': {'factor': 1.0, 'category': UnitCategory.AREA, 'base': 'm2'},
'm²': {'factor': 1.0, 'category': UnitCategory.AREA, 'base': 'm2'},
'sqm': {'factor': 1.0, 'category': UnitCategory.AREA, 'base': 'm2'},
'cm2': {'factor': 0.0001, 'category': UnitCategory.AREA, 'base': 'm2'},
'mm2': {'factor': 0.000001, 'category': UnitCategory.AREA, 'base': 'm2'},
'ha': {'factor': 10000.0, 'category': UnitCategory.AREA, 'base': 'm2'},
'hectare': {'factor': 10000.0, 'category': UnitCategory.AREA, 'base': 'm2'},
'ft2': {'factor': 0.092903, 'category': UnitCategory.AREA, 'base': 'm2'},
'sf': {'factor': 0.092903, 'category': UnitCategory.AREA, 'base': 'm2'},
'sqft': {'factor': 0.092903, 'category': UnitCategory.AREA, 'base': 'm2'},
'yd2': {'factor': 0.836127, 'category': UnitCategory.AREA, 'base': 'm2'},
'sy': {'factor': 0.836127, 'category': UnitCategory.AREA, 'base': 'm2'}, # Square yard
'acre': {'factor': 4046.86, 'category': UnitCategory.AREA, 'base': 'm2'},
# Volume to m³
'm3': {'factor': 1.0, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'm³': {'factor': 1.0, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'cbm': {'factor': 1.0, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'l': {'factor': 0.001, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'liter': {'factor': 0.001, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'litre': {'factor': 0.001, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'ml': {'factor': 0.000001, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'ft3': {'factor': 0.0283168, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'cf': {'factor': 0.0283168, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'cuft': {'factor': 0.0283168, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'yd3': {'factor': 0.764555, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'cy': {'factor': 0.764555, 'category': UnitCategory.VOLUME, 'base': 'm3'}, # Cubic yard
'cuyd': {'factor': 0.764555, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'gal': {'factor': 0.00378541, 'category': UnitCategory.VOLUME, 'base': 'm3'},
'gallon': {'factor': 0.00378541, 'category': UnitCategory.VOLUME, 'base': 'm3'},
# Weight to kg
'kg': {'factor': 1.0, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'kilogram': {'factor': 1.0, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'g': {'factor': 0.001, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'gram': {'factor': 0.001, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'mg': {'factor': 0.000001, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
't': {'factor': 1000.0, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'ton': {'factor': 1000.0, 'category': UnitCategory.WEIGHT, 'base': 'kg'}, # Metric ton
'tonne': {'factor': 1000.0, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'mt': {'factor': 1000.0, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'lb': {'factor': 0.453592, 'category': UnitCategory.WEIGHT, 'base': 'kg'},
'lbs': {'factor': 0.453592, 'category': UnitCategory.WEIGHT, 'baseAnalyze 5000+ IFC and Revit projects at scale for patterns, benchmarks, and insights. Big data analysis for construction.
Manage as-built documentation for project closeout. Track drawing markups, coordinate updates, and verify completeness.
Track as-built documentation and record drawings. Monitor submission status, manage revisions, and ensure completeness for handover.
Batch convert multiple CAD/BIM files (Revit, IFC, DWG, DGN) with progress tracking, error handling, and consolidated reporting.
Compare and analyze contractor bids. Score proposals, identify scope gaps, and recommend selections.
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.
Automated cost estimation from BIM models using DDC CWICR database (8 national bases, 78,228 positions). AI classification + vector search for accurate pricing.