SuperAPI AI Directory

health-trend-analyzer

Data & analytics

View repository

Updated 10-15 22:15

About this skill

Health Trend Analyzer

Analyze trends and patterns in health data over time, identify changes, correlations, and provide data-driven health insights.

Core Features

1. Multi-dimensional Trend Analysis

  • Weight/BMI Trends: Track changes in weight and BMI over time, assess health trends
  • Symptom Patterns: Identify recurring symptoms, frequency changes, potential triggers
  • Medication Adherence: Analyze medication patterns, identify missed dose patterns and areas for improvement
  • Lab Result Trends: Track changes in biochemical indicators (cholesterol, blood sugar, blood pressure, etc.)
  • Mood and Sleep: Correlate mood states with sleep quality, identify mental health trends

2. Correlation Analysis Engine

  • Medication-Symptom Correlation: Identify whether new medications are related to symptom changes
  • Lifestyle Impact: Correlate diet/sleep with symptoms and mood
  • Treatment Effect Evaluation: Measure whether treatment leads to improvement
  • Cycle-Symptom Correlation: Cycle correlation in women's health tracking

3. Change Detection

  • Significant Changes: Warn about rapid weight changes, new symptoms, medication changes
  • Deterioration Patterns: Early identification of health decline
  • Improvement Identification: Highlight positive health changes
  • Threshold Alerts: Warn when approaching dangerous levels (radiation, BMI extremes)

4. Predictive Insights

  • Risk Assessment: Identify risk factors based on trends
  • Preventive Recommendations: Suggest preventive measures based on patterns
  • Early Warning: Predict before problems become serious

Usage Instructions

Trigger Conditions

Use this skill when users mention the following scenarios:

General Inquiries:

  • ✅ "What has changed in my health over the past period?"
  • ✅ "Analyze my health trends"
  • ✅ "What changes have occurred in my physical condition?"
  • ✅ "Health status summary"

Specific Dimensions:

  • ✅ "What trends are there in my weight/BMI?"
  • ✅ "Analyze my symptom patterns"
  • ✅ "How is my medication adherence?"
  • ✅ "What changes are there in my lab indicators?"
  • ✅ "My mood and sleep trends"

Correlation Analysis:

  • ✅ "What are my symptoms related to?"
  • ✅ "Are my medications effective?"
  • ✅ "What is the relationship between sleep and my mood?"

Time Range:

  • Default AnalysisPast 3 monthsdata
  • Supported: "Past 1 month", "Past 6 months", "Past 1 year"
  • Supported: "From January 2025 to present", "Last 90 days"

Execution Steps

Step 1: Determine the analysis time range

Extract the time range from user input, or use the default value (3 months).

Step 2: Read health data

Read the following data sources:

// 1. 个人档案(BMI、体重)
const profile = readFile('data/profile.json');

// 2. 症状记录
const symptomFiles = glob('data/symptoms/**/*.json');
const symptoms = readAllJson(symptomFiles);

// 3. 情绪记录
const moodFiles = glob('data/mood/**/*.json');
const moods = readAllJson(moodFiles);

// 4. 饮食记录
const dietFiles = glob('data/diet/**/*.json');
const diets = readAllJson(dietFiles);

// 5. 用药日志
const medicationLogs = glob('data/medication-logs/**/*.json');

// 6. 女性健康数据(如适用)
const cycleData = readFile('data/cycle-tracker.json');
const pregnancyData = readFile('data/pregnancy-tracker.json');
const menopauseData = readFile('data/menopause-tracker.json');

// 7. 过敏史
const allergies = readFile('data/allergies.json');

// 8. 辐射记录
const radiation = readFile('data/radiation-records.json');

Step 3: Data filtering

Filter data based on the time range:

function filterByDate(data, startDate, endDate) {
  return data.filter(item => {
    const itemDate = new Date(item.date || item.created_at);
    return itemDate >= startDate && itemDate <= endDate;
  });
}

Step 4: Trend analysis

Perform trend analysis for each data dimension:

4.1 Weight/BMI trend

  • Extract historical weight data
  • Calculate BMI changes
  • Identify trend direction (increasing/decreasing/stable)
  • Assess the magnitude of change

4.2 Symptom patterns

  • Count symptom frequency
  • Identify high-frequency symptoms
  • Analyze temporal patterns of symptoms
  • Detect symptom triggers

4.3 Medication adherence

  • Calculate the overall adherence rate
  • Analyze adherence for each medication
  • Identify missed-dose patterns
  • Evaluate improvement recommendations

4.4 Laboratory results

  • Track biochemical indicators across multiple reports
  • Compare with reference ranges
  • Identify improvement/deterioration
  • Flag abnormal indicators

