Israeli Zach Bamberger has developed the SmartAlarm, which checks weather conditions, traffic alerts, and other data and decides when you need to get out of bed in order to make it to work on time. E.g. detecting an incident on your route at 4am, the alarm can wake you 15 minutes earlier than usual.
http://www.timesofisrael.com/teens-alarm-app-knows-when-to-wake-you-or-let-you-sleep/