{
  "name": "Predict F1 Race Winners with OpenAI GPT-4o, Historical Data & Slack Alerts",
  "nodes": [
    {
      "id": "ac0d98a1-34d1-4da5-9f18-e128775b754d",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1456,
        784
      ]
    },
    {
      "id": "326f30b7-ebb4-482a-af1d-6f54c22ade95",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1296,
        784
      ]
    },
    {
      "id": "a3ae51ae-5f82-4d1c-a7be-b99cbcab0cbb",
      "name": "Fetch Current F1 Season Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1056,
        496
      ]
    },
    {
      "id": "f2314633-09a3-4713-81a5-2b03870e15df",
      "name": "Fetch Driver Standings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1056,
        688
      ]
    },
    {
      "id": "85d690ca-12ae-4f7a-88f7-af8861365781",
      "name": "Fetch Constructor Standings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1056,
        1008
      ]
    },
    {
      "id": "7c486d1f-838c-40e7-8d19-df4acf11131a",
      "name": "Merge F1 Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -832,
        592
      ]
    },
    {
      "id": "a628c315-cce2-4847-a617-7893235b987d",
      "name": "F1 Prediction Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -384,
        480
      ]
    },
    {
      "id": "5e28f4ef-69a7-4cd4-ab56-8d55f4f1fc65",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -528,
        816
      ]
    },
    {
      "id": "052bee4d-cedc-4bd7-ba0c-749fd6d5f8e8",
      "name": "Real-Time F1 News Tool",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -432,
        704
      ]
    },
    {
      "id": "0ba84859-71cd-49fc-9b70-f91ef01f3304",
      "name": "Weather Data Tool",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -304,
        704
      ]
    },
    {
      "id": "e2b834d2-3b27-4f5a-83c1-0b62f00a9780",
      "name": "Format Prediction Output",
      "type": "n8n-nodes-base.set",
      "position": [
        320,
        512
      ]
    },
    {
      "id": "e7d272dc-8cb0-4272-a543-8edf00fa6b59",
      "name": "Fetch Historical Race Results",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1056,
        848
      ]
    },
    {
      "id": "30113435-ebf2-4280-a9c2-13d045950fbc",
      "name": "Fetch Qualifying Results",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1056,
        1200
      ]
    },
    {
      "id": "338ec321-f8c6-4627-9bfd-3dfa0d05a309",
      "name": "Fetch Circuit Information",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1056,
        1392
      ]
    },
    {
      "id": "c066baf6-02ee-4ed2-a609-e221fc607352",
      "name": "Historical Data Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        336,
        1152
      ]
    },
    {
      "id": "cc23bbd6-913a-4e31-91e6-296a6067d506",
      "name": "OpenAI Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -192,
        848
      ]
    },
    {
      "id": "b4e75689-fda5-4c51-9fa6-ac1589aca12d",
      "name": "Document Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        544,
        1296
      ]
    },
    {
      "id": "f97fb1dc-a132-4117-b7fd-727f6c10ea64",
      "name": "Recursive Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        544,
        1408
      ]
    },
    {
      "id": "aa9f47f4-5791-40ad-9548-35f371d683ac",
      "name": "Historical Data Retrieval Tool",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        -176,
        704
      ]
    },
    {
      "id": "51ae0cae-2af1-47a4-9fd1-1d5c6a199bf2",
      "name": "Calculate Driver Performance Metrics",
      "type": "n8n-nodes-base.code",
      "position": [
        -512,
        1120
      ]
    },
    {
      "id": "619b5d04-e9fd-446b-bdae-03ef2a936947",
      "name": "Check Prediction Confidence",
      "type": "n8n-nodes-base.if",
      "position": [
        624,
        512
      ]
    },
    {
      "id": "11b7c328-fbce-4c81-8323-64e267a5fa80",
      "name": "Store Prediction in Database",
      "type": "n8n-nodes-base.postgres",
      "position": [
        848,
        416
      ]
    },
    {
      "id": "58ade5fc-bb26-43f7-b9a7-d494f09eed34",
      "name": "Send High Confidence Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        848,
        608
      ]
    },
    {
      "id": "f5101f59-88c2-467e-ae81-20dd29e11284",
      "name": "Log to Prediction Tracker",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        848,
        800
      ]
    },
    {
      "id": "5f44490c-ced5-4c88-a800-4e6e791c5d15",
      "name": "Aggregate Historical Data",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -848,
        976
      ]
    },
    {
      "id": "b493d9bd-d55a-403c-b6aa-9b6f1adfa613",
      "name": "Statistical Analysis Tool",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        112,
        640
      ]
    },
    {
      "id": "eca22c3b-2970-4fbf-b99e-95650797f563",
      "name": "OpenAI Embeddings1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        336,
        1344
      ]
    },
    {
      "id": "23512903-7148-42c2-838b-ae46e90fc9cb",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        -32
      ],
      "parameters": {
        "width": 448,
        "height": 288,
        "content": "## How It Works\nEvery day at 8 AM, the workflow automatically retrieves the latest F1 data—including driver standings, qualifying results, race schedules, and circuit information. All sources are merg"
      }
    },
    {
      "id": "13cbacbe-a977-4acc-affe-97c9afdde95f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -32
      ],
      "parameters": {
        "width": 624,
        "height": 288,
        "content": "## Setup Steps\n1. Update the workflow configuration with: `newsApiUrl`, `weatherApiUrl`, `historicalYears`, and `confidenceThreshold`.\n2. Connect PostgreSQL using the schema:\n   **prediction_date, pre"
      }
    },
    {
      "id": "567cb0ba-8843-411c-b454-e31814333baa",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        160
      ],
      "parameters": {
        "width": 576,
        "height": 112,
        "content": "## Use Cases\nApplicable for sports analytics dashboards, betting platforms, F1 news sites, and fantasy F1 leagues. Provides daily race predictions with confidence scores "
      }
    },
    {
      "id": "271b72d8-657d-4908-aeb5-023d99239d0b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        144
      ],
      "parameters": {
        "width": 400,
        "height": 128,
        "content": "## Customization\nExtend by adding constructor predictions (modify AI prompt). Integrate Discord or Teams instead of Slack.\n\n"
      }
    },
    {
      "id": "384d4620-82c8-4d56-a663-551035d3ada5",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        144
      ],
      "parameters": {
        "width": 400,
        "height": 128,
        "content": "\n## Benefits\nSaves time by automating data collection, improves accuracy using multiple performance metrics and historical patterns."
      }
    },
    {
      "id": "091c0237-ef60-4b13-b5f0-402b659c1676",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        304
      ],
      "parameters": {
        "width": 576,
        "height": 1216,
        "content": "##  Data Collection\n\nRetrieves live F1 standings, historical results, qualifying data, and circuit info via the Ergast API.\n\n**Why:** Fresh, multi-source data is vital. Standings show driver momentum,"
      }
    },
    {
      "id": "568517f0-ae58-4969-996f-eefb668baf6e",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        304
      ],
      "parameters": {
        "width": 256,
        "height": 864,
        "content": "## Data Processing\n\nMerges data and calculates 8 driver metrics, including podium rate, consistency, and recent form.\n\n**Why:** Metrics reveal patterns raw data  "
      }
    },
    {
      "id": "b864770c-1c47-46b4-8dbf-1ec9fdcb47ac",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        304
      ],
      "parameters": {
        "width": 848,
        "height": 656,
        "content": "## AI Prediction\n\nA LangChain agent (GPT-4o) analyzes the dataset with historical context, news, and weather, outputting a winner prediction with confidence.\n\n**Why:** AI synthesizes complex data at s"
      }
    },
    {
      "id": "e5be296b-8ab8-468e-a099-7cade2d9ee53",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        304
      ],
      "parameters": {
        "width": 816,
        "height": 656,
        "content": "## Confidence Validation\n\nCompares scores against a 0.75 threshold; high-confidence predictions move to alerts and storage \n\n**Why:** Reduces alert fatigue and ensures only reliable insights are acted"
      }
    },
    {
      "id": "d2bc78ca-b6a1-4a26-adab-04adc768b23a",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        976
      ],
      "parameters": {
        "width": 736,
        "height": 304,
        "content": "## Driver Performance Metrics\nCalculates 8 advanced metrics (podium rate, consistency score, recent form, DNF rate, points per race, average positions). Why: Raw standings don't capture true performan"
      }
    },
    {
      "id": "b93ff098-080b-479d-946b-cf71eb1c7ba6",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        976
      ],
      "parameters": {
        "width": 944,
        "height": 560,
        "content": "## Historical Data Vectorization Pipeline\nTransforms 3 years of F1 historical data into searchable embeddings via OpenAI. Document Loader ingests raw data, Recursive Text Splitter chunks information i"
      }
    }
  ],
  "connections": {
    "Merge F1 Data": {
      "main": [
        [
          {
            "node": "F1 Prediction Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document Loader": {
      "ai_document": [
        [
          {
            "node": "Historical Data Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "F1 Prediction Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Historical Data Retrieval Tool",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Weather Data Tool": {
      "ai_tool": [
        [
          {
            "node": "F1 Prediction Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Embeddings1": {
      "ai_embedding": [
        [
          {
            "node": "Historical Data Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "F1 Prediction Agent": {
      "main": [
        [
          {
            "node": "Format Prediction Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Driver Standings": {
      "main": [
        [
          {
            "node": "Merge F1 Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Real-Time F1 News Tool": {
      "ai_tool": [
        [
          {
            "node": "F1 Prediction Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Current F1 Season Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Driver Standings",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Constructor Standings",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Historical Race Results",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Qualifying Results",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Circuit Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Document Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Qualifying Results": {
      "main": [
        [
          {
            "node": "Aggregate Historical Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Prediction Output": {
      "main": [
        [
          {
            "node": "Check Prediction Confidence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Historical Data": {
      "main": [
        [
          {
            "node": "Calculate Driver Performance Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Circuit Information": {
      "main": [
        [
          {
            "node": "Aggregate Historical Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Statistical Analysis Tool": {
      "ai_tool": [
        [
          {
            "node": "F1 Prediction Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Check Prediction Confidence": {
      "main": [
        [
          {
            "node": "Send High Confidence Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Prediction in Database",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log to Prediction Tracker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Constructor Standings": {
      "main": [
        [
          {
            "node": "Merge F1 Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Current F1 Season Data": {
      "main": [
        [
          {
            "node": "Merge F1 Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Historical Race Results": {
      "main": [
        [
          {
            "node": "Aggregate Historical Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Historical Data Retrieval Tool": {
      "ai_tool": [
        [
          {
            "node": "F1 Prediction Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Driver Performance Metrics": {
      "main": [
        [
          {
            "node": "Historical Data Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}