ECA Dashboard Template

This is the dashboard template file. The easiest way to get started is to think up a simple name (let's say we take 'dashboard'). Now copy template.py to {name}.py start a new module (so that's dashboard.py) and copy template_static to {name}_static.

Now you can run the new project with:

python neca.py -s {name}.py

Further documentation on the ECA system can be found at github.com/utwente-db/eca/wiki, and demos can be found in the demos/ directory.

In the sample template.py (which comes with the dashboard you're looking at right now), you will find the rules that power this example.

Rules are written in Python and work as follows:

@event("foo")
def action(context, event):
    print("Event " + event.name + "!")
The @event part tells the system to fire the action whenever the event 'foo' occurs. The def action(context, event): part defines a new action that takes two arguments: the context and the event. The rest of the code is the action body.

The graph to the right is continuously filled with data generated by the rules.

In template.py you can see that an event called 'sample' is fired again and again to create new data points for the graph.

These points are then sent to the browser with:

emit('sample',{
    'action': 'add',
    'value': sample
})