{
  "name": "Normalize and validate CSV data with Anthropic/OpenAI, Postgres, Slack and Sheets",
  "nodes": [
    {
      "id": "55c614fc-b469-44f4-b501-716457a7fcce",
      "name": "CSV Upload Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2096,
        224
      ]
    },
    {
      "id": "72dec0b7-ae86-48ac-b700-b141198bd745",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1760,
        224
      ]
    },
    {
      "id": "81c17ab9-dcfe-4722-bec0-1be96785ccf7",
      "name": "Check File Type",
      "type": "n8n-nodes-base.if",
      "position": [
        -1600,
        224
      ]
    },
    {
      "id": "4acb6b44-47f0-4122-9416-3c51ef52bb14",
      "name": "Extract CSV Data",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -1344,
        128
      ]
    },
    {
      "id": "381d7195-36b0-4c16-89ee-5747e8505855",
      "name": "Error - Unsupported File Type",
      "type": "n8n-nodes-base.set",
      "position": [
        -1360,
        320
      ]
    },
    {
      "id": "a3ccc159-930d-4903-9fed-6e95655620f0",
      "name": "Schema Inference & Header Normalization",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1088,
        128
      ]
    },
    {
      "id": "1722f80b-d02b-4d11-b42a-7715e3adc295",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -1088,
        448
      ]
    },
    {
      "id": "e557957c-9ce1-4f85-bfbb-7546a7048ebb",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -944,
        448
      ]
    },
    {
      "id": "aebf766d-9e13-468c-bf19-6c8d02ff4f56",
      "name": "Apply Normalization & Type Coercion",
      "type": "n8n-nodes-base.code",
      "position": [
        -736,
        128
      ]
    },
    {
      "id": "abecb0db-7796-4bf7-9276-4d9c654eed7e",
      "name": "Validate Data Quality",
      "type": "n8n-nodes-base.code",
      "position": [
        -512,
        128
      ]
    },
    {
      "id": "83fc4ccf-8d59-423f-bf2c-866129ca05c3",
      "name": "Prepare Clean CSV Output",
      "type": "n8n-nodes-base.set",
      "position": [
        -288,
        32
      ]
    },
    {
      "id": "86d9b91e-09a4-48f4-a354-6eac8b9768ef",
      "name": "Insert into Postgres",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -64,
        32
      ]
    },
    {
      "id": "6997f71b-82f5-4069-b444-6ae915ec8529",
      "name": "Generate Error Report",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        480
      ]
    },
    {
      "id": "bf64d4a2-7ff0-4380-8e9a-d705e64cc339",
      "name": "Send Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        160,
        32
      ]
    },
    {
      "id": "1c5b987a-9054-4822-aef5-dfb990338980",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -16,
        480
      ]
    },
    {
      "id": "20d8d06f-a9d4-4539-8a0b-c7790b21f437",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2176,
        64
      ],
      "parameters": {
        "width": 320,
        "height": 320,
        "content": "## Upload Trigger\nReceives CSV file via webhook for processing."
      }
    },
    {
      "id": "e69d373d-5786-4ef9-9d2a-be9698c58883",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -112
      ],
      "parameters": {
        "width": 384,
        "height": 320,
        "content": "## Database Insert\nStores cleaned data into Postgres table and notify user"
      }
    },
    {
      "id": "3dfd6dec-9db1-4414-a212-aaf171579352",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        336
      ],
      "parameters": {
        "width": 448,
        "height": 320,
        "content": "## Error Handling\nGenerates error report for invalid or failed rows and Logs errors and reports into Google Sheets."
      }
    },
    {
      "id": "81f4ae28-c4a5-44d6-a6dc-b5c90eda80d0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        0
      ],
      "parameters": {
        "width": 416,
        "height": 320,
        "content": "## Data Normalization and Validation\nCleans data, converts types, and standardizes formats and Checks quality, detects errors, missing values, and outliers."
      }
    },
    {
      "id": "aecd603c-4d70-4bf8-8049-523ae5e3dd6d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        -16
      ],
      "parameters": {
        "width": 320,
        "height": 320,
        "content": "## Schema Detection\nAI infers schema, types, and normalizes column names."
      }
    },
    {
      "id": "33ade988-85d3-4325-9a52-943bee03c93c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        -96
      ],
      "parameters": {
        "width": 256,
        "height": 608,
        "content": "## CSV Extraction\nParses CSV file into structured rows for processing."
      }
    },
    {
      "id": "3f2b7dee-3d87-42b2-ade8-1e5f2e24ce9b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1792,
        64
      ],
      "parameters": {
        "width": 336,
        "height": 320,
        "content": "## Configuration\nDefines Postgres table, error threshold, and Slack channel and Checks if uploaded file is a valid CSV format."
      }
    },
    {
      "id": "2be20044-a5f7-4af4-89db-73772dc6912c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2832,
        80
      ],
      "parameters": {
        "width": 496,
        "height": 464,
        "content": "## How it works\nThis workflow processes CSV files via webhook upload. It validates the file, extracts data, and uses AI to detect schema and standardize columns. The data is cleaned, normalized, and c"
      }
    }
  ],
  "connections": {
    "Check File Type": {
      "main": [
        [
          {
            "node": "Extract CSV Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error - Unsupported File Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract CSV Data": {
      "main": [
        [
          {
            "node": "Schema Inference & Header Normalization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CSV Upload Webhook": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Schema Inference & Header Normalization",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Insert into Postgres": {
      "main": [
        [
          {
            "node": "Send Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Error Report": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Data Quality": {
      "main": [
        [
          {
            "node": "Prepare Clean CSV Output",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate Error Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Check File Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Clean CSV Output": {
      "main": [
        [
          {
            "node": "Insert into Postgres",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Schema Inference & Header Normalization",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Error - Unsupported File Type": {
      "main": [
        [
          {
            "node": "Generate Error Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply Normalization & Type Coercion": {
      "main": [
        [
          {
            "node": "Validate Data Quality",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schema Inference & Header Normalization": {
      "main": [
        [
          {
            "node": "Apply Normalization & Type Coercion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}