← Back to Skills Marketplace
gloriaameng

iwatch health data analysis

by Gloriaameng · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
133
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install iwatch-health-data-analysis
Description
Apple Health 数据全景分析。从 export.zip 流式解析 XML(支持 1-2GB 大文件),提取 RHR/HRV/VO₂Max/睡眠/步数/血氧等核心指标,基于用户个人信息(年龄/性别/身高/体重/病史)动态校准参考范围,生成个性化交互式 HTML 报告(含 6 张 Chart.js 图表)。...
README (SKILL.md)

apple-health-analysis v2.0

目录结构

scripts/
  parse_health.py      # 流式解析 export.zip → chart_data.json
  generate_report.py   # chart_data.json + 用户画像 → 个性化 HTML 报告

用户数据导出指南

步骤(iOS):

  1. 打开「健康」App → 右上角头像
  2. 向下滚动 → 「导出所有健康数据」
  3. 等待打包(约 1-5 分钟)→ 保存或分享 export.zip
  4. 将 zip 文件发给 AI

数据规模参考:

  • 使用 1 年:~200MB-500MB
  • 使用 2-3 年:~1-2GB
  • 解析时间:约 30-60 秒(流式,无需解压)

核心依赖

标准库(zipfile, re, json, statistics),无需额外安装。


工作流(v2.0 标准流程)

Step 0:收集用户画像

收到 export.zip 后,必须先向用户询问以下信息,再进行分析:

为了给你提供个性化的健康基准,我需要了解几个基本信息:

1. 性别(影响 RHR/HRV/VO₂Max/体脂参考范围)
2. 年龄或出生年份(参考范围随年龄变化显著)
3. 身高(计算 BMI,校准体重意义)
4. 体重单位(Apple Health 体重默认为 lb,需确认)
5. 有无已知慢性病/服药史(如甲亢、高血压、心律失常等)
6. 运动习惯(日常久坐/轻度活动/规律运动/专业训练)

以上信息不会离开对话,分析完成后不会保存。

将收到的信息存入 user_profile 字典,传给解析和报告脚本。

Step 1:解析数据

python3 scripts/parse_health.py /path/to/export.zip /tmp/chart_data.json

Step 2:加载用户画像,动态确定参考范围

根据 Step 0 收集的信息,调用 scripts/generate_report.py 中的 build_reference() 函数:

profile = {
    "gender": "female",      # male / female / other
    "age": 26,               # 岁
    "height_cm": 170,        # 厘米
    "weight_unit": "lb",     # lb / kg
    "conditions": ["hyperthyroidism"],  # 已知病史,影响异常标注
    "activity_level": "active"  # sedentary / light / active / athlete
}

Step 3:执行分析(AI 执行,基于动态参考范围)

心血管系统

  • RHR:与同龄同性别参考范围对比(见下方参考表)
  • HRV SDNN:个体化趋势分析优先于绝对值
  • VO₂Max:对应年龄/性别分级(差/一般/良好/优秀/精英)

神经系统(自主神经)

  • HRV \x3C ref.hrv_low → 交感亢奋
  • HRV > ref.hrv_high → 副交感主导(迷走张力高者不追求过高)

睡眠

  • Deep Sleep 占比 \x3C 10% 关注;REM 占比 \x3C 15% 关注
  • Awake 次数与 RHR 同向波动 → 睡眠质量与自主神经相互印证

代谢

  • BMI = 体重kg ÷ 身高m²(体重单位自动换算)
  • 体脂参考范围按性别/年龄分级
  • 步数目标:久坐人群 6000+,一般成人 8000+,健康目标 10000+

异常检测

  • 连续 3+ 个月 RHR 上升 + HRV 下降 → 系统性应激(疾病/压力),建议就医
  • 血氧月均 \x3C 95% → 建议筛查
  • 步数骤降持续 2+ 个月 → 生活方式变化

Step 4:生成报告

python3 scripts/generate_report.py \
  /tmp/chart_data.json \
  health_report.html \
  --gender female \
  --age 26 \
  --height 170 \
  --weight-unit lb \
  --conditions "hyperthyroidism" \
  --activity active \
  --verdict "整体判断:亚健康恢复期..."

动态参考范围表

静息心率 RHR(bpm)

