The Google Health API provides data types that track a user's sleep patterns, including duration, quality, and physiological metrics during rest. These metrics help applications provide insights into recovery, sleep hygiene, and long-term health trends.
Physiological metrics such as Heart Rate Variability (HRV), Oxygen Saturation (SpO2), and respiratory rate are recorded specifically during sleep because the body is in a stable, resting state. This allows the API to capture a baseline of the user's autonomic and respiratory health without the interference of daytime stressors, physical activity, or varying environmental conditions.
تفاوتهای بین این نوع دادهها را درک کنید تا مشخص کنید کدام معیارها برای برنامه شما مناسب هستند.
انواع داده پشتیبانی شده
این API از انواع دادههای زیر برای اندازهگیری خواب پشتیبانی میکند:
نوع دادهdataTypeپارامتر filter | موجود است عملیات | محدوده |
|---|---|---|
تغییرپذیری روزانه ضربان قلبdaily-heart-rate-variabilitydaily_heart_rate_variability نوع ثبت: روزانه دستگاههای سازگار
| فهرست کردن، تطبیق دادن | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
اشباع اکسیژن روزانهdaily-oxygen-saturationdaily_oxygen_saturation نوع ثبت: روزانه دستگاههای سازگار
| فهرست کردن، تطبیق دادن | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
میزان تنفس روزانهdaily-respiratory-ratedaily_respiratory_rate نوع ثبت: روزانه دستگاههای سازگار
| فهرست کردن، تطبیق دادن | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
مشتقات دمای خواب روزانهdaily-sleep-temperature-derivationsdaily_sleep_temperature_derivations نوع ثبت: روزانه دستگاههای سازگار
| فهرست کردن، تطبیق دادن | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
تغییرپذیری ضربان قلبheart-rate-variabilityheart_rate_variability نوع رکورد: نمونه دستگاههای سازگار
| فهرست کردن، تطبیق دادن | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
اشباع اکسیژنoxygen-saturationoxygen_saturation نوع رکورد: نمونه دستگاههای سازگار
| فهرست کردن، تطبیق دادن | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
خلاصه خواب با نرخ تنفسrespiratory-rate-sleep-summaryrespiratory_rate_sleep_summary نوع رکورد: نمونه دستگاههای سازگار
| فهرست کردن، تطبیق دادن | .health_metrics_and_measurements.readonly.health_metrics_and_measurements.writeonly |
خوابsleepsleep نوع رکورد: جلسه دستگاههای سازگار
| لیست کردن، دریافت کردن، تطبیق دادن، ایجاد کردن، بهروزرسانی کردن، حذف دستهای | .sleep.readonly.sleep.writeonly |
جلسات خواب و بیداریهای کوتاه
A Sleep Session ( Sleep ) represents a discrete sleep event, such as a single nightly sleep or a daytime nap. It includes a detailed breakdown of non-overlapping sleep stages alongside brief wake transition intervals known as short awakenings.
- جلسه خواب (
Sleep) : یک رویداد خواب گسسته (فواصل مراحلLIGHT،DEEP،REM،AWAKE) را نشان میدهد که جدول زمانی پیوسته استراحت اولیه را تقسیم میکند. - Short Awakenings (
shortAwakenings) : Brief wake transitions or awakenings that occur during rest. Unlike standardAWAKEstage intervals (which divide the non-overlapping contiguous sleep stage progression), short awakenings are distinct segments that can overlap with surrounding sleep stages. They provide granular visibility into restlessness and micro-awakenings without disrupting the primary sleep stage structure.
مثال
{
"name": "sleeps/12345",
"startTime": "2026-04-20T22:30:00Z",
"endTime": "2026-04-21T06:30:00Z",
"sleepType": "STAGES",
"sleepStages": [
{
"startTime": "2026-04-20T22:30:00Z",
"endTime": "2026-04-20T23:45:00Z",
"type": "LIGHT"
},
{
"startTime": "2026-04-20T23:45:00Z",
"endTime": "2026-04-21T01:15:00Z",
"type": "DEEP"
}
],
"shortAwakenings": [
{
"startTime": "2026-04-20T23:10:00Z",
"endTime": "2026-04-20T23:11:30Z",
"type": "AWAKE"
}
]
}
مشتقات دمای خواب روزانه
Daily Sleep Temperature Derivations measure the variation in a user's skin temperature during sleep compared to their baseline. This data is typically reported once per day after a major sleep session.
میزان تنفس
Respiratory rate measures the user's breaths per minute. During sleep, it is a key metric for monitoring sleep quality and potential disturbances. The API supports sample respiratory rate ( respiratory-rate ), daily summaries ( daily-respiratory-rate ), and session-level sleep summaries ( respiratory-rate-sleep-summary ).
تغییرپذیری ضربان قلب (HRV)
HRV measures the variation in time between each heartbeat. It is a key indicator of the autonomic nervous system's state; high HRV during sleep generally signifies better recovery and readiness, while low HRV can indicate stress or overtraining. The API supports sample HRV ( heart-rate-variability ) and daily summaries ( daily-heart-rate-variability ).
اشباع اکسیژن (SpO2)
SpO2 represents the percentage of oxygen-saturated hemoglobin relative to total hemoglobin in the blood. Monitoring SpO2 during sleep is critical for detecting potential breathing disturbances and ensuring the user is maintaining adequate oxygen levels throughout the night. The API supports sample SpO2 ( oxygen-saturation ) and daily summaries ( daily-oxygen-saturation ).
دیدگاه جامع در مورد سلامت خواب و بهبودی
While each metric provides specific insights, they are deeply interrelated and together offer a holistic view of a user's recovery. Sleep stages (Light, Deep, REM) provide the structural foundation of rest, while physiological markers like HRV and SpO2 indicate how the body is physically responding to that rest. For example, a high-quality sleep session with optimal Deep sleep often correlates with higher HRV, signifying effective recovery of the autonomic nervous system.
Combining these with respiratory rate and sleep temperature derivations allows applications to identify potential disturbances. A sudden spike in respiratory rate or a deviation in sleep temperature can contextualize why a user might have spent less time in restorative stages. By analyzing these data types in tandem, developers can provide a comprehensive assessment of sleep hygiene and long-term health trends.
دستورالعملها
هنگام ادغام معیارهای خواب در برنامه خود، از این دستورالعملها استفاده کنید:
- جزئیات جلسه : برای نمایش مراحل خواب کاربر (سبک، عمیق، REM، بیدار) و بیداریهای کوتاه، نوع داده
sleepرا جستجو کنید. - Physiological Monitoring : For advanced health monitoring, combine the sleep session data with physiological and recovery metrics such as
respiratory-rate-sleep-summary,daily-sleep-temperature-derivations,daily-heart-rate-variability, anddaily-oxygen-saturation. - Reconciliation : Use the
reconcileoperation to ensure that overlapping sleep logs from different devices (for example, a wearable and a mattress sensor) are merged into a single "main" sleep record.
محاسبه کل زمان خواب عمیق
برای محاسبه کل زمانی که کاربر در یک شب خاص در مرحله خواب عمیق ترمیمی گذرانده است:
- نوع داده
sleepرا برای محدوده زمانی مشخص شده پرس و جو کنید. - در لیست مراحل (stages) جستجو کنید و فواصلی را که در آنها
stageTypeDEEPاست، شناسایی کنید. - مدت زمان (زمان پایان - زمان شروع) را برای هر بازه خواب عمیق محاسبه کرده و آنها را با هم جمع کنید.
حاصل جمع، کل مدت زمان فیزیکی خواب عمیق را برای آن جلسه فراهم میکند.