**1. Introduction**

In the near future, healthcare has to rapidly move from a professional-centric system to distributed networked healthcare systems in which citizens become active partners in the entire healthcare process [1]. According to [2], there is the need to move from managing illness to managing wellness. In this new scenario, smart and pervasive healthcare plays an important role [3, 4].

Smart and pervasive healthcare refers to several different application fields: self-management of patients, health-status monitoring and follow-up, communication between patients and healthcare professionals, daily-life activities monitoring of citizens, as well as support for behavioral change for citizens of any age. The common perspective is assisting citizens remotely by relying on a set of sensors and/ or devices (e.g., wearable and medical) suitably integrated together. In doing so,

healthy people may adopt good habits and improve their overall wellness, whereas patients can be remotely assisted and improve their quality of life.

From a software-engineering perspective, developing smart and pervasive solutions for healthcare must take into account key issues such as personalization, adaptation, and scalability. In fact, developing robust monolith systems reached its limitations. Changes in requirements and implementation may imply that the systems evolve too slowly and inefficiently. Thus, a complex problem might be decomposed in easier sub-problems according to a divide-et-impera approach. In this direction, microservice architectures emerged and quickly became a widely used solution [5]. These architectures are especially appropriate for distributed environments in which several functionalities have to be provided separately or different sensors have to work together, as in the case of Internet of Things (IoT) solutions [6]. In this chapter, we propose a development platform, namely xCARE, suitably defined and implemented to give support in developing smart and pervasive healthcare systems. xCARE has been conceived in a very generic way in order to be adapted to any kind of scenarios. It has been built by relying on the concept of microservices. That approach has been adopted since microservices enable software to be divided into modules, making it easier to change and adapt it. In fact, microservices can be considered as modern agents that could improve systems in distributed environments [7].

The platform has been defined and developed as part of the CONNECARE H2020 project1 . Thanks to its generic nature, it is also the baseline of the system currently under development in the PAPRIKA project2 , aimed at improving the quality of life and healthcare results of patients undergoing major surgery. Moreover, the IoT-based self-management system of the CarpeDiem project3 has been built upon xCARE. Finally, xCARE is currently under adaptation for the eVisió project to give support to patients after an ophthalmic surgery4 .

After describing the overall platform and its main components, this chapter presents how xCARE has been used for: (i) providing self-management to complex chronic patients in the CONNECARE project, (ii) empowering and managing patients at home before a major surgery in the PAPRIKA project, and (iii) supporting behavioral change through a recommender system in the CarpeDiem project.

The remaining of the chapter is organized as follow. We present the xCARE platform in Section 2 and its adaptation for the CONNECARE, PAPRIKA, and CarpeDiem projects in Section 3. Section 4 sums up the main novelty of the approach comparing xCARE with other smart and pervasive platforms for healthcare. Finally, in Section 5, we end the chapter with some conclusions and lessons learnt.