性别 年龄 优秀 良好 正常 偏高 过高
18-25 \x3C54 54-60 61-73 74-82 >82
26-35 \x3C55 55-61 62-74 75-83 >83
36-45 \x3C56 56-62 63-75 76-84 >84
18-25 \x3C49 49-55 56-68 69-77 >77
26-35 \x3C50 50-56 57-69 70-78 >78
36-45 \x3C51 51-57 58-70 71-79 >79

VO₂Max 分级(mL/kg/min)

性别 年龄 一般 良好 优秀 精英
20-29 \x3C29 29-34 35-43 44-48 >48
30-39 \x3C28 28-33 34-41 42-46 >46
20-29 \x3C38 38-43 44-51 52-56 >56
30-39 \x3C35 35-41 42-49 50-53 >53

HRV SDNN 参考(ms,Apple Watch 连续监测)

年龄 低(需关注) 正常 良好
20-30 \x3C25 25-50 >50
30-40 \x3C20 20-45 >45
40-50 \x3C15 15-40 >40

体脂率参考

性别 18-30岁 31-40岁
21-32% 23-34%
8-20% 11-22%

病史对分析的影响

病史 影响的指标 分析调整
甲亢/甲减 RHR、HRV、VO₂Max、体重 RHR偏高/偏低时先排除甲状腺因素;标注治疗前后对比
高血压 RHR、血氧 加入血压数据(如有)分析;RHR目标更严格(\x3C70)
心律失常(早搏) RHR、HRV HRV数据可能失真;日常心率偏高有代偿机制解释
血管迷走性晕厥 HRV 不追求HRV越高越好;避免过高迷走张力风险
低血压 RHR 心率轻度代偿(75-85bpm)属正常,不作为异常标注
贫血 RHR、VO₂Max、活动卡路里 RHR偏高/VO₂Max偏低时排除贫血因素
糖尿病 步数、卡路里 步数目标提升至10000+;关注活动消耗稳定性

数据质量说明

  • 体重单位:Apple Health 体重默认 lb(磅),换算:kg = lb × 0.4536必须向用户确认单位
  • HRV 数据源:旧设备 HRV 条目极少(每月1-2条)且量级差异大,不可与新设备数据混合对比;自动检测 sourceName 字段分段处理
  • 睡眠格式:旧格式只有 InBed/Asleep,无分期;Series 6+ 才有 Deep/REM/Core;报告分段显示
  • 血氧:Apple Watch Series 6(2020年)起才有,早期数据缺失属正常
  • 步数多设备重复:已用日汇总方式处理
  • 隐私提示:数据含完整健康信息,分析完成后建议删除 export.zip

常见 Q&A

Q: 没有 HRV 数据? A: 需要 Apple Watch 且设置中开启「心率通知」。无 HRV 时跳过自主神经分析,其余正常生成。

Q: 为什么 HRV 早期数值异常高(80-160ms)? A: 旧 Apple Watch 测量 HRV 频率极低(每月1-2次),且算法不同,不可与新版连续监测数据对比。脚本会自动识别设备名称分段处理。

Q: XML 太大内存不足? A: parse_health.py 流式解析,512KB 分块,1GB+ 文件正常。

Q: 分析多少时间跨度合适? A: 理论无限。月度聚合后每年12个数据点,图表不会过密。建议至少6个月才能做趋势分析。

