SuperAPI AI Directory

lark-workflow-health-diary

Office & productivity

View repository

Updated 10-16 06:23

About this skill

Health Diary Workflow

CRITICAL — Before starting, you MUST first use the Read tool to read ../lark-shared/SKILL.md, which contains authentication and permission handling

Applicable Scenarios

  • "Help me record today's lunch" / "Record diet"
  • "My stomach feels uncomfortable today" / "I didn't sleep well last night"
  • "What did I eat this week?" / "Diet review"
  • "Help me analyze the correlation between diet and physical condition"
  • "Generate a weekly health report"

Prerequisites

Only supports user identity. Before execution, ensure authorization has been granted:

lark-cli auth login --domain im,base,docs

Workflow Overview

记录饮食:
  用户发照片/描述 ──► AI 识别食物 ──► base +record-upsert

记录身体状态:
  用户描述状态 ──► base +record-upsert

关联分析:
  base +data-query ──► AI 分析饮食-状态关联

周报生成:
  base +record-list ──► AI 汇总 ──► doc +create

主动提醒:
  base +record-list ──► 识别风险食物 ──► im +messages-send

Data Initialization

Base Table Structure

Table 1: Diet Log (diet_log)

Field Name Type Description
Date Date Record date
Meal Single select Breakfast/Lunch/Dinner/Snack/Late-night snack
Time Date Specific time
Food List Text Recognized food names (comma-separated)
Food Details Text Detailed description and portion size of each food
Photo Link URL Link to the food photo in Feishu
Estimated Calories Number Estimated calories (optional, AI estimate)
Notes Text Additional notes from the user
Created Time Date Record creation time

Table 2: Body Status (body_status)

Field Name Type Description
Date Date Status date
Time Date Specific time
Status Type Single select Stomach discomfort/Headache/Insomnia/Fatigue/Allergy/Skin/Mood/Other
Severity Single select Mild/Moderate/Severe
Status Description Text Detailed description
Possible Triggers Text Causes guessed by the user (if any)
Duration Text Duration of symptoms
Relief Methods Text How it was relieved (if any)
Created Time Date Record creation time

Table 3: Correlation Analysis (correlation)

Field Name Type Description
Food Text Suspicious food name
Status Text Associated body status
Occurrence count Number Number of times this combination occurred
Time difference pattern Text How long after eating symptoms appear (e.g. "2-4 hours")
Association strength Single select Low/Medium/High
Most recent occurrence date Date Most recent occurrence time
Notes Text Analysis notes

Initialization command

# 注意:+table-create 可能部分成功,需捕获错误后用 +field-create 补字段
# 注意:连续创建字段会触发限流(错误码 800004135),每次调用间隔至少 1 秒
lark-cli base +table-create --name "饮食记录" --fields '[
  {"name":"日期","type":"datetime"},
  {"name":"餐次","type":"select","multiple":false,"options":[{"name":"早餐"},{"name":"午餐"},{"name":"晚餐"},{"name":"加餐"},{"name":"夜宵"}]},
  {"name":"时间","type":"datetime"},
  {"name":"食物列表","type":"text"},
  {"name":"食物详情","type":"text"},
  {"name":"照片链接","type":"link"},
  {"name":"估算热量","type":"number"},
  {"name":"备注","type":"text"},
  {"name":"创建时间","type":"datetime"}
]'
lark-cli base +table-create --name "身体状态" --fields '[
  {"name":"日期","type":"datetime"},
  {"name":"时间","type":"datetime"},
  {"name":"状态类型","type":"select","multiple":false,"options":[{"name":"胃部不适"},{"name":"头痛"},{"name":"失眠"},{"name":"疲劳"},{"name":"过敏"},{"name":"皮肤"},{"name":"情绪"},{"name":"其他"}]},
  {"name":"严重程度","type":"select","multiple":false,"options":[{"name":"轻微"},{"name":"中等"},{"name":"严重"}]},
  {"name":"状态描述","type":"text"},
  {"name":"可能诱因","type":"text"},
  {"name":"持续时间","type":"text"},
  {"name":"缓解方式","type":"text"},
  {"name":"创建时间","type":"datetime"}
]'
lark-cli base +table-create --name "关联分析" --fields '[
  {"name":"食物","type":"text"},
  {"name":"状态","type":"text"},
  {"name":"出现次数","type":"number"},
  {"name":"时间差模式","type":"text"},
  {"name":"关联强度","type":"select","multiple":false,"options":[{"name":"低"},{"name":"中"},{"name":"高"}]},
  {"name":"最近出现日期","type":"datetime"},
  {"name":"备注","type":"text"}
]'

Mode 1: Record diet

Method A: Photo recognition

The user sends a food photo via Feishu message:

# 获取图片消息
lark-cli im +messages-resources-download --message-id "<message_id>" --file-key "<file_key>"