4.5 Mood and sleep

  • Correlate mood scores with sleep duration
  • Identify mood fluctuation patterns
  • Detect stress levels
  • Assess mental health trends

Step 5: Correlation analysis

Use statistical methods to identify correlations:

// 皮尔逊相关系数
function pearsonCorrelation(x, y) {
  // 计算相关系数
  // 返回值范围:-1(负相关)到 1(正相关)
}

// 应用场景
- 药物开始日期 vs 症状频率
- 睡眠时长 vs 情绪评分
- 体重变化 vs 饮食记录
- 运动量 vs 情绪状态

Step 6: Change detection

Identify significant changes:

// 变化点检测
function detectChangePoints(timeSeries) {
  // 使用统计方法检测显著变化点
  // 例如:体重突然下降、症状突然增加
}

// 阈值警报
function checkThresholds(value, thresholds) {
  // 检查是否接近或超过危险阈值
  // 例如:BMI > 30、辐射剂量 > 安全限
}

Step 7: Generate insights

Generate predictive insights based on the analysis results:

// 风险评估
function assessRisks(trends) {
  // 识别高风险趋势
  // 例如:快速体重下降、频繁症状
}

// 预防建议
function generateRecommendations(trends, correlations) {
  // 基于模式建议预防措施
  // 例如:改善睡眠、提高用药依从性
}

// 早期预警
function earlyWarnings(trends) {
  // 在问题变得严重之前预测
  // 例如:症状频率上升、情绪持续低落
}

Step 8: Generate a visualization report

Generate an interactive HTML report:

  1. Data summary: Generate analysis results in JSON format
  2. HTML template rendering: Inject data into the HTML template
  3. ECharts chart configuration: Configure 6 types of interactive charts
  4. Save file: Save as a standalone HTML file

For detailed output format, see:Data source description

Output format

Text report (concise version)

健康趋势分析报告
━━━━━━━━━━━━━━━━━━━━━━━━━━
生成时间: 2025-12-31
分析周期: 过去3个月 (2025-10-01 至 2025-12-31)

📊 总体评估
━━━━━━━━━━━━━━━━━━━━━━━━━━
改善中: 体重管理、胆固醇水平
稳定: 血糖控制、情绪状态
需关注: 用药依从性、睡眠质量

📊 体重/BMI 趋势
├─ 当前体重: 68.5 kg
├─ 当前 BMI: 23.1(正常范围)
├─ 3个月变化: -2.3 kg(-3.2%)
├─ 趋势: 📉 逐渐减重
└─ 评估: ✅ 积极趋势,在健康范围内

💊 药物依从性
├─ 当前药物: 3种
├─ 总体依从率: 78%
├─ 漏服次数: 8次
├─ 最好: 阿司匹林 (95%)
└─ 需改进: 氨氯地平 (65%)

⚠️ 症状模式
├─ 最频繁: 头痛(过去3个月 12次)
├─ 趋势: 📉 频率下降(较上期减少4次)
├─ 潜在诱因: 与睡眠质量识别出中等相关(r=0.62)
└─ 建议: 继续改善睡眠模式

🧪 化验结果趋势
├─ 胆固醇: 240 → 210 mg/dL(改善 ✅)
├─ 血糖: 5.6 → 5.4 mmol/L(稳定)
├─ 上次检查: 30天前
└─ 建议: 3个月后复查

😊 情绪与睡眠
├─ 平均情绪评分: 6.8/10
├─ 平均睡眠时长: 6.5小时
├─ 趋势: 情绪稳定,睡眠略有改善
└─ 相关性: 睡眠时长与情绪评分强相关(r=0.78)

🔗 相关性分析
━━━━━━━━━━━━━━━━━━━━━━━━━━
• 睡眠时长 ↔ 情绪评分: 强正相关 (r=0.78)
• 体重变化 ↔ 饮食记录: 中等相关 (r=0.55)
• 用药依从性 ↔ 症状频率: 中等负相关 (r=-0.62)

💡 风险评估与建议
━━━━━━━━━━━━━━━━━━━━━━━━━━

🟢 继续保持
• 当前体重管理方法有效
• 胆固醇水平改善明显

🟡 需要关注
• 提高氨氯地平依从性(设置提醒)
• 增加睡眠时长至7-8小时

📅 复查计划
• 3个月后复查血脂四项
• 1个月后评估用药依从性改善

━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ 免责声明
本分析仅供参考,不替代专业医疗诊断。
请咨询医生获取专业建议。

HTML visualization report (full version)

