# ヘルストラッカーAPI

> ステップ数、心拍数、HRV、睡眠、SpO₂をウェアラブルデバイスからLOINCコード化されたFHIR Observationとして保存します。どのデバイスがどのヘルスストアに到達するか、Web APIが存在しない理由、および動作するリクエストについて説明します。

Source: https://developers.anpheros.com/ja/guides/health-tracker-api

**ヘルストラッカーAPIを使用すると、アプリケーションはウォッチ、リング、バンド、スケールが収集するデータ（ステップ数、心拍数、心拍変動、睡眠、酸素飽和度、体重）を構造化データとしてサーバーに送受信できます。** ほとんどのデバイスは共有APIを提供していません。データはスマートフォンのヘルスストア（Apple HealthKitまたはAndroid Health Connect）に到達し、アプリはそこからデータを読み取ります。Anpherosはサーバーサイドです。アプリは読み取り値をLOINCコード化されたFHIR R4 Observationとして書き込み、同意を得た他のすべてのアプリ、クリニック、またはAIエージェントは、1つのAPIを通じて同じデータを読み取ることができます。

<!-- visual:tracker-flow -->

## どのデバイスがどのヘルスストアに到達するか

| デバイス | 到達先 | 読み取り方法 |
|---|---|---|
| Apple Watch, iPhone, 多くのiOSアプリ | Apple HealthKit | iPhone上のSwift ([Apple Health to FHIR](https://developers.anpheros.com/ja/guides/apple-health-fhir)) |
| Galaxy Watch, Wear OS, Fitbit, Garmin, Oura, Withings (Androidアプリ) | Android Health Connect | スマートフォン上のKotlinまたはFlutter ([Health Connect to FHIR](https://developers.anpheros.com/ja/guides/health-connect-fhir)) |
| Health Connectに含まれないGalaxy Watchの詳細 | Samsung Health | Samsung Health Data SDK ([Samsung Health to FHIR](https://developers.anpheros.com/ja/guides/samsung-health-fhir)) |

HealthKitもHealth ConnectもWeb APIやREST APIを持っていません。データはスマートフォン上に存在し、ユーザーがインストールして許可したアプリのみがそれを読み取ることができます。したがって、サーバー上のヘルス・トラッカーAPIは、常に小さなモバイルアプリから始まります。

<!-- visual:tracker-codes -->

## 1日のステップを記録する

```bash
curl -X POST https://platform.anpheros.com/fhir/R4/Observation \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/fhir+json" \
  -H "Idempotency-Key: steps-$PID-2026-10-15" \
  -d '{
    "resourceType": "Observation",
    "status": "final",
    "category": [{"coding": [{"system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "activity"}]}],
    "code": {"coding": [{"system": "http://loinc.org", "code": "41950-7", "display": "Number of steps in 24 hour Measured"}]},
    "subject": {"reference": "Patient/'"$PID"'"},
    "effectivePeriod": {"start": "2026-10-15T00:00:00+03:00", "end": "2026-10-16T00:00:00+03:00"},
    "valueQuantity": {"value": 8412, "unit": "steps", "system": "http://unitsofmeasure.org", "code": "{steps}"}
  }'
```

メトリックごとに、個人のタイムゾーンを期間に含めて、ローカルの1日につき1つのObservationを保存します。`Idempotency-Key`により、再送信は無害になります。[FHIR形式のウェアラブルデータ](https://developers.anpheros.com/ja/guides/wearable-data-fhir)には、完全なLOINCテーブルとテスト済みの毎日のupsertが含まれています。

## 読み取り

```bash
# the last 30 daily step counts
curl "https://platform.anpheros.com/fhir/R4/Observation?patient=$PID&code=http://loinc.org|41950-7&_sort=-date&_count=30" \
  -H "Authorization: Bearer $KEY"
```

別のアプリケーションは、その人の同意を得てのみ同じデータを読み取ります（OAuth 2.1、`patient/Observation.rs?category=activity`のようなSMARTスコープ）。すべての読み取りは記録され、その人はそれを見ることができます。

## よくある質問

### 無料のヘルス・トラッカーAPIはありますか？
Anpherosには無料のサンドボックスがあります。30人の合成患者のFHIR Observationとしてトラッカーデータを保存・読み取りできます。デバイスメーカー独自のAPI（Fitbit、Garmin、Oura、Withings）には、それぞれ独自のアクセスルールと利用規約があります。

### Apple HealthまたはHealth Connect用のWeb APIはありますか？
いいえ。HealthKitとHealth Connectはデータを電話上に保持します。インストールされたアプリは、ユーザーの許可を得てそれを読み取り、Anpherosのようなサーバーに送信できます。

### ヘルス・トラッカーAPIはどのコードを使用すべきですか？
LOINC: 41950-7 ステップ、8867-4 心拍数、40443-4 安静時心拍数、80404-7 心拍変動（RMSSD）、59408-5 酸素飽和度、93832-4 睡眠時間、29463-7 体重。単位はUCUM。

### AnpherosはFitbitまたはGarminに直接接続しますか？
いいえ。それらのデータは、電話のヘルスストアとお客様のアプリを経由してAnpherosに到達します。直接のクラウド間接続はありません。

<!-- visual:cta-tracker -->

## 関連情報

- [ウェアラブルAPI：Fitbit、Garmin、Oura、Withings](https://developers.anpheros.com/ja/guides/wearable-apis)
- [Fitbit Web API サービス終了（2026年10月）](https://developers.anpheros.com/ja/guides/fitbit-web-api-shutdown)
- [FHIRにおけるウェアラブルデータ（Apple Health、Health Connect）](https://developers.anpheros.com/ja/guides/wearable-data-fhir)
- [FHIRによる遠隔患者モニタリング](https://developers.anpheros.com/ja/guides/remote-patient-monitoring-fhir)
- [FHIRによるパーソナルヘルスレコード（PHR）アプリ](https://developers.anpheros.com/ja/guides/personal-health-record-app)
- [医療データAPI](https://developers.anpheros.com/ja/guides/medical-data-api)
