Conversation
| ALARM_RANG(15), | ||
| UNKNOWN(16); | ||
| SLEEP_DISTURBANCE(16), | ||
| UNKNOWN(17); |
There was a problem hiding this comment.
don't change the enum values if you can avoid it.
| public final static String ALARM_NOT_SO_SMART_MESSAGE = "Your Smart Alarm rang at **%s**."; | ||
| public final static String ALARM_SMART_MESSAGE = "Your Smart Alarm rang at **%s**.\nYou set it to wake you up by **%s**."; | ||
| public final static String NOISE_MESSAGE = "There was a noise disturbance."; | ||
| public final static String SLEEP_DISTURBANCE_MESSAGE = "Your sleep was interrupted."; |
There was a problem hiding this comment.
Has this been approved by product/copy/james?
There was a problem hiding this comment.
Checked it with copy/product. Consulting with Matt Walker following James' advices
| } | ||
|
|
||
| //Finds intances where the pill recorded 15seconds + of motion within a 4 minute window | ||
| public HashMap<Long, Long> getSleepDisturbances(final List<TrackerMotion> trackerMotions){ |
There was a problem hiding this comment.
Use Map<Long, Long> instead of the more specific HashMap
| long previousMotionTS = 0L; | ||
|
|
||
| List<TrackerMotion> trackerMotionWindowCurrent = new ArrayList<>(); | ||
| final HashMap<Long,Integer> sleepDisturbances = new HashMap<>(); |
|
|
||
| currentDisturbanceEndTS = currentTS; | ||
| int onDurationSum = trackerMotionCurrent.onDurationInSeconds.intValue(); | ||
| if (!trackerMotionWindowPrevious.isEmpty()) { |
There was a problem hiding this comment.
I believe that some of this would benefit from being refactored. It's a little too much of twisted logic to be easily readable.
|
|
||
| public List<MotionEvent> generateMotionEvents(final List<TrackerMotion> trackerMotions) { | ||
| public List<MotionEvent> generateMotionEvents(final List<TrackerMotion> trackerMotions, final boolean hasSleepDisturbance) { | ||
| int minSleepDepth = 0; |
There was a problem hiding this comment.
put comments about why min sleep depth is added
| return result; | ||
| } | ||
|
|
||
| public List<Event> cleanEventWindow(final List<Event> eventList){ |
There was a problem hiding this comment.
add comments for what this does and why it's here
| return events; | ||
| } | ||
|
|
||
| public List<Event> getSleepDisturbanceEvents(final OneDaysTrackerMotion oneDaysTrackerMotion, final Long sleepTime, final Long wakeTime, final TimeZoneOffsetMap timeZoneOffsetMap){ |
There was a problem hiding this comment.
describe algo briefly in comments
New event to label possible wake events during sleep based on heuristic classifier.
https://hello.hackpad.com/Sleep-Disturbance-Event-igLaLwPeAqE