## 4 System Architecture
### Architecture Description
#### 4.2.2 Functional View  
Figure 3 shows the system as a set of interrelated layers. The layers represent the various components that the system needs to connect to achieve a valid interaction between them and thus provide the implemented health services. Figure 3: Layer view. Figure 2: Context view. These layers must have a secure access configuration, and the design of each of them considers the system services as a set of end-to-end elements. Additionally, there is a set of microservices that can be used by the users of the system. The layers considered in the architecture are perception, communication, infrastructure, orchestration and containerization, middleware, and application. The perception layer includes the sensors, the QR code reader, and other devices that could be included in future applications such as video sensors or radio frequency identification (RFID) tags. The infrastructure layer reflects the use of the services offered by the public cloud, and the orchestration and containerization layer covers the use of Docker container images to be installed on the Kubernetes cluster. Finally, another relevant aspect is the inclusion of fast data features in the middleware layer for real-time analytics and real-time ingestion, which are useful in capturing big data. Figure 4 shows the functional components and their relationships. System functionality has been divided into the following set of components:  
1. The Core System: It consists mainly of: * Elderly People Manager: Allows managing the personal data of elderly people; * User and User Groups Manager: Its main functions are to create profiles and security levels, create user-type profiles, and create users or groups of users of the system. It is only managed by the system administrator; * Home Manager: Allows creating data related to the elderly person's home such as location, number of rooms, types of rooms, free zones, and dimensions; * Sensors Manager: Permits recording of the data about features of the sensors. 2. Monitor and Control Manager: It consists mainly of: * The sensor monitoring and control subsystem to collect the vital signs and the temperature status of the room inside the home; * The input/output transporter whose function is to transport the sensing data in near real time (real-time ingestion); * The functional elements of the system that allow the parameterization and configuration of the input/output transporter, such as the creation of topics in distributed publish/subscribe systems; * The system elements for near real-time data analytics (real-time analytics). 3. Data Storage Manager: The functional component that stores the data used by the system. It is a conventional database management system. Its goal is to keep the data in a secure repository. 4. Diet Manager: It consists of the following components: * Diet Catalog Manager: Used to manage all the data in the digitized catalog; * Diet Prediction Service: A set of operations for updating the physical data of an individual. These data are age, weight, height, and physical activity level (personal physical data). It also contains the functional element that performs the predictor role based on the EER of elderly people; * Diet Prescription Service: Helps the nutritionist to assign a diet label to a person based on the diet proposed by the EER predictor and establishes the periods of the diet; * Diet Preparation Service: The group of operations that are specially designed for the housekeeping, who is the person in charge of preparing meals in the elderly person's house. It also provides videos and the steps for preparing menus through recipes to help prepare meals of the day; * Service for Food Intake Monitoring: A set of operations used to record in the system the start and end of food intake. These data are sent from a mobile application to a system using the IoT messaging system. The start of food intake is recorded by sending the QR code of the diet menu stored in the catalog.