能力标签
苹果健康数据中心
🛠
AI工具

苹果健康数据中心

基于 Python · 开源免费,本地部署,数据完全自主可控
英文名:health-data-hub
⭐ 8 Stars 🍴 1 Forks 💻 Python 📄 NOASSERTION 🏷 AI 7.5分
7.5AI 综合评分
apple-healthapple-watchdockerfastapigrafana
✦ AI Skill Hub 推荐

苹果健康数据中心 是 AI Skill Hub 本期精选AI工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。

📚 深度解析

苹果健康数据中心 是一款基于 Python 的开源工具,在 GitHub 上收获 0k+ Star,是apple-health、apple-watch、docker、fastapi领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
苹果健康数据中心 依赖 Python 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 Python 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 苹果健康数据中心 的版本更新,及时通知重要功能变化。

📋 工具概览

将iPhone/Apple Watch健康数据同步到服务器

苹果健康数据中心 是一款基于 Python 开发的开源工具,专注于 apple-health、apple-watch、docker 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 8
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
NOASSERTION
AI 综合评分
7.5 分
工具类型
AI工具
Forks
1

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

将iPhone/Apple Watch健康数据同步到服务器

苹果健康数据中心 是一款基于 Python 开发的开源工具,专注于 apple-health、apple-watch、docker 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:pip 安装(推荐)
pip install health-data-hub

# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install health-data-hub

# 方式三:从源码安装(获取最新功能)
git clone https://github.com/umutkeltek/health-data-hub
cd health-data-hub
pip install -e .

# 验证安装
python -c "import health_data_hub; print('安装成功')"
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 命令行使用
health-data-hub --help

# 基本用法
health-data-hub input_file -o output_file

# Python 代码中调用
import health_data_hub

# 示例
result = health_data_hub.process("input")
print(result)
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# health-data-hub 配置文件示例(config.yml)
app:
  name: "health-data-hub"
  debug: false
  log_level: "INFO"

# 运行时指定配置文件
health-data-hub --config config.yml

# 或通过环境变量配置
export HEALTH_DATA_HUB_API_KEY="your-key"
export HEALTH_DATA_HUB_OUTPUT_DIR="./output"
📑 README 深度解析 真实文档 完整度 72/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

Health Data Hub

CI License: Elastic 2.0 Python 3.12 FastAPI TimescaleDB Docker Ollama Download on the App Store

Self-hosted Apple Health server - sync HealthKit data from your iPhone and Apple Watch into TimescaleDB, visualize it in Grafana, and get an AI-written daily briefing via a local Ollama model. Private. Local-first. Your data stays on your hardware.
New here? BRIDGE.md is the one-page tour: pipeline diagram, who it's for, what's local vs self-hosted, setup gotchas. Read that first if 500 lines of README is too much.

Keywords: apple-health · healthkit · self-hosted · quantified-self · timescaledb · grafana · fastapi · ollama · local-llm · home-assistant · docker · privacy · health-data · wearables

Your own server, on your own hardware, turning the health data your phone already collects into an AI-written daily briefing - no cloud, no subscription, no one else reading your numbers.

You point your iPhone at it. It stores everything from your Apple Watch (heart rate, HRV, SpO2, sleep, workouts, steps, and more), graphs it in Grafana, and - if you turn it on - runs a small local AI model that writes you a short narrative every morning about how your body is actually doing.

Manual quick-start (without `setup.sh`)

```bash cp .env.example .env

Updating Existing Installs

Fresh installs load db/schema.sql automatically. Existing Docker volumes keep their original schema, so the Compose stack runs the migration service before the API, worker, agents, or Home Assistant bridge start:

docker compose up -d --build

To run the same migration pass explicitly:

docker compose run --rm migrate

The runner records applied files in schema_migrations, so re-runs are safe. Migration files still live in db/migrations/ for review and manual recovery. The current set starts at db/migrations/001_audit_hardening.sql and includes later additive upgrades such as db/migrations/002_analysis_tables.sql and db/migrations/008_oauth_tokens.sql; files apply in filename order.

Add to docker-compose.yml

caddy: image: caddy:2-alpine ports: - "443:443" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro

Quick start

You need Docker installed and running, plus a terminal. On Windows, run this inside WSL2 - setup.sh is a bash script.

git clone https://github.com/umutkeltek/health-data-hub.git
cd health-data-hub
./setup.sh

That's it. setup.sh:

  1. Generates secure passwords and writes a .env for you
  2. Asks if you want the AI briefing system, then detects your RAM + GPU and recommends the right Ollama model (you can override)
  3. Brings the whole stack up with docker compose up -d

When it finishes, run ./setup.sh doctor to confirm every service is healthy. The doctor prints the exact iOS-app URL to paste into HealthSave under Settings → Server Sync.

Re-running ./setup.sh is safe - it preserves passwords and updates only the AI-related config based on your answers.

Edit .env to set OLLAMA_MODEL=<new-tag>

docker compose exec ollama ollama pull <new-tag> docker compose restart api ```

The tier table above is a starting point - any Ollama model tag works. Browse ollama.com/library for the full list.

./setup.sh doctor says a service isn't running.

Run docker compose logs <service> (e.g. docker compose logs api) to see why. Most first-time failures are Docker not having enough memory allocated - bump it in Docker Desktop's preferences and re-run ./setup.sh.

---

Edit .env with your passwords

docker compose up -d ```

This starts: - TimescaleDB on port 5432 - FastAPI on port 8000 - Grafana on port 3000 (default login: admin / your GRAFANA_PASSWORD)

The database port is bound to 127.0.0.1 by default so it is available for local tooling without being exposed on your LAN.

To opt into Ollama manually, copy docker-compose.override.yml.example to docker-compose.override.yml, copy config.yaml.example to config.yaml, set analysis.daily_briefing.enabled and analysis.anomaly_detection.enabled to true, and set OLLAMA_MODEL in .env to the tag you want.

API Endpoints

EndpointMethodDescription
/healthGETHealth check
/api/healthGETApp-friendly health check
/readyGETAPI plus database readiness check
/api/apple/batchPOSTReceive metric batch from the client bridge
/api/apple/statusGETReturn flat per-table status objects
/api/v2/sync/runs/latestGETOptional latest HealthSave delivery receipt
/api/v2/sync/coverageGETOptional metric-level receipt coverage
/api/insights/latestGETMost recent briefing (if AI enabled)
/api/insights/anomaliesGETRecent anomaly findings, filterable by since and severity
/api/insights/trendsGETRecent HR / HRV trend findings, filterable by period=30d
/api/insights/triggerPOSTRun an analysis pass now (if AI enabled)
/metricsGETPrometheus text exposition (no auth, DB-independent)

/api/apple/status intentionally returns top-level metric objects, not a wrapped {"status":"ok","counts":...} payload. See API.md for the compatibility contract.

Home Assistant Integration

There are two supported Home Assistant paths:

  1. MQTT bridge (recommended): Health Data Hub reads TimescaleDB and publishes retained Home Assistant MQTT discovery + state topics. This keeps Home Assistant out of the database and works even when Grafana is deployed separately.
  2. Direct SQL package (legacy/example): Home Assistant queries TimescaleDB directly using integrations/home-assistant/healthsave-package.yaml.

The bridge publishes in two layers each cycle:

Aggregate parent device (one device, one state topic, the legacy shape):

  • Retained state topic: healthsave/sensor/state
  • Discovery topics: homeassistant/sensor/healthsave/<metric>/config
  • Availability: healthsave/status

Six entities on the parent device by default:

  • sensor.healthsave_heart_rate
  • sensor.healthsave_hrv_7d_avg
  • sensor.healthsave_steps_today
  • sensor.healthsave_last_sleep_hours
  • sensor.healthsave_source_model
  • sensor.healthsave_room_health_state

Per-source sub-devices (one device per distinct source_id seen in recent data — Apple Watch, Whoop, iPhone, etc.):

  • Retained state topic: healthsave/source/<slug>/state (one JSON payload per source)
  • Discovery topics: homeassistant/sensor/healthsave_<slug>/<metric>/config
  • Linked to the parent via Home Assistant's via_device so HA nests sub-devices under the parent.
  • Metrics carried per sub-device: heart_rate, hrv_latest_ms, steps_today, last_sleep_hours. Only metrics with a recent non-null value get a discovery message, so HA never sees ghost entities.

Example: a household running both an Apple Watch and a Whoop sees: - sensor.healthsave_apple_watch_heart_rate, _hrv_latest_ms, _steps_today, _last_sleep_hours - sensor.healthsave_whoop_heart_rate, _hrv_latest_ms, _last_sleep_hours (no _steps_today if Whoop hasn't logged any).

Source attribution comes from source_id on the ingestion tables (added to daily_activity and sleep_sessions in migration 009; native to heart_rate / hrv since v1). Rows with NULL source_id collapse to a single sensor.healthsave_unknown_* sub-device so legacy data never fragments into empty entities.

Both layers share healthsave/status so HA marks every sub-device offline together if the bridge stops.

Legacy MQTT namespace migration. Fresh installs should keep the primary HA_MQTT_STATE_TOPIC_PREFIX, HA_MQTT_DEVICE_IDENTIFIER, and HA_MQTT_DEVICE_NAME values on healthsave / HealthSave. If an existing Home Assistant install still has dashboards or automations on an older namespace, set HA_MQTT_LEGACY_STATE_TOPIC_PREFIX plus the matching legacy device identifier/name. The bridge then publishes both shapes from the same Data Hub service so Home Assistant can be migrated one entity at a time.

HA_MQTT_STATE_TOPIC_PREFIX=healthsave
HA_MQTT_DEVICE_IDENTIFIER=healthsave
HA_MQTT_DEVICE_NAME=HealthSave
HA_MQTT_LEGACY_STATE_TOPIC_PREFIX=<old-prefix>
HA_MQTT_LEGACY_DEVICE_IDENTIFIER=<old-device-id>
HA_MQTT_LEGACY_DEVICE_NAME=<old-display-name>

Enable it with Docker Compose. Two patterns:

(a) Bring your own broker. Point the bridge at an MQTT server you already run:

HA_MQTT_ENABLED=true \
HA_MQTT_BROKER=<your-mqtt-host> \
HA_MQTT_USERNAME=<optional-user> \
HA_MQTT_PASSWORD=<optional-password> \
docker compose --profile home-assistant up -d homeassistant-mqtt

(b) Use the bundled broker. Add the mosquitto profile and the stack runs an eclipse-mosquitto:2 container alongside the bridge. The bridge's default HA_MQTT_BROKER=mqtt resolves through docker DNS, and host port 1883 is published so a Home Assistant install on the same LAN can also connect by host IP. Persistence is on a docker volume so retained messages survive restarts.

HA_MQTT_ENABLED=true \
docker compose --profile mosquitto --profile home-assistant up -d

The bundled broker defaults to anonymous-on-LAN. To require auth, overlay a docker-compose.override.yml that flips allow_anonymous false and mounts a password file — the conf at deploy/mosquitto/mosquitto.conf is read-only so the override is the right seam.

Useful defaults:

  • Discovery prefix: homeassistant
  • State prefix: healthsave
  • Device identifier: healthsave
  • Publish interval: 60 seconds

Direct SQL example files remain available for setups that prefer DB polling: - integrations/home-assistant/healthsave-package.yaml - integrations/home-assistant/secrets.example.yaml

Troubleshooting

The Ollama container won't start.

docker compose logs ollama

The most common causes are: not enough free RAM (Ollama refuses to load a model that won't fit), the override file missing (re-run ./setup.sh - it copies the example), or another process holding port 11434 (stop it, or edit docker-compose.override.yml to bind a different port).

My briefing came back empty (or said "not enough data").

Two things to check:

  1. Has HealthSave actually synced? Hit http://localhost:8000/api/apple/status - if the table counts are all zero, sync from your phone first.
  2. How much history do you have? The statistical engine needs at least ~24 hours of heart-rate data to compute anything. Newly-installed users typically see a real briefing on day 2.

I want to change the model after setup.

Edit the OLLAMA_MODEL= line in your .env, then pull the new tag and restart:

```bash

🎯 aiskill88 AI 点评 A 级 2026-05-30

一个不错的健康数据同步工具

📚 实用指南(长尾问题)
适合谁
  • 需要 health-data-hub 解决具体问题的开发者与运营人员
最佳实践
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • Python 依赖冲突:建议用 venv / uv 隔离环境
部署方案
  • Docker:health-data-hub 提供官方镜像,docker compose up 一键启动
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
health-data-hub 中文教程health-data-hub 安装报错怎么办health-data-hub Docker 部署health-data-hub 与同类工具对比health-data-hub 最佳实践health-data-hub 适合谁用

⚡ 核心功能

👥 适合谁
  • 需要 health-data-hub 解决具体问题的开发者与运营人员
⭐ 最佳实践
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • Python 依赖冲突:建议用 venv / uv 隔离环境

👥 适合人群

AI 技术爱好者研究人员和学生开发者和工程师技术创业者

🎯 使用场景

  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发

⚖️ 优点与不足

✅ 优点
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

该工具使用 NOASSERTION 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

📄 NOASSERTION — 请查阅原始协议条款了解具体使用限制。

🔗 相关工具推荐

📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

health-data-hub 是一款Python开发的AI辅助工具。开源AI工具:Self-hosted Apple Health server - sync HealthKit from iPhone/Apple Watch to Time。⭐8 · Python 主要应用场景包括:同步健康数据到服务器。
💡 AI Skill Hub 点评

经综合评估,苹果健康数据中心 在AI工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。

📚 深入学习 苹果健康数据中心
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 health-data-hub
原始描述 开源AI工具:Self-hosted Apple Health server - sync HealthKit from iPhone/Apple Watch to Time。⭐8 · Python
Topics apple-healthapple-watchdockerfastapigrafana
GitHub https://github.com/umutkeltek/health-data-hub
License NOASSERTION
语言 Python
🔗 原始来源
🐙 GitHub 仓库  https://github.com/umutkeltek/health-data-hub 🌐 官方网站  https://apps.apple.com/app/id6759843047

收录时间:2026-05-30 · 更新时间:2026-05-31 · License:NOASSERTION · AI Skill Hub 不对第三方内容的准确性作法律背书。