Generate a standalone HTML file containing ECharts interactive charts, including:

  1. Overall assessment card: Key indicators at a glance
  2. Weight/BMI trend chart: Dual Y-axis line chart (weight + BMI)
  3. Symptom frequency chart: Color-coded bar chart (high frequency red/medium frequency yellow/low frequency green)
  4. Medication adherence dashboard: Overall adherence rate + details for each medication
  5. Laboratory result trend chart: Multi-series line chart + reference lines
  6. Correlation heatmap: Heatmap displaying correlations between variables
  7. Mood and sleep area chart: Dual Y-axis area chart

HTML file features:

  • ✅ Fully standalone (all dependencies via CDN)
  • ✅ Interactive charts (zoom, export, legend toggle)
  • ✅ Responsive design (mobile adaptation)
  • ✅ Printable (print-optimized styles)
  • ✅ Shareable (send to doctor)

Data Sources

Primary Data Sources

Data Source File Path Data Content
Personal Profile data/profile.json Weight, height, BMI history
Symptom Records data/symptoms/**/*.json Symptom name, severity, duration
Mood Records data/mood/**/*.json Mood score, sleep quality, stress level
Diet Records data/diet/**/*.json Meal, food, calories, nutrients
Medication Log data/medication-logs/**/*.json Medication time, adherence records
Lab Results data/medical_records/**/*.json Biochemical indicators, reference ranges

Auxiliary Data Sources

Data Source File Path Data Content
Female Cycle data/cycle-tracker.json Cycle length, symptom records
Pregnancy Tracking data/pregnancy-tracker.json Gestational week, weight, examination records
Menopause data/menopause-tracker.json Symptoms, HRT use
Allergy History data/allergies.json Allergens, severity
Radiation Records data/radiation-records.json Cumulative radiation dose

For detailed data structure descriptions, please refer to:data-sources.md

Analysis Algorithms

Time Series Analysis

  • Trend detection (linear regression)
  • Seasonality analysis
  • Outlier detection

Correlation Analysis

  • Pearson correlation coefficient (continuous variables)
  • Spearman correlation coefficient (ordinal variables)
  • Cross-correlation analysis (time series)

Change Point Detection

  • CUSUM algorithm
  • Sliding window t-test
  • Bayesian change point detection

Statistical Metrics

  • Mean, median, standard deviation
  • Percentiles (25%, 50%, 75%)
  • Rate of change (month-over-month, year-over-year)

For detailed algorithm descriptions, please refer to:algorithms.md

Safety and Privacy

Must Follow

  • ❌ Do not provide medical diagnoses
  • ❌ Do not provide specific medication recommendations
  • ❌ Do not judge life or death prognosis
  • ❌ Include disclaimer (for reference only)

Information Accuracy

  • ✅ Analyze based only on recorded data
  • ✅ Do not speculate or infer missing information
  • ✅ Clearly indicate data source and time range
  • ✅ Recommendations should be reviewed by medical professionals

Privacy Protection

  • ✅ All data remains local
  • ✅ No external API calls
  • ✅ Analysis results are saved locally only
  • ✅ HTML report runs standalone (no data transmission)

Error Handling

Missing Data

  • No data: Output "No data available, it is recommended to first record [data type]"
  • Insufficient data: Output "Insufficient data (at least 1 month of data is required for trend analysis)"
  • Narrow data range: Use existing data, prompt "recommend extending the recording time to obtain a more accurate trend"

Analysis failed

  • Unable to calculate trend: Output "Unable to calculate trend, insufficient data points"
  • Correlation analysis failed: Output "Correlation analysis requires more data"
  • Chart rendering failed: Fall back to a text report

Usage examples

Example 1: General health trends

User: "What changes have there been in my health over the past 3 months?" Output: Generate a complete HTML report, including trend analysis for all dimensions

Example 2: Symptom analysis

User: "Analyze my symptom patterns" Output: Focus on analyzing symptom frequency, triggers, and trends

Example 3: Weight trends

User: "What trends are there in my weight?" Output: Focus on analyzing weight/BMI changes and correlations with diet/exercise

Example 4: Medication effectiveness

User: "Is my blood pressure medication effective?" Output: Correlate medication start dates with blood pressure readings and symptom improvement

For more complete examples, please refer to:examples.md

Related commands

  • /symptom: Record symptoms
  • /mood: Record mood
  • /diet: Record diet
  • /medication: Manage medications and medication records
  • /query: Query specific data points

Technical implementation

Tool limitations

This Skill uses only the following tools (no additional permissions required):

  • Read: Read JSON data files
  • Grep: Search for specific patterns
  • Glob: Find data files by pattern
  • Write: Generate HTML reports (save todata/health-reports/)

Performance optimization

  • Incremental reading: only read data files for the specified time range
  • Data caching: avoid repeatedly reading the same file
  • Lazy computation: generate chart data on demand

Extensibility

  • Support adding new data dimensions
  • Support custom chart types
  • Support custom analysis algorithms