Usage Guidance
This skill appears to do exactly what it says: locally parse an Apple Health export and produce a personalized HTML report. Before using it: 1) Only run it if you trust the skill/source — the repository/source is unknown. 2) Be aware export.zip contains very sensitive personal health data; prefer running the included scripts locally (not sending the ZIP to a remote service). 3) Check where files are written (e.g., /tmp/chart_data.json, health_report.html) and securely delete the export.zip and any outputs when finished if you don't want them retained. 4) If you require stronger guarantees that data never leaves your machine or platform logs, review the hosting platform's privacy/log retention policies or run the scripts on a local isolated environment. 5) If you want additional assurance, inspect the included scripts yourself (they are short, standard Python) to confirm there are no network calls or hidden uploads before executing.
Capability Analysis
Type: OpenClaw Skill Name: iwatch-health-data-analysis Version: 1.0.0 The skill bundle is a legitimate tool for analyzing Apple Health data exports. It consists of a streaming XML parser (scripts/parse_health.py) designed to handle large files efficiently and a report generator (scripts/generate_report.py) that creates interactive HTML charts using Chart.js. The instructions in SKILL.md guide the AI agent to collect necessary health profile information (age, gender, etc.) to provide accurate benchmarks, and include privacy reminders for the user. No evidence of data exfiltration, malicious execution, or unauthorized access was found.
Capability Assessment
Purpose & Capability
Name/description match the provided code and instructions: parse Apple Health export.zip, extract RHR/HRV/VO₂Max/steps/sleep/spO2, aggregate monthly data and render an HTML report. No unrelated env vars, binaries, or installs are requested.
Instruction Scope
SKILL.md instructs the agent to ask for a user profile and to have the user provide export.zip; scripts parse the ZIP and generate chart_data.json and an HTML report. All operations are file I/O and in-process parsing. Note: the skill requires users to upload highly sensitive health data (export.zip) — that is expected for this purpose but is a privacy risk that the user must accept.
Install Mechanism
No install spec; code uses only Python standard library modules (zipfile, re, json, statistics, pathlib). No downloads or external packages are required.
Credentials
No credentials, env vars, or config paths are requested. The data the skill needs (export.zip and user profile) are directly relevant to the stated purpose.
Persistence & Privilege
The skill is not always-enabled and allows model invocation. It performs local file writes (e.g., /tmp/chart_data.json and the HTML output) which is expected for report generation; it does not modify other skills or request persistent elevated privileges.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install iwatch-health-data-analysis
  3. After installation, invoke the skill by name or use /iwatch-health-data-analysis
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Major update: Adds individualized, interactive Apple Health analysis with dynamic benchmarks and robust big-file support. - 支持 1–2GB Apple Health export.zip 的流式解析,无需解压,显著提升大文件处理能力。 - 自动提取 RHR、HRV、VO₂Max、睡眠、步数、血氧等多项核心健康指标。 - 基于用户性别、年龄、身高、体重、慢病史、运动习惯,动态校准健康参考范围,实现个性化分析。 - 生成交互式 HTML 报告(内含 6 张 Chart.js 图表),直观展示健康趋势与参考对比。 - 增加自动检测异常与个性化解释(如慢病、设备型号、数据不足等),增强实用性和安全提示。 - 全新中英文场景指令和用户数据导出说明,提升使用体验。 What's New: 🚀 Performance & Core Features Optimized Large File Processing: Added streaming parsing support for massive 1–2GB Apple Health export.zip files. The skill can now read data directly without needing to unzip, significantly improving speed and reliability. Interactive HTML Reports: The skill now generates a rich, interactive HTML report containing 6 custom Chart.js graphs, giving you a highly visual comparison of your health trends against reference baselines. Comprehensive Metric Extraction: Automatically extracts and processes your most important health indicators, including Resting Heart Rate (RHR), Heart Rate Variability (HRV), VO₂ Max, Sleep, Steps, and Blood Oxygen (SpO₂). 🧠 Smarter, Personalized Analysis Dynamic Health Baselines: Health reference ranges are no longer one-size-fits-all. The skill now dynamically calibrates ranges based on your gender, age, height, weight, chronic disease history, and exercise habits. Smart Anomaly Detection: Automatically detects data outliers and provides personalized explanations. It now considers context like chronic conditions, specific wearable device models, or insufficient data points, providing better practical advice and safety warnings. ✨ User Experience (UX) Bilingual Support & Better Onboarding: Introduced entirely new system prompts and usage scenarios in both English and Chinese. Added clear, step-by-step instructions on how users can easily export their Apple Health data.
Metadata
Slug iwatch-health-data-analysis
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is iwatch health data analysis?

Apple Health 数据全景分析。从 export.zip 流式解析 XML(支持 1-2GB 大文件),提取 RHR/HRV/VO₂Max/睡眠/步数/血氧等核心指标,基于用户个人信息(年龄/性别/身高/体重/病史)动态校准参考范围,生成个性化交互式 HTML 报告(含 6 张 Chart.js 图表)。... It is an AI Agent Skill for Claude Code / OpenClaw, with 133 downloads so far.

How do I install iwatch health data analysis?

Run "/install iwatch-health-data-analysis" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is iwatch health data analysis free?

Yes, iwatch health data analysis is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does iwatch health data analysis support?

iwatch health data analysis is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created iwatch health data analysis?

It is built and maintained by Gloriaameng (@gloriaameng); the current version is v1.0.0.

💬 Comments