Reports
1. Create Reports
- Asleep.createReports :Generate Reports to get results for sleep tracking.
fun createReports(asleepConfig: AsleepConfig?): Reports?
Parameter Name | Type | Description |
---|---|---|
asleepConfig | AsleepConfig? | Enter the set value received by the callback in the initasleepconfig call |
2. Get Single Report
- Asleep.Reports.getReport :Bring sessionId Report.
fun getReport(sessionId: String, reportListener: ReportListener)
Parameter Name | Type | Description |
---|---|---|
sessionId | String | When Sleep Tracking stops, sessionId value |
reportListener | ReportListener | Report Callback listener |
- Asleep.Reports.ReportListener
interface ReportListener {
fun onSuccess(report: Report?)
fun onFail(errorCode: Int, detail: String)
}
- If success, onSuccess() is called.
data class Report(
val timezone: String,
val peculiarities: List<String>,
val missingDataRatio: Float,
val session: Session?,
val stat: Stat?
)
data class Session(
val id: String,
val state: String,
val startTime: String,
val endTime: String?,
val sleepStages: List<Int>?,
val breathStages: List<Int>?,
val createdTimezone: String,
val unexpectedEndTime: String?
)
data class Stat(
val sleepEfficiency: Float?,
val sleepLatency: Int?,
val sleepTime: String?,
val wakeupLatency: Int?,
val wakeTime: String?,
val timeInWake: Int?,
val timeInSleepPeriod: Int?,
val timeInSleep: Int?,
val timeInBed: Int?,
val timeInRem: Int?,
val timeInLight: Int?,
val timeInDeep: Int?,
val timeInStableBreath: Int?,
val timeInUnstableBreath: Int?,
val wakeRatio: Float?,
val sleepRatio: Float?,
val remRatio: Float?,
val lightRatio: Float?,
val deepRatio: Float?,
val stableBreathRatio: Float?,
val unstableBreathRatio: Float?,
val breathingPattern: String?,
val breathingIndex: Float?,
val sleepCycle: Int?,
val sleepCycleCount: Int?,
val wasoCount: Int?,
val longestWaso: Int?,
val unstableBreathCount: Int?,
val lightLatency: Int?,
val remLatency: Int?,
val deepLatency: Int?
val sleepIndex: Int?,
val timeInSnoring: Int?,
val timeInNoSnoring: Int?,
val snoringRatio: Float?,
val noSnoringRatio: Float?,
val snoringCount: Int?,
val sleepCycleTime: List<String>?
)
Parameter Name | Type | Description | Version |
---|---|---|---|
timezone | String | Timezone (Timezone List) | |
peculiarities | List | A field for describing any specific details or peculiarities of the sleep session. This field can include multiple labels below.IN_PROGRESS : If the session is OPEN, CLOSEDNEVER_SLEPT : If it is determined that there was no sleep at all during the session measurement timeTOO_SHORT_FOR_ANALYSIS : When the measurement time is too short to conduct a valid analysis (currently less than 20 minutes)TOO_LONG_FOR_ANALYSIS : Analysis has been conducted successfully, but the session measurement time is excessively long, making it difficult to trust (currently exceeding 24 hours)TOO_MANY_DEFECTS_IN_SLEEP_STAGES : When the error rate is high due to factors like missing audio uploads, resulting in insufficient sleep analysis results.NO_BREATHING_STABILITY : When the customer's contract conditions do not support breathing stability analysis.NO_REALTIME_POLLING : When, according to the customer's contract, real-time access to sleep information is not available. | |
missingDataRatio | Float | The error rate in sleep analysis results due to reasons such as missing audio uploads | |
session | Session? | Session analysis information | |
stat | Stat? | Analysis statistical information | |
id | String | Session Id | |
state | String | Status of SessionOPEN : An in-progress session, with audio uploads availableCLOSED : The session terminated by sending an end session request. Unable to upload audio files. Analysis of uploaded sleep audio is still in progress' COMPLETE : All sleep analysis completed after the end of the session | |
startTime | String | Session start time Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) | |
endTime | String? | Session end time Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) | |
sleepStages | List<Int>? | Sleep Stages List | |
breathStages | List<Int>? | Breath Stability Stages List | |
createdTimezone | String | Timezone of session creation (Timezone List) | v2.2.0<=SDK |
unexpectedEndTime | String? | Abnormal session termination time. This assign the next initAsleepConfig time. | v2.2.0<=SDK |
sleepEfficiency | Float? | The percentage of time you actually slept during sleep measurement | |
sleepLatency | Int? | time it took to fall asleep | |
sleepTime | String? | The time it takes to fall asleep after the start of sleep staging | |
wakeupLatency | Int? | The time it takes to wake up and end your sleep measurement | |
wakeTime | String? | wake up time | |
timeInWake | Int? | wake during sleep | |
timeInSleepPeriod | Int? | During sleep measurement time, excluding the time it took from the start of the sleep measurement to fall asleep and the time it took from the wake to the end of the sleep measurement (time_in_bed - sleep_latency - wakeup_latency) | |
timeInSleep | Int? | During sleep measurement time, the time you were actually sleeping This time is divided into three stages: deep, light, and rem | |
timeInBed | Int? | The time from the start of the sleep measurement to the end of the sleep measurement | |
timeInRem | Int? | Total time the sleep phase progressed to rem | |
timeInLight | Int? | Total time the sleep phase progressed to light | |
timeInDeep | Int? | Total time the sleep phase progressed to deep | |
timeInStableBreath | Int? | Total time in the breathing stable section | |
timeInUnstableBreath | Int? | Total time of breath instability | |
wakeRatio | Float? | Rate of waking time in the middle during sleep stage | |
sleepRatio | Float? | During sleep stage, sleep ratio, not wake | |
remRatio | Float? | Rate of rem sleep during sleep stage | |
lightRatio | Float? | Rate of light sleep during sleep stage | |
deepRatio | Float? | Rate of deep sleep during sleep stage | |
stableBreathRatio | Float? | The percentage of time that was a breathing stable section during the sleep stage | |
unstableBreathRatio | Float? | The percentage of time during the sleep phase that there was a breathing instability section | |
breathingPattern | String? | Breathing Instability LevelSTABLE_BREATH : stableMILDLY_UNSTABLE_BREATH : mildly unstableMODERTATELY_UNSTABLE_BREATH : moderately unstableSEVERELY_UNSTABLE_BREATH : severely unstable | |
breathingIndex | Float? | Values for determining respiratory instability levels | |
sleepCycle | Int? | The average duration of one sleep cycle. | v2.2.0<=SDK |
sleepCycleCount | Int? | The number of sleep cycles. | v2.2.0<=SDK |
wasoCount | Int? | The number of times 'wake' occurred during the sleep period | v2.2.0<=SDK |
longestWaso | Int? | The duration of the longest 'wake' during the sleep period | v2.2.0<=SDK |
unstableBreathCount | Int? | The number of times unstable breathing occurred. | v2.2.0<=SDK |
lightLatency | Int? | The time it takes to the first Light after the start of sleep. | v2.2.0<=SDK |
remLatency | Int? | The time it takes to the first REM after the start of sleep. | v2.2.0<=SDK |
deepLatency | Int? | The time it takes to the first Deep after the start of sleep. | v2.2.0<=SDK |
sleepIndex | Int? | The metric that comprehensively represents sleep quality, defined by learning from the distribution of sleep data | v2.3.0<=SDK |
timeInSnoring | Int? | Total time in the breathing stable section | 2.4.0<=SDK |
timeInNoSnoring | Int? | 2.4.0<=SDK | |
snoringRatio | Float? | 2.4.0<=SDK | |
noSnoringRatio | Float? | 2.4.0<=SDK | |
snoringCount | Int? | 2.4.0<=SDK | |
sleepCycleTime | List? | 2.4.0<=SDK |
- If failure, onFail() is called.
Parameter Name | Type | Description |
---|---|---|
errorCode | Int | See AsleepErrorCode |
detail | String | errorCode Message |
3. Get Multiple Reports
- Asleep.Reports.getReports :Gets a list of Report that are within the range of the date you entered.
fun getReports(
fromDate: String,
toDate: String,
orderBy: String = "DESC",
offset: Int = 0,
limit: Int = 20,
reportsListener: ReportsListener?)
Parameter Name | Type | Description |
---|---|---|
fromDate | String (YYYY-MM-DD ) | View start date |
toDate | String (YYYY-MM-DD ) | View last date |
orderBy = "DESC" | String | DESC: descending order, ASC: ascending order |
offset = 0 | Int | number of skipped Report |
limit = 20 | Int | max number of Report (0~100) |
reportsListener | ReportsListener? | Report list callback listener |
- Asleep.Reports.ReportsListener
interface ReportsListener {
fun onSuccess(reports: List<SleepSession>?)
fun onFail(errorCode: Int, detail: String)
}
- If success, onSuccess() is called.
data class SleepSession(
val sessionId: String?,
val lastReceivedSeqNum: Int?,
val sessionEndTime: String?,
val sessionStartTime: String?,
val state: String?,
val timeInBed: Int?,
val createdTimezone: String,
val unexpectedEndTime: String?
)
Parameter Name | Type | Description | Version |
---|---|---|---|
sessionId | String? | Sleep session ID | |
lastReceivedSeqNum | Int? | The sequence number of the last uploaded audio file | |
sessionEndTime | String? | Session end time | |
sessionStartTime | String? | Session start time | |
state | String? | Sleep session state (OPEN, CLOSED or COMPLETE) | |
timeInBed | Int? | The time from the start of the sleep measurement to the end of the sleep measurement | |
createdTimezone | String | Timezone of session creation (Timezone List) | v2.2.0<=SDK |
unexpectedEndTime | String? | Abnormal session termination time. This assign the next initAsleepConfig time. | v2.2.0<=SDK |
- When getReport() is called with a sessionId, it acquires a comprehensive report.
- If failure, onFail() is called.
Parameter Name | Type | Description |
---|---|---|
errorCode | Int | See AsleepErrorCode |
detail | String | errorCode Message |
4. Average-stats
- Available from v2.3.0
- Asleep.Reports.getAverageReport
- You can check the average sleep metrics for a specific period of time.
fun getAverageReport(fromDate: String, toDate: String, averageReportListener: AverageReportListener?)
Parameter Name | Type | Description |
---|---|---|
fromDate | String | The starting time for the period you want to check the average |
toDate | String | The ending time for the period you want to check the average |
averageReportListener | AverageReportListener | Average Report callback listener |
- Asleep.Reports.AverageReportListener
interface AverageReportListener {
fun onSuccess(averageReport: AverageReport?)
fun onFail(errorCode: Int, detail: String)
}
- If success, onSuccess() is called.
AverageReport
data class AverageReport (
val period: Period,
val peculiarities: List<String>,
val averageStats: AverageStats?,
val neverSleptSessions: List<NeverSleptSessions>,
val sleptSessions: List<SleptSessions>
)
Parameter Name | Type | Description |
---|---|---|
period | Period | Timezone |
peculiarities | List | Special considerations when calculating the average of sleep sessions |
averageStats | AverageStats? | An object containing the averages of sleep metrics for "sleptSessions" |
neverSleptSessions | List | A list of sessions during which it is determined that no sleep occurred at all during the measurement time. |
sleptSessions | List | A list of sessions during which it is determined that sleep occurred during the measurement time. |
Period
data class Period (
val timezone: String,
val endDate: String,
val startDate: String,
)
Parameter Name | Type | Description |
---|---|---|
timezone | String | requested timezone Ex. UTC, Asia/Seoul |
startDate | String | requested start date |
endDate | String | requested end date |
AverageStats
data class AverageStats(
val startTime: String,
val endTime: String,
val sleepTime: String,
val wakeTime: String,
val sleepLatency: Int,
val wakeupLatency: Int,
val timeInBed: Int,
val timeInSleepPeriod: Int,
val timeInSleep: Int,
val timeInWake: Int,
val timeInLight: Int?,
val timeInDeep: Int?,
val timeInRem: Int?,
val timeInStableBreath: Int?,
val timeInUnstableBreath: Int?,
val sleepEfficiency: Float,
val wakeRatio: Float,
val sleepRatio: Float,
val lightRatio: Float?,
val deepRatio: Float?,
val remRatio: Float?,
val stableBreathRatio: Float?,
val unstableBreathRatio: Float?,
val breathingIndex: Float?,
val wasoCount: Int?,
val longestWaso: Int?,
val unstableBreathCount: Int?,
val sleepCycleCount: Int?,
val timeInSnoring: Int?,
val timeInNoSnoring: Int?,
val snoringRatio: Float?,
val noSnoringRatio: Float?,
val snoringCount: Int?
)
Parameter Name | Type | Description | Version |
---|---|---|---|
startTime | String | Session start time | |
endTime | String | Session end time | |
sleepTime | String | The time it takes to fall asleep after the start of sleep staging | |
wakeTime | String | Wake time | |
sleepLatency | Int | Time to fall asleep | |
wakeupLatency | Int | The time it takes to wake up and end your sleep measurement | |
timeInBed | Int | The time from the start of the sleep measurement to the end of the sleep measurement | |
timeInSleepPeriod | Int | During sleep measurement time, excluding the time it took from the start of the sleep measurement to fall asleep and the time it took from the wake to the end of the sleep measurement (time_in_bed - sleep_latency - wakeup_latency) | |
timeInSleep | Int | During sleep measurement time, the time you were actually sleeping This time is divided into three stages: deep,light,and rem | |
timeInWake | Int | Wake time during sleep | |
timeInLight | Int? | Total time the sleep phase progressed to light | |
timeInDeep | Int? | Total time the sleep phase progressed to deep | |
timeInRem | Int? | Total time the sleep phase progressed to rem | |
timeInStableBreath | Int? | Total time in the breathing stable section | |
timeInUnstableBreath | Int? | Total time of breath instability | |
sleepEfficiency | Float? | The percentage of time you actually slept during sleep measurement | |
wakeRatio | Float? | Rate of waking time in the middle during sleep phase | |
sleepRatio | Float? | During sleep stage, sleep ratio, not wake | |
lightRatio | Float? | Rate of light sleep during sleep phase | |
deepRatio | Float? | Rate of deep sleep during sleep phase | |
remRatio | Float? | rem sleep ratio | |
stableBreathRatio | Float? | The percentage of time that was a breathing stable section during the sleep phase | |
unstableBreathRatio | Float? | The percentage of time during the sleep phase that there was a breathing instability section | |
breathingIndex | Float? | Values for determining respiratory instability levels | |
wasoCount | Int? | The number of times 'wake' occurred during the sleep period | |
longestWaso | Int? | The duration of the longest 'wake' during the sleep period | |
unstableBreathCount | Int? | The number of times unstable breathing occurred. | |
sleepCycleCount | Int? | The number of sleep cycles. | |
timeInSnoring | Int? | 2.4.0<=SDK | |
timeInNoSnoring | Int? | 2.4.0<=SDK | |
snoringRatio | Float? | 2.4.0<=SDK | |
noSnoringRatio | Float? | 2.4.0<=SDK | |
snoringCount | Int? | 2.4.0<=SDK |
NeverSleptSessions
data class NeverSleptSessions (
val id: String,
val startTime: String,
val endTime: String,
val completedTime: String
)
Parameter Name | Type | Description |
---|---|---|
id | String | session id |
startTime | String | Session start time Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) |
endTime | String | Session end time Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) |
completedTime | String | Time of session analysis completion Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) |
SleptSessions
data class SleptSessions (
val id: String,
val createdTimezone: String,
val startTime: String,
val endTime: String,
val completedTime: String,
val sleepEfficiency: Float,
val sleepLatency: Int?,
val sleepTime: String?,
val wakeupLatency: Int?,
val wakeTime: String?,
val lightLatency: Int?,
val deepLatency: Int?,
val remLatency: Int?,
val timeInWake: Int,
val timeInSleepPeriod: Int,
val timeInSleep: Int,
val timeInBed: Int,
val timeInRem: Int?,
val timeInLight: Int?,
val timeInDeep: Int?,
val timeInStableBreath: Int?,
val timeInUnstableBreath: Int?,
val wakeRatio: Float,
val sleepRatio: Float,
val remRatio: Float?,
val lightRatio: Float?,
val deepRatio: Float?,
val stableBreathRatio: Float?,
val unstableBreathRatio: Float?,
val unstableBreathCount: Int?,
val breathingPattern: String?,
val sleepCycle: Int?,
val sleepCycleCount: Int?,
val wasoCount: Int?,
val longestWaso: Int?,
val timeInSnoring: Int?,
val timeInNoSnoring: Int?,
val snoringRatio: Float?,
val noSnoringRatio: Float?,
val snoringCount: Int?,
val breathingIndex: Float?
)
Parameter name | Type | Description | Version |
---|---|---|---|
id | String | session id | |
createdTimezone | String | Timezone of session creation (Timezone List) | |
startTime | String | Session start time Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) | |
endTime | String | Session end time Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) | |
completedTime | String | Time of session analysis completion Example) 2022-08-01T01:31: 17+09: 00 (If the request timezone is Asia/Seoul) | |
sleepEfficiency | Float | The percentage of time you actually slept during sleep measurement | |
sleepLatency | Int? | Time to fall asleep | |
sleepTime | String? | The time it takes to fall asleep after the start of sleep staging | |
wakeupLatency | Int? | The time it takes to wake up and end your sleep measurement | |
wakeTime | String? | Wake time | |
lightLatency | Int? | The time it takes to the first Light after the start of sleep | |
deepLatency | Int? | The time it takes to the first Deep after the start of sleep | |
remLatency | Int? | The time it takes to the first REM after the start of sleep | |
timeInWake | Int | Wake time during sleep | |
timeInSleepPeriod | Int | During sleep measurement time, excluding the time it took from the start of the sleep measurement to fall asleep and the time it took from the wake to the end of the sleep measurement (time_in_bed - sleep_latency - wakeup_latency) | |
timeInSleep | Int | During sleep measurement time, the time you were actually sleeping This time is divided into three stages: deep,light,and rem | |
timeInBed | Int | The time from the start of the sleep measurement to the end of the sleep measurement | |
timeInRem | Int? | Total time the sleep phase progressed to rem | |
timeInLight | Int? | Total time the sleep phase progressed to light | |
timeInDeep | Int? | Total time the sleep phase progressed to deep | |
timeInStableBreath | Int? | Total time in the breathing stable section | |
timeInUnstableBreath | Int? | Total time of breath instability | |
wakeRatio | Float | Rate of waking time in the middle during sleep phase | |
sleepRatio | Float | During sleep stage, sleep ratio, not wake | |
remRatio | Float? | rem sleep ratio | |
lightRatio | Float? | Rate of light sleep during sleep phase | |
deepRatio | Float? | Rate of deep sleep during sleep phase | |
stableBreathRatio | Float? | The percentage of time that was a breathing stable section during the sleep phase | |
unstableBreathRatio | Float? | The percentage of time during the sleep phase that there was a breathing instability section | |
unstableBreathCount | Int? | The number of times unstable breathing occurred. | |
breathingPattern | String? | Breathing Instability Level STABLE_BREATH: stable MILDLY_UNSTABLE_BREATH: mildly unstable MODERTATELY_UNSTABLE_BREATH: moderately unstable SEVERELY_UNSTABLE_BREATH: severely unstable | |
sleepCycle | Int? | The average duration of one sleep cycle | |
sleepCycleCount | Int? | The number of sleep cycles | |
wasoCount | Int? | The number of times 'wake' occurred during the sleep period | |
longestWaso | Int? | The duration of the longest 'wake' during the sleep period | |
timeInSnoring | Int? | 2.4.0<=SDK | |
timeInNoSnoring | Int? | 2.4.0<=SDK | |
snoringRatio | Float? | 2.4.0<=SDK | |
noSnoringRatio | Float? | 2.4.0<=SDK | |
snoringCount | Int? | 2.4.0<=SDK | |
breathingIndex | Float? | Values for determining respiratory instability levels | 2.4.0<=SDK |
- If failure, onFail() is called.
Parameter Name | Type | Description |
---|---|---|
errorCode | Int | See AsleepErrorCode |
detail | String | errorCode Message |
5. Delete Report
When session data is deleted from the Asleep server upon a request, it becomes difficult to provide specific evidence for the deleted sessions during subsequent billing usage analysis.
- Asleep.deleteReport :Delete sessionId Report.
fun deleteReport(sessionId: String, deleteReportListener: DeleteReportListener)
Parameter Name | Type | Description |
---|---|---|
sessionId | String | Delete sessionId value |
deleteReportListener | DeleteReportListener | Report delete callback listener |
- Asleep.Reports.DeleteReportListener
interface DeleteReportListener {
fun onSuccess(sessionId: String?)
fun onFail(errorCode: Int, detail: String)
}
- If success, onSuccess() is called.
Parameter Name | Type | Description |
---|---|---|
sessionId | String? | delete sessionId value |
- If failure, onFail() is called.
Parameter Name | Type | Description |
---|---|---|
errorCode | Int | See AsleepErrorCode |
detail | String | errorCode Message |
Updated 5 months ago