I'm not sure exactly what you mean by "merging data for consecutive days" but I suspect you're querying for "what is the total amount of sleep time in this calendar day" which will include data from both the night you care about but also the morning corresponding to the night before and that's what you mean by merged. You'll likely want to query a little differently. For example, instead of bucketing by a midnight to midnight day, bucket by a 6pm - 6pm bounded day. Or apply some other type of processing to determine which "actual" day sleep data belongs to.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags: