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 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 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~20) |
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?
)
Parameter Name | Type | Description |
---|---|---|
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 |
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. 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 over 1 year ago