**3.3 Collaborative and adaptive recommendations for personalized diet management**

The project CarpeDiem (Collaborative and Adaptive Recommender for PErsonalized DIEt Management) is aimed at providing intelligent and automatic support to people who want to follow a diet to stay fit, lose or gain weight. The concept of "diet" in CarpeDiem is considered in an integral way, taking into account nutrition, physical- and sleeping-activity. CarpeDiem users are elderly people who need to follow a strict diet, athletes who want to control their weight and stay healthy or simply, people who want to follow a healthy diet.

CarpeDiem is an IoT-based intelligent self-management system aimed at monitoring physical- and sleeping-activity, nutrition, as well as environmental data and lifestyle habits, with the final goal of providing personalized recommendations and nudges to foster behavior change towards healthier behaviors [14]. The selfmanagement system is bulit upon xCARE where intelligent techniques have been implemented for personalization and automatic monitoring, and a front-end is given in the form of an app to be installed in the citizen's smartphone.

As depicted in **Figure 8**, the IoT-based self-management system works with a set of data coming from different sources. CarpeDiem users wear an off-the-shelf activity tracker 24/7 to monitor physical- and sleep-activity as well as the energy expenditure in terms of calories. CarpeDiem users are also asked to monitor their weight once a week in order to take under control the Body Mass Index (BMI) and

<sup>15</sup> Apple store: https://apps.apple.com/us/app/prehab/id1466618747 and Google Play: https://play. google.com/store/apps/details?id=org.eurecat.prehab hl = es*M*X

### *xCARE: A Development Platform for Supporting Smart and Pervasive Healthcare DOI: http://dx.doi.org/10.5772/intechopen.95951*

#### **Figure 7.**

*Sample screenshots of the PAPRIKA digital tools showing: (a) the list of prescriptions assigned to a patient, from the case management system, and (b) the home screen with the list of activities to be performed today, (c) the performed physical activity, and (d) the communications with the team of professionals, from the self-management system.*

to avoid reaching overweight and, thus, obesity. The CarpeDiem system integrates the LogMeal API [15], capable of recognizing meals through pictures taken from the smartphone camera. The pictures taken by using the CarpeDiem system are automatically sent to LogMeal that analyzes them and gives as output a list of meals. The citizen selects the right one and CarpeDiem automatically indicates the corresponding food group and calculates the number of calories and key nutrients of a dish portion, basing such calculation on the recipes also available through LogMeal. Moreover, questionnaires are used to directly ask the users regarding some lifestyle

**Figure 8.** *The CarpeDiem IoT system at a glance.*

habits. Finally, to be aware of the seasonality, the daylight hours, and further environmental data, we rely to the Dark Sky API16, whereas to monitor the air quality (currently, only in Catalonia) Dades Obertes by Generalitat de Catalunya is used17.

**Figure 9** shows how xCARE has been adapted to implement the CarpeDiem IoTbased self-management system; 10 microservices have been implemented:

	- Physical Activity, to monitor the walking activity by relying on an activity tracker.
	- Sleeping, through the activity tracker it automatically recognizes when the patient is sleeping or awake.
	- Nutrition, to monitor food intake by relying on the LogMeal app.
	- Weight, to monitor the increase/decrease of the weight by relying on a smart scale that automatically sends the data.
	- Questionnaires, to collect answers from the selected questionnaires: SATED [16], about the satisfaction of the citizen regarding her/his sleep; Smoke, on the number of cigarettes smoked on average during the week; Use of light-emitting screens, concerning the number of minutes spent on average using the smartphone or a tablet just before going to sleep; and Caffeine, to check the number of coffees, teas, and energy drinks the user drunk during the 7 hours before going to sleep, the day before.

<sup>16</sup> https://darksky.net/dev

<sup>17</sup> http://governobert.gencat.cat/en/dades\_obertes/

*xCARE: A Development Platform for Supporting Smart and Pervasive Healthcare DOI: http://dx.doi.org/10.5772/intechopen.95951*

**Figure 9.**

*xCARE adapted to CarpeDiem.*

	- PA\_RecSys, according to the goal in terms of number of steps, it calculates the adherence day by day considering also the day of the week and the weather.
	- S\_RecSys, analyzing the sleep habits gathering the information from the *Sleeping*, *Questionnaires*, and *Weight* microservices, it sends nudges and recommendations to follow better habits.
	- N\_RecSys, generating the profile of the user, this service sends suggestions to change habits, as well as general recommendations on healthy foods.
	- Third party, it implements the connections and calls the selected external APIs (i.e., activity trackers18, smart scales19, LogMeal, and open-data sources). This microservice works as an abstraction level. It only has to ask the third party connector for the information and wait for the data without worrying about the communication process and the different data model used.
	- Notifications, it sends to the front-end the notifications generated by any of the microservices.

<sup>18</sup> In the current version, we use activity trackers from Fitbit (https://www.fitbit.com/) and Withings(https://www.withings.com/) for monitoring steps, sleeping habits, and energy expenditure;

<sup>19</sup> In the current version, we use smart scales from Withings, for monitoring the weight and the BMI

**Figure 10.**

*The CarpeDiem app: (a) the main page with an overview of the activities; (b) a list of received notifications; (c) the setting page; (d) the physical activity details; (e) the sleeping activity details; (f) an example of food recognized from its picture.*

The CarpeDiem IoT-based self-management system is an app available in the Google Play (early access) for Android smartphones20. On July 2020, a pilot started with 14 healthy volunteers recruited in Eurecat ( 35.64 8.58 ± years old; 5 females; and 22.96 2.67 ± BMI). The pilot, which will end at the end of the year, has a threefold objective: (1) collecting feedback to improve the app and/or correct bugs; (2) testing the usability and evaluating the user experience; and (3) gathering new data to improve the 3 recommender systems and start implementing the holistic one. Results of the pilot will be calculated in terms of usability once the pilot ends.

**Figure 10** shows some screenshots of the Carpe Diem system: (a) the home page where the user has an overview of her/his status and may answer to the questionnaires; (b) a list of received notifications, each pillar represented by a different icon; (c) the setting page that shows, besides other information, that the app is linked to Fitbit; (d) the physical activity page with the summary of the steps per day and a green star indicating when the goal was achieved; (e) the sleeping page

<sup>20</sup> https://play.google.com/store/apps/details?id=com.eurecat.carpediem

with the summary of the current week showing the sleeping hours and the efficiency as calculated by Fitbit; and (f) an example of recognized food (meatballs).
