Medical Assistant Mobile Application for Diabetes Control by Simulating a Compartmental Model

Featured Application: Mobile application for iterative simulation of a diabetic model. Abstract: This paper presents an educational mobile assistant application for type 1 diabetes patients. The proposed application is based on four mathematical models that describe the glucose-insulin-glucagon dynamics using a compartmental model, with additional equations to reproduce aerobic exercise, gastric glucose absorption by the gut, and subcutaneous insulin absorption. The medical assistant was implemented in Java and deployed and validated on several smartphones with Android OS. Multiple daily doses can be simulated to perform intensive insulin therapy. As a result, the proposed application shows the inﬂuence of exercise periods, food intakes, and insulin treatments on the glucose concentrations. Four parameter variations are studied, and their corresponding glucose concentration plots are obtained, which show agreement with simulators of the state of the art. The developed application is focused on type-1 diabetes, but this can be extended to consider type-2 diabetes by modifying the current mathematical models.


Introduction
In recent years, obesity and overweight have become a severe problem for human health. In 2014 more than 1.9 billion adults aged 18 and older were overweight globally, from which over 600 million were obese. The data indicated that 39% of these adults were overweight and 13% were obese [1]. Body mass index (BMI) provides the most useful population-level measure of overweight and obesity as it is the same for both sexes and all ages of adults. Patients with higher BMI are at greater risk for having diabetes. In 2014, more than 422 million people had diabetes in the world, with a global prevalence of 8.5% among adults over 18 years old. Diabetes is a leading cause of blindness, kidney failure, heart attacks, stroke and lower limb amputation. In 2012, an estimated 1.5 million deaths

PC or Web Simulators for Glucose Concentration Levels
In recent years, an effort to implement glucose levels simulators has been made. One standard option for implementing simulators are PCs or Laptops. PCs have as their main advantage the inherent high computational power for performing simulations. In addition, there has been a trend to replace PCs with much more compact devices, such as smartphones, but most simulators for glucose concentration are PC-based. Another implementation option consists of Web systems, allowing for a broad range of devices to access such simulation systems. Web-based simulators have an advantage: many platforms can access the simulator compared to a particular PC implementation. Web-based simulators have as main disadvantage the requirement of Internet connectivity, making the simulator difficult to access in places with connectivity problems.
In [10], the AIDA diabetes simulator is presented, and extensive evaluation about this simulator has been reported in [11]. Recently, new types of rapid-acting insulins have been added to the AIDA diabetes simulator [12]. AIDA's mathematical model was created to simulate glucose tolerance; however, its use is not based on daily periods.
In [13], the REACTION project is presented. This project consists of a set of healthcare services oriented to diabetic patients and caregivers through a cloud-based application focusing on management and therapy services. The REACTION project is a management system created for the implementation of logistics related to medical personnel. The dosage management algorithm is based on basic rules, and it is not a pharmacological-dynamic behavioral study of insulin. In other words, it is a mathematical model with experimental parameters.
In [14], GLUCOSIM is proposed as a desktop application designed to do virtual experiments to show the effects of food intake changes and insulin therapy on glucose levels. A more detailed version of this system is reported in [15], where a Web-based solution was included. It is important to mention that GLUCOSIM is a tool designed to study, train and analyze the external effects that modify glucose concentration. It uses three mathematical models to consider all the mentioned effects; however, it does not describe periods of exercise or other modeled effects.
In [16], a system is proposed based on the combination of Compartmental Models (CMs) and artificial Neural Networks (NNs). Data from a Type 1 diabetes patient, which contains information about measured blood glucose levels, insulin intake, and food intake description, along with the corresponding time, were used as input to the model. The proposed strategy was not adequately validated. Furthermore, no performance criteria were mentioned to assess the results objectively.
The literature review indicates that early studies of compartmental modelling of glucose/insulin interactions were proposed since the 1980s in [17][18][19]. On the other hand, recently, different research groups have reported important works related with the implementations of compartmental models to develop glucose level simulators, for example, in [20,21] are presented a glucose forecasting algorithm based on a compartmental composite model of glucose-insulin dynamics. In [22] is developed a dynamic model for type 1 diabetic patient that focuses on blood glucose regulation. A first model for insulin adsorption in infusion sets using a minimal lumped two-compartment modelling approach is reported in [23]. A review of the key role of the UVA/Padova simulator is presented in [24], which has tested the use of new molecules for better glucose control.

