Duration of Event Records
At Validic, an event is defined by a start and end time. In some cases, the start
and end time are the same representing a point in time event. Other events occur
over a period of time. For example:
- A blood pressure record is a point in time measurement and would contain an identical start_time and end_time.
"end_time": "2017-03-29T15:59:56Z",
"created_at": "2017-03-29T16:48:55.370Z",
"start_time": "2017-03-29T15:59:56Z",
- A workout record captures the duration of an event and the start_time and end_time would be used to calculate the duration of an event.
"end_time":"2017-07-25T20:24:19Z",
"segments":[
],
"created_at":"2017-07-25T20:24:40.869Z",
"deleted_at":null,
"start_time":"2017-07-25T19:24:19Z",
By providing a consistent view of an event across all Validic types, customers can write code to reliably calculate durations. All Validic integrations and data types report a start_time and end_time so this method can be used to calculate duration for any record.
Workout Duration Metric (added July 2021)
Alternatively, Validic now calculates a workout_duration metric value to make it easier for you to retrieve the event duration of workouts if you prefer to parse a metric rather than calculate duration based on the start and end time fields. The workout_duration value is the difference between the start and end times of the workout record.
Active Duration Metric
In the event a record provides an active duration, we will pass this value as the active_duration metric. An active_duration is normally representing the duration of an event, minus any periods of inactivity. It is possible this active_duration value will present a different value than calculated duration using the start and end time (and, as a result, a different value than workout_duration). For instance,
- A runner starts a run at 1:00 and ends at 2:00, making the calculated run 1hr. No active_duration is provided by the device. The calculated duration is 60 mins.
- A runner starts a run at 1:00 and ends at 2:00, making the calculated run 1hr. The runner paused their workout for 15 mins. An active_duration is provided by the device of 45 mins.
Sleep Duration Metric
In the event that a sleep record provides a duration, we will pass this value as the sleep_duration metric. A sleep_duration is normally representing the duration of an event, minus periods of wakefulness. It is possible this sleep_duration value will present a different value than calculated duration using start and end time. For instance,
- A user falls asleep at 9:00 and wakes at 11:00, making the calculated sleep 2hr. No sleep_duration is provided by the device. The calculated duration is 120 mins.
- A user falls asleep at 9:00 and wakes at 11:00, making the calculated sleep 2hr. The user woke up for 10 mins (bathroom break). A sleep_duration is provided by the device of 110 mins.
As mentioned above, in the event that the duration metric value is 0 or is not provided at all, customers can determine a duration based on the start and end times provided.
Updated about 3 years ago