{
  "id": "oYrTphNZqfYV6uJX",
  "name": "AI Sonar-Reasoning Powered GCE O-Level Math Topic Analysis & Prediction",
  "tags": [],
  "nodes": [
    {
      "id": "816a5f56-ea2b-49ff-b42b-4661716ee3d5",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        656,
        -16
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b6013e58-fbe9-482c-b7c6-327735bca79d",
      "name": "Fetch O-Level Math Syllabus",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        -112
      ],
      "parameters": {
        "url": "https://www.seab.gov.sg/docs/default-source/national-examinations/syllabus/olevel/2025syllabus/4048_y25_sy.pdf",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "5c7e686f-72c9-48f0-a3b5-1e2b7d99b9ed",
      "name": "Extract Syllabus Text",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1104,
        -112
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1
    },
    {
      "id": "3655c347-a6d6-4d5b-a7dc-e1c552ddf75b",
      "name": "Prepare Analysis Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1296,
        -112
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "syllabus_content",
              "type": "string",
              "value": "={{ $json.data }}"
            },
            {
              "id": "a2",
              "name": "analysis_year",
              "type": "number",
              "value": "=2025"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "85229eea-e100-45a1-967e-bad53795037e",
      "name": "Load Historical Context",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b1",
              "name": "historical_topics",
              "type": "string",
              "value": "=Algebra (equations, inequalities, functions), Geometry (congruence, similarity, circle theorems), Trigonometry (ratios, identities, graphs), Statistics (data analysis, probability), Number patterns (sequences, series), Mensuration (area, volume, surface area), Coordinate geometry (gradients, equations of lines), Vectors (operations, applications), Matrices (operations, transformations), Sets (Venn diagrams, operations)"
            },
            {
              "id": "b2",
              "name": "challenging_areas",
              "type": "string",
              "value": "=Circle theorems and angle properties, Trigonometric identities and proofs, Probability with multiple events, Algebraic manipulation and factorization, Application problems requiring multi-step reasoning"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b9fccdae-a80e-4091-a9ae-0feaab9bac1d",
      "name": "AI Analysis Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1520,
        -16
      ],
      "parameters": {
        "text": "=You are an expert educational analyst specializing in GCE O-Level Mathematics examinations in Singapore.\n\nAnalyze the following syllabus content and provide a comprehensive exam analysis:\n\n**Syllabus Content:**\n{{ $('Prepare Analysis Data').item.json.syllabus_content }}\n\n**Historical Context:**\nRecurring Topics: {{ $('Load Historical Context').item.json.historical_topics }}\nChallenging Areas: {{ $('Load Historical Context').item.json.challenging_areas }}\n\n**Required Output Structure (JSON format):**\n```json\n{\n  \"exam_summary\": {\n    \"year\": 2025,\n    \"total_marks\": \"Paper 1 + Paper 2 distribution\",\n    \"key_changes\": \"Notable syllabus changes for 2025\"\n  },\n  \"top_10_recurring_topics\": [\n    {\n      \"rank\": 1,\n      \"topic\": \"Topic name\",\n      \"frequency_percentage\": 85,\n      \"typical_question_types\": \"Description\"\n    }\n  ],\n  \"top_5_challenging_areas\": [\n    {\n      \"rank\": 1,\n      \"area\": \"Area name\",\n      \"difficulty_reason\": \"Why students struggle\",\n      \"success_tips\": \"Brief study advice\"\n    }\n  ],\n  \"topic_weightage\": {\n    \"algebra\": {\"percentage\": 25, \"marks_range\": \"25-30 marks\"},\n    \"geometry\": {\"percentage\": 20, \"marks_range\": \"20-25 marks\"},\n    \"trigonometry\": {\"percentage\": 15, \"marks_range\": \"15-20 marks\"},\n    \"statistics\": {\"percentage\": 20, \"marks_range\": \"20-25 marks\"},\n    \"number_patterns\": {\"percentage\": 10, \"marks_range\": \"10-15 marks\"},\n    \"others\": {\"percentage\": 10, \"marks_range\": \"10-15 marks\"}\n  },\n  \"predicted_questions\": [\n    {\n      \"prediction_number\": 1,\n      \"paper\": \"Paper 1 or Paper 2\",\n      \"topic_combination\": \"Topics involved\",\n      \"question_type\": \"Description of question format\",\n      \"confidence_score\": 85,\n      \"reasoning\": \"Why this is likely based on patterns\"\n    }\n  ]\n}\n```\n\nProvide detailed, actionable insights based on historical exam patterns and the 2025 syllabus emphasis.",
        "options": {
          "systemMessage": "You are a GCE O-Level Mathematics exam specialist with deep knowledge of Singapore's education system, syllabus trends, and student learning patterns. Provide accurate, evidence-based analysis."
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "8270de30-9c03-4711-a9e9-bae4bf2c9243",
      "name": "Parse AI Output",
      "type": "n8n-nodes-base.set",
      "position": [
        1792,
        -16
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "cce94e46-d2a1-4624-8d08-25be02ce4c1f",
      "name": "Format Report",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1952,
        -16
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a3c4b303-c81c-41b9-b770-2abb1568c22e",
      "name": "Convert to HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        2112,
        -16
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "f56cd26a-aedc-42e8-9ecd-c119d892e4db",
      "name": "Publish to WordPress",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        2288,
        -16
      ],
      "parameters": {
        "title": "=GCE O-Level Math Predictions {{ $('Prepare Analysis Data').item.json.analysis_year }}",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "79d45a5b-7988-47c7-aae9-fc3c64fee16b",
      "name": "Send Slack Summary",
      "type": "n8n-nodes-base.slack",
      "position": [
        2480,
        -16
      ],
      "parameters": {
        "text": "=\ud83c\udf93 *GCE O-Level Mathematics Exam Analysis {{ $('Prepare Analysis Data').item.json.analysis_year }} - Now Available!*\n\n\ud83d\udcca *Key Highlights:*\n\u2022 Top 10 recurring topics identified\n\u2022 5 challenging areas with success tips\n\u2022 Topic weightage breakdown\n\u2022 5 predicted question types with confidence scores\n\n\ud83d\udcdd *Top 3 Predicted Topics:*\n{{ $('Parse AI Output').item.json.predicted_questions.slice(0, 3).map((p, i) => `${i + 1}. ${p.topic_combination} (${p.confidence_score}% confidence)`).join('\\n') }}\n\n\ud83d\udd17 Full report published to WordPress\n\n_Analysis based on 2025 syllabus and historical exam patterns_",
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "22696c5f-9c7d-489e-a6ef-f3d94b0197a4",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1520,
        160
      ],
      "parameters": {
        "model": "perplexity/sonar-reasoning",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e5a1c828-8bda-4c3c-87b2-55b02cc026ac",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        176
      ],
      "parameters": {
        "width": 752,
        "height": 544,
        "content": "## **Introduction**\nExams create significant stress for students. This workflow automates syllabus analysis and predicts exam trends using AI, helping educators and students better prepare for GCE 'O' Level Mathematics in Singapore.\n\n## **How It Works**\nTrigger \u2192 Fetch Syllabus \u2192 Extract & Prepare Data \u2192 Load History \u2192 AI Analyze \u2192 Parse \u2192 Format \u2192 Convert \u2192 Publish \u2192 Notify\n\n## **Workflow Template**\nManual Trigger \u2192 Fetch O-Level Math Syllabus \u2192 Extract Syllabus Text \u2192 Prepare Analysis Data \u2192 Load Historical Context \u2192 AI Analysis Agent \u2192 Parse AI Output \u2192 Format Report \u2192 Convert to HTML \u2192 Publish to WordPress \u2192 Send Slack Summary\n\n## **Data Collection & AI Processing**\nHTTP retrieves O-Level Math syllabus from SEAB and extracts text. Loads 3-5 years exam history. OpenRouter compares syllabus vs trends, predicts topics with confidence scores.\n\n## **Report Generation & Publishing**\nFormats AI insights to Markdown (topics, trends, recommendations), converts to HTML. Auto-publishes to WordPress and sends Slack summary with report link.\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "15fbf510-bf4e-488d-b2a6-781dae32ba07",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        144
      ],
      "parameters": {
        "color": 4,
        "width": 592,
        "height": 656,
        "content": "## **Workflow Steps**\n1. Fetch & extract syllabus from SEAB site\n2. Load historical exam content\n3. AI analyzes syllabus + trends via OpenRouter model\n4. Parse and format AI output to Markdown/HTML\n5. Auto-publish report to WordPress and Slack\n\n## **Setup Instructions**\n1. Connect HTTP node to SEAB syllabus URL\n2. Configure OpenRouter AI model with API key\n3. Set WordPress and Slack credentials for publishing\n\n## **Prerequisites**\nOpenRouter account, WordPress API access, Slack webhook, SEAB syllabus link.\n\n## **Use Cases**\nPredict 2025 GCE Math topics, generate AI insights, publish summaries for educators.\n\n## **Customization**\nAdapt for other subjects or boards by changing syllabus source and analysis prompt.\n\n## **Benefits**\nEnables fast, data-driven exam forecasting and automated report publication."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "42c008fc-1542-4479-8605-e8c219b2ec73",
  "connections": {
    "Format Report": {
      "main": [
        [
          {
            "node": "Convert to HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Fetch O-Level Math Syllabus",
            "type": "main",
            "index": 0
          },
          {
            "node": "Load Historical Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to HTML": {
      "main": [
        [
          {
            "node": "Publish to WordPress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Output": {
      "main": [
        [
          {
            "node": "Format Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Analysis Agent": {
      "main": [
        [
          {
            "node": "Parse AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish to WordPress": {
      "main": [
        [
          {
            "node": "Send Slack Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Syllabus Text": {
      "main": [
        [
          {
            "node": "Prepare Analysis Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Analysis Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Analysis Data": {
      "main": [
        [
          {
            "node": "AI Analysis Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Historical Context": {
      "main": [
        [
          {
            "node": "AI Analysis Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch O-Level Math Syllabus": {
      "main": [
        [
          {
            "node": "Extract Syllabus Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}