Products
Sleep Score
The Sleep Score offers a detailed evaluation of sleep quality and quantity. By analyzing various sleep aspects, it provides insights into rest patterns and their impact on overall health. This score helps users understand their sleep habits and guides them toward better sleep quality.
At-a-Glance: Sleep Score
Aspect | Details |
---|---|
Score type | sleep |
score range | 0.0 - 1.0 |
Possible state s | minimal , low , medium , high |
Contributing factors | sleep_duration , sleep_regularity , sleep_continuity , sleep_debt , circadian_alignment , physical_recovery , mental_recovery |
Supported dataSources | age , gender , sleep |
Latest version | 1.0 |
Status | PRODUCTION |
Example JSON Response
{ "id": "a1b2c3d4-e5f6-1234-efgh-ij1234567891", "profileId": "p1q2r3s4-t5u6-7890-vwxy-z1234567890", "accountId": "x1y2z3a4-b5c6-7890-dfgh-i1234567890", "externalId": "e1f2g3h4", "type": "sleep", "score": 0.9, "state": "high", "factors": [ { "name": "sleep_duration", "value": 473, "goal": 480, "unit": "minute", "score": 0.99, "state": "high" }, { "name": "sleep_regularity", "value": 85, "goal": 100, "unit": "percent", "score": 0.85, "state": "high" }, { "name": "sleep_continuity", "value": 10, "goal": 0, "unit": "minute", "score": 0.91, "state": "high" }, { "name": "sleep_debt", "value": 1.5, "goal": 0, "unit": "hour", "score": 0.84, "state": "high" }, { "name": "circadian_alignment", "value": 50, "goal": 30, "unit": "minute", "score": 0.9, "state": "high" }, { "name": "physical_recovery", "value": 90, "goal": 90, "unit": "minute", "score": 1.0, "state": "high" }, { "name": "mental_recovery", "value": 110, "goal": 120, "unit": "minute", "score": 0.96, "state": "high" } ], "dataSources": ["age", "sleep"], "scoreDateTime": "2023-11-11T00:00:00+02:00", "createdAt": "2023-11-11T11:05:41.644Z", "version": 1.0}
For a breakdown of each field in the JSON response, please refer to the output schema on the health scores homepage.
Understanding the Sleep Score
The Sleep Score measures the quality and quantity of an individual's sleep. It evaluates various aspects such as sleep duration, regularity, continuity, and recovery stages (deep and REM sleep).
Important Note
For a detailed explanation of how the Sleep Score works and recommendations to improve it, please refer to Sleep Score Explained .
Interpreting the Score
The higher the Sleep Score, the better the sleep quality and habits.
- 0.81 - 1.00 (High) : Excellent sleep quality and quantity.
- 0.66 - 0.80 (Medium) : Adequate sleep with potential areas for improvement.
- 0.51 - 0.65 (Low) : Suboptimal sleep quality; attention needed to improve sleep habits.
- 0.00 - 0.50 (Minimal) : Poor sleep quality; significant changes required for better sleep health.
Factors in Sleep Score
The Sleep Score is calculated using several factors, each representing different aspects of sleep health:
Factor | Description | Data Sources | Requires Wearable |
---|---|---|---|
Sleep Duration | Total amount of sleep obtained during the night. | Sleep | No |
Sleep Regularity | Consistency of bed and wake times across days. | Sleep | No |
Sleep Continuity | Measure of how uninterrupted and restful the sleep period is, assessed by restlessness and awakenings. | Sleep | Yes |
Sleep Debt | Accumulated shortfall of sleep relative to an individual's sleep needs over time. | Sleep | No |
Circadian Alignment | Alignment of sleep timing with an individual's circadian rhythm. | Sleep | No |
Physical Recovery | Duration and timing of deep sleep cycles (slow-wave sleep). | Sleep | Yes |
Mental Recovery | Duration and timing of REM sleep cycles. | Sleep | Yes |
Data Requirements
The Sleep Score calculation relies on sleep data. Below are the detailed requirements:
Full Data Types Needed:
- Sleep Data: Bed and wake times, sleep stages (light, deep, REM).
Minimum Data Required:
A minimum of three contributing factors are required to compute a reliable Sleep Score. The essential data includes:
- Sleep Data: Bed and wake times.
Permissions Needed:
Platform | Permissions |
---|---|
Apple HealthKit (HK) | sleepAnalysis |
Google Health Connect (HC) | SleepSession |
Handling Missing Data:
- If certain data points are missing (e.g., no sleep stage data), the related factors will be returned as
null
. - The Sleep Score adjusts for missing data when possible. However, if there aren’t enough factors to compute a reliable score (less than three factors available), the score itself will be returned as
null
.
Integrating the Sleep Score
To start receiving the Sleep Score, set up webhooks (recommended) or use the API. You can also display the score in your application using the UI widgets.
Webhooks
- In the dashboard , navigate to Webhooks > Create new Webhook > Health Scores > tick the Sleep Score box > paste in your destination URL.
- Once a Sleep Score is generated, the webhook will automatically forward the event to your data store.
API
Retrieve Sleep Scores for a profile within a specific time window:
-
Endpoint :
GET /api/v1/profile/score
-
Authorization :
Bearer
token -
Parameters :
-
types
: list of types (e.g.,sleep
) -
startDateTime
: Start date-time (ISO format) -
endDateTime
: End date-time (ISO format) -
version
: version of the score algorithm (default: 1)
-
-
Responses :
- 200 : Returns Sleep Scores with details like id, type, state, score, factors, dataSources, scoreDateTime.
- 400 : Invalid profile ID.
- 401 : Invalid token.
-
Example Request :
curl -X GET "https://api.sahha.ai/v1/profile/score?types=sleep&startDateTime=2024-08-01T00:00:00Z&endDateTime=2024-08-31T23:59:59Z" \-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
For further details, refer to the API reference .
UI Widgets
You can also make use of UI Widgets to display the Sleep Score.
-
Configure your app to utilize the widgets using the UI Widgets Guide .
-
Once configured, simply paste the URL for the widget of your choice, which can be any of:
/arc
− displays the score as an arc./factors
− displays a list of the factors./chart
− displays the scores over time.
Best Practices
Follow these best practices to ensure accurate interpretation and effective use of the Sleep Score:
- Data Accuracy : To ensure that the sleep data collected is accurate, encourage users to maintain consistent sleep tracking habits.
- Wearable Devices : For detailed sleep stage data (that helps gauge recovery), the use of wearables is recommended.
- Personalized Feedback : Use the factors to provide personalized recommendations to users for improving their sleep habits.
- Holistic Approach : Encourage users to consider the Sleep Score alongside other health indicators for a comprehensive view of their well-being.
Frequently Asked Questions (FAQs)
Q: Can I use the Sleep Score without a wearable device?
A: Yes, the Sleep Score can be calculated using data from a smartphone. However, some factors like physical and mental recovery require sleep stage data typically obtained from wearables. For a more comprehensive analysis, a wearable device is recommended.
Q: How can I improve my Sleep Score?
A: To enhance your Sleep Score, focus on establishing a regular sleep schedule, ensuring adequate sleep duration, and minimizing nighttime disturbances. Creating a conducive sleep environment and practicing good sleep hygiene can also be beneficial.
Q: What does a high
Sleep Score indicate?
A: A high
Sleep Score indicates excellent sleep quality and quantity. It reflects healthy sleep patterns, including sufficient sleep duration, regularity, minimal disturbances, and proper sleep stage distribution.
Q: Can the Sleep Score diagnose sleep disorders?
A: The Sleep Score is an informational tool designed to provide insights into sleep patterns. It is not intended to diagnose sleep disorders. If you have concerns about your sleep health, please consult a healthcare professional.