Esper generating episodes
- by Jasonojh
I would like to use Esper to generate episodes of events. I am trying to detect the changes in robot movement during each time period and was wondering what would be the best way of implementation.
The rules for generation of episodes from the events would be
If the new event time(eg. 7sec, robot A) of a robot is more than 3 sec than the latest event(eg. 3 sec, robot A) of the same robot, the new event belongs to a new episode.
Each episode should represent only one robot (eg. 2sec, robotA and 3sec, robotB should output 2 episodes)
Input data:
Event Time Robot Position
1 1 A 0
2 2 A 1
3 6 A 2
Output data should be:
Array[0]={Event 1,Event 2}
Array[1]={Event 3} //more than 3 sec
Input data:
Event Time Robot Position
1 1 A 0
2 2 A 1
3 4 B 0
4 6 A 2
Output data should be:
Array[0]={Event 1,Event 2}
Array[1]={Event 3} //different robot
Array[2]={Event 4}
Please help provide suggestions. I have tried using mulitple listeners, one for each robot, to create episodes and it works but I am trying to use a single EPL statement to do it. I have tried win:time_accum(3sec) group by robot but the second example output:
Array[0]={Event 1,Event 2, Event 4}
Array[1]={Event 3}
as the time window is shifted everytime an event comes in, the system still thinks that event 4 is less than 3 sec due to event 3. how do I create a unique time window for each robot?
Thank you for your suggestions and any help is greatly appreciated.