So I'm not a developer but I'm making an attempt at putting together charts of visitor dwell time from the scanning API. The scanning API posts a timestamp of when a device is seen, but there's no data element indicating when a device leaves. I'm looking to understand how the length of stay is calculated based on the data elements that the scanning API will post. I think the idea is each 60-ish seconds the post happens and a MAC will be seen, and if it's seen each post, that's considered a minute of dwell time... but to be frank, it's confusing to me. If anyone could provide any guidance, it would be very much appreciated. Thanks!
The API can deliver an array of the 'point in time' detections as you've quite rightly highlighted. From that there is typically a job to do to sort through these individual detections and work out those which are in the middle of a visit..
When we've done this previously we've maintained an intermediary SQL based database and some logic in the receiver script/program, broadly outlined as follows:
For each recorded detection:
"have I seen this Mac address in the last 3 minutes?"
- if yes, update the last_seen on a visit entry.
- if no, create a new visit and add the information.
We've found this is the best way of cleanly doing it. This then allows you the ability to hold a table full of 'visits' which can be analysed separately to 'detections'.