Health Trend Analyzer
Analyze trends and patterns in health data over time, identify changes and 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 to evaluate health trends
- Symptom Patterns: Identify recurring symptoms, frequency changes, and potential triggers
- Medication Adherence: Analyze medication-taking patterns, identify missed dose patterns, and find areas for improvement
- Lab Result Trends: Track changes in biochemical indicators (cholesterol, blood glucose, blood pressure, etc.)
- Mood and Sleep: Correlate emotional states with sleep quality to identify mental health trends
2. Correlation Analysis Engine
- Medication-Symptom Correlation: Identify if new medications are associated with symptom changes
- Lifestyle Impact: Correlate diet/sleep with symptoms and mood
- Treatment Effect Evaluation: Measure if treatments lead to improvements
- Cycle-Symptom Correlation: Cycle correlation in women's health tracking
3. Change Detection
- Significant Changes: Warn of rapid weight changes, new symptoms, and medication changes
- Deterioration Patterns: Early identification of declining health status
- Improvement Recognition: 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
- Prevention Recommendations: Suggest preventive measures based on patterns
- Early Warning: Predict issues before they become serious
Usage Instructions
Trigger Conditions
Use this skill when users mention the following scenarios:
General Inquiries:
- ✅ "What changes have occurred in my health over the past period?"
- ✅ "Analyze my health trends"
- ✅ "What's changed with my physical condition?"
- ✅ "Health status summary"
Specific Dimensions:
- ✅ "What's the trend of 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?"
- ✅ "Is my medication effective?"
- ✅ "What's the relationship between sleep and my mood?"
Time Range:
- Default analysis of past 3 months of data
- Supported: "Past 1 month", "Past 6 months", "Past 1 year"
- Supported: "From January 2025 to present", "Last 90 days"
Execution Steps
Step 1: Determine 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:
javascript
// 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:
javascript
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 Trends
- Extract historical weight data
- Calculate BMI changes
- Identify trend direction (upward/downward/stable)
- Evaluate change magnitude
4.2 Symptom Patterns
- Count symptom frequencies
- Identify high-frequency symptoms
- Analyze symptom time patterns
- Detect symptom triggers
4.3 Medication Adherence
- Calculate overall adherence rate
- Analyze adherence for each medication
- Identify missed dose patterns
- Evaluate improvement suggestions
4.4 Lab Results
- Track biochemical indicators across multiple reports
- Compare with reference ranges
- Identify improvements/deterioration
- Mark abnormal indicators
4.5 Mood and Sleep
- Correlate mood scores with sleep duration
- Identify mood fluctuation patterns
- Detect stress levels
- Evaluate mental health trends
Step 5: Correlation Analysis
Use statistical methods to identify correlations:
javascript
// 皮尔逊相关系数
function pearsonCorrelation(x, y) {
// 计算相关系数
// 返回值范围:-1(负相关)到 1(正相关)
}
// 应用场景
- 药物开始日期 vs 症状频率
- 睡眠时长 vs 情绪评分
- 体重变化 vs 饮食记录
- 运动量 vs 情绪状态
Step 6: Change Detection
Identify significant changes:
javascript
// 变化点检测
function detectChangePoints(timeSeries) {
// 使用统计方法检测显著变化点
// 例如:体重突然下降、症状突然增加
}
// 阈值警报
function checkThresholds(value, thresholds) {
// 检查是否接近或超过危险阈值
// 例如:BMI > 30、辐射剂量 > 安全限
}
Step 7: Generate Insights
Generate predictive insights based on analysis results:
javascript
// 风险评估
function assessRisks(trends) {
// 识别高风险趋势
// 例如:快速体重下降、频繁症状
}
// 预防建议
function generateRecommendations(trends, correlations) {
// 基于模式建议预防措施
// 例如:改善睡眠、提高用药依从性
}
// 早期预警
function earlyWarnings(trends) {
// 在问题变得严重之前预测
// 例如:症状频率上升、情绪持续低落
}
Step 8: Generate Visualization Report
Generate an interactive HTML report:
- Data Summary: Generate analysis results in JSON format
- HTML Template Rendering: Inject data into the HTML template
- ECharts Chart Configuration: Configure 6 types of interactive charts
- Save File: Save as a standalone HTML file
Detailed output format refers to: Data Sources Description
Output Formats
Text Report (Concise Version)
Health Trend Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━
Generation Time: 2025-12-31
Analysis Period: Past 3 months (2025-10-01 to 2025-12-31)
📊 Overall Assessment
━━━━━━━━━━━━━━━━━━━━━━━━━━
Improving: Weight management, cholesterol levels
Stable: Blood glucose control, emotional state
Needs Attention: Medication adherence, sleep quality
📊 Weight/BMI Trends
├─ Current Weight: 68.5 kg
├─ Current BMI: 23.1 (Normal Range)
├─ 3-month Change: -2.3 kg (-3.2%)
├─ Trend: 📉 Gradual weight loss
└─ Assessment: ✅ Positive trend, within healthy range
💊 Medication Adherence
├─ Current Medications: 3 types
├─ Overall Adherence Rate: 78%
├─ Missed Doses: 8 times
├─ Best: Aspirin (95%)
└─ Needs Improvement: Amlodipine (65%)
⚠️ Symptom Patterns
├─ Most Frequent: Headache (12 times in past 3 months)
├─ Trend: 📉 Decreasing frequency (4 fewer than previous period)
├─ Potential Trigger: Moderate correlation identified with sleep quality (r=0.62)
└─ Recommendation: Continue improving sleep patterns
🧪 Lab Result Trends
├─ Cholesterol: 240 → 210 mg/dL (Improved ✅)
├─ Blood Glucose: 5.6 → 5.4 mmol/L (Stable)
├─ Last Check: 30 days ago
└─ Recommendation: Recheck in 3 months
😊 Mood and Sleep
├─ Average Mood Score: 6.8/10
├─ Average Sleep Duration: 6.5 hours
├─ Trend: Stable mood, slight improvement in sleep
└─ Correlation: Strong correlation between sleep duration and mood score (r=0.78)
🔗 Correlation Analysis
━━━━━━━━━━━━━━━━━━━━━━━━━━
• Sleep Duration ↔ Mood Score: Strong positive correlation (r=0.78)
• Weight Change ↔ Diet Records: Moderate correlation (r=0.55)
• Medication Adherence ↔ Symptom Frequency: Moderate negative correlation (r=-0.62)
💡 Risk Assessment and Recommendations
━━━━━━━━━━━━━━━━━━━━━━━━━━
🟢 Keep Up the Good Work
• Current weight management methods are effective
• Cholesterol levels have improved significantly
🟡 Needs Attention
• Improve amlodipine adherence (set reminders)
• Increase sleep duration to 7-8 hours
📅 Follow-up Plan
• Recheck lipid panel in 3 months
• Evaluate medication adherence improvement in 1 month
━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ Disclaimer
This analysis is for reference only and does not replace professional medical diagnosis.
Please consult a doctor for professional advice.
HTML Visualization Report (Full Version)
Generate a standalone HTML file with ECharts interactive charts, including:
- Overall Assessment Card: Key indicators at a glance
- Weight/BMI Trend Chart: Dual Y-axis line chart (weight + BMI)
- Symptom Frequency Chart: Color-coded bar chart (high frequency red/medium frequency yellow/low frequency green)
- Medication Adherence Dashboard: Overall adherence rate + details for each medication
- Lab Result Trend Chart: Multi-series line chart + reference lines
- Correlation Heatmap: Heatmap showing correlations between variables
- 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-adapted)
- ✅ Printable (print-optimized styles)
- ✅ Shareable (send to doctors)
Data Sources
Primary Data Sources
| Data Source | File Path | Data Content |
|---|
| Personal Profile | | Weight, height, BMI history |
| Symptom Records | | Symptom name, severity, duration |
| Mood Records | | Mood score, sleep quality, stress level |
| Diet Records | | Meals, food, calories, nutrients |
| Medication Logs | data/medication-logs/**/*.json
| Medication time, adherence records |
| Lab Results | data/medical_records/**/*.json
| Biochemical indicators, reference ranges |
Secondary Data Sources
| Data Source | File Path | Data Content |
|---|
| Women's Cycle | | Cycle length, symptom records |
| Pregnancy Tracker | data/pregnancy-tracker.json
| Gestational week, weight, checkup records |
| Menopause | data/menopause-tracker.json
| Symptoms, HRT usage |
| Allergy History | | Allergens, severity |
| Radiation Records | data/radiation-records.json
| Cumulative radiation dose |
Detailed data structure description refers to: data-sources.md
Analysis Algorithms
Time Series Analysis
- Trend detection (linear regression)
- Seasonal 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 Indicators
- Mean, median, standard deviation
- Percentiles (25%, 50%, 75%)
- Change rates (month-over-month, year-over-year)
Detailed algorithm description refers to: algorithms.md
Safety and Privacy
Must Follow
- ❌ Do not provide medical diagnoses
- ❌ Do not provide specific medication advice
- ❌ Do not judge life-or-death prognosis
- ❌ Include a disclaimer (for reference only)
Information Accuracy
- ✅ Only analyze based on recorded data
- ✅ Do not speculate or infer missing information
- ✅ Clearly label data sources and time ranges
- ✅ Recommendations should be reviewed by medical professionals
Privacy Protection
- ✅ All data remains local
- ✅ No external API calls
- ✅ Analysis results are only stored locally
- ✅ HTML reports run independently (no data transmission)
Error Handling
Data Missing
- No Data: Output "No data available. It is recommended to record [data type] first"
- Insufficient Data: Output "Insufficient data (at least 1 month of data is required for trend analysis)"
- Narrow Data Range: Use existing data and prompt "It is recommended to extend the recording time for more accurate trends"
Analysis Failure
- Unable to Calculate Trends: Output "Unable to calculate trends due to insufficient data points"
- Correlation Analysis Failure: Output "More data is needed for correlation analysis"
- Chart Rendering Failure: Degrade to text report
Usage Examples
Example 1: General Health Trends
User: "What changes have occurred in my health over the past 3 months?"
Output: Generate a complete HTML report with trend analysis across all dimensions
Example 2: Symptom Analysis
User: "Analyze my symptom patterns"
Output: Focus on symptom frequency, triggers, and trends
Example 3: Weight Trends
User: "What's the trend of my weight?"
Output: Focus on weight/BMI changes and correlations with diet/exercise
Example 4: Medication Effectiveness
User: "Is my blood pressure medication effective?"
Output: Correlate medication start date with blood pressure readings and symptom improvements
More complete examples refer to: examples.md
Related Commands
- : Record symptoms
- : Record mood
- : Record diet
- : Manage medications and medication records
- : Query specific data points
Technical Implementation
Tool Limitations
This Skill only uses 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 to )
Performance Optimization
- Incremental reading: Only read data files within the specified time range
- Data caching: Avoid re-reading the same file
- Lazy calculation: Generate chart data on demand
Extensibility
- Support adding new data dimensions
- Support custom chart types
- Support custom analysis algorithms