Dashboard Sign InKR

Reports

1. Create Reports

  • Asleep.createReports :Generate Reports to get results for sleep tracking.
fun createReports(asleepConfig: AsleepConfig?): Reports?

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 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\>?
)

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~100)
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?,
    val createdTimezone: String,
    val unexpectedEndTime: String?
)
Parameter NameTypeDescriptionVersion
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
createdTimezoneStringTimezone of session creation (Timezone List)v2.2.0<=SDK
unexpectedEndTimeString?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 NameTypeDescription
errorCodeIntSee AsleepErrorCode
detailStringerrorCode 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 NameTypeDescription
fromDateStringThe starting time for the period you want to check the average
toDateStringThe ending time for the period you want to check the average
averageReportListenerAverageReportListenerAverage Report callback listener
  • Asleep.Reports.AverageReportListener
interface AverageReportListener {
    fun onSuccess(averageReport: AverageReport?)
    fun onFail(errorCode: Int, detail: String)
}

AverageReport

data class AverageReport (
    val period: Period,
    val peculiarities: List\<String\>,
    val averageStats: AverageStats?,
    val neverSleptSessions: List\<NeverSleptSessions\>,
    val sleptSessions: List\<SleptSessions\>
)
Parameter NameTypeDescription
periodPeriodTimezone
peculiaritiesList<String>Special considerations when calculating the average of sleep sessions
averageStatsAverageStats?An object containing the averages of sleep metrics for "sleptSessions"
neverSleptSessionsList<NeverSleptSession>A list of sessions during which it is determined that no sleep occurred at all during the measurement time.
sleptSessionsList<SleptSession>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
)

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?
)

NeverSleptSessions

data class NeverSleptSessions (
    val id: String,
    val startTime: String,
    val endTime: String,
    val completedTime: String
)

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?
)
  • If failure, onFail() is called.
Parameter NameTypeDescription
errorCodeIntSee AsleepErrorCode
detailStringerrorCode 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 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