{
  "name": "Calculate Embodied Carbon (CO2) for Revit/IFC Models using AI Classification",
  "nodes": [
    {
      "id": "86512d4b-52b7-46ac-ac59-61ed748b3045",
      "name": "Find Category Fields1",
      "type": "n8n-nodes-base.code",
      "position": [
        -80,
        720
      ]
    },
    {
      "id": "ceeaa6f3-781e-421f-bae1-c6ccb784ecbd",
      "name": "Apply Classification to Groups1",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        768
      ]
    },
    {
      "id": "ffc937c8-4ca6-4963-a24f-114f45b5345b",
      "name": "Non-Building Elements Output1",
      "type": "n8n-nodes-base.set",
      "position": [
        848,
        784
      ]
    },
    {
      "id": "731a2f76-60b4-4b4c-8e56-465c0ea6ad5c",
      "name": "Extract Headers and Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        496
      ]
    },
    {
      "id": "7bbf3d9d-4406-4fa3-9ca6-49eeaea551ff",
      "name": "AI Analyze All Headers1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        240,
        496
      ]
    },
    {
      "id": "10caf6f7-ad6b-4de2-9e63-8b06b5609414",
      "name": "Process AI Response1",
      "type": "n8n-nodes-base.code",
      "position": [
        592,
        496
      ]
    },
    {
      "id": "435f2cb9-9ccb-4f32-ba95-6bb0126a73d2",
      "name": "Group Data with AI Rules1",
      "type": "n8n-nodes-base.code",
      "position": [
        784,
        496
      ]
    },
    {
      "id": "ff967309-0ef4-4b49-abf1-b4c3ff6d48ac",
      "name": "AI Classify Categories1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        112,
        768
      ]
    },
    {
      "id": "3e9cd8b6-3117-493b-97f7-c9d6a889e55d",
      "name": "Is Building Element1",
      "type": "n8n-nodes-base.if",
      "position": [
        640,
        768
      ]
    },
    {
      "id": "1f3e2b55-6c9d-4466-801b-d8b31792a907",
      "name": "Check If All Batches Done",
      "type": "n8n-nodes-base.if",
      "position": [
        -416,
        1200
      ]
    },
    {
      "id": "15da077e-8560-4bf9-b610-0199f66292f8",
      "name": "Collect All Results",
      "type": "n8n-nodes-base.code",
      "position": [
        -192,
        1552
      ]
    },
    {
      "id": "7ae11a97-c8f9-4554-a1ae-0fc22c5ef6f9",
      "name": "Process in Batches1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -256,
        1072
      ]
    },
    {
      "id": "b2423ed4-6d42-4b31-a1c1-db9affbf720b",
      "name": "Clean Empty Values1",
      "type": "n8n-nodes-base.code",
      "position": [
        -80,
        1072
      ]
    },
    {
      "id": "b9e77fc6-907b-47d2-8625-fdc0f6febb56",
      "name": "AI Agent Enhanced",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        272,
        1072
      ]
    },
    {
      "id": "2c3a57c2-66c2-414a-82e0-8f0df26cbfc8",
      "name": "Accumulate Results",
      "type": "n8n-nodes-base.code",
      "position": [
        848,
        1216
      ]
    },
    {
      "id": "fbf5d0a1-ed19-49e0-9a6e-27bf506bedec",
      "name": "Anthropic Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        160,
        1264
      ]
    },
    {
      "id": "e7df68eb-4420-48b5-8465-b80c49f0122f",
      "name": "Calculate Project Totals4",
      "type": "n8n-nodes-base.code",
      "position": [
        -16,
        1552
      ]
    },
    {
      "id": "82b3f0eb-07d8-4a97-82a0-bbc38c7d040a",
      "name": "Enhance Excel Output",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        1712
      ]
    },
    {
      "id": "4d379a3c-ab28-450b-a7a1-0eb28b706376",
      "name": "Prepare Excel Data",
      "type": "n8n-nodes-base.code",
      "position": [
        192,
        1712
      ]
    },
    {
      "id": "a4d43d4c-ef26-4d96-b8df-88cdff94a9b3",
      "name": "Create Excel File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        352,
        1712
      ]
    },
    {
      "id": "36bb02f7-baba-48c7-aad7-4fe2b057e6be",
      "name": "Prepare Enhanced Prompts",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        1072
      ]
    },
    {
      "id": "32640ecd-b337-4745-bbe2-072e60163dcf",
      "name": "Parse Enhanced Response",
      "type": "n8n-nodes-base.code",
      "position": [
        624,
        1072
      ]
    },
    {
      "id": "62b7db30-b6f2-4608-bcd8-f866759bcf56",
      "name": "Read Excel File",
      "type": "n8n-nodes-base.readBinaryFile",
      "position": [
        -288,
        496
      ]
    },
    {
      "id": "40d06cd0-e57e-4d9d-8557-a06f64126d43",
      "name": "Parse Excel",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        -96,
        496
      ]
    },
    {
      "id": "5f385292-ebab-4c4f-92b9-15c7ee875e02",
      "name": "Setup - Define file paths",
      "type": "n8n-nodes-base.set",
      "position": [
        -272,
        -64
      ]
    },
    {
      "id": "c8ae79e4-3a12-4b9e-bcc2-129adf5ecf25",
      "name": "Create - Excel filename",
      "type": "n8n-nodes-base.set",
      "position": [
        -48,
        -64
      ]
    },
    {
      "id": "60bcb5b5-2f61-4314-94a2-7d0bf53427fe",
      "name": "Check - Does Excel file exist?",
      "type": "n8n-nodes-base.readBinaryFile",
      "position": [
        144,
        -64
      ]
    },
    {
      "id": "4a82e1e2-4c87-4132-82f0-bfcacf07ca38",
      "name": "If - File exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        304,
        -64
      ]
    },
    {
      "id": "3b60c81d-ec57-4183-b6e0-03fdf6636739",
      "name": "Extract - Run converter",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        64,
        144
      ]
    },
    {
      "id": "4bf02c30-f53f-4345-a564-9f6b8f7f8a14",
      "name": "Info - Skip conversion",
      "type": "n8n-nodes-base.set",
      "position": [
        496,
        -80
      ]
    },
    {
      "id": "3b014ecd-d104-4d18-8d78-260e45b9b61a",
      "name": "Check - Did extraction succeed?",
      "type": "n8n-nodes-base.if",
      "position": [
        272,
        144
      ]
    },
    {
      "id": "760e0a5b-86a1-4515-b5bb-58a88448eba5",
      "name": "Error - Show what went wrong",
      "type": "n8n-nodes-base.set",
      "position": [
        496,
        80
      ]
    },
    {
      "id": "977dcd47-8b05-4d18-9fa8-e8ce86ca6f8a",
      "name": "Set xlsx_filename after success",
      "type": "n8n-nodes-base.set",
      "position": [
        496,
        256
      ]
    },
    {
      "id": "04eb1693-ca61-4ec5-ad69-7993df0cb087",
      "name": "Merge - Continue workflow",
      "type": "n8n-nodes-base.merge",
      "position": [
        688,
        -16
      ]
    },
    {
      "id": "bc8164ab-2ae9-4e1d-b180-d492b1296473",
      "name": "Set Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        832,
        256
      ]
    },
    {
      "id": "28c70099-5314-4475-8ee0-0435a1e5ece8",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -480,
        -64
      ]
    },
    {
      "id": "b9899d95-37cf-4540-902b-dce17b8f90ec",
      "name": "Conversion Block",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        -240
      ],
      "parameters": {
        "width": 1912,
        "height": 660,
        "content": "## 🔄 Conversion Block\n\nAutomatic conversion of project files (Revit) to Excel.\n\n- Checks if Excel file exists\n- If not, runs the converter\n- If exists, skips conversion\n\nSimply: Converts project to da"
      }
    },
    {
      "id": "8e7df7b7-d4ab-499a-aacb-3e358e34da19",
      "name": "Data Loading Block",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        448
      ],
      "parameters": {
        "width": 1920,
        "height": 240,
        "content": "## 📊 Block 1: Data Loading and Processing\n\n- Reads Excel file from specified path\n- Extracts and cleans column headers\n- Analyzes headers using AI for aggregation rules (sum, mean, first)\n- Groups dat"
      }
    },
    {
      "id": "26af2822-394b-4746-bf11-7bd7c6a692c1",
      "name": "Element Classification Block",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        720
      ],
      "parameters": {
        "width": 1920,
        "height": 256,
        "content": "## 🏗️ Block 2: Element Classification\n\n- Searches for category fields (Category, IFC Type, etc.)\n- Uses AI to classify: building elements or annotations/drawings\n- Applies classification to data group"
      }
    },
    {
      "id": "2b8e5d57-8f51-41d4-8558-594d921e2311",
      "name": "Material Analysis Block",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        1008
      ],
      "parameters": {
        "width": 1920,
        "height": 448,
        "content": "\n## 🧪 Block 3: Material Analysis\n\n- Processes building elements in batches for optimization\n- Classifies materials by standards (EU, DE, US)\n- Determines quantity units (m³, m², kg, etc.)\n- Calculates"
      }
    },
    {
      "id": "ebc11ab6-d7db-4a1a-a46d-0938321d3c88",
      "name": "CO2 Calculation and Reporting Block",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        1488
      ],
      "parameters": {
        "width": 1920,
        "height": 416,
        "content": "## 🌍 Block 4: CO2 Calculation and Reporting\n\n- Calculates CO2 emissions based on materials, volumes, and factors\n- Creates visualization data (charts, graphs)\n- Generates reports: Markdown, HTML, Exce"
      }
    },
    {
      "id": "bcb4b571-4db5-4d91-b057-cf3f91f1c16b",
      "name": "Setup Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        -240
      ],
      "parameters": {
        "width": 336,
        "height": 384,
        "content": "## 📝 Setup Instructions\n\n1. In the 'Setup - Define file paths' node, specify:\n   - Path to converter (RvtExporter.exe)\n   - Path to project file (.rvt)\n   - Grouping parameter (group_by, e.g. 'Type Na"
      }
    },
    {
      "id": "3abb7e6c-6004-4da0-ba89-f36d893c495f",
      "name": "Important Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        160
      ],
      "parameters": {
        "width": 336,
        "height": 288,
        "content": "## ⚠️ Important Information\n\n- Pipeline uses AI (OpenAI, Grok, Anthropic) - check credits and limits.\n- Revit converter requires downloaded DDC_Converter_Revit\n- Data is aggregated by groups, volumes "
      }
    },
    {
      "id": "8d7c13c3-9044-45bc-9759-9baf1d175aa1",
      "name": "Prepare HTML Path",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        1552
      ]
    },
    {
      "id": "e4851576-a8ff-4618-ba9c-cae2ab579d5c",
      "name": "Write HTML to Project Folder",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [
        704,
        1552
      ]
    },
    {
      "id": "7bd64a70-7bc3-47d3-9db8-c766aec135d6",
      "name": "Open HTML in Browser",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        880,
        1552
      ]
    },
    {
      "id": "165b21cb-90a7-43e7-870c-036813bb60b6",
      "name": "Prepare Excel Path",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        1712
      ]
    },
    {
      "id": "e1e918c3-c5a3-4382-878a-5cdf19c1fd48",
      "name": "Write Excel to Project Folder",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [
        880,
        1712
      ]
    },
    {
      "id": "319e5fdf-1b31-48c6-9a8f-006c03fc23dd",
      "name": "Generate HTML Report",
      "type": "n8n-nodes-base.code",
      "position": [
        192,
        1552
      ]
    },
    {
      "id": "8d2144e0-ea60-46c3-ab58-1f2e3a988d2d",
      "name": "HTML to Binary",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        1552
      ]
    },
    {
      "id": "b3a16d39-4c38-4c35-b810-1eeb3325694f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        464
      ],
      "parameters": {
        "width": 340,
        "height": 116,
        "content": "⭐ **If you find our tools helpful**, please consider **starring our repository** on [GitHub](https://github.com/datadrivenconstruction/cad2data-Revit-IFC-DWG-DGN-pipeline-with-conversion-validation-qt"
      }
    },
    {
      "id": "3089d1b0-7633-44c4-81ec-16b06cd61369",
      "name": "Conversion Block1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        -352
      ],
      "parameters": {
        "width": 1064,
        "height": 96,
        "content": "# Carbon Footprint CO2 Estimator for Revit and IFC with AI (LLM)\nDataDrivenConstruction [GitHub](https://github.com/datadrivenconstruction/cad2data-Revit-IFC-DWG-DGN-pipeline-with-conversion-validatio"
      }
    },
    {
      "id": "6cdf5726-dbbc-420b-9feb-c00a007e2a25",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        304,
        1264
      ]
    },
    {
      "id": "f16d5db4-57a8-49fa-b678-d69b45e15d9a",
      "name": "xAI Grok Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatXAiGrok",
      "position": [
        480,
        1264
      ]
    },
    {
      "id": "ff1a82e6-2138-45f3-a51e-4ce140f718e1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -208
      ],
      "parameters": {
        "width": null,
        "height": 384,
        "content": "## ⬇️ Only modify the variables here  \n— everything else works automatically"
      }
    },
    {
      "id": "91417501-7993-4c62-bb22-095b30ce3c1a",
      "name": "On the standard 3D View",
      "type": "n8n-nodes-base.if",
      "position": [
        -256,
        768
      ]
    },
    {
      "id": "a607b5db-6257-4ba3-99b7-a31e5779e0ea",
      "name": "Non-3D View Elements Output",
      "type": "n8n-nodes-base.set",
      "position": [
        -80,
        848
      ]
    }
  ],
  "connections": {
    "Parse Excel": {
      "main": [
        [
          {
            "node": "Extract Headers and Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML to Binary": {
      "main": [
        [
          {
            "node": "Prepare HTML Path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Parameters": {
      "main": [
        [
          {
            "node": "Read Excel File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Excel File": {
      "main": [
        [
          {
            "node": "Parse Excel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent Enhanced": {
      "main": [
        [
          {
            "node": "Parse Enhanced Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Excel File": {
      "main": [
        [
          {
            "node": "Enhance Excel Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If - File exists?": {
      "main": [
        [
          {
            "node": "Info - Skip conversion",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract - Run converter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare HTML Path": {
      "main": [
        [
          {
            "node": "Write HTML to Project Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Accumulate Results": {
      "main": [
        [
          {
            "node": "Check If All Batches Done",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Excel Data": {
      "main": [
        [
          {
            "node": "Create Excel File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Excel Path": {
      "main": [
        [
          {
            "node": "Write Excel to Project Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Empty Values1": {
      "main": [
        [
          {
            "node": "Prepare Enhanced Prompts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect All Results": {
      "main": [
        [
          {
            "node": "Calculate Project Totals4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process in Batches1": {
      "main": [
        [
          {
            "node": "Clean Empty Values1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "xAI Grok Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent Enhanced",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Enhance Excel Output": {
      "main": [
        [
          {
            "node": "Prepare Excel Path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate HTML Report": {
      "main": [
        [
          {
            "node": "HTML to Binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Building Element1": {
      "main": [
        [
          {
            "node": "Process in Batches1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Non-Building Elements Output1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process AI Response1": {
      "main": [
        [
          {
            "node": "Group Data with AI Rules1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Category Fields1": {
      "main": [
        [
          {
            "node": "AI Classify Categories1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Info - Skip conversion": {
      "main": [
        [
          {
            "node": "Merge - Continue workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Analyze All Headers1": {
      "main": [
        [
          {
            "node": "Process AI Response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Classify Categories1": {
      "main": [
        [
          {
            "node": "Apply Classification to Groups1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create - Excel filename": {
      "main": [
        [
          {
            "node": "Check - Does Excel file exist?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract - Run converter": {
      "main": [
        [
          {
            "node": "Check - Did extraction succeed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On the standard 3D View": {
      "main": [
        [
          {
            "node": "Find Category Fields1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Non-3D View Elements Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Enhanced Response": {
      "main": [
        [
          {
            "node": "Accumulate Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Enhanced Prompts": {
      "main": [
        [
          {
            "node": "AI Agent Enhanced",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Project Totals4": {
      "main": [
        [
          {
            "node": "Generate HTML Report",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare Excel Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If All Batches Done": {
      "main": [
        [
          {
            "node": "Collect All Results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process in Batches1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Headers and Data1": {
      "main": [
        [
          {
            "node": "AI Analyze All Headers1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group Data with AI Rules1": {
      "main": [
        [
          {
            "node": "On the standard 3D View",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge - Continue workflow": {
      "main": [
        [
          {
            "node": "Set Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Setup - Define file paths": {
      "main": [
        [
          {
            "node": "Create - Excel filename",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error - Show what went wrong": {
      "main": [
        [
          {
            "node": "Merge - Continue workflow",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Write HTML to Project Folder": {
      "main": [
        [
          {
            "node": "Open HTML in Browser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check - Does Excel file exist?": {
      "main": [
        [
          {
            "node": "If - File exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply Classification to Groups1": {
      "main": [
        [
          {
            "node": "Is Building Element1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check - Did extraction succeed?": {
      "main": [
        [
          {
            "node": "Error - Show what went wrong",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set xlsx_filename after success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set xlsx_filename after success": {
      "main": [
        [
          {
            "node": "Merge - Continue workflow",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Setup - Define file paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}