Skip to content

apple_health

diapason.connectors.apple_health

Apple Health connector -- reads HealthKit SQLite DB or iPhone Health export XML.

Two data sources are tried in order: 1. HealthKit SQLite DB at ~/Library/Health/healthdb_secure.sqlite (macOS with HealthKit sync enabled). 2. Health Export XML placed by the user at ~/.diapason/connectors/apple_health_export/export.xml.

Both are local-only; no API keys are needed.

AppleHealthConnector

Bases: BaseConnector

Sync health data from Apple Health (local files only).

is_connected()

Readable HealthKit database, or an export file we can open.

exists() on the HealthKit store is True under macOS TCC even when every read is refused, so it could not distinguish "connected" from "visible and forbidden". The export path is an ordinary file the user placed themselves, so existence is the right question for it.

sync(*, since=None, cursor=None)

Yield health Documents, preferring HealthKit DB over export XML.