Dashboard Sign InKR

Sleep Tracking System

API / SDK / Dashboard

The API analyzes sound data collected from a smartphone using AsleepTrack’s AI technology. It tracks the user’s sleep stages in real time and detects sleep-related sounds (e.g., snoring). After the measurement is complete, it generates a sleep report that includes total sleep time, sleep score, sleep stage distribution, sleep efficiency, and various other metrics.

The SDK simplifies the use of the API within an app by automatically processing audio data collected through the smartphone’s microphone. It converts the collected data into an analyzable format and periodically uploads it to the server. By integrating the SDK, client apps can implement sleep tracking functionality simply by calling the sleep measurement function.

The dashboard allows users to visually check sleep data measured using their logged-in account’s API Key. Before developing a report UI in the client app, the dashboard provides an easy way to verify whether sleep measurements in the test environment are functioning correctly.

Sleep Tracking Flow

Before starting full-scale development, understanding the sleep tracking flow is essential for efficient development and troubleshooting. Check the sample app’s source code to see how the following sleep tracking flow is implemented.

  1. Initialization: This step initializes the SDK. It involves creating a new User ID or closing any previously open sleep tracking sessions.
  2. Tracking: This step starts audio recording and periodically converts the data into a mel spectrogram, which is then uploaded to the server. This process allows real-time sleep state tracking.
    1. Once sleep tracking begins, the SDK operates within the client app to collect the user’s sound data and uploads it to the server every 30 seconds.
    2. The uploaded data is analyzed asynchronously by the AI server every 5 minutes, and the results are sent in real time to the client’s backend via the registered callback URL.
    3. Since the first analysis starts after 5 minutes, the user must track sleep for at least 5 minutes to receive sleep analysis results.
  3. Report: This step retrieves sleep analysis results. Once the sleep tracking session is closed and the AI server completes its analysis, sleep metrics (Stat Object) become available for review.

Valid Session and Invalid Session

A valid session refers to a session where sufficient sound data has been uploaded, allowing the AI to perform sleep analysis and provide meaningful sleep data. The minimum requirements for sleep analysis are as follows:

  • At least 5 consecutive minutes of sound data is required for sleep analysis.
    • If this condition is not met, the session will be marked as peculiarities == TOO_SHORT_FOR_ANALYSIS.
  • At least 70% of the total sleep tracking session must have properly uploaded sound data.
    • If this condition is not met, the session will be marked as peculiarities == TOO_MANY_DEFECTS_IN_SLEEP_STAGES.

An invalid session is a session where AI sleep analysis was not performed or the results were deemed invalid. Such sessions are excluded from billing.