Code Examples
A repository of 155 code examples for BeepBeep
Package episodes

Examples related to a stream of events for a pressure sensor. More...

Classes

class  AverageEpisodes
 Computes the list of average values of each episode, grouped by day. More...
 
class  MaxEpisode
 Computes the maximum value of all episodes in each day. More...
 
class  PressureEvent
 Abstract class representing events in a pressure stream. More...
 

Detailed Description

Examples related to a stream of events for a pressure sensor.

This stream of events is made of raw pressure readings made by the sensor, and is separated into various parts using special events that act as markers. Episodes are sub-sequences of successive pressure readings, and days are sequences of episodes.

Formally, a PressureEvent can be either:

  • A pressure reading
  • A marker indicating the end of a day, represented by the symbol ✸
  • A marker indicating the start of an episode, represented by the symbol ↑
  • A marker indicating the end of an episode, represented by the symbol ↓

For example, given this stream of pressure events:

✸ ↑ 151 142 ↓ ↑ 148 149 144 ↓ ✸ ↑ 150 142 ↓ ✸

one can identify two days; Day 1 is composed of two episodes (one of two readings and one of three readings), and Day 2 is composed of one episode of two readings.

The examples in this section illustrate the possibility of computing "hierarchical" summaries on parts of the input stream; two examples are included:

  • MaxEpisode: compute the maximum value inside each episode
  • AverageEpisodes: compute the average of each episode, and group these averages into days

In BeepBeep, such hierarchies can be obtained by nesting Slice or ResetLast processors. The notion of hierarchical summary has been discussed, among others, in the following publication:

K. Mamouras, M. Raghothaman, R. Alur, Z.G. Ives, S. Khanna. (2017). StreamQRE: modular specification and efficient evaluation of quantitative queries over streaming data. Proc. PLDI 2017, ACM. DOI: 10.1145/3062341.3062369.