In one of our previous posts we showed you the consumer experience for a task that is tracked with HyperTrack. Accurate status events are an important piece for a good user experience. In this post we take a deeper look into the data model that powers these events and how you can use them in your application.
The ETA model
The basic unit in our API is a task which is defined as going from A to B to perform an action. For example a task can be a package pickup or delivery. Every task has an internal data model for its estimated time of arrival or the ETA. Predicting the ETA involves solving two interesting subproblems.
- The travel time problem or how much time is required to travel from point A to B. While this is a major component of the task duration it is deterministic to a high degree.
- The first and last mile problem or how much time is required at point A in preparing for the task and similarly at point B in completing the task. These answers can be variable.
The two subproblems are captured in the five states of our ETA model: not started check out transit check in and completed. When the task is being prepared at point A it is in the check out state. The task then moves to transit when the driver is traveling from A to B. On reaching B the task goes into the check in state. Transitions between these states trigger events.
The accuracy of transitions in the state machine affect the ETA estimate and the status events. In cases where a sequence of task is tracked the problem compounds in estimating ETAs for tail end tasks. To solve this problem we use a variety of sensor data from the smartphone.
Tracking activities
Smartphones are equipped with accelerometers gyroscope and compass sensors. The data from these sensors can be used to estimate motion and orientation and thus determine activity. It is possible to detect activities like walking cycling automotive motion and being stationary. The task ETA models use this sensor data to determine the activity and then trigger transitions in the ETA model.
Let’s take the example of a task with a car. When the start of automotive motion is detected the model transitions from ‘check out’ to ‘transit’. Similarly when the motion stops the model transitions from ‘transit’ to ‘check in’.
As with location data the accuracy of activity recognition can vary. To ensure usable accuracy levels we have built rules and filters which improve as we get more data to learn from.
Using status events
HyperTrack events are accessible through web hooks. You can directly use the events or build your own custom events on top of them. These web hooks can have multiple use-cases. An internal use-case can be ending a task automatically when the ‘arrived’ web hook is received. Sending intelligent app notifications text messages or integrations with Slack are some of the end consumer use-cases.
Status events are one of the building blocks in the HyperTrack API v2. Get started with integrating tracking in your application by signing up here.