Mobile Applications for Diabetes Management
The universe of mobile applications for diabetes care is enormous. A first step consists in determining the utility of apps. One standard classification includes exercise and fitness apps, med adherence, weight management, blood glucose trackers, support, healthcare professional apps, and educational simulators. There is extensive availability of applications related to any of the previously mentioned apps, but few efforts are related to educational simulators for smartphones.
One interesting branch of smartphone applications for health care is the simulators. In this paper, we are specifically interested in creating a smartphone-based simulator of glucose-insulin metabolism. In recent years, there have been advances in creating models that can replicate the behavior of parts (or entire) of human organisms and their corresponding implementation as a computer simulation. A smartphone-based simulation can be useful for patients with recently diagnosed diabetes to help them estimate the insulin doses and food intake, but also for patients at risk of developing diabetes or without diabetes, for contributing to raising awareness of the benefits of changing their food consumption and exercise habits. In [25], a review of several diabetes simulators is presented, but the applications reported in that paper is out of the scope of this work, since there is an interest in providing a realistic simulation of blood glucose levels.
There are several reviews of applications for diabetes management. In [26], a set of critical factors to be considered when designing diabetes management applications are explored. These factors come from patient demographics, technology costs, platform varieties, and ease of use. They also categorize the applications in the following classes: blood glucose logging, nutrition databases, carbohydrate tracking, tracking physical activity and weight, data-sharing and social support, and short messages and reminders. An important point to consider is that the FDA does not approve most applications. In [27], several commercial applications for diabetes management available on the Apple App Store and articles published in relevant databases are reviewed. The reviewed applications support self-management tasks such as physical exercise, insulin dosage or medication, blood glucose testing, and diet. Other support tasks considered include decision support, notification/alert, tagging of input data, and social media integration. Analysis indicates that application usage is associated with improved attitudes favorable to diabetes self-management. Limitations of the applications include lack of personalized feedback; usability issues, particularly the ease of data entry; and integration with patients and electronic health records. In much more detail, in [28], it is concluded that a critical feature strongly recommended by clinical guidelines-namely, personalized education is not assimilated in current diabetes applications. In [29] a critical assessment was reported of several smartphone apps for calculating insulin dose. The conclusion was that popular apps offering insulin dose calculations carry a risk of incorrect dose recommendations ranging from those that might lead to suboptimal disease control to those with potentially life-threatening consequences. In [30], an analysis of the benefits of smartphone apps for type 2 diabetes mellitus (T2DM) self-management was presented. It can be concluded that more research with valid study designs and longer follow-up is needed to evaluate the impact of health apps for diabetes care and self-management, specifically for T2DM. In [31], both Heuristic and keystroke level modeling (KLM) are used to measure efficiency for each analyzed mobile diabetes management application for patients with Type-1 Diabetes Mellitus.
With recent advances in connectivity technologies, there are some efforts to build tools based on cloud computing [32] or social network support [33,34]. One disadvantage of these tools is that they always require Internet connectivity at all times, which makes them useless in places with connectivity problems. Some applications are targeted to a particular segment of the population, such as pregnant women; one of these applications is reported in [35,36], where a tool to follow patients with gestational diabetes is described. In [37], an application for insulin dose calculation is reported. The authors establish that this application's innovation consists of the incorporation of exercise and alcohol intake to the calculator in addition to carbohydrates intake. In [38], an application created explicitly for controlling an insulin pump taking as real-time input data from a continuous glucose monitor is reported. A closed-loop control system used to automatically manage insulin infusion to maintain the desire range´s glucose level is proposed. To summarize, there is a strong interest from the scientific community in developing applications around the problems associated with diabetes. This article adds to this trend with an emphasis on the exercise model.

Models
The idea of creating an artificial model for a glucose-insulin system for several purposes has been widely explored. In [39], a minimal glucose-insulin system is proposed; the model starts with the Bergman model [17] and presents modifications to improve, considering the glucose level´s description in the subcutaneous layer and a meal disturbance term. The developed application uses four mathematical models related to them, following the different dynamics that they describe:

1.
Glucose-Insulin Model: Sorensen in [40] proposed it. This model comprises 19 nonlinear differential equations, which include significant metabolic effects related to glucose regulation. The model was obtained through a compartmental technique, where the pancreas compartment is omitted to consider a type 1 diabetic patient. Recently, this glucose-insulin model was extended to consider exercise periods [41]. 2.
Subcutaneous Insulin model: Berger and Rodbard [42] obtained it. This model describes the subcutaneous insulin uptake pattern after an insulin injection. The model considers interactions between components after subcutaneous injections such as insulin absorption and elimination in plasma insulin, active insulin, glucose utilization, plasma glucose, and glucose input. The model is based on a set of differential equations. Variations in plasma insulin concentration (I) can be estimated by Equation (1).
where I abs represents the rate of insulin absorption, V i is the volume of insulin distribution, and k e is the first-order rate constant of insulin elimination. The absorption of insulin can be calculated as follows: where s is a parameter associated with the insulin absorption pattern, t represents the time of the injection, T 50 is when the dose (D) is absorbed in an amount of 50%.

3.
To estimate steady-state conditions, insulin profile (I ss ) using the superposition principle is computed assuming three days as follows: where I a is the build-up and the deactivation of the insulin pump. 4.
Meal Intake model: this model was proposed in 1992 by Lehmann and Deutsch [43]. It describes the gastric glucose absorption into the bloodstream by a meal intake represented by its carbohydrates content. According to this model, glucose utilization G out (G) at plasma insulin concentration is: G represents the glucose concentration, V max maximal glucose utilization for reference insulin concentration, and K m is glucose concentration for the half-maximal response. V max depends on insulin; mathematically, this is where I ss is plasma insulin concentration equivalent to steady-state insulin, and G x is the reference glucose value. Glucose utilization for any combination of plasma glucose and insulin levels is given by where c is insulin sensitivity, and d represents insulin-independent glucose utilization. The insulin absorption dynamics for regular, NPH, lente, ultralente formulations were characterized in [42] just by changing some specific parameters in the general model. Recently, in [44], the Lispro insulin formulation was also characterized by the model in [42]. 5.
The exercise model was considered from [41]. The liver's glycogen reservoir (GLY) can be calculated as shown in Equation (8).
where ϕ is the net glycogenolysis rate, Ψ represents the absorptive period, ζ is the glucose uptake due to exercise intensity, and PVO 2 max is the percentage of the maximum oxygen consumption rate.
In Figure 1, the block diagram of the diabetic patient utilized in this work is shown. There are four subsystems, each one corresponds to a previously described model, and their interactions are shown as solid arrows. The dotted lines delimit the mathematical models proposed in the literature, which describe different but comparable physiological phenomena because they have the same scale.

Hardware and Software Tools
The proposed education simulator was developed based on the models described in the last section. The models were implemented in Java using Android Studio IDE with Android Studio SDK and Java SE Development Kit; besides, Android MPChart Library is used for showing results of the glucose level simulation in a plot [45].
The proposed application was validated on devices with several versions of Android. Table 1, shows the list of devices and its specifications used for testing the proposed application.

Hardware and Software Tools
The proposed education simulator was developed based on the models described in the last section. The models were implemented in Java using Android Studio IDE with Android Studio SDK and Java SE Development Kit; besides, Android MPChart Library is used for showing results of the glucose level simulation in a plot [45].
The proposed application was validated on devices with several versions of Android. Table 1, shows the list of devices and its specifications used for testing the proposed application. In Figure 2, the architecture of the proposed application is shown. The architecture takes as an input the following data:

1.
Meal parameters: these parameters are related to carbohydrate intake (in grams) and the day´s carbohydrate intake schedule.

2.
Insulin dose parameters: these parameters are related to the type (fast or slow actions) and the dose of insulin (in units).

3.
Exercise parameters: these parameters are related to the quantity and intensity of exercise. 4.
Simulation configuration: these parameters are related to the simulation's duration and the type of plot to be generated.

5.
The architecture contains the following blocks: 6.
Simulation variables container: this block stores data required to be accessed and shared by all model blocks. It contains three profiles: meal dosing, insulin dosing, and exercise quantification. 7.
Meal model block: this block takes as input the meal profile and generates as output the glucose obtained according to the carbohydrate intake grams. 8.
Insulin model block: this block takes as input the insulin dosing profile and generates as output the quantity and duration of insulin in the blood flow. 9.
Exercise model block: this block takes as input the exercise dosing profile and generates as output the blood redistribution volume according to the quantity of exercise. 10. Simulation loop block: this block updates each model block with required data from others and controls the simulation's start and end. 11. Plot generation module: this block generates data from the simulation to be used for generating a plot. 12. Plot visualization module: this block takes as input the vector generated by the plot generation module and displays the plot.  Figure 2, the architecture of the proposed application is shown. The architecture takes as an input the following data: 1. Meal parameters: these parameters are related to carbohydrate intake (in grams) and the day´s carbohydrate intake schedule. 2. Insulin dose parameters: these parameters are related to the type (fast or slow actions) and the dose of insulin (in units). 3. Exercise parameters: these parameters are related to the quantity and intensity of exercise. 4. Simulation configuration: these parameters are related to the simulation's duration and the type of plot to be generated. 5. The architecture contains the following blocks: 6. Simulation variables container: this block stores data required to be accessed and shared by all model blocks. It contains three profiles: meal dosing, insulin dosing, and exercise quantification. 7. Meal model block: this block takes as input the meal profile and generates as output the glucose obtained according to the carbohydrate intake grams. 8. Insulin model block: this block takes as input the insulin dosing profile and generates as output the quantity and duration of insulin in the blood flow. 9. Exercise model block: this block takes as input the exercise dosing profile and generates as output the blood redistribution volume according to the quantity of exercise. 10. Simulation loop block: this block updates each model block with required data from others and controls the simulation's start and end. 11. Plot generation module: this block generates data from the simulation to be used for generating a plot. 12. Plot visualization module: this block takes as input the vector generated by the plot generation module and displays the plot.  Finally, the architecture generates as the output the plot with the information according to the user's input.

User Interface
In Figure 3a, a welcome screen of the proposed application is shown. The proposed application's main objective is the generation of a plot of the blood glucose concentration based on the parameters defined in the previous section. For user commodity and better distribution application's controls, a tabbed document interface (TDI) was conceived as the main container for hosting all the needed user controls required to set the simulation parameters and show the results. Specifically, for the Android SDK environment, a tab host container was utilized. This control enables the integration of plenty of components in a single form. The proposed application contains four tabs: the first three tabs allow the user to define the parameters of meal, insulin, and exercise models, and the last one is designed to generate simulation data and show the blood glucose concentration in a plot.
Appl. Sci. 2020, xx, 5 8 of 17 Finally, the architecture generates as the output the plot with the information according to the user's input.

User Interface
In Figure 3a, a welcome screen of the proposed application is shown. The proposed application's main objective is the generation of a plot of the blood glucose concentration based on the parameters defined in the previous section. For user commodity and better distribution application's controls, a tabbed document interface (TDI) was conceived as the main container for hosting all the needed user controls required to set the simulation parameters and show the results. Specifically, for the Android SDK environment, a tab host container was utilized. This control enables the integration of plenty of components in a single form. The proposed application contains four tabs: the first three tabs allow the user to define the parameters of meal, insulin, and exercise models, and the last one is designed to generate simulation data and show the blood glucose concentration in a plot.  In Figure 3b, the tab for the meal model parameters is shown. This tab contains interface controls where users can define each meal's time and its estimated carbohydrate contents (in grams). The estimated carbohydrate contents also can be automatically calculated based on a default estimation of calories for a day, or user can input the total calories, and the application estimates the carbohydrate content in grams based on the given calories.
In Figure 3c, the tab for the insulin model is shown. This tab contains interface controls that define the type of insulin and the unit to be dosed in each meal, for both the rapid and prolonged effect.
In Figure 4a, the tab for the exercise model is shown. This tab contains interface controls where the user defines the intensity, duration, start time, and exercise routine.
Appl. Sci. 2020, xx, 5 9 of 17 In Figure 3b, the tab for the meal model parameters is shown. This tab contains interface controls where users can define each meal's time and its estimated carbohydrate contents (in grams). The estimated carbohydrate contents also can be automatically calculated based on a default estimation of calories for a day, or user can input the total calories, and the application estimates the carbohydrate content in grams based on the given calories.
In Figure 3c, the tab for the insulin model is shown. This tab contains interface controls that define the type of insulin and the unit to be dosed in each meal, for both the rapid and prolonged effect.
In Figure 4a, the tab for the exercise model is shown. This tab contains interface controls where the user defines the intensity, duration, start time, and exercise routine. In Figure 4b, the tab for simulation is shown. In this tab, the user defines the time of the simulation in weeks and days. It is also possible to set all variables to their default values, start simulation, shown insulin, carbohydrate, or glucose concentration plots.
In Table 2, the application's default values are listed, but the user can syntonize this to get a better understanding of the model behavior.   Table. (b) Components of the simulations tab.
In Figure 4b, the tab for simulation is shown. In this tab, the user defines the time of the simulation in weeks and days. It is also possible to set all variables to their default values, start simulation, shown insulin, carbohydrate, or glucose concentration plots.
In Table 2, the application's default values are listed, but the user can syntonize this to get a better understanding of the model behavior.

Reported Experiments
In Table 3, the parameters utilized for validating the meal and insulin models are shown. The abbreviations in the column names are experiment number (Exp), carbohydrate grams in breakfast (B-CHO), carbohydrate grams in lunch (L-CHO), carbohydrate grams in dinner (D-CHO), insulin units at breakfast (B-u), insulin units at lunch (L-u), insulin units at dinner (D-u). In the first experiment, the default values for carbohydrate and insulin units are used. In the second experiment, carbohydrate grams are reduced to half, but the insulin units are left at their default values. In the third experiment, default values for carbohydrate grams are used, but the insulin dose is doubled, and in the last experiment, carbohydrate grams are reduced to half, and the insulin dose is doubled. Figure 5 shows a glucose concentration plot for a 5-day simulation for each experiment reported in Table 3. In Figure 5a, the maximum glucose peak is close to 195 mg/dL every day of the reported simulation. In contrast, in Figure 5b, the maximum glucose peak surpasses 175 mg/dL due to the reduction of carbohydrate intake. In Figure 5c, the same carbohydrate intake is used, but both prolonged and rapid insulin doses are doubled. It can be shown that glucose levels are lower when compared with the plot of experiment 1, and in Figure 5d, also the carbohydrate intake is reduced to half to validate both meal and insulin models. In both experiments (3 and 4), it can be shown for its corresponding plots that even a risk of hyperglycemia is present due to the high insulin dose. In Figure 6, a validation of the exercise models through the corresponding simulation plots are shown. In order to obtain the reported plots, the used exercise intensities are light, moderate, and heavy, and the exercise durations are 10, 30, and 90 min. The default values for grams of carbohydrate intake and insulin doses are used. In Figure 6a, the simulation using 10 min of light exercise is shown. The value of the glucose peaks after exercise (at 9:00 AM) is close to 185 mg/dL, but using 30 min of light exercise, this is under 180 mg/dL (Figure 6b), and when using 90 min of light exercise, the glucose peaks is close to 175 mg/dL (Figure 6c). Similar behavior is shown when using the same duration but with moderate exercise (Figure 6d-f). The value of the glucose peaks after exercise (at 9:00 AM) is close to 175 mg/dL, and it is low when compared with the same peak obtained when using light exercise (180 mg/dL). Finally, this behavior remains when using heavy exercise ( Figure  6g-i). For comparing exercise intensities, it can be shown from plots that the glucose peaks after 10 min exercise are: close to 185 mg/dL for light exercise, over 175 mg/dL for moderate exercise, and In Figure 6, a validation of the exercise models through the corresponding simulation plots are shown. In order to obtain the reported plots, the used exercise intensities are light, moderate, and heavy, and the exercise durations are 10, 30, and 90 min. The default values for grams of carbohydrate intake and insulin doses are used. In Figure 6a, the simulation using 10 min of light exercise is shown. The value of the glucose peaks after exercise (at 9:00 AM) is close to 185 mg/dL, but using 30 min of light exercise, this is under 180 mg/dL (Figure 6b), and when using 90 min of light exercise, the glucose peaks is close to 175 mg/dL (Figure 6c). Similar behavior is shown when using the same duration but with moderate exercise (Figure 6d-f). The value of the glucose peaks after exercise (at 9:00 AM) is close to 175 mg/dL, and it is low when compared with the same peak obtained when using light exercise (180 mg/dL). Finally, this behavior remains when using heavy exercise (Figure 6g-i). For comparing exercise intensities, it can be shown from plots that the glucose peaks after 10 min exercise are: close to Appl. Sci. 2020, 10, 6846 12 of 17 185 mg/dL for light exercise, over 175 mg/dL for moderate exercise, and below 170 mg/dL for heavy exercise. Similar results are obtained for 30 and 90 min of exercise duration. In general, there are many applications, however, long-term prediction of glucose still remains a challenge [20]. In this work, an app has been developed capable of predicting the behavior of glucose levels for several days (see Figure 5) or during a day with different exercise regimes (see Figure 6).
Appl. Sci. 2020, xx, 5 12 of 17 below 170 mg/dL for heavy exercise. Similar results are obtained for 30 and 90 min of exercise duration. In general, there are many applications, however, long-term prediction of glucose still remains a challenge [20]. In this work, an app has been developed capable of predicting the behavior of glucose levels for several days (see Figure 5) or during a day with different exercise regimes (see Figure 6). Until now, the complete software of the presented application has not been compared with other applications since our priority is to focus on the diet and physical activity of the Mexican population with diabetes. There are many applications, but with European or United States standards. However, each submodel has been compared and validated separately by its respective authors. It is important to point out that the current version of the application presented in this work is an extension of a Until now, the complete software of the presented application has not been compared with other applications since our priority is to focus on the diet and physical activity of the Mexican population with diabetes. There are many applications, but with European or United States standards. However, each submodel has been compared and validated separately by its respective authors. It is important to point out that the current version of the application presented in this work is an extension of a previous compartmental model that takes into account exercise periods. This model was developed by the main author, who validated and compared its results with experimental data [41]. So far, we have performed a prototype test on 26 young adults and execution times comparison for different devices.

