Dashboard Sign InKR
These docs are for v1.0. Click to read the latest docs for v3.0.

Reports

1. Create Reports

  • Asleep.createReports

Generate Reports to get results for sleep tracking.

fun createReports(asleepConfig: AsleepConfig?): Reports?
Parameter NameTypeDescription
asleepConfigAsleepConfig?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 NameTypeDescription
sessionIdStringWhen Sleep Tracking stops, sessionId value
reportListenerReportListenerReport 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 validity: String?,
    val session: Session?,
    val stat: Stat?,
    val timezone: String?
)

data class Session(
    val endTime: String?,
    val id: String?,
    val osaStages: List<Int?>?,
    val sleepStages: List<Int?>?,
    val startTime: String?,
    val state: String?
)

data class Stat(
    val sleepEfficiency: Float?,
    val sleepLatency: Int?,
    val sleepTime: String?,
    val timeInBed: Int?,
    val timeInDeep: Int?,
    val timeInLight: Int?,
    val timeInRem: Int?,
    val timeInSleep: Int?,
    val timeInWake: Int?,
    val wakeTime: String?,
    val wakeupLatency: Int?,
    val timeInSleepPeriod: 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 estimatedAhi: Float?
)

Parameter Name

Type

Description

validity

String?

Whether the analysis of that sleep session is valid
If some of the uploaded audio files are invalid, or if the percentage lost is more than a certain number, the analysis is inaccurate and displays a field

IN_PROGRESS: If session is OPEN
INVALID:TOO_MANDY_DEFECTS_IN_SLEEP_STAGES: Sleep stage analysis result is not enough
INVALID:TOO_MANY_DEFECTS_IN_OSA_STAGES: Sleep apnea stage analysis result is not enough
VALID: Analysis is valid

session

Session?

Session analysis information

stat

Stat?

Analysis statistical information

timezone

String?

The adjusted time zone of the analysis result
e.g. UTC, Asia/Seoul

endTime

String?

Session end time

id

String?

Session Id

osaStages

List<Int?>?

Sleep apnea stages

sleepStages

List<Int?>?

Sleep stages

startTime

String?

Session start time

state

String?

Sleep session state (OPEN, CLOSED or COMPLETE)

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 measurement

timeInBed

Int?

The time from the start of the sleep measurement to the end of the sleep measurement

timeInDeep

Int?

Total time the sleep phase progressed to deep

timeInLight

Int?

Total time the sleep phase progressed to light

timeInRem

Int?

Total time the sleep phase progressed to rem

timeInSleep

Int?

During sleep measurement time, the time you were actually sleeping
Classified into three stages: deep, light, rem

timeInWake

Int?

wake during sleep

wakeTime

String?

wake up time

wakeupLatency

Int?

The time it takes to wake up and end your 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

timeInStableBreath

Int?

Total time in the breathing stable section

timeInUnstableBreath

Int?

Total time in the breathing unstable section

wakeRatio

Float?

Rate of waking time in the middle during sleep stage

sleepRatio

Float?

The percentage of time you sleep without waking during the sleep phase

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 that was a breathing unstable section during the sleep stage

breathingPattern

String?

Breathing stability stage
VERY_STABLE: Very Stable
STABLE: Stable
UNSTABLE: Unstable

estimatedAhi

Float?

Values for determining respiratory instability levels

If failure, onFail() is called.

Parameter NameTypeDescription
errorCodeIntSee AsleepErrorCode
detailStringerrorCode 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 NameTypeDescription
fromDateString (YYYY-MM-DD)View start date
toDateString (YYYY-MM-DD)View last date
orderBy = "DESC"StringDESC: descending order, ASC: ascending order
offset = 0Intnumber of skipped Report
limit = 20Intmax number of Report (0~20)
reportsListenerReportsListener?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?
)
Parameter NameTypeDescription
sessionIdString?Sleep session ID
lastReceivedSeqNumInt?The sequence number of the last uploaded audio file
sessionEndTimeString?Session end time
sessionStartTimeString?Session start time
stateString?Sleep session state (OPEN, CLOSED or COMPLETE)
timeInBedInt?The time from the start of the sleep measurement to the end of the sleep measurement

When getReport() is called with a sessionId, it acquires a comprehensive report.

If failure, onFail() is called.

Parameter NameTypeDescription
errorCodeIntSee AsleepErrorCode
detailStringerrorCode Message

4. 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 NameTypeDescription
sessionIdStringDelete sessionId value
deleteReportListenerDeleteReportListenerReport delete callback listener
  • Asleep.Reports.DeleteReportListener
interface DeleteReportListener {
    fun onSuccess(sessionId: String?)
    fun onFail(errorCode: Int, detail: String)
}

If success, onSuccess() is called.

Parameter NameTypeDescription
sessionIdString?delete sessionId value

If failure, onFail() is called.

Parameter NameTypeDescription
errorCodeIntSee AsleepErrorCode
detailStringerrorCode Message