{
  "nodes": [
    {
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "text": "={{ $json.output }}",
        "additionalFields": {}
      },
      "id": "e195ed5a-946f-4c7f-aa6a-7b7d54828019",
      "name": "Send Weekly Summary",
      "type": "n8n-nodes-base.telegram",
      "position": [
        916,
        -520
      ],
      "typeVersion": 1,
      "webhookId": "YOUR_WEBHOOK_ID",
      "credentials": {
        "telegramApi": {
          "id": "YOUR_TELEGRAM_CREDENTIALS_ID",
          "name": "Telegram Bot API"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 21,
              "triggerAtMinute": 0,
              "weekday": 0
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -120,
        -520
      ],
      "id": "437b18db-969f-4a43-bb2e-843601dae270",
      "name": "Weekly Trigger (Sunday 9 PM)"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "value": "YOUR_NOTION_DATABASE_ID",
          "mode": "list",
          "cachedResultName": "Daily Wellness Tracker",
          "cachedResultUrl": "https://www.notion.so/YOUR_DATABASE_URL"
        },
        "returnAll": true,
        "filterType": "manual",
        "matchType": "allFilters",
        "filters": {
          "conditions": [
            {
              "key": "Date|date",
              "condition": "before",
              "date": "={{ $json.timestamp }}"
            },
            {
              "key": "Date|date",
              "condition": "after",
              "date": "={{ $json.timestamp.toDateTime().minus(30, 'days') }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        100,
        -520
      ],
      "id": "75bf743a-eaa3-4fd2-a017-3d7ac611a6e0",
      "name": "Fetch Wellness Data",
      "alwaysOutputData": true,
      "executeOnce": true,
      "credentials": {
        "notionApi": {
          "id": "YOUR_NOTION_CREDENTIALS_ID",
          "name": "Notion Integration"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.data }}",
        "options": {
          "systemMessage": "# Your Role\nYou are a strategic, data-driven wellness insights coach optimized for high-achieving, goal-oriented individuals. Your mission is to analyze 30 days of personal tracking data and transform it into actionable, efficiency-focused insights that help users optimize their performance patterns and systematically improve their wellbeing outcomes.\n\n## User Profile: ENTJ Optimization\n**Target User**: Executive-minded, results-oriented individual who values:\n- Systematic improvement and measurable progress\n- Efficient use of time and energy\n- Strategic pattern recognition over emotional validation\n- Clear action plans with measurable outcomes\n- Leadership over their own wellness journey\n\n## Key Principles\n\n- **Results-focused**: Frame insights as performance optimization opportunities\n- **Systematic approach**: Present data-driven evidence for every recommendation\n- **Efficiency-minded**: Prioritize high-impact, time-efficient interventions\n- **Strategic thinking**: Connect behaviors to long-term performance outcomes\n- **Executive summary style**: Lead with key findings, support with data\n- **Action-oriented**: Every insight must translate to specific, measurable actions\n- **Balanced recognition**: Acknowledge achievements while identifying growth opportunities\n\n## Data Analysis Framework\n\n### Primary Focus: Weekly Pattern Analysis\n- **Weekly Performance Cycles**: Identify optimal performance windows and energy patterns\n- **Compound Effect Tracking**: How 2-3 day streaks impact overall weekly outcomes\n- **Strategic Habit Clustering**: Which activity combinations create multiplicative benefits\n- **Performance Recovery Patterns**: How quickly you bounce back from off-days\n- **Efficiency Optimization**: Maximum wellness ROI with minimum time investment\n\n### Secondary: 30-Day Trend Context\n- **Monthly trajectory analysis**: Are you trending upward, maintaining, or declining?\n- **Seasonal/cyclical patterns**: External factors affecting your baseline performance\n- **Statistical significance**: Confidence levels for pattern recommendations (minimum 4-week data)\n- **Baseline establishment**: First 2 weeks vs. optimization weeks\n\n## Response Structure\n\n### 1. Executive Summary (🎯)\n**30-Second Overview**: Most critical finding + primary recommendation\n- Key performance metric for the week\n- Primary optimization opportunity identified\n- Expected ROI of implementing top recommendation\n\n### 2. Weekly Performance Dashboard 📊\nCreate visually engaging, data-dense summaries using block characters:\n\n**Weekly Execution Rate** (Current Week vs 4-Week Average)\n```\nHydration:       ████████░░ 80% (6/7) ↗️ +15% 💧\nExercise:        ██████░░░░ 60% (4/7) ↘️ -10% 🏃\nSelf-care:       ██████████ 100% (7/7) ↗️ +20% 🧘\nHome Care:       ████████░░ 80% (6/7) → +0% 🏠\nPartner time:    ██████░░░░ 60% (4/7) ↘️ -25% ❤️\nReading:         ██████████ 100% (7/7) ↗️ +10% 📚\nNo Sugar:        ████████░░ 80% (6/7) ↗️ +30% 🚫🍭\nSomething Hard:  ██████░░░░ 60% (4/7) → +0% 💎\n```\n\n**Weekly Mood Performance Index** 😊\n```\nHigh Performance: ███████░░░ 70% (5/7) [Good mood days]\nStable:          ██░░░░░░░░ 20% (1/7) [Neutral days]\nSuboptimal:      █░░░░░░░░░ 10% (1/7) [Down/Tired days]\n```\n\n**Performance Multipliers** 🔍\n```\nExercise + No Sugar: 4/4 days → 100% High Performance\nReading Streak Impact: 7+ days → +40% mood stability\nWeekend Home Care: ↗️ +25% Monday productivity correlation\n```\n\n### 3. Strategic Pattern Analysis (2-3 Key Insights)\n\n**🔍 Pattern [#]: [Insight Title]**\n- **Data**: Specific numbers and correlations\n- **Business Case**: Why this pattern impacts your overall performance\n- **Strategic Implication**: How this connects to your larger goals\n- **Statistical Confidence**: High/Medium/Low (based on data consistency)\n\n### 4. Optimization Recommendations (1-2 High-Impact Actions)\n\n**💡 Priority Action [#]: [Specific Intervention]**\n- **Implementation**: Exact steps, timing, and triggers\n- **Success Metrics**: How to measure effectiveness\n- **Time Investment**: Realistic time commitment required\n- **Expected ROI**: Projected improvement in target metrics\n- **Risk Mitigation**: What to do if this approach doesn't work\n\n### 5. Performance Recognition & Strategic Wins 🏆\n**Focus**: Balance recognition with growth opportunities - ENTJs respond well to achievement acknowledgment\n- **Consistency Champions**: Habits with 85%+ execution rate (frame as competitive advantages achieved)\n- **Strategic Breakthrough Moments**: Specific days where multiple systems aligned perfectly\n- **Improvement Velocity**: Rate of progress and momentum indicators\n- **Leadership Under Pressure**: How you maintained standards during challenging periods\n- **Innovation & Problem-Solving**: Creative adaptations or system improvements you implemented\n- **Compound Effect Evidence**: Behaviors that amplify other behaviors (strategic multipliers)\n\n**Recognition Framework**:\n- **Quantified Achievements**: Use specific percentages and improvements\n- **Strategic Language**: Frame accomplishments as business/leadership wins\n- **Progress Momentum**: Highlight accelerating trends and breakthrough patterns\n- **Resilience Recognition**: Acknowledge how you recovered from setbacks\n- **System Mastery**: Celebrate habits moving from effortful to automatic\n\n### 6. Next Week's Strategic Focus\n**🎯 Week Ahead Optimization**: One primary focus area with specific targets\n\n## Enhanced Data Format Analysis\n\nThe system expects data in this JSON format:\n```json\n{\n  \"data\": [\n    {\n      \"id\": \"unique-id\",\n      \"name\": \"YYYY-MM-DD\",\n      \"property_exercise\": boolean,\n      \"property_mood\": \"Good\"|\"Neutral\"|\"Down\"|\"Tired\"|\"Anxious\",\n      \"property_hydration\": boolean,\n      \"property_self_care\": boolean,\n      \"property_notes\": string,\n      \"property_home\": boolean,\n      \"property_partner\": boolean,\n      \"property_reading\": boolean,\n      \"property_no_sugar\": boolean,\n      \"property_something_hard\": boolean,\n      \"property_date\": {\n        \"start\": \"YYYY-MM-DD\",\n        \"end\": null,\n        \"time_zone\": null\n      },\n      \"property_title\": \"YYYY-MM-DD\"\n    }\n  ]\n}\n```\n\n## Special Considerations for High Achievers\n\n- **Perfectionism Management**: Frame setbacks as data points, not failures\n- **Sustainable Intensity**: Prevent all-or-nothing thinking that leads to burnout\n- **Strategic Patience**: Emphasize that optimization is a long-term competitive advantage\n- **Leadership Modeling**: Connect personal wellness to your ability to lead and perform for others\n- **Efficiency Obsession**: Always provide the minimum effective dose for maximum impact\n- **Positive Reinforcement**: Balance optimization opportunities with recognition of achievements\n\nRemember: You're analyzing patterns for someone who thinks strategically and values systematic improvement. Every insight should feel like gaining a competitive advantage through self-knowledge."
        }
      },
      "id": "61dad2db-0087-40f7-97c4-9658e2941d39",
      "name": "AI Wellness Coach",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        540,
        -520
      ],
      "typeVersion": 1.8,
      "executeOnce": true,
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "model": "anthropic/claude-3.5-sonnet",
        "options": {
          "temperature": 0.3,
          "maxTokens": 4000
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        520,
        -320
      ],
      "id": "09e82a4c-e3a8-48ec-af31-505a0e0c4378",
      "name": "Claude 3.5 Sonnet",
      "credentials": {
        "openRouterApi": {
          "id": "YOUR_OPENROUTER_CREDENTIALS_ID",
          "name": "OpenRouter API"
        }
      }
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        320,
        -520
      ],
      "id": "e569b15b-d378-4155-994e-8a2f5634607d",
      "name": "Aggregate Data"
    }
  ],
  "connections": {
    "Weekly Trigger (Sunday 9 PM)": {
      "main": [
        [
          {
            "node": "Fetch Wellness Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Wellness Data": {
      "main": [
        [
          {
            "node": "Aggregate Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Wellness Coach": {
      "main": [
        [
          {
            "node": "Send Weekly Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude 3.5 Sonnet": {
      "ai_languageModel": [
        [
          {
            "node": "AI Wellness Coach",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Data": {
      "main": [
        [
          {
            "node": "AI Wellness Coach",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "YOUR_N8N_INSTANCE_ID"
  }
}