Qualitative Study
For validating the AEDMA, we perform a prototype test using a questionnaire to evaluate the main points of the proposed system. We applied a questionnaire to 26 young adults (age [15][16][17][18][19][20][21][22][23][24][25]. This application is focused mainly on this user group, which is highly familiar with tablet or smartphone devices, and they are regular users of mobile apps. We restrict the participants of the prototype test to have an android device because we designed AEDMA specifically for this mobile OS. In Table 4, relevant information about the distribution of the testing subjects is shown. After testing the ADEMA by at least 1 h in the participant's device, they were asked to answer a questionnaire that contains 10 questions related to the key aspects of the AEDMA. Each question has 5 options, rated from NO, Rather NO, Do not know, Rather YES, and YES. The questions and the percentage of responses for each option are summarized in Table 5. From the obtained responses, we can summarize the following remarks: 1.
From questions 1, 3, 4, and 5, a preliminary conclusion about important points to be improved to the AEDMA can be guessed. These points are related to improving the user interface, the clarity, and legibility of presented glucose level graphs, and the ease of use of the app. Question 8 gives a general panorama showing that the mobile app in its current state can be improved. From question 9, the variability of glucose levels is adequate from the user's perspective.

2.
In general, from questions 2 and 7, we can conclude that the AEDMA is useful and to give an appropriate impression to the test user, to reuse the application if a next version is released. Question 10 allows highlighting the importance of giving users an important role to involve them in the design of these types of apps.

Execution Time Comparison
We obtain a measurement of the time required to conclude the simulation using several parameters for each application's deployment device. Table 6 shows the obtained measurements for each device. We compute each measurement using only one thread environment because a multithread environment was not conceived in the original application. We choose the following simulation times: 4 days, one week, two weeks, and three weeks. A Polaroid tablet device obtained the biggest execution time, while a Galaxy Tab 10.1 device obtained the shortest one. The rows in Table 6 start from the slower to the higher simulation time. The mobile devices used for the application's deployment were not recent models, because even when some of them were featured as high-end devices when released, they are old devices and, with recent advances in mobile technology, many of them can be featured as low or middle-end devices when compared with the existing technology available at the time of writing this paper.

Conclusions
In this paper, an application for diabetes education is proposed. The proposed application was designed to provide a software tool to help support therapy in patients with diabetes, seeking to improve the quality of life. The simulation is fixed, but an interactive simulation functionality can be added to provide a richer user experience. The software is based on four mathematical models originally designed as a desktop computer program. An exercise option in the interface helps patients to schedule their routines and to estimate in advance its impact on blood glucose. This app could also be developed for Apples' iOS products. Besides, this app could potentially be implemented as a smartwatch app. The most important conclusions are: 1.
The App includes glucose regulation associated with metabolism and the application of an insulin injection.

2.
The App is capable of taking into account the effects of food intake and physical activity.

3.
The developed application can simulate the behavior of glucose levels for long periods.

4.
The App is capable of considering three types of physical activity: light, moderate and heavy.

5.
The developed application is focused on type-1 diabetes, but this can be extended to consider type-2 diabetes. 6.
As a future improvement, the application should be modified to split the simulation processing into smaller operations running on multiple threads. This could be beneficial in devices with more than one core.