{
  "id": "SN8IPZsF4ezEdP4z",
  "name": "Sonar Pro AI Assignment Evaluation with Multi-Deadline Reminders",
  "tags": [],
  "nodes": [
    {
      "id": "3ae96cfc-23c9-4619-af4c-6f73ec220e45",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        976,
        96
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "70a0c1e7-16b0-4d09-8c55-18d5619ad4ef",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        976,
        288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "abda9b85-fece-4c81-b3bb-e7e4284e973a",
      "name": "Webhook - Assignment Submission",
      "type": "n8n-nodes-base.webhook",
      "position": [
        992,
        608
      ],
      "parameters": {
        "path": "engineering-peer-eval",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "dd75a29c-993e-4f8b-a6a7-42bbd10bff5f",
      "name": "Extract Submission Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1184,
        608
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "={{ $json.body.student_id }}",
              "value": "={{ $json.body.student_id }}"
            },
            {
              "id": "={{ $json.body.assignment_file }}",
              "value": "={{ $json.body.assignment_file }}"
            },
            {
              "id": "={{ $json.body.course_code }}",
              "value": "={{ $json.body.course_code }}"
            },
            {
              "id": "={{ $json.body.assignment_title }}",
              "value": "={{ $json.body.assignment_title }}"
            },
            {
              "id": "={{ $json.body.peer_reviewers }}",
              "value": "={{ $json.body.peer_reviewers }}"
            },
            {
              "id": "={{ $json.body.deadline }}",
              "value": "={{ $json.body.deadline }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "63cdfbc2-7ceb-48a8-9921-4bec0ff7601a",
      "name": "Read Assignment File",
      "type": "n8n-nodes-base.readPDF",
      "position": [
        1360,
        608
      ],
      "parameters": {
        "binaryPropertyName": "={{ $json.assignment_file }}"
      },
      "typeVersion": 1
    },
    {
      "id": "0ab69570-bc79-4a49-9372-2ffda95a37d4",
      "name": "AI Evaluation - Technical Criteria",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1504,
        608
      ],
      "parameters": {
        "text": "=You are an engineering professor evaluating a student assignment. Analyze the following submission based on these ENGINEERING-SPECIFIC CRITERIA:\n\n**Technical Accuracy (30 points)**\n- Correct application of engineering principles\n- Accurate calculations and formulas\n- Proper units and dimensional analysis\n- Valid assumptions and constraints\n\n**Problem-Solving Methodology (25 points)**\n- Systematic approach to problem decomposition\n- Appropriate engineering tools/methods used\n- Quality of design/analysis process\n- Innovation and creativity in solutions\n\n**Documentation & Communication (20 points)**\n- Clear technical writing and explanations\n- Proper engineering notation and symbols\n- Quality of diagrams, schematics, or CAD drawings\n- Professional formatting and organization\n\n**Analysis & Critical Thinking (15 points)**\n- Depth of analysis and interpretation\n- Recognition of limitations and trade-offs\n- Consideration of practical constraints\n- Engineering judgment demonstrated\n\n**Code/Implementation Quality (10 points, if applicable)**\n- Code efficiency and optimization\n- Proper documentation and comments\n- Testing and validation approach\n- Adherence to engineering standards\n\nAssignment Content:\n{{ $json.data }}\n\nProvide a detailed evaluation with:\n1. Score for each criterion (with justification)\n2. Total score out of 100\n3. Specific strengths identified\n4. Areas for improvement with actionable feedback\n5. Overall assessment summary\n\nFormat the response as structured JSON.",
        "agent": "conversationalAgent",
        "options": {
          "systemMessage": "You are an expert engineering educator with 15+ years of experience evaluating student work across mechanical, electrical, civil, and software engineering disciplines."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "bf9412cc-3af5-4878-80a2-b1a914998539",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1648,
        816
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "94dbc235-e275-495b-ae55-d63af377dc8f",
      "name": "Store Evaluation Results",
      "type": "n8n-nodes-base.set",
      "position": [
        1776,
        608
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "={{ $json.student_id }}",
              "value": "={{ $('Extract Submission Data').item.json.student_id }}"
            },
            {
              "id": "={{ $json.course_code }}",
              "value": "={{ $('Extract Submission Data').item.json.course_code }}"
            },
            {
              "id": "={{ $json.assignment_title }}",
              "value": "={{ $('Extract Submission Data').item.json.assignment_title }}"
            },
            {
              "id": "={{ $json.ai_evaluation }}",
              "value": "={{ $json.output }}"
            },
            {
              "id": "={{ $json.evaluation_date }}",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "={{ $json.total_score }}",
              "value": "={{ $json.output.total_score }}"
            },
            {
              "id": "={{ $json.peer_reviewers }}",
              "value": "={{ $('Extract Submission Data').item.json.peer_reviewers }}"
            },
            {
              "id": "={{ $json.deadline }}",
              "value": "={{ $('Extract Submission Data').item.json.deadline }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6b6d447c-2287-41c8-afe1-827b8dd5a2f1",
      "name": "Split Peer Reviewers",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1936,
        560
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "peer_reviewers"
      },
      "typeVersion": 1
    },
    {
      "id": "515f185f-2338-43df-b601-28135f39f427",
      "name": "Create Evaluation Template",
      "type": "n8n-nodes-base.set",
      "position": [
        2080,
        560
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "={{ $json.reviewer_email }}",
              "value": "={{ $json.peer_reviewers }}"
            },
            {
              "id": "={{ $json.evaluation_template }}",
              "value": "=**PEER EVALUATION FORM - {{ $('Store Evaluation Results').item.json.course_code }}**\n\nAssignment: {{ $('Store Evaluation Results').item.json.assignment_title }}\nStudent ID: {{ $('Store Evaluation Results').item.json.student_id }}\nReviewer: {{ $json.peer_reviewers }}\nDeadline: {{ $('Store Evaluation Results').item.json.deadline }}\n\n---\n\n**EVALUATION CRITERIA:**\n\n1. Technical Accuracy (0-30 points)\n   - Engineering principles correctly applied?\n   - Calculations accurate?\n   - Units and dimensions correct?\n   Score: ___/30\n   Comments:\n\n2. Problem-Solving Methodology (0-25 points)\n   - Systematic approach used?\n   - Appropriate tools/methods?\n   - Creative solutions?\n   Score: ___/25\n   Comments:\n\n3. Documentation & Communication (0-20 points)\n   - Clear explanations?\n   - Professional formatting?\n   - Quality diagrams/drawings?\n   Score: ___/20\n   Comments:\n\n4. Analysis & Critical Thinking (0-15 points)\n   - Depth of analysis?\n   - Trade-offs considered?\n   - Engineering judgment?\n   Score: ___/15\n   Comments:\n\n5. Implementation Quality (0-10 points)\n   - Code/design quality?\n   - Testing approach?\n   - Standards compliance?\n   Score: ___/10\n   Comments:\n\n---\n\n**AI PRELIMINARY EVALUATION:**\nTotal Score: {{ $('Store Evaluation Results').item.json.total_score }}/100\n\nStrengths: {{ $('Store Evaluation Results').item.json.ai_evaluation.strengths.join(', ') }}\n\nAreas for Improvement: {{ $('Store Evaluation Results').item.json.ai_evaluation.improvements.join(', ') }}\n\n---\n\nPlease submit your evaluation by: {{ $('Store Evaluation Results').item.json.deadline }}\nSubmission Link: [Evaluation Form URL]"
            },
            {
              "id": "={{ $json.student_id }}",
              "value": "={{ $('Store Evaluation Results').item.json.student_id }}"
            },
            {
              "id": "={{ $json.assignment_title }}",
              "value": "={{ $('Store Evaluation Results').item.json.assignment_title }}"
            },
            {
              "id": "={{ $json.deadline }}",
              "value": "={{ $('Store Evaluation Results').item.json.deadline }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bf9a0291-f743-4b97-bf2d-814dcc1b4d6a",
      "name": "Send Teams Notification",
      "type": "n8n-nodes-base.microsoftTeams",
      "position": [
        2256,
        368
      ],
      "parameters": {
        "resource": "message"
      },
      "typeVersion": 2
    },
    {
      "id": "e5e4c276-b2c4-4296-967f-0681c32375c4",
      "name": "Send Discord Notification",
      "type": "n8n-nodes-base.discord",
      "position": [
        2256,
        560
      ],
      "parameters": {
        "content": "=**\ud83c\udf93 Peer Evaluation Assignment**\n\n@{{ $json.reviewer_email }}\n\nYou've been assigned to review:\n- **Assignment:** {{ $json.assignment_title }}\n- **Student:** {{ $json.student_id }}\n- **Deadline:** {{ $json.deadline }}\n\nAI Preliminary Score: {{ $('Store Evaluation Results').item.json.total_score }}/100\n\nPlease check your email for the complete evaluation template and submission link.",
        "guildId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "options": {},
        "resource": "message",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 2
    },
    {
      "id": "56aea28b-e448-4769-91b4-a98b54f6984b",
      "name": "Send Email with Template",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        2256,
        752
      ],
      "parameters": {
        "options": {
          "allowUnauthorizedCerts": false
        },
        "subject": "=Peer Evaluation Assignment - {{ $json.assignment_title }}",
        "toEmail": "={{ $json.reviewer_email }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "da00d68a-3cf0-4ab2-821d-a720436b598d",
      "name": "Save to Google Sheets - Grading",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1936,
        752
      ],
      "parameters": {
        "columns": {
          "value": {
            "status": "Pending Peer Review",
            "ai_score": "={{ $('Store Evaluation Results').item.json.total_score }}",
            "analysis": "={{ $('Store Evaluation Results').item.json.ai_evaluation.analysis }}",
            "student_id": "={{ $('Store Evaluation Results').item.json.student_id }}",
            "course_code": "={{ $('Store Evaluation Results').item.json.course_code }}",
            "documentation": "={{ $('Store Evaluation Results').item.json.ai_evaluation.documentation }}",
            "implementation": "={{ $('Store Evaluation Results').item.json.ai_evaluation.implementation }}",
            "evaluation_date": "={{ $('Store Evaluation Results').item.json.evaluation_date }}",
            "problem_solving": "={{ $('Store Evaluation Results').item.json.ai_evaluation.problem_solving }}",
            "assignment_title": "={{ $('Store Evaluation Results').item.json.assignment_title }}",
            "technical_accuracy": "={{ $('Store Evaluation Results').item.json.ai_evaluation.technical_accuracy }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Peer Evaluations"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "engineering-grades-sheet-id"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "05f1584b-1ee8-49d0-9aa4-8b59523265fe",
      "name": "Check Review Deadlines",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1152,
        192
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Pending Peer Review",
              "lookupColumn": "status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Peer Evaluations"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "engineering-grades-sheet-id"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "4b7c80b4-ee14-4113-8847-54db1b587096",
      "name": "Filter Approaching Deadlines",
      "type": "n8n-nodes-base.filter",
      "position": [
        1328,
        192
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "id": "deadline_check",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ new Date($json.deadline).getTime() - Date.now() }}",
              "rightValue": 172800000
            },
            {
              "id": "not_overdue",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ new Date($json.deadline).getTime() - Date.now() }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6add76c6-15a6-4bdc-8322-79dfe04e7aa5",
      "name": "Send Deadline Reminder - Teams",
      "type": "n8n-nodes-base.microsoftTeams",
      "position": [
        1552,
        0
      ],
      "parameters": {
        "resource": "message"
      },
      "typeVersion": 2
    },
    {
      "id": "cddfbdcf-b637-49c8-8588-15f665b10ffc",
      "name": "Send Deadline Reminder - Discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        1552,
        192
      ],
      "parameters": {
        "content": "=\u23f0 **DEADLINE REMINDER**\n\n**Assignment:** {{ $json.assignment_title }}\n**Student:** {{ $json.student_id }}\n**Deadline:** {{ $json.deadline }}\n\nYour peer evaluation is due in less than 48 hours! Please complete your review.",
        "guildId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "options": {},
        "resource": "message",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 2
    },
    {
      "id": "1a0937dc-69a0-4605-8064-14c05b08ea19",
      "name": "Send Deadline Reminder - Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1552,
        384
      ],
      "parameters": {
        "options": {},
        "subject": "=\u23f0 Reminder: Peer Evaluation Due Soon - {{ $json.assignment_title }}",
        "toEmail": "={{ $json.reviewer_email }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "891f0175-4e59-4622-a6c6-4a30a6dbe5cb",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2416,
        752
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"success\",\n  \"message\": \"Peer evaluation workflow initiated\",\n  \"student_id\": \"{{ $('Store Evaluation Results').item.json.student_id }}\",\n  \"assignment\": \"{{ $('Store Evaluation Results').item.json.assignment_title }}\",\n  \"ai_score\": {{ $('Store Evaluation Results').item.json.total_score }},\n  \"peer_reviewers_notified\": {{ $('Split Peer Reviewers').all().length }},\n  \"deadline\": \"{{ $('Store Evaluation Results').item.json.deadline }}\"\n}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "05d609e9-ddbf-4038-9b31-aec3a514a85f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -32
      ],
      "parameters": {
        "width": 672,
        "height": 784,
        "content": "## Introduction\nAutomate peer review assignment and grading with AI-powered evaluation. Designed for educators managing collaborative assessments efficiently.\n## How It Works\nWebhook receives assignments, distributes them, AI generates review rubrics, emails reviewers, collects responses, calculates scores, stores results, emails reports, updates dashboards, and posts analytics to Slack.\n## Workflow Template\nWebhook \u2192 Store Assignment \u2192 Distribute \u2192 Generate Review Rubric \u2192 Notify Slack \u2192 Email Reviewers \u2192 Prepare Response \u2192 Calculate Score \u2192 Store Results \u2192 Check Status \u2192 Generate Report \u2192 Email Report \u2192 Update Dashboard \u2192 Analytics \u2192 Post to Slack \u2192 Respond to Webhook\n## Workflow Steps\n1. Receive & Store: Webhook captures assignments, stores data.\n2. Distribute & Generate: Assigns peer reviewers, AI creates rubrics.\n3. Notify & Email: Alerts via Slack, sends review requests.\n4. Collect & Score: Gathers responses, calculates peer scores.\n5. Report & Update: Generates reports, emails results, updates dashboard.\n6. Analyze & Alert: Posts analytics to Slack, confirms completion.\n## Setup Instructions\n1. Webhook & Storage: Configure endpoint, set up database.\n2. AI Configuration: Add OpenAI key, customize rubric prompts.\n3. Communication: Connect Gmail, Slack credentials.\n4. Dashboard: Link analytics platform, configure metrics.\n## Prerequisites\n- OpenAI API key\n- Gmail account\n- Slack workspace\n- Database or storage system\n- Dashboard tool\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6f2c649e-1bc4-4fbe-b196-0f0213c0d643",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1504,
        816
      ],
      "parameters": {
        "model": "perplexity/sonar-pro",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4932a9e3-d18c-4b45-a686-381da89e6160",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        -16
      ],
      "parameters": {
        "color": 5,
        "width": 352,
        "height": 400,
        "content": "## Use Cases\n- University peer review assignments\n- Corporate training evaluations\n- Research paper assessments\n\n## Customization\n- Multi-round review cycles\n- Custom scoring algorithms\n- LMS integration (Canvas, Moodle)\n\n## Benefits\n- Eliminates manual distribution\n- Ensures consistent evaluation\n- Provides instant feedback and analytics"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3a5d4cce-fbe3-4843-8a3e-757e66e9482b",
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Check Review Deadlines",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Check Review Deadlines",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Assignment File": {
      "main": [
        [
          {
            "node": "AI Evaluation - Technical Criteria",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Peer Reviewers": {
      "main": [
        [
          {
            "node": "Create Evaluation Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Evaluation - Technical Criteria",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check Review Deadlines": {
      "main": [
        [
          {
            "node": "Filter Approaching Deadlines",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Submission Data": {
      "main": [
        [
          {
            "node": "Read Assignment File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email with Template": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Evaluation Results": {
      "main": [
        [
          {
            "node": "Split Peer Reviewers",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save to Google Sheets - Grading",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Evaluation - Technical Criteria",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Create Evaluation Template": {
      "main": [
        [
          {
            "node": "Send Teams Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Discord Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Email with Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Approaching Deadlines": {
      "main": [
        [
          {
            "node": "Send Deadline Reminder - Teams",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Deadline Reminder - Discord",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Deadline Reminder - Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Assignment Submission": {
      "main": [
        [
          {
            "node": "Extract Submission Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Evaluation - Technical Criteria": {
      "main": [
        [
          {
            "node": "Store Evaluation Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}