*3.6. Virtual Coaching*

The Virtual Coach component of the PERGAMON framework is designed to keep track of the personal objectives of each of the users as well as their achievements in the real world and in the game world. The coach uses this information to assist the users in achieving their objectives by processing collected data and offering guidance in the form of reminders, notifications and suggestions about certain actions and events.

Figure 7 presents an overview of the virtual coach component. The data for the virtual coach comes from the Ground Layer. Data from the sensor network and data from the games can be accessed by the virtual coach component. Knowledge for the virtual coach is gathered from rules for self-management of T1D in cooperation with healthcare professionals. Personalization and tailoring of these self-management rules is done by defining personal goals between the client and the healthcare professionals (shared decision making). The Virtual Coach component consists of a coaching engine and a graphical representation of the virtual coach [16]. Coaching rules are defined in the coaching engine and allow for the analysis of data available in the Ground Layer derived from other components of the PERGAMON framework. The coaching engine is a rule- based engine based on the ECA (event, condition and action) engine developed at the University of Twente [16]. A typical coaching rule looks like the one in Figure 8. The rule (named 'glucose\_hyper' in this example) is executed based on an event (in this case the event 'glucose\_update'), triggered by an event from the Ground Layer (in this case a trigger from the sensor network of a new measure of value 13.0). The rule is only executed when the value of the new measurement is greater than 10.0 (a blood glucose level of 10 or higher is called a hyperglycemia). Conditions can be general fixed values (such as hypoglycemia or hypoglycemia) or personals goals (such as the number of steps or the number of times a user wants to measure their blood glucose levels). The action of this coaching rule is a suggestion to play a mini game.

**Figure 7.** The coaching engine of the Virtual Coach of the PERGAMON platform depicting the knowledge and data source components used by the Virtual Coach.

```
fire (' glucose_update ', {'value ': 13 .0})
@event (' glucose_update ')
@condition ( lambda c , e: c . value > 10 .0)
def glucose_hyper ( ctx , e ):
    # Play the Tako Maze mini game }
```
The coaching rules are executed by triggers that are event- or time-based. Event based triggers are notifications from the sensor network or other components of the PERGAMON framework via the Ground Layer. Examples of triggers for coaching events are the creation of new users, data from sensors or achievements in the game(s). Time based triggers are based on the time of day and related to self-management (e.g., measuring glucose levels before dinner or before sleeping). All events are processed by the coaching engine and the result of these coaching rules can be a dialogue act of several kinds such as a *suggestion* (e.g., to play mini games where the user can meet educational objectives), a *reminder* or a *notification* (e.g., when personal goals are reached or users forget to do their measurements) or *hints* about how to continue in the main game. The Virtual Coach is able to send text messages and notifications to the website and to the Android application. By presenting the Virtual Coach as a cartoon-like character from the main game world, the coach connects the in-game world with the primary world of the user's daily care activities. Figure 9 gives an example of a coaching message presented on the website including an educational movie with extra background information.

**Figure 9.** Example of a coaching message on the PERGAMON website. The message is in Dutch (English: *"Too bad! This week you did not do all your glucose measurements. You measured 10 times, 3 times your level was too high and 4 times your level was too low. Please, discuss this with your diabetes nurse or with your parents."*).
