Analyze diet and nutritional data, identify nutritional patterns, assess nutritional status, and provide personalized nutritional improvement recommendations.
Features
1. Nutritional Trend Analysis
Analyze trends in nutrient intake, identify areas of improvement or concern.
Analysis Dimensions:
- Macronutrient trends (protein, carbohydrates, fat, fiber, calories)
- Micronutrient trends (vitamins, minerals)
- Changes in calorie source distribution
- Meal patterns (eating times, frequency)
- Food category preferences
Output:
- Trend direction (improving/stable/declining)
- Magnitude and percentage of change
- Trend significance
- Improvement recommendations
2. Nutrient Intake Assessment
Assess whether nutrient intake meets recommended standards (RDA/AI).
Assessment Content:
-
Macronutrient Assessment:
- Protein intake and quality
- Carbohydrate type distribution (refined vs complex carbohydrates)
- Fat type distribution (saturated/monounsaturated/polyunsaturated/trans fats)
- Dietary fiber intake
-
Vitamin Assessment:
- Vitamins A, C, D, E, K
- B vitamins (B1, B2, B3, B6, B12, folate, pantothenic acid, biotin)
- Comparison with RDA
- Deficiency risk assessment
-
Mineral Assessment:
- Macrominerals: calcium, phosphorus, magnesium, sodium, potassium, chloride, sulfur
- Trace minerals: iron, zinc, copper, manganese, iodine, selenium, chromium, molybdenum
- Comparison with RDA
- Deficiency risk assessment
-
Special Nutrient Assessment:
- Omega-3 fatty acids (EPA, DHA, ALA)
- Choline
- Coenzyme Q10
- Phytochemicals (flavonoids, carotenoids, etc.)
Output:
- Achievement rate for each nutrient
- Deficient/insufficient/adequate/excessive classification
- Deficiency risk identification
- Priority improvement recommendations
3. Nutritional Status Assessment
Comprehensively assess the user's nutritional status.
Assessment Content:
-
Overall nutritional quality score:
- Nutrient density score
- Food diversity score
- Balanced diet score
-
Nutritional Pattern Identification:
- Dietary pattern type (Mediterranean, DASH, vegetarian, etc.)
- Eating time patterns (eating frequency, eating window)
- Snacking and between-meal eating patterns
-
Nutritional Risk Identification:
- Risk of nutritional deficiency (e.g., vitamin D deficiency, iron deficiency)
- Risk of nutritional excess (e.g., vitamin A excess, sodium excess)
- Unhealthy eating habits (high sugar, high fat, high sodium)
Output:
- Nutritional status level (excellent/good/fair/poor)
- Identification of main nutritional problems
- List of risk factors
- Improvement priorities
4. Correlation Analysis
Analyze the correlation between nutrition and other health indicators.
Supported Correlation Analyses:
-
Nutrition ↔ Body Weight:
- Relationship between calorie intake and body weight change
- Macronutrient ratio and body weight management
- Relationship between eating timing and metabolism
-
Nutrition ↔ Exercise:
- Impact of nutritional intake on exercise performance
- Nutritional needs on exercise days vs rest days
- Protein intake and muscle recovery
-
Nutrition ↔ Sleep:
- Caffeine intake and sleep quality
- Dinner time and time to fall asleep
- Specific nutrients (such as magnesium, tryptophan) and sleep
-
Nutrition ↔ Blood Pressure:
- Sodium intake and blood pressure
- Potassium/sodium ratio and blood pressure
- DASH diet adherence and blood pressure control
-
Nutrition ↔ Blood Glucose:
- Carbohydrate type and blood glucose fluctuations
- Dietary fiber and blood glucose control
- Eating timing and blood glucose curve
Output:
- Correlation coefficient (-1 to 1)
- Correlation strength (weak/moderate/strong)
- Statistical significance
- Causal inference
- Practical recommendations
5. Personalized Recommendation Generation
Generate personalized nutrition improvement recommendations based on user data.
Recommendation Type:
-
Nutrient adjustment recommendations:
- Increase deficient nutrients
- Reduce excessive nutrients
- Optimize nutrient ratios
-
Food choice recommendations:
- Recommend specific food categories
- Food substitution recommendations (healthier choices)
- Food pairing recommendations (promote absorption)
-
Dietary habit recommendations:
- Adjust eating timing
- Adjust meal frequency
- Cooking method recommendations
-
Supplement recommendations(for reference only):
- Supplement recommendations based on deficiency risk
- Supplement dosage and timing
- Interaction warnings
Basis for Recommendations:
- DRIs/RDA standards
- User nutrition history data
- User health status and goals
- Evidence-based nutrition evidence
Instructions for Use
Trigger Conditions
This skill is triggered when the user requests the following:
- Nutrition trend analysis
- Nutrient intake assessment
- Nutritional status assessment
- Nutrition improvement recommendations
- Correlation analysis between nutrition and other health indicators
Execution Steps
Step 1: Determine the analysis scope
Clarify the type of analysis and time range requested by the user:
- Analysis type: trend/assessment/correlation/recommendation
- Time range: week/month/quarter/custom
- Analysis depth: macronutrients/micronutrients/comprehensive analysis
Step 2: Read data
Primary data sources:
data-example/nutrition-tracker.json- Nutrition tracking master datadata-example/nutrition-logs/YYYY-MM/YYYY-MM-DD.json- Daily diet records
Related data sources:
data-example/profile.json- Basic data such as body weight and BMIdata-example/fitness-tracker.json- Exercise datadata-example/sleep-tracker.json- Sleep datadata-example/hypertension-tracker.json- Blood pressure datadata-example/diabetes-tracker.json- Blood glucose data
Step 3: Data analysis
Execute the corresponding analysis algorithm based on the analysis type:
Trend analysis algorithm:
- Linear regression to calculate trend slope
- Moving average to smooth fluctuations
- Statistical significance testing
RDA achievement rate calculation:
rda_achievement = (actual_intake / rda_value) * 100
status_classification:
- < 50%: 严重缺乏
- 50-75%: 不足
- 75-100%: 接近目标
- 100-150%: 充足(理想范围)
- > 150%: 过量(注意安全上限UL)
Nutrient density score:
nutrient_density_score = (
(vitamins_achieved / total_vitamins) * 40 +
(minerals_achieved / total_minerals) * 30 +
(fiber_achieved / fiber_rda) * 30
)
Correlation analysis algorithm:
- Pearson correlation coefficient calculation
- Lagged correlation analysis (considering time delay effects)
- Multivariate regression analysis
Step 4: Generate report
Output the analysis report in the standard format (see the "Output format" section)
Output format
Nutrition trend analysis report
# 营养摄入趋势分析报告
## 分析周期
2025-03-20 至 2025-06-20(3个月,90天记录)
## 宏量营养素趋势
### 卡路里摄入
- **趋势**:⬇️ 下降
- **开始**:平均2100卡/天
- **当前**:平均1950卡/天
- **变化**:-150卡/天 (-7.1%)
- **解读**:卡路里摄入适度减少,与减重目标一致
**趋势线**:
2100 ┤ ╭╮ 2050 ┤ ╭╯╰╮ 2000 ┼─╯ ╰╮ 1950 ┤ ╰ 1900 └─────────── Mar Apr May Jun
### 蛋白质
- **趋势**:➡️ 稳定
- **平均**:82g/天(范围:70-95g)
- **目标**:80g/天
- **达标率**:93%(84/90天达标)
- **解读**:蛋白质摄入稳定,基本达标
### 膳食纤维
- **趋势**:⬆️ 改善
- **开始**:平均18g/天
- **当前**:平均22g/天
- **变化**:+4g/天 (+22%)
- **目标**:30g/天
- **解读**:纤维摄入显著增加,但仍需继续努力
### 脂肪
- **趋势**:⬇️ 下降
- **开始**:平均75g/天
- **当前**:平均68g/天
- **变化**:-7g/天 (-9.3%)
- **目标**:≤65g/天
- **解读**:脂肪摄入减少,接近目标
**脂肪类型分布变化**:
| 脂肪类型 | 开始 | 当前 | 目标 | 趋势 |
|---------|------|------|------|------|
| 饱和脂肪 | 25g | 20g | <20g | ⬇️ 改善 |
| 单不饱和 | 30g | 32g | >35g | ⬆️ 略增 |
| 多不饱和 | 15g | 12g | 15-20g | ⬇️ 需增加 |
| 反式脂肪 | 2g | 0.5g | 0g | ⬇️ 改善 |
## 维生素状况趋势
### 维生素D
- **摄入趋势**:⬆️ 增加(补充剂开始)
- **开始**:平均2μg/天(饮食来源)
- **当前**:平均52μg/天(含2000IU补充剂)
- **RDA**:15μg/天
- **血清水平变化**:
- 基线(2025-05):18 ng/mL
- 当前(2025-06):22 ng/mL
- 目标:30-100 ng/mL
- **解读**:✅ 补充剂起效,但需继续监测
### 维生素C
- **趋势**:⬆️ 改善
- **开始**:平均65mg/天
- **当前**:平均85mg/天
- **RDA**:100mg/天
- **达标率**:从65% → 85%
- **建议**:增加柑橘类、奇异果、草莓等水果
### B族维生素
- **维生素B12**:✅ 充足(平均2.5μg,RDA 2.4μg)
- **叶酸**:⚠️ 不足(平均320μg,RDA 400μg)
- **B6**:✅ 充足(平均1.5mg,RDA 1.3mg)
## 矿物质趋势
### 钙
- **趋势**:➡️ 稳定
- **平均**:850mg/天
- **RDA**:1000mg/天
- **达标率**:85%
- **主要来源**:乳制品40%、豆腐25%、绿叶蔬菜20%
### 铁
- **趋势**:✅ 充足
- **平均**:12mg/天
- **RDA**:8mg/天(男性)
- **达标率**:150%
- **主要来源**:肉类、蛋类、豆类、绿叶蔬菜
### 钠
- **趋势**:⬇️ 改善
- **开始**:平均2800mg/天
- **当前**:平均2100mg/天
- **目标**:<2300mg/天(理想<1500mg)
- **解读**:✅ 达到一般目标,⚠️ 理想目标仍需努力
### 钾
- **趋势**:⬆️ 改善
- **开始**:平均2800mg/天
- **当前**:平均3200mg/天
- **目标**:3500-4700mg/天
- **钾/钠比值**:从1.0 → 1.5(目标>2)
- **建议**:继续增加水果和蔬菜
## 特殊营养素趋势
### Omega-3
- **趋势**:⬆️ 增加(鱼油补充剂)
- **开始**:平均150mg/天
- **当前**:平均850mg/天(含补充剂)
- **推荐量**:500-1000mg/天
- **状态**:✅ 达标
### 胆碱
- **趋势**:➡️ 稳定
- **平均**:350mg/天
- **AI(适宜摄入量)**:425mg/天
- **达标率**:82%
- **主要来源**:鸡蛋(60%)、肉类(25%)、豆类(15%)
## 饮食模式分析
### 食物类别分布
| 食物类别 | 占比 | 变化 | 评价 |
|---------|------|------|------|
| 蔬菜水果 | 35% | +8% | ✅ 增加 |
| 全谷物 | 20% | +5% | ✅ 改善 |
| 精制谷物 | 15% | -7% | ✅ 减少 |
| 蛋白质来源 | 20% | 稳定 | ✅ 充足 |
| 添加脂肪 | 8% | -3% | ✅ 减少 |
| 添加糖 | 2% | -2% | ✅ 减少 |
### 进食时间模式
- **平均进食窗口**:12.5小时(07:30 - 20:00)
- **进食频率**:平均4.2次/天
- **最常见餐食时间**:
- 早餐:07:30(90%天数)
- 午餐:12:15(95%天数)
- 晚餐:18:45(98%天数)
- 加餐:15:30(60%天数)
### 饮食质量评分
- **营养密度评分**:7.2/10(从6.5提升)
- **食物多样性评分**:6.8/10
- **均衡饮食评分**:7.5/10
- **综合评分**:7.2/10 → **良好**
## 洞察与建议
### 关键洞察
1. **膳食纤维持续改善但仍不足**
- 从18g增至22g,但仍低于目标30g
- 影响:饱腹感、肠道健康、血糖控制
- 建议:每餐至少包含5g纤维
2. **脂肪质量改善**
- 饱和脂肪减少,反式脂肪几乎消除
- 多不饱和脂肪略低,需增加Omega-3食物
- 建议:增加深海鱼类、坚果、亚麻籽
3. **钠摄入改善但钾/钠比仍低**
- 钠减少33%,钾增加14%
- 钾/钠比从1.0升至1.5,仍低于目标2.0
- 建议:继续增加高钾食物(香蕉、橙子、土豆、菠菜)
4. **维生素D补充剂有效**
- 血清水平从18升至22 ng/mL(4周+4ng)
- 预计3-4个月可达目标范围
- 建议:继续补充,定期监测
### 优先级行动计划
#### Priority 1:提升膳食纤维至30g/天(2周)
**具体行动**:
1. 早餐:全谷物(燕麦/全麦面包)+ 水果(9g)
2. 午餐:糙米/全麦面 + 2份蔬菜(8g)
3. 晚餐:红薯/杂粮 + 2份蔬菜(8g)
4. 加餐:水果 + 坚果(5g)
**总计**:30g ✅
#### Priority 2:优化钾/钠比值至2.0(4周)
**具体行动**:
1. 减少加工食品(主要钠源)
2. 每日2-3份高钾水果(香蕉、橙子、猕猴桃)
3. 蔬菜选择菠菜、土豆、蘑菇、番茄
4. 使用香料替代盐调味
#### Priority 3:维持维生素D补充(长期)
**监测计划**:
- 3个月后复查血清水平
- 目标:40-60 ng/mL
- 根据结果调整剂量
## 营养目标进度
| 目标 | 开始 | 当前 | 目标值 | 进度 | 状态 |
|------|------|------|--------|------|------|
| 卡路里 | 2100 | 1950 | 1800-2000 | 100% | ✅ 达标 |
| 蛋白质 | 75g | 82g | 80g | 100% | ✅ 达标 |
| 膳食纤维 | 18g | 22g | 30g | 73% | ⚠️ 进行中 |
| 维生素D | 18 ng/mL | 22 ng/mL | 30-100 | 20% | ⚠️ 改善中 |
| 钠摄入 | 2800mg | 2100mg | <2300 | 100% | ✅ 达标 |
| Omega-3 | 150mg | 850mg | 500-1000mg | 100% | ✅ 达标 |
---
**报告生成时间**:2025-06-20
**分析周期**:2025-03-20 至 2025-06-20(90天)
**数据记录数**:90天
**营养分析器版本**:v1.0
Data structure
Diet record data
{
"date": "2025-06-20",
"meals": [
{
"type": "breakfast",
"time": "07:30",
"foods": ["鸡蛋", "牛奶", "全麦面包"],
"calories": 450,
"macronutrients": {
"protein_g": 20,
"carbs_g": 55,
"fat_g": 15,
"fiber_g": 5,
"saturated_fat_g": 5,
"monounsaturated_fat_g": 6,
"polyunsaturated_fat_g": 3,
"trans_fat_g": 0.1
},
"micronutrients": {
"vitamin_a_mcg": 150,
"vitamin_c_mg": 5,
"vitamin_d_mcg": 1.5,
"vitamin_e_mg": 1,
"vitamin_k_mcg": 5,
"thiamine_mg": 0.3,
"riboflavin_mg": 0.4,
"niacin_mg": 4,
"vitamin_b6_mg": 0.1,
"folate_mcg": 30,
"vitamin_b12_mcg": 0.6,
"calcium_mg": 250,
"iron_mg": 2,
"magnesium_mg": 40,
"phosphorus_mg": 200,
"zinc_mg": 2,
"selenium_mcg": 10,
"potassium_mg": 350,
"sodium_mg": 300
},
"special_nutrients": {
"omega_3_g": 0.1,
"choline_mg": 150
}
}
],
"daily_summary": {
"total_calories": 2000,
"total_macronutrients": {
"protein_g": 80,
"carbs_g": 250,
"fat_g": 65,
"fiber_g": 30
},
"rda_achievement": {
"protein": 100,
"vitamin_c": 85,
"vitamin_d": 35,
"calcium": 90,
"iron": 75
},
"goal_achieved": true
}
}
Algorithm description
RDA achievement rate calculation
def calculate_rda_achievement(actual_intake, rda_value, ul_value=None):
"""
计算RDA达成率和状态
参数:
- actual_intake: 实际摄入量
- rda_value: 推荐膳食供给量
- ul_value: 可耐受最高摄入量(可选)
返回:
- achievement_rate: 达成率百分比
- status: 状态标签
"""
achievement_rate = (actual_intake / rda_value) * 100
if ul_value and actual_intake > ul_value:
status = "exceeds_ul"
category = "过量(危险)"
elif achievement_rate < 50:
status = "severe_deficiency"
category = "严重缺乏"
elif achievement_rate < 75:
status = "insufficient"
category = "不足"
elif achievement_rate < 100:
status = "approaching_target"
category = "接近目标"
elif achievement_rate <= 150:
status = "adequate"
category = "充足"
else:
status = "high_intake"
category = "较高"
return {
'achievement_rate': round(achievement_rate, 1),
'status': status,
'category': category
}
Nutrient density score
def calculate_nutrient_density_score(meal_data):
"""
计算食物营养密度评分(0-10分)
因素权重:
- 维生素达成率:40%
- 矿物质达成率:30%
- 膳食纤维:20%
- 限制性营养素(饱和脂肪、钠、添加糖):10%
"""
score = 0
# 维生素评分
vitamin_achievements = [
meal_data['micronutrients'][v] / RDA[v]
for v in ['vitamin_a', 'vitamin_c', 'vitamin_d', 'vitamin_e', 'vitamin_k']
]
vitamin_score = min(sum(vitamin_achievements) / len(vitamin_achievements), 1.5) * 10
score += min(vitamin_score, 10) * 0.40
# 矿物质评分
mineral_achievements = [
meal_data['micronutrients'][m] / RDA[m]
for m in ['calcium', 'iron', 'magnesium', 'zinc']
]
mineral_score = min(sum(mineral_achievements) / len(mineral_achievements), 1.5) * 10
score += min(mineral_score, 10) * 0.30
# 膳食纤维评分
fiber_score = min(meal_data['macronutrients']['fiber_g'] / 5, 2) * 10
score += min(fiber_score, 10) * 0.20
# 限制性营养素扣分
penalty = 0
if meal_data['macronutrients']['saturated_fat_g'] > 10:
penalty += 2
if meal_data['micronutrients']['sodium_mg'] > 600:
penalty += 2
if meal_data.get('added_sugars_g', 0) > 10:
penalty += 2
score = max(0, score - penalty * 0.10)
return round(score, 1)
Healthy Eating Index score
def calculate_healthy_eating_index(daily_data):
"""
计算健康饮食指数(HEI-2015改编)
评分范围:0-100分
"""
score = 0
# 充足性成分(满分50分)
# 1. 水果(5分)
fruit_servings = daily_data['fruit_servings']
score += min(fruit_servings, 2.5) * 2
# 2. 蔬菜(5分)
veg_servings = daily_data['vegetable_servings']
score += min(veg_servings, 3) * 1.67
# 3. 全谷物(10分)
whole_grains_oz = daily_data['whole_grains_oz']
score += min(whole_grains_oz, 3) * 3.33
# 4. 乳制品(10分)
dairy_servings = daily_data['dairy_servings']
score += min(dairy_servings, 3) * 3.33
# 5. 蛋白质(5分)
protein_oz = daily_data['protein_oz']
score += min(protein_oz, 5) * 1
# 6. 海鲜/植物蛋白(5分)
plant_protein_oz = daily_data['plant_protein_oz']
score += min(plant_protein_oz, 2) * 2.5
# 7. 脂肪酸比例(10分)
fat_ratio = daily_data['unsaturated_fat_g'] / max(daily_data['saturated_fat_g'], 1)
score += min(fat_ratio, 2.5) * 4
# 适度性成分(满分40分,反向计分)
# 8. 精制谷物(10分,越少越好)
refined_grains_oz = daily_data['refined_grains_oz']
score += max(10 - refined_grains_oz * 2, 0)
# 9. 钠(10分,越少越好)
sodium_g = daily_data['sodium_mg'] / 1000
score += max(10 - sodium_g * 2, 0)
# 10. 添加糖(10分,越少越好)
added_sugars_pct = daily_data['added_sugars_g'] / (daily_data['total_calories'] / 100)
score += max(10 - added_sugars_pct * 10, 0)
# 11. 饱和脂肪(10分,越少越好)
saturated_fat_pct = daily_data['saturated_fat_g'] / (daily_data['total_calories'] / 100)
score += max(10 - saturated_fat_pct * 10, 0)
return round(score, 1)
Medical safety boundaries
⚠️ Important statement
This analysis is for health reference only and does not constitute a medical diagnosis or nutritional prescription.
Scope of analysis capabilities
✅ Can do:
- Nutrition data statistics and analysis
- Trend identification and visualization
- RDA achievement rate calculation
- Nutritional deficiency risk assessment
- General nutritional advice
- Supplement interaction check
❌ Do not do:
- Diagnose nutritional deficiency diseases
- Prescribe supplements
- Replace a registered dietitian
- Manage severe malnutrition
- Evaluate food allergies
Danger signal detection
Detect the following danger signals during analysis:
-
Nutrient excess:
- Vitamin A > 3000μg (long-term)
- Vitamin D > 100μg (long-term)
- Iron > 45mg (long-term)
- Selenium > 400μg
- Sodium > 2300mg (continuous)
-
Nutrient deficiency:
- Vitamin D < 10μg/day (serum < 12 ng/mL)
- Vitamin B12 < 1.5μg/day (vegetarians)
- Iron < 6mg/day (women of childbearing age)
- Calcium < 500mg/day
-
Abnormal energy intake:
- Persistent <1200 calories/day (possible malnutrition)
- Persistent >3500 calories/day (possible overweight)
-
Abnormal dietary pattern:
- Dietary fiber <10g/day
- Added sugar >25% of calories
- Saturated fat >15% of calories
Recommendation grading
Level 1: General recommendations
- Based on DRIs/RDA standards
- Applicable to the general population
- No medical supervision required
Level 2: Reference recommendations
- Based on user data and health status
- Needs to be combined with individual circumstances
- Consulting a dietitian is recommended
Level 3: Medical recommendations
- Involves disease management or supplements
- Requires doctor confirmation
- Do not adjust medication dosage on your own
Reference Resources
- Chinese Dietary Reference Intakes (DRIs):http://www.cnsoc.org/
- Dietary Guidelines for Americans:https://www.dietaryguidelines.gov/
- USDA FoodData Central:https://fooddatacentral.usda.gov/
- WHO nutrition recommendations:https://www.who.int/nutrition/
- Supplement Interaction Database:https://naturalmedicines.therapeuticresearch.com/
Skill version: v1.0 Creation date: 2026-01-06 Maintainer: WellAlly Tech