AI processing:

  1. Use multimodal capabilities to recognize the food in the photo
  2. Prompt the user to confirm or supplement: "Received, dinner is spaghetti bolognese pizza, how many slices did you eat?"
  3. After the user replies, record it in the diet record table

Method B: Text description

The user directly describes what they ate:

  • "For lunch I ate rice, braised pork, and green vegetables"
  • "In the afternoon I drank a latte"

AI processing:

  1. Parse food names
  2. If the description is vague, ask for details (e.g. "What was added to the coffee? Whole milk or oat milk?")
  3. Estimate calories (optional)
  4. Record in the diet record table

Record command

lark-cli base +record-upsert --table-id "<diet_table_id>" --json '{
  "日期": "2026-03-31",
  "餐次": "午餐",
  "时间": "2026-03-31 12:30:00",
  "食物列表": "米饭,红烧肉,青菜",
  "食物详情": "米饭一碗、红烧肉约200g、炒青菜一份",
  "备注": ""
}'

Mode 2: Record body status

The user describes their body status:

  • "My stomach feels uncomfortable today" → Record: status type = stomach discomfort
  • "I had insomnia last night, didn't fall asleep until around 3 a.m." → Record: status type = insomnia
  • "I felt a bit dizzy after lunch" → Record: status type = headache + possible trigger = lunch
lark-cli base +record-upsert --table-id "<body_table_id>" --json '{
  "日期": "2026-03-31",
  "时间": "2026-03-31 14:00:00",
  "状态类型": "胃部不适",
  "严重程度": "中等",
  "状态描述": "午饭后胃有点胀,持续约1小时",
  "可能诱因": "午餐吃的太快"
}'

Mode 3: Association analysis

AI automatically analyzes the association between diet and body status:

Analysis logic

  1. Time window matching: Find diet records within 2-24 hours before the body status occurs
  2. Frequency statistics: Count the co-occurrence frequency of each food and each body status
  3. Time difference pattern: Analyze the pattern of the time interval from food consumption to symptom onset
  4. Exclude common factors: Exclude commonly occurring foods (such as rice, water), and focus on specific foods

Analysis command

# 获取最近 30 天的数据
lark-cli base +record-list --table-id "<diet_table_id>" --filter '...日期 >= "30天前"'
lark-cli base +record-list --table-id "<body_table_id>" --filter '...日期 >= "30天前"'

AI analysis output

## 饮食-身体状态关联分析(过去 30 天)

### 发现的关联模式
| 食物 | 身体状态 | 出现次数 | 典型时间差 | 关联强度 |
|------|---------|---------|-----------|---------|
| 冰美式 | 胃部不适 | 3次 | 1-2小时 | 高 |
| 辣味火锅 | 失眠 | 2次 | 6-8小时 | 中 |

### 建议
- 冰美式可能与你的胃部不适有较强关联,建议减少摄入或改用热饮
- 辣味火锅后出现失眠,建议避免晚餐食用辛辣食物

Update association analysis table

lark-cli base +record-upsert --table-id "<correlation_table_id>" --json '{
  "食物": "冰美式",
  "状态": "胃部不适",
  "出现次数": 3,
  "时间差模式": "1-2小时",
  "关联强度": "高"
}'

Mode 4: Proactive reminders

When the user records a body status, AI proactively checks the association analysis table:

lark-cli base +record-list --table-id "<correlation_table_id>" --filter '...关联强度 IN ("高","中")'

If the current diet contains high-risk foods, remind immediately:

提醒:你今天喝了冰美式,之前 3 次喝冰美式后 1-2 小时内都出现了胃部不适。
建议:注意观察,如果出现不适请记录。

Mode 5: Weekly report generation

Generate a health report every week and save it as a Feishu document:

Report content

## 健康周报({日期范围})

### 饮食概览
- 记录天数:N 天
- 总餐次:N 次
- 饮食规律性:{评价}

### 身体状态概览
- 记录不适:N 次
- 主要症状:{列表}
- 严重程度分布:轻微 N 次、中等 N 次、严重 N 次

### 本周新发现
- {新发现的关联模式}

### 趋势对比(vs 上周)
- 饮食多样性:{变化}
- 不适频率:{变化}

### 建议
- {个性化建议}

Generation command

lark-cli doc +create --title "健康周报 ({日期范围})" --markdown "<报告内容>"

Permission table

Command Required scope
im +chat-messages-list im:message:readonly
im +messages-resources-download im:message.resource:readonly
im +messages-send im:message:send_as_bot
base +table-create bitable:app
base +record-list bitable:app:read
base +record-upsert bitable:app:write
base +data-query bitable:app:read
docs +create docx:document:create

Reference

  • lark-shared — Authentication, permissions (required reading)
  • lark-im — +chat-messages-list、+messages-resources-download、+messages-send Detailed usage
  • lark-base — +table-create、+record-list、+record-upsert、+data-query Detailed usage
  • lark-doc — +create Detailed usage