Google Health API
https://developers.google.com/health?hl=ja
Google Cloud上のOAuth 2.0のクライアントが必要
https://developers.google.com/health/setup?hl=ja
Google Health API へのアクセスは Google Cloud を通じて提供されます。API を有効にして Google アカウントを承認するには、Google Cloud プロジェクトが必要です。
取れるデータの分類
心拍系
呼吸・酸素
活動量
「どれだけ動いたか」。加速度センサー+気圧センサー由来。
エネルギー
消費カロリー。歩数 + 心拍 + 個人プロファイルから算出。
運動・パフォーマンス
運動のセッションやGPS
睡眠
身体測定
身長、体重、体脂肪
栄養
今は水だけ
dataType
データの種類。上の概念のなかの具体的なデータ
https://developers.google.com/health/data-types?hl=ja
https://developers.google.com/health/reference/rest/v4/users.dataTypes.dataPoints
recordType(時刻やデータの保持単位)
interval
期間, ある区間の集計filt
steps, distance, heart-rate
sample
単発の測定、瞬間
weight, body-fat
daily
日付のみ、日の集計値
daily-*
session
期間と内部構造
1セッションの記録
sleep, exercise
operation
list
デバイスごとのナマのデータ
get
reconcile
デバイス複数あるのを正規化したデータ。つまり基本はこっちを見ればいい
rollUp
UTC任意時間窓の集計
physical time(物理時間)
dailyRollUp
civil timeの日時集計
夏時間とか、UTC offsetの面倒事とか、そういうもののためかも?
create, patch, batchDelete
exportExerciseTcx
GPSのやつ
endpoint
メタ的なidentity,setting,profile
本体は
dataPoints
メインはこれ
webhook
dataPointsの例
GET https://health.googleapis.com
/v4/users/me
/dataTypes/:data-type/dataPoints
dataPoints:rollUpのように、operationごとにエンドポイントが分かれる(:operationって感じ)
?page_size=10&filter=data_type.interval.start_time >= "2025-10-01T00:00:00Z"
filterでどのdataPointsを返すのかを指定する。SQLのWHEREに相当
ANDが基本で、ORはsleepのみ