Skip to main content Skills Marketplace Discover and explore AI skills built by the community.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Copy promptShow prompt details A direct command skips the review prompt. Inspect the source before running it.
npx skills add https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill cwicr-report-generatorThe command stays on one line. Scroll horizontally to inspect it before copying.
Prefer a local copy? Download the files currently available to SkillsMP.
Download Zip Downloading... More from this repository Related occupations SOC
Based on SOC occupation classification
name cwicr-report-generator description Generate professional cost estimation reports from CWICR calculations. HTML, PDF, Excel outputs with charts and breakdowns. homepage https://datadrivenconstruction.io metadata {"openclaw":{"emoji":"🗄️","os":["darwin","linux","win32"],"homepage":"https://datadrivenconstruction.io","requires":{"bins":["python3"]}}}
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 :
title:
content:
chart_type: [ ] =
chart_data: [ ] =
:
project_name:
generated_date: datetime
total_cost:
currency:
sections: [ReportSection]
line_items: [ ]
summary: [ , ]
:
( ):
.project_name = project_name
.currency = currency
.sections: [ReportSection] = []
.line_items: [ ] = []
( ):
content =
.sections.append(ReportSection(
title= ,
content=content,
chart_type= ,
chart_data={
: [ , , , , ],
: [
summary_data.get( , ),
summary_data.get( , ),
summary_data.get( , ),
summary_data.get( , ),
summary_data.get( , )
]
}
))
( ):
rows =
category, cost (breakdown.items(), key= x: -x[ ]):
rows +=
content =
.sections.append(ReportSection(
title= ,
content=content,
chart_type= ,
chart_data={
: (breakdown.keys()),
: (breakdown.values())
}
))
( ):
.line_items = items
rows =
item items[: ]:
rows +=
content =
.sections.append(ReportSection(
title= ,
content=content
))
( ) -> :
sections_html =
section .sections:
sections_html +=
html =
html
( ) -> :
html = .generate_html()
(output_path, , encoding= ) f:
f.write(html)
output_path
( ) -> :
pd.ExcelWriter(output_path, engine= ) writer:
.sections:
summary_data = []
section .sections:
section.chart_data:
i, label (section.chart_data.get( , [])):
summary_data.append({
: label,
: section.chart_data.get( , [])[i]
})
summary_data:
pd.DataFrame(summary_data).to_excel(
writer, sheet_name= , index= )
.line_items:
pd.DataFrame( .line_items).to_excel(
writer, sheet_name= , index= )
output_path
( ) -> :
report = {
: .project_name,
: datetime.now().isoformat(),
: .currency,
: [
{
: s.title,
: s.chart_data
} s .sections
],
: .line_items
}
json.dumps(report, indent= )
:
( ) -> CWICRReportGenerator:
gen = CWICRReportGenerator(project_name)
summary = {
: df[ ]. () df.columns ,
: df[ ]. () df.columns ,
: df[ ]. () df.columns ,
: df[ ]. () df.columns ,
: df[ ]. () df.columns ,
: df[ ]. () df.columns
}
gen.add_summary(summary)
df.columns df.columns:
breakdown = df.groupby( )[ ]. ().to_dict()
gen.add_breakdown_by_category(breakdown)
items = df.to_dict( )
gen.add_line_items(items)
gen
"""Report section content."""
str
str
Optional
str
None
Optional
Dict
None
@dataclass
class
CostReport
"""Complete cost report."""
str
float
str
List
List
Dict
Dict
str
Any
class
CWICRReportGenerator
"""Generate cost estimation reports."""
def
__init__
self, project_name: str = "Project" ,
currency: str = "USD"
self
self
self
List
self
List
Dict
def
add_summary
self, summary_data: Dict [str , float ]
"""Add executive summary section."""
f"""
<div class="summary-box">
<h3>Cost Summary</h3>
<table class="summary-table">
<tr><td>Labor</td><td class="amount">${summary_data.get('labor' , 0 ):,.2 f} </td></tr>
<tr><td>Materials</td><td class="amount">${summary_data.get('material' , 0 ):,.2 f} </td></tr>
<tr><td>Equipment</td><td class="amount">${summary_data.get('equipment' , 0 ):,.2 f} </td></tr>
<tr><td>Overhead</td><td class="amount">${summary_data.get('overhead' , 0 ):,.2 f} </td></tr>
<tr><td>Profit</td><td class="amount">${summary_data.get('profit' , 0 ):,.2 f} </td></tr>
<tr class="total"><td>TOTAL</td><td class="amount">${summary_data.get('total' , 0 ):,.2 f} </td></tr>
</table>
</div>
"""
self
"Executive Summary"
"pie"
'labels'
'Labor'
'Materials'
'Equipment'
'Overhead'
'Profit'
'values'
'labor'
0
'material'
0
'equipment'
0
'overhead'
0
'profit'
0
def
add_breakdown_by_category
self, breakdown: Dict [str , float ]
"""Add breakdown by category section."""
""
for
in
sorted
lambda
1
f"<tr><td>{category} </td><td class='amount'>${cost:,.2 f} </td></tr>"
f"""
<table class="detail-table">
<thead><tr><th>Category</th><th>Cost</th></tr></thead>
<tbody>{rows} </tbody>
</table>
"""
self
"Cost by Category"
"bar"
'labels'
list
'values'
list
def
add_line_items
self, items: List [Dict ]
"""Add detailed line items."""
self
""
for
in
50
f"""
<tr>
<td>{item.get('code' , '' )} </td>
<td>{item.get('description' , '' )[:50 ]} </td>
<td>{item.get('quantity' , 0 ):,.2 f} </td>
<td>{item.get('unit' , '' )} </td>
<td class="amount">${item.get('unit_price' , 0 ):,.2 f} </td>
<td class="amount">${item.get('total' , 0 ):,.2 f} </td>
</tr>
"""
f"""
<table class="line-items">
<thead>
<tr>
<th>Code</th>
<th>Description</th>
<th>Qty</th>
<th>Unit</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>{rows} </tbody>
</table>
"""
self
"Line Items"
def
generate_html
self
str
"""Generate HTML report."""
""
for
in
self
f"""
<section class="report-section">
<h2>{section.title} </h2>
{section.content}
</section>
"""
f"""
<!DOCTYPE html>
<html>
<head>
<title>Cost Report - {self.project_name} </title>
<style>
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; }}
</style>
</head>
<body>
<div class="report-container">
<h1>Cost Estimation Report</h1>
<div class="meta">
<p>Project: {self.project_name} </p>
<p>Generated: {datetime.now().strftime('%Y-%m-%d %H:%M' )} </p>
<p>Currency: {self.currency} </p>
</div>
{sections_html}
<footer style="margin-top: 40px; color: #95a5a6; text-align: center;">
Generated by DDC CWICR | DataDrivenConstruction.io
</footer>
</div>
</body>
</html>
"""
return
def
save_html
self, output_path: str
str
"""Save HTML report to file."""
self
with
open
'w'
'utf-8'
as
return
def
generate_excel
self, output_path: str
str
"""Generate Excel report."""
with
'openpyxl'
as
if
self
for
in
self
if
for
in
enumerate
'labels'
'Category'
'Amount'
'values'
if
'Summary'
False
if
self
self
'Line Items'
False
return
def
generate_json
self
str
"""Generate JSON report."""
'project_name'
self
'generated_date'
'currency'
self
'sections'
'title'
'chart_data'
for
in
self
'line_items'
self
return
2
class
QuickReport
"""Quick report generation from cost data."""
@staticmethod
def
from_dataframe
df: pd.DataFrame,
project_name: str = "Project"
"""Generate report from cost DataFrame."""
'labor'
'labor_cost'
sum
if
'labor_cost'
in
else
0
'material'
'material_cost'
sum
if
'material_cost'
in
else
0
'equipment'
'equipment_cost'
sum
if
'equipment_cost'
in
else
0
'overhead'
'overhead_cost'
sum
if
'overhead_cost'
in
else
0
'profit'
'profit_cost'
sum
if
'profit_cost'
in
else
0
'total'
'total_cost'
sum
if
'total_cost'
in
else
0
if
'category'
in
and
'total_cost'
in
'category'
'total_cost'
sum
'records'
return
Quick Start
gen = CWICRReportGenerator("Office Building" , currency="EUR" )
gen.add_summary({
'labor' : 125000 ,
'material' : 350000 ,
'equipment' : 75000 ,
'overhead' : 82500 ,
'profit' : 63250 ,
'total' : 695750
})
gen.save_html("cost_report.html" )
gen.generate_excel("cost_report.xlsx" )
From DataFrame
report = QuickReport.from_dataframe(cost_df, "My Project" )
report.save_html("quick_report.html" )
Resources
DDC Book : Chapter 4.2 - ETL Load Reports