[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FJGPJFVGWZQ0Z1MERV6FEY":3,"skill-same:01M6FJGPJFVGWZQ0Z1MERV6FEY":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":26,"linkOnly":27,"markdownContent":28,"markdownBody":29,"frontMatter":30,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":38,"install":39,"resources":52},"01M6FJGPJFVGWZQ0Z1MERV6FEY","auto-estimate-generator",null,"Automatically generate estimates from QTO data. Apply pricing rules to BIM quantities for cost estimates.","kbarbel640-del\u002Fskills","kbarbel640-del","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255315490?v=4","01M6CJPPQGCCESXMG3K7BBGQ5J","01M6CJPPX2PB2BCZERFVM2C2B3",1,"MIT","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Fauto-estimate-generator\u002FSKILL.md",[],[18,19,20,21,22,23,24,25],"auto","generator","auto estimate generator","pricing","generate","data","Rules","cost","2026-11-10 10:12:30",false,"---\r\nslug: \"auto-estimate-generator\"\r\ndisplay_name: \"Auto Estimate Generator\"\r\ndescription: \"Automatically generate estimates from QTO data. Apply pricing rules to BIM quantities for cost estimates.\"\r\n---\r\n\r\n# Auto Estimate Generator\r\n\r\n## Business Case\r\n\r\n### Problem Statement\r\nManual estimate creation challenges:\r\n- Time-consuming quantity mapping\r\n- Inconsistent pricing rules\r\n- Errors in calculations\r\n- Difficulty updating estimates\r\n\r\n### Solution\r\nAutomated estimate generation from BIM\u002FQTO data using configurable pricing rules and assembly mappings.\r\n\r\n## Technical Implementation\r\n\r\n```python\r\nimport pandas as pd\r\nfrom typing import Dict, Any, List, Optional, Callable\r\nfrom dataclasses import dataclass, field\r\nfrom enum import Enum\r\n\r\n\r\nclass ElementType(Enum):\r\n    WALL = \"wall\"\r\n    FLOOR = \"floor\"\r\n    CEILING = \"ceiling\"\r\n    DOOR = \"door\"\r\n    WINDOW = \"window\"\r\n    COLUMN = \"column\"\r\n    BEAM = \"beam\"\r\n    FOUNDATION = \"foundation\"\r\n    ROOF = \"roof\"\r\n    STAIR = \"stair\"\r\n    MEP = \"mep\"\r\n\r\n\r\n@dataclass\r\nclass QTOItem:\r\n    element_id: str\r\n    element_type: ElementType\r\n    name: str\r\n    quantity: float\r\n    unit: str\r\n    properties: Dict[str, Any] = field(default_factory=dict)\r\n\r\n\r\n@dataclass\r\nclass PricingRule:\r\n    rule_id: str\r\n    name: str\r\n    element_type: ElementType\r\n    conditions: Dict[str, Any] = field(default_factory=dict)\r\n    unit_cost: float = 0\r\n    assembly_code: str = \"\"\r\n    cost_breakdown: Dict[str, float] = field(default_factory=dict)\r\n\r\n\r\n@dataclass\r\nclass EstimateItem:\r\n    qto_element_id: str\r\n    description: str\r\n    quantity: float\r\n    unit: str\r\n    unit_cost: float\r\n    total_cost: float\r\n    rule_applied: str\r\n    wbs_code: str = \"\"\r\n\r\n\r\nclass AutoEstimateGenerator:\r\n    \"\"\"Generate estimates from QTO data automatically.\"\"\"\r\n\r\n    def __init__(self, project_name: str):\r\n        self.project_name = project_name\r\n        self.pricing_rules: List[PricingRule] = []\r\n        self.qto_items: List[QTOItem] = []\r\n        self.estimate_items: List[EstimateItem] = []\r\n        self.unmapped_items: List[QTOItem] = []\r\n\r\n    def add_pricing_rule(self, rule: PricingRule):\r\n        \"\"\"Add pricing rule.\"\"\"\r\n        self.pricing_rules.append(rule)\r\n\r\n    def load_pricing_rules_from_df(self, df: pd.DataFrame):\r\n        \"\"\"Load pricing rules from DataFrame.\"\"\"\r\n\r\n        for _, row in df.iterrows():\r\n            conditions = {}\r\n            if 'material' in row:\r\n                conditions['material'] = row['material']\r\n            if 'thickness_min' in row:\r\n                conditions['thickness_min'] = row['thickness_min']\r\n            if 'thickness_max' in row:\r\n                conditions['thickness_max'] = row['thickness_max']\r\n\r\n            rule = PricingRule(\r\n                rule_id=row['rule_id'],\r\n                name=row['name'],\r\n                element_type=ElementType(row['element_type'].lower()),\r\n                conditions=conditions,\r\n                unit_cost=float(row['unit_cost']),\r\n                assembly_code=row.get('assembly_code', ''),\r\n                cost_breakdown={\r\n                    'labor': float(row.get('labor_pct', 0.4)),\r\n                    'material': float(row.get('material_pct', 0.5)),\r\n                    'equipment': float(row.get('equipment_pct', 0.1))\r\n                }\r\n            )\r\n            self.add_pricing_rule(rule)\r\n\r\n    def load_qto_from_df(self, df: pd.DataFrame):\r\n        \"\"\"Load QTO items from DataFrame.\"\"\"\r\n\r\n        for _, row in df.iterrows():\r\n            properties = {}\r\n            for col in df.columns:\r\n                if col not in ['element_id', 'element_type', 'name', 'quantity', 'unit']:\r\n                    properties[col] = row[col]\r\n\r\n            qto = QTOItem(\r\n                element_id=str(row['element_id']),\r\n                element_type=ElementType(row['element_type'].lower()),\r\n                name=row['name'],\r\n                quantity=float(row['quantity']),\r\n                unit=row['unit'],\r\n                properties=properties\r\n            )\r\n            self.qto_items.append(qto)\r\n\r\n    def find_matching_rule(self, qto_item: QTOItem) -> Optional[PricingRule]:\r\n        \"\"\"Find pricing rule that matches QTO item.\"\"\"\r\n\r\n        matching_rules = []\r\n\r\n        for rule in self.pricing_rules:\r\n            if rule.element_type != qto_item.element_type:\r\n                continue\r\n\r\n            # Check conditions\r\n            match = True\r\n            for key, value in rule.conditions.items():\r\n                if key.endswith('_min'):\r\n                    prop_name = key[:-4]\r\n                    if prop_name in qto_item.properties:\r\n                        if qto_item.properties[prop_name] \u003C value:\r\n                            match = False\r\n                elif key.endswith('_max'):\r\n                    prop_name = key[:-4]\r\n                    if prop_name in qto_item.properties:\r\n                        if qto_item.properties[prop_name] > value:\r\n                            match = False\r\n                else:\r\n                    if key in qto_item.properties:\r\n                        if qto_item.properties[key] != value:\r\n                            match = False\r\n\r\n            if match:\r\n                matching_rules.append(rule)\r\n\r\n        # Return most specific rule (most conditions)\r\n        if matching_rules:\r\n            return max(matching_rules, key=lambda r: len(r.conditions))\r\n        return None\r\n\r\n    def generate_estimate(self) -> Dict[str, Any]:\r\n        \"\"\"Generate estimate from QTO items.\"\"\"\r\n\r\n        self.estimate_items = []\r\n        self.unmapped_items = []\r\n        total_cost = 0\r\n\r\n        for qto in self.qto_items:\r\n            rule = self.find_matching_rule(qto)\r\n\r\n            if rule:\r\n                item_cost = qto.quantity * rule.unit_cost\r\n\r\n                self.estimate_items.append(EstimateItem(\r\n                    qto_element_id=qto.element_id,\r\n                    description=f\"{qto.name} ({rule.name})\",\r\n                    quantity=qto.quantity,\r\n                    unit=qto.unit,\r\n                    unit_cost=rule.unit_cost,\r\n                    total_cost=round(item_cost, 2),\r\n                    rule_applied=rule.rule_id,\r\n                    wbs_code=rule.assembly_code\r\n                ))\r\n                total_cost += item_cost\r\n            else:\r\n                self.unmapped_items.append(qto)\r\n\r\n        return {\r\n            'project': self.project_name,\r\n            'total_qto_items': len(self.qto_items),\r\n            'mapped_items': len(self.estimate_items),\r\n            'unmapped_items': len(self.unmapped_items),\r\n            'mapping_rate': round(len(self.estimate_items) \u002F len(self.qto_items) * 100, 1) if self.qto_items else 0,\r\n            'total_cost': round(total_cost, 2),\r\n            'items': self.estimate_items\r\n        }\r\n\r\n    def get_cost_by_element_type(self) -> Dict[str, float]:\r\n        \"\"\"Get cost breakdown by element type.\"\"\"\r\n\r\n        by_type = {}\r\n        for qto in self.qto_items:\r\n            for est_item in self.estimate_items:\r\n                if est_item.qto_element_id == qto.element_id:\r\n                    type_name = qto.element_type.value\r\n                    by_type[type_name] = by_type.get(type_name, 0) + est_item.total_cost\r\n\r\n        return {k: round(v, 2) for k, v in by_type.items()}\r\n\r\n    def get_unmapped_summary(self) -> pd.DataFrame:\r\n        \"\"\"Get summary of unmapped items.\"\"\"\r\n\r\n        if not self.unmapped_items:\r\n            return pd.DataFrame()\r\n\r\n        data = []\r\n        for item in self.unmapped_items:\r\n            data.append({\r\n                'Element ID': item.element_id,\r\n                'Type': item.element_type.value,\r\n                'Name': item.name,\r\n                'Quantity': item.quantity,\r\n                'Unit': item.unit,\r\n                'Properties': str(item.properties)\r\n            })\r\n\r\n        return pd.DataFrame(data)\r\n\r\n    def export_to_excel(self, output_path: str) -> str:\r\n        \"\"\"Export estimate to Excel.\"\"\"\r\n\r\n        result = self.generate_estimate()\r\n\r\n        with pd.ExcelWriter(output_path, engine='openpyxl') as writer:\r\n            # Summary\r\n            summary_df = pd.DataFrame([{\r\n                'Project': self.project_name,\r\n                'Total QTO Items': result['total_qto_items'],\r\n                'Mapped Items': result['mapped_items'],\r\n                'Unmapped Items': result['unmapped_items'],\r\n                'Mapping Rate %': result['mapping_rate'],\r\n                'Total Cost': result['total_cost']\r\n            }])\r\n            summary_df.to_excel(writer, sheet_name='Summary', index=False)\r\n\r\n            # Estimate items\r\n            items_df = pd.DataFrame([{\r\n                'Element ID': item.qto_element_id,\r\n                'Description': item.description,\r\n                'Quantity': item.quantity,\r\n                'Unit': item.unit,\r\n                'Unit Cost': item.unit_cost,\r\n                'Total Cost': item.total_cost,\r\n                'WBS': item.wbs_code,\r\n                'Rule': item.rule_applied\r\n            } for item in self.estimate_items])\r\n            items_df.to_excel(writer, sheet_name='Estimate', index=False)\r\n\r\n            # By element type\r\n            by_type_df = pd.DataFrame([\r\n                {'Element Type': k, 'Cost': v}\r\n                for k, v in self.get_cost_by_element_type().items()\r\n            ])\r\n            by_type_df.to_excel(writer, sheet_name='By Type', index=False)\r\n\r\n            # Unmapped items\r\n            unmapped_df = self.get_unmapped_summary()\r\n            if not unmapped_df.empty:\r\n                unmapped_df.to_excel(writer, sheet_name='Unmapped', index=False)\r\n\r\n        return output_path\r\n\r\n    def suggest_missing_rules(self) -> List[Dict[str, Any]]:\r\n        \"\"\"Suggest pricing rules for unmapped items.\"\"\"\r\n\r\n        suggestions = []\r\n        seen_types = set()\r\n\r\n        for item in self.unmapped_items:\r\n            key = (item.element_type.value, str(item.properties))\r\n            if key not in seen_types:\r\n                seen_types.add(key)\r\n                suggestions.append({\r\n                    'element_type': item.element_type.value,\r\n                    'sample_name': item.name,\r\n                    'properties': item.properties,\r\n                    'count': sum(1 for i in self.unmapped_items\r\n                                if i.element_type == item.element_type\r\n                                and str(i.properties) == str(item.properties))\r\n                })\r\n\r\n        return sorted(suggestions, key=lambda x: x['count'], reverse=True)\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\n# Initialize generator\r\ngenerator = AutoEstimateGenerator(\"Office Building A\")\r\n\r\n# Add pricing rules\r\ngenerator.add_pricing_rule(PricingRule(\r\n    rule_id=\"W-001\",\r\n    name=\"Interior Wall - Drywall\",\r\n    element_type=ElementType.WALL,\r\n    conditions={\"material\": \"Drywall\"},\r\n    unit_cost=45.00,\r\n    assembly_code=\"09.29.10\"\r\n))\r\n\r\ngenerator.add_pricing_rule(PricingRule(\r\n    rule_id=\"W-002\",\r\n    name=\"Exterior Wall - Masonry\",\r\n    element_type=ElementType.WALL,\r\n    conditions={\"material\": \"Masonry\"},\r\n    unit_cost=125.00,\r\n    assembly_code=\"04.21.13\"\r\n))\r\n\r\n# Load QTO data\r\ngenerator.qto_items = [\r\n    QTOItem(\"W-001\", ElementType.WALL, \"Interior Wall L1\", 500, \"SF\", {\"material\": \"Drywall\"}),\r\n    QTOItem(\"W-002\", ElementType.WALL, \"Exterior Wall\", 1200, \"SF\", {\"material\": \"Masonry\"})\r\n]\r\n\r\n# Generate estimate\r\nresult = generator.generate_estimate()\r\nprint(f\"Total Cost: ${result['total_cost']:,.2f}\")\r\nprint(f\"Mapping Rate: {result['mapping_rate']}%\")\r\n```\r\n\r\n## Common Use Cases\r\n\r\n### 1. Cost by Element Type\r\n```python\r\nby_type = generator.get_cost_by_element_type()\r\nfor element_type, cost in by_type.items():\r\n    print(f\"{element_type}: ${cost:,.2f}\")\r\n```\r\n\r\n### 2. Unmapped Items\r\n```python\r\nunmapped = generator.get_unmapped_summary()\r\nprint(unmapped)\r\n```\r\n\r\n### 3. Rule Suggestions\r\n```python\r\nsuggestions = generator.suggest_missing_rules()\r\nfor s in suggestions:\r\n    print(f\"Need rule for: {s['element_type']} ({s['count']} items)\")\r\n```\r\n\r\n## Resources\r\n- **DDC Book**: Chapter 3.2 - QTO and Automated Estimates\r\n- **Website**: https:\u002F\u002Fdatadrivenconstruction.io\r\n","# Auto Estimate Generator\r\n\r\n## Business Case\r\n\r\n### Problem Statement\r\nManual estimate creation challenges:\r\n- Time-consuming quantity mapping\r\n- Inconsistent pricing rules\r\n- Errors in calculations\r\n- Difficulty updating estimates\r\n\r\n### Solution\r\nAutomated estimate generation from BIM\u002FQTO data using configurable pricing rules and assembly mappings.\r\n\r\n## Technical Implementation\r\n\r\n```python\r\nimport pandas as pd\r\nfrom typing import Dict, Any, List, Optional, Callable\r\nfrom dataclasses import dataclass, field\r\nfrom enum import Enum\r\n\r\n\r\nclass ElementType(Enum):\r\n    WALL = \"wall\"\r\n    FLOOR = \"floor\"\r\n    CEILING = \"ceiling\"\r\n    DOOR = \"door\"\r\n    WINDOW = \"window\"\r\n    COLUMN = \"column\"\r\n    BEAM = \"beam\"\r\n    FOUNDATION = \"foundation\"\r\n    ROOF = \"roof\"\r\n    STAIR = \"stair\"\r\n    MEP = \"mep\"\r\n\r\n\r\n@dataclass\r\nclass QTOItem:\r\n    element_id: str\r\n    element_type: ElementType\r\n    name: str\r\n    quantity: float\r\n    unit: str\r\n    properties: Dict[str, Any] = field(default_factory=dict)\r\n\r\n\r\n@dataclass\r\nclass PricingRule:\r\n    rule_id: str\r\n    name: str\r\n    element_type: ElementType\r\n    conditions: Dict[str, Any] = field(default_factory=dict)\r\n    unit_cost: float = 0\r\n    assembly_code: str = \"\"\r\n    cost_breakdown: Dict[str, float] = field(default_factory=dict)\r\n\r\n\r\n@dataclass\r\nclass EstimateItem:\r\n    qto_element_id: str\r\n    description: str\r\n    quantity: float\r\n    unit: str\r\n    unit_cost: float\r\n    total_cost: float\r\n    rule_applied: str\r\n    wbs_code: str = \"\"\r\n\r\n\r\nclass AutoEstimateGenerator:\r\n    \"\"\"Generate estimates from QTO data automatically.\"\"\"\r\n\r\n    def __init__(self, project_name: str):\r\n        self.project_name = project_name\r\n        self.pricing_rules: List[PricingRule] = []\r\n        self.qto_items: List[QTOItem] = []\r\n        self.estimate_items: List[EstimateItem] = []\r\n        self.unmapped_items: List[QTOItem] = []\r\n\r\n    def add_pricing_rule(self, rule: PricingRule):\r\n        \"\"\"Add pricing rule.\"\"\"\r\n        self.pricing_rules.append(rule)\r\n\r\n    def load_pricing_rules_from_df(self, df: pd.DataFrame):\r\n        \"\"\"Load pricing rules from DataFrame.\"\"\"\r\n\r\n        for _, row in df.iterrows():\r\n            conditions = {}\r\n            if 'material' in row:\r\n                conditions['material'] = row['material']\r\n            if 'thickness_min' in row:\r\n                conditions['thickness_min'] = row['thickness_min']\r\n            if 'thickness_max' in row:\r\n                conditions['thickness_max'] = row['thickness_max']\r\n\r\n            rule = PricingRule(\r\n                rule_id=row['rule_id'],\r\n                name=row['name'],\r\n                element_type=ElementType(row['element_type'].lower()),\r\n                conditions=conditions,\r\n                unit_cost=float(row['unit_cost']),\r\n                assembly_code=row.get('assembly_code', ''),\r\n                cost_breakdown={\r\n                    'labor': float(row.get('labor_pct', 0.4)),\r\n                    'material': float(row.get('material_pct', 0.5)),\r\n                    'equipment': float(row.get('equipment_pct', 0.1))\r\n                }\r\n            )\r\n            self.add_pricing_rule(rule)\r\n\r\n    def load_qto_from_df(self, df: pd.DataFrame):\r\n        \"\"\"Load QTO items from DataFrame.\"\"\"\r\n\r\n        for _, row in df.iterrows():\r\n            properties = {}\r\n            for col in df.columns:\r\n                if col not in ['element_id', 'element_type', 'name', 'quantity', 'unit']:\r\n                    properties[col] = row[col]\r\n\r\n            qto = QTOItem(\r\n                element_id=str(row['element_id']),\r\n                element_type=ElementType(row['element_type'].lower()),\r\n                name=row['name'],\r\n                quantity=float(row['quantity']),\r\n                unit=row['unit'],\r\n                properties=properties\r\n            )\r\n            self.qto_items.append(qto)\r\n\r\n    def find_matching_rule(self, qto_item: QTOItem) -> Optional[PricingRule]:\r\n        \"\"\"Find pricing rule that matches QTO item.\"\"\"\r\n\r\n        matching_rules = []\r\n\r\n        for rule in self.pricing_rules:\r\n            if rule.element_type != qto_item.element_type:\r\n                continue\r\n\r\n            # Check conditions\r\n            match = True\r\n            for key, value in rule.conditions.items():\r\n                if key.endswith('_min'):\r\n                    prop_name = key[:-4]\r\n                    if prop_name in qto_item.properties:\r\n                        if qto_item.properties[prop_name] \u003C value:\r\n                            match = False\r\n                elif key.endswith('_max'):\r\n                    prop_name = key[:-4]\r\n                    if prop_name in qto_item.properties:\r\n                        if qto_item.properties[prop_name] > value:\r\n                            match = False\r\n                else:\r\n                    if key in qto_item.properties:\r\n                        if qto_item.properties[key] != value:\r\n                            match = False\r\n\r\n            if match:\r\n                matching_rules.append(rule)\r\n\r\n        # Return most specific rule (most conditions)\r\n        if matching_rules:\r\n            return max(matching_rules, key=lambda r: len(r.conditions))\r\n        return None\r\n\r\n    def generate_estimate(self) -> Dict[str, Any]:\r\n        \"\"\"Generate estimate from QTO items.\"\"\"\r\n\r\n        self.estimate_items = []\r\n        self.unmapped_items = []\r\n        total_cost = 0\r\n\r\n        for qto in self.qto_items:\r\n            rule = self.find_matching_rule(qto)\r\n\r\n            if rule:\r\n                item_cost = qto.quantity * rule.unit_cost\r\n\r\n                self.estimate_items.append(EstimateItem(\r\n                    qto_element_id=qto.element_id,\r\n                    description=f\"{qto.name} ({rule.name})\",\r\n                    quantity=qto.quantity,\r\n                    unit=qto.unit,\r\n                    unit_cost=rule.unit_cost,\r\n                    total_cost=round(item_cost, 2),\r\n                    rule_applied=rule.rule_id,\r\n                    wbs_code=rule.assembly_code\r\n                ))\r\n                total_cost += item_cost\r\n            else:\r\n                self.unmapped_items.append(qto)\r\n\r\n        return {\r\n            'project': self.project_name,\r\n            'total_qto_items': len(self.qto_items),\r\n            'mapped_items': len(self.estimate_items),\r\n            'unmapped_items': len(self.unmapped_items),\r\n            'mapping_rate': round(len(self.estimate_items) \u002F len(self.qto_items) * 100, 1) if self.qto_items else 0,\r\n            'total_cost': round(total_cost, 2),\r\n            'items': self.estimate_items\r\n        }\r\n\r\n    def get_cost_by_element_type(self) -> Dict[str, float]:\r\n        \"\"\"Get cost breakdown by element type.\"\"\"\r\n\r\n        by_type = {}\r\n        for qto in self.qto_items:\r\n            for est_item in self.estimate_items:\r\n                if est_item.qto_element_id == qto.element_id:\r\n                    type_name = qto.element_type.value\r\n                    by_type[type_name] = by_type.get(type_name, 0) + est_item.total_cost\r\n\r\n        return {k: round(v, 2) for k, v in by_type.items()}\r\n\r\n    def get_unmapped_summary(self) -> pd.DataFrame:\r\n        \"\"\"Get summary of unmapped items.\"\"\"\r\n\r\n        if not self.unmapped_items:\r\n            return pd.DataFrame()\r\n\r\n        data = []\r\n        for item in self.unmapped_items:\r\n            data.append({\r\n                'Element ID': item.element_id,\r\n                'Type': item.element_type.value,\r\n                'Name': item.name,\r\n                'Quantity': item.quantity,\r\n                'Unit': item.unit,\r\n                'Properties': str(item.properties)\r\n            })\r\n\r\n        return pd.DataFrame(data)\r\n\r\n    def export_to_excel(self, output_path: str) -> str:\r\n        \"\"\"Export estimate to Excel.\"\"\"\r\n\r\n        result = self.generate_estimate()\r\n\r\n        with pd.ExcelWriter(output_path, engine='openpyxl') as writer:\r\n            # Summary\r\n            summary_df = pd.DataFrame([{\r\n                'Project': self.project_name,\r\n                'Total QTO Items': result['total_qto_items'],\r\n                'Mapped Items': result['mapped_items'],\r\n                'Unmapped Items': result['unmapped_items'],\r\n                'Mapping Rate %': result['mapping_rate'],\r\n                'Total Cost': result['total_cost']\r\n            }])\r\n            summary_df.to_excel(writer, sheet_name='Summary', index=False)\r\n\r\n            # Estimate items\r\n            items_df = pd.DataFrame([{\r\n                'Element ID': item.qto_element_id,\r\n                'Description': item.description,\r\n                'Quantity': item.quantity,\r\n                'Unit': item.unit,\r\n                'Unit Cost': item.unit_cost,\r\n                'Total Cost': item.total_cost,\r\n                'WBS': item.wbs_code,\r\n                'Rule': item.rule_applied\r\n            } for item in self.estimate_items])\r\n            items_df.to_excel(writer, sheet_name='Estimate', index=False)\r\n\r\n            # By element type\r\n            by_type_df = pd.DataFrame([\r\n                {'Element Type': k, 'Cost': v}\r\n                for k, v in self.get_cost_by_element_type().items()\r\n            ])\r\n            by_type_df.to_excel(writer, sheet_name='By Type', index=False)\r\n\r\n            # Unmapped items\r\n            unmapped_df = self.get_unmapped_summary()\r\n            if not unmapped_df.empty:\r\n                unmapped_df.to_excel(writer, sheet_name='Unmapped', index=False)\r\n\r\n        return output_path\r\n\r\n    def suggest_missing_rules(self) -> List[Dict[str, Any]]:\r\n        \"\"\"Suggest pricing rules for unmapped items.\"\"\"\r\n\r\n        suggestions = []\r\n        seen_types = set()\r\n\r\n        for item in self.unmapped_items:\r\n            key = (item.element_type.value, str(item.properties))\r\n            if key not in seen_types:\r\n                seen_types.add(key)\r\n                suggestions.append({\r\n                    'element_type': item.element_type.value,\r\n                    'sample_name': item.name,\r\n                    'properties': item.properties,\r\n                    'count': sum(1 for i in self.unmapped_items\r\n                                if i.element_type == item.element_type\r\n                                and str(i.properties) == str(item.properties))\r\n                })\r\n\r\n        return sorted(suggestions, key=lambda x: x['count'], reverse=True)\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\n# Initialize generator\r\ngenerator = AutoEstimateGenerator(\"Office Building A\")\r\n\r\n# Add pricing rules\r\ngenerator.add_pricing_rule(PricingRule(\r\n    rule_id=\"W-001\",\r\n    name=\"Interior Wall - Drywall\",\r\n    element_type=ElementType.WALL,\r\n    conditions={\"material\": \"Drywall\"},\r\n    unit_cost=45.00,\r\n    assembly_code=\"09.29.10\"\r\n))\r\n\r\ngenerator.add_pricing_rule(PricingRule(\r\n    rule_id=\"W-002\",\r\n    name=\"Exterior Wall - Masonry\",\r\n    element_type=ElementType.WALL,\r\n    conditions={\"material\": \"Masonry\"},\r\n    unit_cost=125.00,\r\n    assembly_code=\"04.21.13\"\r\n))\r\n\r\n# Load QTO data\r\ngenerator.qto_items = [\r\n    QTOItem(\"W-001\", ElementType.WALL, \"Interior Wall L1\", 500, \"SF\", {\"material\": \"Drywall\"}),\r\n    QTOItem(\"W-002\", ElementType.WALL, \"Exterior Wall\", 1200, \"SF\", {\"material\": \"Masonry\"})\r\n]\r\n\r\n# Generate estimate\r\nresult = generator.generate_estimate()\r\nprint(f\"Total Cost: ${result['total_cost']:,.2f}\")\r\nprint(f\"Mapping Rate: {result['mapping_rate']}%\")\r\n```\r\n\r\n## Common Use Cases\r\n\r\n### 1. Cost by Element Type\r\n```python\r\nby_type = generator.get_cost_by_element_type()\r\nfor element_type, cost in by_type.items():\r\n    print(f\"{element_type}: ${cost:,.2f}\")\r\n```\r\n\r\n### 2. Unmapped Items\r\n```python\r\nunmapped = generator.get_unmapped_summary()\r\nprint(unmapped)\r\n```\r\n\r\n### 3. Rule Suggestions\r\n```python\r\nsuggestions = generator.suggest_missing_rules()\r\nfor s in suggestions:\r\n    print(f\"Need rule for: {s['element_type']} ({s['count']} items)\")\r\n```\r\n\r\n## Resources\r\n- **DDC Book**: Chapter 3.2 - QTO and Automated Estimates\r\n- **Website**: https:\u002F\u002Fdatadrivenconstruction.io\r\n",{"slug":5,"description":7,"display_name":31},"Auto Estimate Generator","main","e7e336ac628c3e3bd771aff1aaa469c93778f94a","skills\u002Fdatadrivenconstruction\u002Fauto-estimate-generator",0,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del","2026-08-23 22:39:37",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add kbarbel640-del\u002Fskills --skill auto-estimate-generator",{"tool":45,"command":46},"bunx","bunx skills add kbarbel640-del\u002Fskills --skill auto-estimate-generator",{"tool":48,"command":49},"pnpm","pnpm dlx skills add kbarbel640-del\u002Fskills --skill auto-estimate-generator","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Fauto-estimate-generator\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"_meta.json","REFERENCE","参考文档",314,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Fauto-estimate-generator\u002F_meta.json",[60,86,110,128,133,153],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":26},"01M6G8J55967D6281ACMKAKTEQ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85],"crowd prompting","prompting","api","with","tokens","domain","world","prompts","operations","instructions","text","tool","system","improve","productivity","marketplace","https","content","ai agents",{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":26},"01M6G8J0PKPAYVET6BWE8W4C26","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[93,69,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,74,109],"dilemm ai","arena","analyze","browser","openclaw agent","create","automation","browser automation","bot","openclaw","design","strategy","headless","compete","submit","matchmaking","use",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":26},"01M6G8HWAF3K9SW7NP3Z83CPJ6","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, or submitting paper reviews via API at http:\u002F\u002F150.158.152.82:8000.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Fweak-accept\u002FSKILL.md",[],[117,118,119,120,121,122,123,70,124,107,109,125,69,126,127],"arxiv paper reviews","reviews","arxiv","paper","crawler","papers","comments","fetch","read","http","via",{"skillNo":129,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":26},"01M6G8HQJ7N7WMY6YV7D7SSJ16","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[120,119,118,117,127,122,123,70,121,107,109,124,125,69,126],{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":26},"01M6G8HM95Y64JNVFC2HN4E2BG","git-summary","Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzweack\u002Fgit-summary\u002FSKILL.md",[],[140,141,142,143,144,145,146,147,148,149,150,151,152],"git","summary","git summary","commits","repository","win32","status","linux","contributors","true","quick","get","branches",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":26},"01M6G8HGEGF05CNEJCGVYFSC4R","agent-constitution","Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fztsalexey\u002Fagent-constitution\u002FSKILL.md",[],[160,161,162,163,70,164,165,32,166,125,167,24,168,169,170,83,171,172,173],"agent constitution","constitution","contracts","tree","query","base","log","check","projects","compliance","actions","state","governance","github"]