Install
$ agentstack add skill-datadrivenconstruction-ddc-skills-for-ai-agents-in-construction-cwicr-report-generator ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ● Filesystem access Used
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
CWICR Report Generator
Overview
Generate professional cost reports from CWICR calculations - executive summaries, detailed breakdowns, charts, and export to multiple formats.
Python Implementation
import pandas as pd
from typing import Dict, Any, List, Optional
from dataclasses import dataclass, field
from datetime import datetime
from pathlib import Path
import json
@dataclass
class ReportSection:
"""Report section content."""
title: str
content: str
chart_type: Optional[str] = None
chart_data: Optional[Dict] = None
@dataclass
class CostReport:
"""Complete cost report."""
project_name: str
generated_date: datetime
total_cost: float
currency: str
sections: List[ReportSection]
line_items: List[Dict]
summary: Dict[str, Any]
class CWICRReportGenerator:
"""Generate cost estimation reports."""
def __init__(self, project_name: str = "Project",
currency: str = "USD"):
self.project_name = project_name
self.currency = currency
self.sections: List[ReportSection] = []
self.line_items: List[Dict] = []
def add_summary(self, summary_data: Dict[str, float]):
"""Add executive summary section."""
content = f"""
Cost Summary
Labor${summary_data.get('labor', 0):,.2f}
Materials${summary_data.get('material', 0):,.2f}
Equipment${summary_data.get('equipment', 0):,.2f}
Overhead${summary_data.get('overhead', 0):,.2f}
Profit${summary_data.get('profit', 0):,.2f}
TOTAL${summary_data.get('total', 0):,.2f}
"""
self.sections.append(ReportSection(
title="Executive Summary",
content=content,
chart_type="pie",
chart_data={
'labels': ['Labor', 'Materials', 'Equipment', 'Overhead', 'Profit'],
'values': [
summary_data.get('labor', 0),
summary_data.get('material', 0),
summary_data.get('equipment', 0),
summary_data.get('overhead', 0),
summary_data.get('profit', 0)
]
}
))
def add_breakdown_by_category(self, breakdown: Dict[str, float]):
"""Add breakdown by category section."""
rows = ""
for category, cost in sorted(breakdown.items(), key=lambda x: -x[1]):
rows += f"{category}${cost:,.2f}"
content = f"""
CategoryCost
{rows}
"""
self.sections.append(ReportSection(
title="Cost by Category",
content=content,
chart_type="bar",
chart_data={
'labels': list(breakdown.keys()),
'values': list(breakdown.values())
}
))
def add_line_items(self, items: List[Dict]):
"""Add detailed line items."""
self.line_items = items
rows = ""
for item in items[:50]: # Limit for report
rows += f"""
{item.get('code', '')}
{item.get('description', '')[:50]}
{item.get('quantity', 0):,.2f}
{item.get('unit', '')}
${item.get('unit_price', 0):,.2f}
${item.get('total', 0):,.2f}
"""
content = f"""
Code
Description
Qty
Unit
Unit Price
Total
{rows}
"""
self.sections.append(ReportSection(
title="Line Items",
content=content
))
def generate_html(self) -> str:
"""Generate HTML report."""
sections_html = ""
for section in self.sections:
sections_html += f"""
{section.title}
{section.content}
"""
html = f"""
Cost Report - {self.project_name}
body {{ font-family: 'Segoe UI', Arial, sans-serif; margin: 40px; background: #f5f5f5; }}
.report-container {{ max-width: 1200px; margin: 0 auto; background: white; padding: 40px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }}
h1 {{ color: #2c3e50; border-bottom: 3px solid #3498db; padding-bottom: 10px; }}
h2 {{ color: #34495e; margin-top: 30px; }}
.summary-box {{ background: #ecf0f1; padding: 20px; border-radius: 8px; }}
table {{ width: 100%; border-collapse: collapse; margin: 20px 0; }}
th, td {{ padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }}
th {{ background: #3498db; color: white; }}
.amount {{ text-align: right; font-family: monospace; }}
.total {{ font-weight: bold; background: #f8f9fa; }}
.line-items td {{ font-size: 0.9em; }}
.meta {{ color: #7f8c8d; font-size: 0.9em; margin-bottom: 20px; }}
Cost Estimation Report
Project: {self.project_name}
Generated: {datetime.now().strftime('%Y-%m-%d %H:%M')}
Currency: {self.currency}
{sections_html}
Generated by DDC CWICR | DataDrivenConstruction.io
"""
return html
def save_html(self, output_path: str) -> str:
"""Save HTML report to file."""
html = self.generate_html()
with open(output_path, 'w', encoding='utf-8') as f:
f.write(html)
return output_path
def generate_excel(self, output_path: str) -> str:
"""Generate Excel report."""
with pd.ExcelWriter(output_path, engine='openpyxl') as writer:
# Summary sheet
if self.sections:
summary_data = []
for section in self.sections:
if section.chart_data:
for i, label in enumerate(section.chart_data.get('labels', [])):
summary_data.append({
'Category': label,
'Amount': section.chart_data.get('values', [])[i]
})
if summary_data:
pd.DataFrame(summary_data).to_excel(
writer, sheet_name='Summary', index=False)
# Line items sheet
if self.line_items:
pd.DataFrame(self.line_items).to_excel(
writer, sheet_name='Line Items', index=False)
return output_path
def generate_json(self) -> str:
"""Generate JSON report."""
report = {
'project_name': self.project_name,
'generated_date': datetime.now().isoformat(),
'currency': self.currency,
'sections': [
{
'title': s.title,
'chart_data': s.chart_data
} for s in self.sections
],
'line_items': self.line_items
}
return json.dumps(report, indent=2)
class QuickReport:
"""Quick report generation from cost data."""
@staticmethod
def from_dataframe(df: pd.DataFrame,
project_name: str = "Project") -> CWICRReportGenerator:
"""Generate report from cost DataFrame."""
gen = CWICRReportGenerator(project_name)
# Calculate summary
summary = {
'labor': df['labor_cost'].sum() if 'labor_cost' in df.columns else 0,
'material': df['material_cost'].sum() if 'material_cost' in df.columns else 0,
'equipment': df['equipment_cost'].sum() if 'equipment_cost' in df.columns else 0,
'overhead': df['overhead_cost'].sum() if 'overhead_cost' in df.columns else 0,
'profit': df['profit_cost'].sum() if 'profit_cost' in df.columns else 0,
'total': df['total_cost'].sum() if 'total_cost' in df.columns else 0
}
gen.add_summary(summary)
# Category breakdown
if 'category' in df.columns and 'total_cost' in df.columns:
breakdown = df.groupby('category')['total_cost'].sum().to_dict()
gen.add_breakdown_by_category(breakdown)
# Line items
items = df.to_dict('records')
gen.add_line_items(items)
return gen
Quick Start
# Create report generator
gen = CWICRReportGenerator("Office Building", currency="EUR")
# Add sections
gen.add_summary({
'labor': 125000,
'material': 350000,
'equipment': 75000,
'overhead': 82500,
'profit': 63250,
'total': 695750
})
# Save reports
gen.save_html("cost_report.html")
gen.generate_excel("cost_report.xlsx")
From DataFrame
# Quick report from cost DataFrame
report = QuickReport.from_dataframe(cost_df, "My Project")
report.save_html("quick_report.html")
Resources
- DDC Book: Chapter 4.2 - ETL Load Reports
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: datadrivenconstruction
- Source: datadrivenconstruction/DDCSkillsforAIAgentsin_Construction
- License: MIT
- Homepage: https://datadrivenconstruction.io/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.