Skill detail
cwicr-cost-calculator
Calculates transparent resource-based construction costs.
Inspect before use
Automated review checks relevance, not safety or endorsement. Read the source instructions before using this skill.
SKILL.md
The saved excerpt is a snapshot from review. The external source remains the complete and most current version.
---
name: "cwicr-cost-calculator"
description: "Calculate construction costs using DDC CWICR resource-based methodology. Break down costs into labor, materials, equipment with transparent pricing."
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw":{"emoji":"💰","os":["darwin","linux","win32"],"homepage":"https://datadrivenconstruction.io","requires":{"bins":["python3"]}}}
---
# CWICR Cost Calculator
## Business Case
### Problem Statement
Traditional cost estimation often produces "black box" estimates with hidden markups. Stakeholders need:
- Transparent cost breakdowns
- Traceable pricing logic
- Auditable calculations
- Resource-level detail
### Solution
Resource-based cost calculation using CWICR methodology that separates physical norms (labor hours, material quantities) from volatile prices, enabling transparent and auditable estimates.
### Business Value
- **Full transparency** - Every cost component visible
- **Auditable** - Traceable calculation logic
- **Flexible** - Update prices without changing norms
- **Accurate** - Based on 55,000+ validated work items
## Technical Implementation
### Prerequisites
```bash
pip install pandas numpy
```
### Python Implementation
```python
import pandas as pd
import numpy as np
from typing import Dict, Any, List, Optional, Tuple
from dataclasses import dataclass, field
from enum import Enum
from datetime import datetime
class CostComponent(Enum):
"""Cost breakdown components."""
LABOR = "labor"
MATERIAL = "material"
EQUIPMENT = "equipment"
OVERHEAD = "overhead"
PROFIT = "profit"
TOTAL = "total"
class CostStatus(Enum):
"""Cost calculation status."""
CALCULATED = "calculated"
ESTIMATED = "estimated"
MISSING_DATA = "missing_data"
ERROR = "error"
@dataclass
class CostBreakdown:
"""Detailed cost breakdown for a work item."""
work_item_code: str
description: str
unit: str
quantity: float
labor_cost: float = 0.0
material_cost: float = 0.0
equipment_cost: float = 0.0
overhead_cost: float = 0.0
profit_cost: float = 0.0
unit_price: float = 0.0
total_cost: float = 0.0
labor_hours: float = 0.0
labor_rate: float = 0.0
resources: List[Dict[str, Any]] = field(default_factory=list)
status: CostStatus = CostStatus.CALCULATED
def to_dict(self) -> Dict[str, Any]:
return {
'work_item_code': self.work_item_code,
'description': self.description,
'unit': self.unit,
'quantity': self.quantity,
'labor_cost': self.labor_cost,
'material_cost': self.material_cost,
'equipment_cost': self.equipment_cost,
'overhead_cost': self.overhead_cost,
'profit_cost': self.profit_cost,
'total_cost': self.total_cost,
'status': self.status.value
}
@dataclass
class CostSummary:
"""Summary of cost estimate."""
total_cost: float
labor_total: float
material_total: float
equipment_total: float
overhead_total: float
profit_total: float
item_count: int
currency: str
calculated_at: datetime
breakdown_by_category: Dict[str, float] = field(default_factory=dict)
class CWICRCostCalculator:
"""Resource-based cost calculator using CWICR methodology."""
DEFAULT_OVERHEAD_RATE = 0.15 # 15% overhead
DEFAULT_PROFIT_RATE = 0.10 # 10% profit
def __init__(self, cwicr_data: pd.DataFrame,
overhead_rate: float = None,
profit_rate: float = None,
currency: str = "USD"):
"""Initialize calculator with CWICR data."""
self.data = cwicr_data
self.overhead_rate = overhead_rate or self.DEFAULT_OVERHEAD_RATE
self.profit_rate = profit_rate or self.DEFAULT_PROFIT_RATE
self.currency = currency
# Index data for fast lookup
self._index_data()
def _index_data(self):
"""Create index foRead the full source on GitHub (opens external page)