Ga naar inhoud

Health.md export reference

Deze inhoud is nog niet vertaald.

This reference documents the data Health.md can produce for users, scripts, databases, and connected applications. It covers readable daily summaries and the source-level Apple Health records behind them.

The reference is written for two audiences:

  • Users deciding which formats and metrics to export.
  • Developers building parsers, automations, data warehouses, Obsidian workflows, or connected clients.

All committed examples use deterministic synthetic data. They contain no real health information.

When sources disagree, use this order:

  1. Production exporters, serializers, metric catalogs, and protocol models.
  2. The committed versioned export-schema signature.
  3. Generated examples and generated field inventories.
  4. Explanatory prose.

The generated artifacts are rebuilt by running the real production code against a fixed synthetic corpus. CI compares regenerated output byte-for-byte with the committed files. This keeps examples from drifting into hand-written approximations.

Surface Identifier Current version Purpose
Daily record healthmd.health_data 8 Apple daily summaries, optional typed provider sections, diagnostics, and optional canonical archive.
Typed WHOOP day healthmd.provider.whoop_daily 1 Provider-namespaced WHOOP cycles, recovery, sleep, workouts, body snapshot, and safe resource status.
Canonical Apple Health archive healthmd.healthkit_records 1 Source records, provenance, relationships, query results, and external records.
Roll-up summary healthmd.rollup_summary 9 One immutable requested-range projection derived from successful daily summaries; historical weekly/monthly/yearly v8 files remain valid.
API Endpoint envelope healthmd.api_export 1 or 2 One or more daily records sent to a configured endpoint; v2 adds provider sidecars.
Strict CLI raw result healthmd.raw_result 1 Canonical daily records returned through the Mac CLI without writing files.
Compact context day healthmd.query_context_day 1 Portable typed query input with coverage and evidence locators.
Query request/response/error healthmd.query_request / healthmd.query_response / healthmd.query_error 1 Shared paged query semantics and structured failures.
Evidence packet healthmd.evidence_packet 1 Deterministic factual results linked to source evidence.
Connected app protocol Versioned capabilities/messages Independent Mac–iPhone requests, progress, transfer, acknowledgement, and results.

Versions advance independently. A newer API or connected-protocol envelope does not automatically change the daily-record schema.

Need Recommended surface Exact source records? Human-readable?
Complete machine archive JSON Yes Partly
Spreadsheet or stream ingestion CSV Yes, as canonical JSON cells Partly
Daily journal Markdown No; compact diagnostics only Yes
Obsidian database properties Obsidian Bases No; compact diagnostics only Frontmatter
One note per source event Individual Entry Tracking Selected UUID-backed records Yes
Send to your own service API Endpoint Yes when lossless capture is enabled No
Terminal automation Mac CLI strict raw Yes No
Local queries and evidence Loopback query API/CLI/MCP Directly scoped Typed JSON
Requested-range trends Roll-ups No; summary projections Yes

The generated directory contains complete, copyable fixtures rather than shortened snippets:

  • generated/core/: daily exports, canonical records, data dictionary, metric catalog, path/type inventories, and CSV contracts.
  • generated/individual/: canonical and compatibility entry notes, filename/path behavior, and recursive frontmatter inventory.
  • generated/rollups/: production range-v9 JSON/CSV/Markdown/Bases output, historical weekly-v8 examples, and the complete aggregation matrix.
  • generated/automation/: API, localhost control, strict raw, sync-message, connected-transfer, and Mac job/result contracts.
  • generated/cli/: executable CLI requests, responses, diagnostics, and exit-code behavior.

Generated files may be large because they intentionally exercise optional branches and specialized payloads. Start with the hand-written reference pages, then open the complete fixture relevant to your integration.

  1. Branch on every declared schema identifier and version.
  2. Preserve unknown keys, enum values, metadata tags, and record kinds when possible.
  3. Treat absent optional fields as absent, never as zero or false.
  4. Inspect capture status and every query result before claiming completeness.
  5. Use source UUIDs or documented external identities for deduplication.
  6. Use canonical archive timestamps for source-event joins; summary clock fields are presentation values.
  7. Parse CSV with an RFC 4180 implementation. Do not split on commas or physical lines.
  8. Keep historical files under their original version. Never relabel older exports as v8.

Lossless exports may include exact timestamps, route locations, medications, mental-wellbeing entries, clinical content, source/device details, ECG measurements, documents, and binary attachments. Health.md keeps local exports on the selected device or destination, but API and CLI users control where copied data goes. Apply encryption, access controls, retention limits, and logging policies appropriate for sensitive health information.