Logging telemetry

I’m monitoring beacon’s movement and logging the timestamps when it was moved. For instance I’m logging following data about motion of the beacon:

timestamp, motion, beacon
1 TRUE A
2 false A (small gap => combine)
3 TRUE A
4 TRUE A
5 false A
6 false A
7 TRUE A
8 false A (small gap => combine)
9 TRUE A
10 false A

1 false B
2 TRUE B
3 false B (small gap => combine)
4 TRUE B
5 false B
6 false B
7 TRUE B
8 false B (small gap => combine)
9 TRUE B
10 false B

I want to achieve following result in real time while logging on Android device:

someId1: A { start: 1, end: 4 },
someId2: A { start: 7, end: 9 ,
someId3: B { start: 2, end: 3 }
someId4: B { start: 7, end: 9 }

Or is better to run a query on the server side?
Does it have something to do with map reduce?

:slight_smile: