自然语言生成建筑数据处理代码
简介
用自然语言生成Python/Pandas代码,零编程基础实现建筑数据处理自动化,支持ChatGPT/Claude及本地LLM离线运行。
原始描述
Automate construction data processing using LLM (ChatGPT, Claude, LLaMA). Generate Python/Pandas scripts, extract data from documents, and create automated p...
通过你的 Agent 添加
安装目录:llm-data-automation/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
本 Skill 基于 DataDrivenConstruction(DDC)方法论,为建筑工程领域提供 LLM 驱动的数据自动化解决方案。用户无需掌握 Python 编程,仅需用自然语言描述数据处理需求,即可生成可执行的 Pandas 代码。支持三种使用模式:在线 ChatGPT/Claude 交互、本地 Ollama 部署(离线可用)、LM Studio 图形界面。核心工作流围绕 DataFrame 展开——将建筑元素(墙、柱、梁等)转化为结构化表格,通过自然语言指令完成数据导入、清洗、聚合、导出全流程。
典型应用场景包括:PDF 工程文档表格提取、BIM 模型数据批量分析、工程量清单与成本估算自动化、施工进度延误识别等。文档提供了完整的 Prompt 模板库,覆盖数据导入("读取 Excel 并显示前10行")、数据清洗("按 element_id 去重")、数据分析("计算成本与工期的相关性")、数据导出("生成多工作表 Excel")四大环节。
显著优点
极低技术门槛:建筑工程师、项目经理等专业人员无需学习编程语法,直接通过业务语言驱动数据处理,大幅降低数字化转型的技能壁垒。
灵活部署选项:既支持云端大模型(GPT-4、Claude)获得最佳效果,也支持完全离线的本地 LLM(Ollama + Mistral/CodeLlama),满足工程数据保密性要求。
行业深度适配:源自《Data-Driven Construction》专著方法论,所有示例代码均针对建筑场景优化(BIM 元素解析、混凝土用量统计、成本估算等),而非通用数据教程。
成本效益突出:相比传统定制化开发或采购专业软件,本方案利用开源生态(Pandas、Ollama)实现零许可费用,仅需现有硬件资源。
潜在缺点与局限性
生成代码需人工验证:LLM 输出代码可能存在逻辑错误或边界情况处理不当,要求用户具备基础的代码阅读能力和数据校验意识,不能完全"盲用"。
复杂场景 Prompt 工程成本:简单任务描述即可,但涉及多表关联、复杂条件筛选时,需要学习如何编写精确的 Prompt,存在隐性学习曲线。
本地模型性能 trade-off:离线部署虽保障隐私,但 7B 参数级别的开源模型(Mistral、CodeLlama)在复杂逻辑生成和代码质量上逊于 GPT-4/Claude,可能出现更多迭代修正。
Windows 平台限制:metadata 明确标注仅支持 win32 系统,macOS/Linux 用户需自行适配或调整环境。
适合的目标群体
- 建筑工程技术人员:结构工程师、BIM 协调员、造价工程师,希望自动化处理 Revit 导出数据、工程量计算
- 项目管理人员:需要快速整合多源施工数据(进度表、材料清单、成本数据)生成决策报表
- 中小型施工单位:缺乏专职开发团队,寻求低成本数字化工具替代昂贵的企业级软件
- 建筑院校师生:用于教学演示数据驱动决策方法论,结合专著内容实践
使用风险与注意事项
执行安全:文档中包含 curl ... | sh 形式的 Ollama 安装示例,虽来自官方可信源,但管道执行脚本存在理论风险。建议用户先下载审查脚本内容再执行,或采用包管理器安装。
数据隐私:使用云端 LLM(ChatGPT/Claude)时,敏感工程数据会传输至第三方服务器。涉及商业机密或客户隐私的项目应优先选择本地 Ollama 部署。
依赖管理:核心功能依赖 Python 3 环境及 Pandas、pdfplumber 等库,需确保环境正确配置。建议通过 Jupyter Notebook 或 Google Colab 降低环境搭建难度。
结果可靠性:自动化生成的数据分析结果需与传统手工核算交叉验证,关键决策(如最终成本估算、合同结算)不应完全依赖 LLM 输出,需保留专业审核环节。
技能正文
name: "llm-data-automation"
description: "Automate construction data processing using LLM (ChatGPT, Claude, LLaMA). Generate Python/Pandas scripts, extract data from documents, and create automated pipelines without deep programming knowledge."
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw": {"emoji": "🐼", "os": ["win32"], "homepage": "https://datadrivenconstruction.io", "requires": {"bins": ["python3"]}}}
LLM Data Automation for Construction
Overview
Overview
Based on DDC methodology (Chapter 2.3), this skill enables automation of construction data processing using Large Language Models (LLM). Instead of manually coding data transformations, you describe what you need in natural language, and the LLM generates the necessary Python/Pandas code.
Book Reference: "Pandas DataFrame и LLM ChatGPT" / "Pandas DataFrame and LLM ChatGPT"
"LLM-модели, такие как ChatGPT и LLaMA, позволяют специалистам без глубоких знаний программирования внести свой вклад в автоматизацию и улучшение бизнес-процессов компании." — DDC Book, Chapter 2.3
Quick Start
Option 1: Use ChatGPT/Claude Online
Simply describe your data processing task in natural language:
Prompt: "Write Python code to read an Excel file with construction materials,
filter rows where quantity > 100, and save to CSV."
Option 2: Run Local LLM (Ollama)
# Install Ollama from ollama.com
ollama pull mistral
# Run a query
ollama run mistral "Write Pandas code to calculate total cost from quantity * unit_price"
Option 3: Use LM Studio (GUI)
- Download from lmstudio.ai
- Install and select a model (e.g., Mistral, LLaMA)
- Start chatting with your local AI
Core Concepts
DataFrame as Universal Format
import pandas as pd
# Construction project as DataFrame
# Rows = elements, Columns = attributes
df = pd.DataFrame({
'element_id': ['W001', 'W002', 'C001'],
'category': ['Wall', 'Wall', 'Column'],
'material': ['Concrete', 'Brick', 'Steel'],
'volume_m3': [45.5, 32.0, 8.2],
'cost_per_m3': [150, 80, 450]
})
# Calculate total cost
df['total_cost'] = df['volume_m3'] * df['cost_per_m3']
print(df)
LLM Prompts for Construction Tasks
# Install Ollama from ollama.com
ollama pull mistral
# Run a query
ollama run mistral "Write Pandas code to calculate total cost from quantity * unit_price"
- Download from lmstudio.ai
- Install and select a model (e.g., Mistral, LLaMA)
- Start chatting with your local AI
Core Concepts
DataFrame as Universal Format
import pandas as pd
# Construction project as DataFrame
# Rows = elements, Columns = attributes
df = pd.DataFrame({
'element_id': ['W001', 'W002', 'C001'],
'category': ['Wall', 'Wall', 'Column'],
'material': ['Concrete', 'Brick', 'Steel'],
'volume_m3': [45.5, 32.0, 8.2],
'cost_per_m3': [150, 80, 450]
})
# Calculate total cost
df['total_cost'] = df['volume_m3'] * df['cost_per_m3']
print(df)
LLM Prompts for Construction Tasks
Data Import:
"Write code to import Excel file with construction schedule,
parse dates, and create a Pandas DataFrame"
Data Filtering:
"Filter construction elements where category is 'Structural'
and cost exceeds budget limit of 50000"
Data Aggregation:
"Group construction data by floor level,
calculate total volume and cost for each floor"
Report Generation:
"Create summary report with material quantities grouped by category,
export to Excel with formatting"
Common Use Cases
1. Extract Data from PDF Documents
# Prompt to ChatGPT:
# "Write code to extract tables from PDF and convert to DataFrame"
import pdfplumber
import pandas as pd
def pdf_to_dataframe(pdf_path):
"""Extract tables from PDF file"""
all_tables = []
with pdfplumber.open(pdf_path) as pdf:
for page in pdf.pages:
tables = page.extract_tables()
for table in tables:
if table:
df = pd.DataFrame(table[1:], columns=table[0])
all_tables.append(df)
if all_tables:
return pd.concat(all_tables, ignore_index=True)
return pd.DataFrame()
# Usage
df = pdf_to_dataframe("construction_spec.pdf")
df.to_excel("extracted_data.xlsx", index=False)
2. Process BIM Element Data
# Prompt: "Analyze BIM elements, group by category, calculate volumes"
import pandas as pd
def analyze_bim_elements(csv_path):
"""Analyze BIM element data from CSV export"""
df = pd.read_csv(csv_path)
# Group by category
summary = df.groupby('Category').agg({
'Volume': 'sum',
'Area': 'sum',
'ElementId': 'count'
}).rename(columns={'ElementId': 'Count'})
return summary
# Usage
summary = analyze_bim_elements("revit_export.csv")
print(summary)
3. Cost Estimation Pipeline
# Prompt: "Create cost estimation from quantities and unit prices"
import pandas as pd
def calculate_cost_estimate(quantities_df, prices_df):
"""
Calculate project cost estimate
Args:
quantities_df: DataFrame with columns [item_code, quantity]
prices_df: DataFrame with columns [item_code, unit_price, unit]
Returns:
DataFrame with cost calculations
"""
# Merge quantities with prices
result = quantities_df.merge(prices_df, on='item_code', how='left')
# Calculate costs
result['total_cost'] = result['quantity'] * result['unit_price']
# Add summary
result['cost_percentage'] = (result['total_cost'] /
result['total_cost'].sum() * 100).round(2)
return result
# Usage
quantities = pd.DataFrame({
'item_code': ['C001', 'S001', 'W001'],
'quantity': [150, 2000, 500]
})
prices = pd.DataFrame({
'item_code': ['C001', 'S001', 'W001'],
'unit_price': [120, 45, 85],
'unit': ['m3', 'kg', 'm2']
})
estimate = calculate_cost_estimate(quantities, prices)
print(estimate)
4. Schedule Data Processing
# Prompt: "Parse construction schedule, calculate durations, identify delays"
import pandas as pd
from datetime import datetime
def analyze_schedule(schedule_path):
"""Analyze construction schedule for delays"""
df = pd.read_excel(schedule_path)
# Parse dates
df['start_date'] = pd.to_datetime(df['start_date'])
df['end_date'] = pd.to_datetime(df['end_date'])
df['actual_end'] = pd.to_datetime(df['actual_end'])
# Calculate durations
df['planned_duration'] = (df['end_date'] - df['start_date']).dt.days
df['actual_duration'] = (df['actual_end'] - df['start_date']).dt.days
# Identify delays
df['delay_days'] = df['actual_duration'] - df['planned_duration']
df['is_delayed'] = df['delay_days'] > 0
return df
# Usage
schedule = analyze_schedule("project_schedule.xlsx")
delayed_tasks = schedule[schedule['is_delayed']]
print(f"Delayed tasks: {len(delayed_tasks)}")
Local LLM Setup (No Internet Required)
Using Ollama
# Install
curl -fsSL https://ollama.com/install.sh | sh
# Download models
ollama pull mistral # General purpose, 7B params
ollama pull codellama # Code-focused
ollama pull deepseek-coder # Best for coding tasks
# Run
ollama run mistral "Write Pandas code to merge two DataFrames on project_id"
Using LlamaIndex for Company Documents
# Load company documents into local LLM
from llama_index import SimpleDirectoryReader, VectorStoreIndex
# Read all PDFs from folder
reader = SimpleDirectoryReader("company_documents/")
documents = reader.load_data()
# Create searchable index
index = VectorStoreIndex.from_documents(documents)
# Query your documents
query_engine = index.as_query_engine()
response = query_engine.query(
"What are the standard concrete mix specifications?"
)
print(response)
IDE Recommendations
IDE
Best For
Features
Jupyter Notebook
Learning, experiments
Interactive cells, visualizations
Google Colab
Free GPU, quick start
Cloud-based, pre-installed libs
VS Code
Professional development
Extensions, GitHub Copilot
PyCharm
Large projects
Advanced debugging, refactoring
Quick Setup with Jupyter
pip install jupyter pandas openpyxl pdfplumber
jupyter notebook
Best Practices
- Start Simple: Begin with clear, specific prompts
- Iterate: Refine prompts based on results
- Validate: Always check generated code before running
- Document: Save working prompts for reuse
- Secure: Use local LLM for sensitive company data
Common Prompts Library
Data Import
- "Read Excel file and show first 10 rows"
- "Import CSV with custom delimiter and encoding"
- "Load multiple Excel sheets into dictionary of DataFrames"
Data Cleaning
- "Remove duplicate rows based on element_id"
- "Fill missing values with column mean"
- "Convert column to numeric, handling errors"
Data Analysis
- "Calculate descriptive statistics for numeric columns"
- "Find correlation between cost and duration"
- "Identify outliers using IQR method"
Data Export
- "Export to Excel with multiple sheets"
- "Save to CSV with specific encoding"
- "Generate formatted PDF report"
Resources
- Book: "Data-Driven Construction" by Artem Boiko, Chapter 2.3
- Website: https://datadrivenconstruction.io
- Pandas Documentation: https://pandas.pydata.org/docs/
- Ollama: https://ollama.com
- LM Studio: https://lmstudio.ai
- Google Colab: https://colab.research.google.com
Next Steps
- See
pandas-construction-analysis for advanced Pandas operations
- See
pdf-to-structured for document processing
- See
etl-pipeline for automated data pipelines
- See
rag-construction for RAG implementation with construction documents
# Prompt: "Analyze BIM elements, group by category, calculate volumes"
import pandas as pd
def analyze_bim_elements(csv_path):
"""Analyze BIM element data from CSV export"""
df = pd.read_csv(csv_path)
# Group by category
summary = df.groupby('Category').agg({
'Volume': 'sum',
'Area': 'sum',
'ElementId': 'count'
}).rename(columns={'ElementId': 'Count'})
return summary
# Usage
summary = analyze_bim_elements("revit_export.csv")
print(summary)
# Prompt: "Create cost estimation from quantities and unit prices"
import pandas as pd
def calculate_cost_estimate(quantities_df, prices_df):
"""
Calculate project cost estimate
Args:
quantities_df: DataFrame with columns [item_code, quantity]
prices_df: DataFrame with columns [item_code, unit_price, unit]
Returns:
DataFrame with cost calculations
"""
# Merge quantities with prices
result = quantities_df.merge(prices_df, on='item_code', how='left')
# Calculate costs
result['total_cost'] = result['quantity'] * result['unit_price']
# Add summary
result['cost_percentage'] = (result['total_cost'] /
result['total_cost'].sum() * 100).round(2)
return result
# Usage
quantities = pd.DataFrame({
'item_code': ['C001', 'S001', 'W001'],
'quantity': [150, 2000, 500]
})
prices = pd.DataFrame({
'item_code': ['C001', 'S001', 'W001'],
'unit_price': [120, 45, 85],
'unit': ['m3', 'kg', 'm2']
})
estimate = calculate_cost_estimate(quantities, prices)
print(estimate)
4. Schedule Data Processing
# Prompt: "Parse construction schedule, calculate durations, identify delays"
import pandas as pd
from datetime import datetime
def analyze_schedule(schedule_path):
"""Analyze construction schedule for delays"""
df = pd.read_excel(schedule_path)
# Parse dates
df['start_date'] = pd.to_datetime(df['start_date'])
df['end_date'] = pd.to_datetime(df['end_date'])
df['actual_end'] = pd.to_datetime(df['actual_end'])
# Calculate durations
df['planned_duration'] = (df['end_date'] - df['start_date']).dt.days
df['actual_duration'] = (df['actual_end'] - df['start_date']).dt.days
# Identify delays
df['delay_days'] = df['actual_duration'] - df['planned_duration']
df['is_delayed'] = df['delay_days'] > 0
return df
# Usage
schedule = analyze_schedule("project_schedule.xlsx")
delayed_tasks = schedule[schedule['is_delayed']]
print(f"Delayed tasks: {len(delayed_tasks)}")
Local LLM Setup (No Internet Required)
Using Ollama
# Install
curl -fsSL https://ollama.com/install.sh | sh
# Download models
ollama pull mistral # General purpose, 7B params
ollama pull codellama # Code-focused
ollama pull deepseek-coder # Best for coding tasks
# Run
ollama run mistral "Write Pandas code to merge two DataFrames on project_id"
Using LlamaIndex for Company Documents
# Load company documents into local LLM
from llama_index import SimpleDirectoryReader, VectorStoreIndex
# Read all PDFs from folder
reader = SimpleDirectoryReader("company_documents/")
documents = reader.load_data()
# Create searchable index
index = VectorStoreIndex.from_documents(documents)
# Query your documents
query_engine = index.as_query_engine()
response = query_engine.query(
"What are the standard concrete mix specifications?"
)
print(response)
IDE Recommendations
IDE
Best For
Features
Jupyter Notebook
Learning, experiments
Interactive cells, visualizations
Google Colab
Free GPU, quick start
Cloud-based, pre-installed libs
VS Code
Professional development
Extensions, GitHub Copilot
PyCharm
Large projects
Advanced debugging, refactoring
Quick Setup with Jupyter
pip install jupyter pandas openpyxl pdfplumber
jupyter notebook
Best Practices
- Start Simple: Begin with clear, specific prompts
- Iterate: Refine prompts based on results
- Validate: Always check generated code before running
- Document: Save working prompts for reuse
- Secure: Use local LLM for sensitive company data
Common Prompts Library
Data Import
- "Read Excel file and show first 10 rows"
- "Import CSV with custom delimiter and encoding"
- "Load multiple Excel sheets into dictionary of DataFrames"
Data Cleaning
- "Remove duplicate rows based on element_id"
- "Fill missing values with column mean"
- "Convert column to numeric, handling errors"
Data Analysis
- "Calculate descriptive statistics for numeric columns"
- "Find correlation between cost and duration"
- "Identify outliers using IQR method"
Data Export
- "Export to Excel with multiple sheets"
- "Save to CSV with specific encoding"
- "Generate formatted PDF report"
Resources
- Book: "Data-Driven Construction" by Artem Boiko, Chapter 2.3
- Website: https://datadrivenconstruction.io
- Pandas Documentation: https://pandas.pydata.org/docs/
- Ollama: https://ollama.com
- LM Studio: https://lmstudio.ai
- Google Colab: https://colab.research.google.com
Next Steps
- See
pandas-construction-analysis for advanced Pandas operations
- See
pdf-to-structured for document processing
- See
etl-pipeline for automated data pipelines
- See
rag-construction for RAG implementation with construction documents
# Prompt: "Parse construction schedule, calculate durations, identify delays"
import pandas as pd
from datetime import datetime
def analyze_schedule(schedule_path):
"""Analyze construction schedule for delays"""
df = pd.read_excel(schedule_path)
# Parse dates
df['start_date'] = pd.to_datetime(df['start_date'])
df['end_date'] = pd.to_datetime(df['end_date'])
df['actual_end'] = pd.to_datetime(df['actual_end'])
# Calculate durations
df['planned_duration'] = (df['end_date'] - df['start_date']).dt.days
df['actual_duration'] = (df['actual_end'] - df['start_date']).dt.days
# Identify delays
df['delay_days'] = df['actual_duration'] - df['planned_duration']
df['is_delayed'] = df['delay_days'] > 0
return df
# Usage
schedule = analyze_schedule("project_schedule.xlsx")
delayed_tasks = schedule[schedule['is_delayed']]
print(f"Delayed tasks: {len(delayed_tasks)}")
Using Ollama
# Install
curl -fsSL https://ollama.com/install.sh | sh
# Download models
ollama pull mistral # General purpose, 7B params
ollama pull codellama # Code-focused
ollama pull deepseek-coder # Best for coding tasks
# Run
ollama run mistral "Write Pandas code to merge two DataFrames on project_id"
# Load company documents into local LLM
from llama_index import SimpleDirectoryReader, VectorStoreIndex
# Read all PDFs from folder
reader = SimpleDirectoryReader("company_documents/")
documents = reader.load_data()
# Create searchable index
index = VectorStoreIndex.from_documents(documents)
# Query your documents
query_engine = index.as_query_engine()
response = query_engine.query(
"What are the standard concrete mix specifications?"
)
print(response)
IDE Recommendations
IDE
Best For
Features
Jupyter Notebook
Learning, experiments
Interactive cells, visualizations
Google Colab
Free GPU, quick start
Cloud-based, pre-installed libs
VS Code
Professional development
Extensions, GitHub Copilot
PyCharm
Large projects
Advanced debugging, refactoring
Quick Setup with Jupyter
| IDE | Best For | Features |
|---|---|---|
| Jupyter Notebook | Learning, experiments | Interactive cells, visualizations |
| Google Colab | Free GPU, quick start | Cloud-based, pre-installed libs |
| VS Code | Professional development | Extensions, GitHub Copilot |
| PyCharm | Large projects | Advanced debugging, refactoring |
pip install jupyter pandas openpyxl pdfplumber
jupyter notebook
Best Practices
- Start Simple: Begin with clear, specific prompts
- Iterate: Refine prompts based on results
- Validate: Always check generated code before running
- Document: Save working prompts for reuse
- Secure: Use local LLM for sensitive company data
Common Prompts Library
Data Import
- "Read Excel file and show first 10 rows"
- "Import CSV with custom delimiter and encoding"
- "Load multiple Excel sheets into dictionary of DataFrames"
Data Cleaning
Data Import
- "Remove duplicate rows based on element_id"
- "Fill missing values with column mean"
- "Convert column to numeric, handling errors"
Data Analysis
- "Calculate descriptive statistics for numeric columns"
- "Find correlation between cost and duration"
- "Identify outliers using IQR method"
Data Export
- "Export to Excel with multiple sheets"
- "Save to CSV with specific encoding"
- "Generate formatted PDF report"
Resources
- Book: "Data-Driven Construction" by Artem Boiko, Chapter 2.3
- Website: https://datadrivenconstruction.io
- Pandas Documentation: https://pandas.pydata.org/docs/
- Ollama: https://ollama.com
- LM Studio: https://lmstudio.ai
- Google Colab: https://colab.research.google.com
Next Steps
- See
pandas-construction-analysis for advanced Pandas operations
- See
pdf-to-structured for document processing
- See
etl-pipeline for automated data pipelines
- See
rag-construction for RAG implementation with construction documents
- "Export to Excel with multiple sheets"
- "Save to CSV with specific encoding"
- "Generate formatted PDF report"
Resources
- Book: "Data-Driven Construction" by Artem Boiko, Chapter 2.3
- Website: https://datadrivenconstruction.io
- Pandas Documentation: https://pandas.pydata.org/docs/
- Ollama: https://ollama.com
- LM Studio: https://lmstudio.ai
- Google Colab: https://colab.research.google.com
Next Steps
- See
pandas-construction-analysis for advanced Pandas operations
- See
pdf-to-structured for document processing
- See
etl-pipeline for automated data pipelines
- See
rag-construction for RAG implementation with construction documents
- See
pandas-construction-analysisfor advanced Pandas operations - See
pdf-to-structuredfor document processing - See
etl-pipelinefor automated data pipelines - See
rag-constructionfor RAG implementation with construction documents
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。