https://doi.org/10.53853/encr.9.4.770

Recibido: 7 de junio de 2022; Aceptado: 19 de julio de 2022

STUDIA: An application to support carbohydrate counting by simulating glucose dynamics


STUDIA: una aplicación para apoyar el conteo de carbohidratos simulando la dinámica de la glucosa

C. Builes-Montaño, 12* L. Lema-Pérez, 3 L. Monsalve-Arango, 4 M. Naranjo-Cano, 4 C. Sierra Duque, 4 J. García-Tirado, 5 H. Alvarez Zapata, 6

Internal Medicine Department, Endocrinology and Metabolism Section, School of Medicine, Universidad de Antioquia, Medellín, Colombia Universidad de Antioquia Internal Medicine Department Endocrinology and Metabolism Section, School of Medicine Universidad de Antioquia Medellín Colombia
Internal Medicine Department, Endocrinology Section, Hospital Pablo Tobón Uribe, Medellín, Colombia Internal Medicine Department Endocrinology Section Hospital Pablo Tobón Uribe Medellín Colombia
Department of Engineering Cybernetics, Norwegian University of Science and Technology (NTNU), Trondheim, Norway Department of Engineering Cybernetics Norwegian University of Science and Technology (NTNU) Trondheim Norway
School of Engineering, Universidad de Antioquia, Medellín, Colombia Universidad de Antioquia School of Engineering Universidad de Antioquia Medellín Colombia
Center for Diabetes Technology, University of Virginia, Charlottesville, VA, USA University of Virginia Center for Diabetes Technology University of Virginia Charlottesville VA USA
Facultad de Minas, Universidad Nacional de Colombia, Medellín, Colombia Universidad Nacional de Colombia Facultad de Minas Universidad Nacional de Colombia Medellín Colombia

Correspondencia: esteban.builes@udea.edu.co

Abstract:

Background:

Carbohydrate counting is often considered the ideal way to calculate meal- related insulin doses. Several ways to improve carbohydrate counting have been proposed.

Purpose:

We propose that carbohydrate counting can be refined via simulation and, as such, we present a mobile application for the real-time simulation of postprandial glucose dynamics: STUDIA.

Methods:

We used a phenomenological model of the gastrointestinal tract, coupled with the minimal glucose model to recreate postprandial glucose challenges in people with type 1 diabetes (T1DM). A requirements gathering process was implemented to define the application's functionalities and technical requirements. In addition, a person-based approach was used to characterize the users. Technological stacks were evaluated under the UX/UI criteria, learning curve, flexibility, and the possibility of executing mathematical models with a resolution of differential equations. We used data from one patient with T1DM to guide users in how to use the app. Continuous glucose monitor readings were used for comparison.

Results:

STUDIA is a mobile app built on Android Studio® with a user interface and a web- based administrative module connected to AWS®. The app, allows glucose simulations for day-to-day carbohydrate counting refinement, and patient parameter modification based on previous glucose readings and data analysis for comparison and clinical research.

Conclusions:

We present the first-of-a-kind postprandial simulation app based on a phenomenological model of the GI tract for patients with T1DM and its subsequent clinical research use. STUDIA will be tested in silico with data from multiple meals from patients with T1DM, and in a clinical trial.

Keywords:

mathematical model, diabetes mellitus, mobile applications, computer simulation, carbohydrate counting..

Resumen:

Contexto:

El conteo de carbohidratos se ha considerado la forma ideal de calcular la insulina prandial, por ende se han propuesto varias formas de mejorarlo.

Objetivo:

Proponemos refinar el conteo de carbohidratos utilizando una simulación, la cual se presenta en una aplicación móvil, STUDIA, que simula en tiempo real la glucosa postprandial.

Métodos:

Utilizamos un fenomenológico del tracto gastrointestinal, acoplado al modelo mínimo para la glucosa postprandial en personas con diabetes mellitus tipo 1 (DM1). Las funciones y requisitos técnicos se definieron mediante un sistema de adquisición de requerimientos. Para la caracterización de usuarios, utilizamos una aproximación basada en el individuo. El ecosistema de datos se evaluó mediante el criterio UX/UI, la curva de aprendizaje, flexibilidad y la posibilidad de ejecutar modelos matemáticos. Utilizamos datos de un paciente con DM1 para ejemplificar el uso de la aplicación y los datos del monitoreo continuo de glucosa para comparación.

Resultados:

STUDIA fue construida en Android Studio® con una interfaz de usuario y un módulo administrativo basado en la web conectado a AWS®. Permite similar la glucosa basado en el conteo de carbohidratos para su refinamiento. Se utilizan los parámetros del paciente y los datos históricos de la glucosa para el ajuste de la aplicación. Esta aplicación puede ser utilizada tanto por los pacientes para comparar diferentes escenarios al igual que en la investigación clínica.

Conclusiones:

Presentamos la primera aplicación para simular la glucosa postprandial basada en un modelo fenomenológico del tracto gastrointestinal para pacientes con DM1. STUDIA se probará con datos históricos de pacientes y en un ensayo clínico.

Palabras Clave:

Modelo matemático, diabetes mellitus, aplicación móvil, simulación por computadora, conteo de carbohidratos..

Introducción

Diabetes mellitus (DM) is one of the most common chronic conditions found in Colombia, which ranks second in the region (South America and the Caribbean - SACA) (1). Indeed, its prevalence in adults has been estimated at 8.4% (CI95% 6.0-11.3), which is equivalent to a little less than 3 million people affected in 2017. Chronic hyperglycemia has been linked to the development of microvascular (2, 3) and macrovascular complications (4, 5). Moreover, high blood glucose is related to acute forms of DM decompensation, diabetic ketoacidosis (DKA), and hyperglycemic hyperosmolar state (HHS) (6). A treatment strategy based on stricter glucose control intended to reduce glycated hemoglobin (HbA1c) to values closer to those of a person without diabetes, has been proven to reduce mortality as well as the appearance of micro and macrovascular complications in people with type 1 DM (T1DM) (7, 8) and those with type 2 DM (T2DM) (9, 10).

Treatment has evolved over the last 20 years for people with T2DM. A better understanding of the disease and its mechanisms allowed for more treatment options and an individualized treatment strategy. However, for people with T1DM, the only currently available treatment is still insulin (11). In Colombia, insulin is among the most widely used therapies for adults with DM (12- 14), possibly due to drug price regulation policies.

Most patients use insulin, based on their physicians' dose estimates empirically or on population approximations (15). Nevertheless, carbohydrate counting is the ideal way to calculate meal-related insulin doses. It allows greater flexibility in diet and could, in some people, reduce the burden of the disease (11, 16, 17).

The efficacy and safety of carbohydrate counting have recently been reported in a systematic review, in which carbohydrate counting was associated with a significant reduction in HbA1c in adults and children, standardized mean difference (SMD) - 0.52% (95% CI -0.82 to -0.23). Advanced carbohydrate counting, but not the other forms of carbohydrate counting, significantly reduces the HbA1c, SMD -0.44% (CI95% -0.76 to -0.11), and is higher compared to standard nutritional education, SMD -0.51% (CI95% -0.83 to -0.19). As well, carbohydrate counting was not associated with an increased risk of hypoglycemia, blood lipid concentration, or weight changes. Besides, it seems to improve quality of life, specifically in the disease or its treatment domains, and despite being an iterative educational technique, its effectiveness is not affected by its use for up to two years (18).

Several strategies have been proposed to complement carbohydrate counting. For example, some consider not only the amount, but the type of carbohydrates that are consumed (19); others, the macronutrients content of a meal such as fat and protein (20-22); and others, still simplify the estimation of the carbohydrate content in food (23).

We propose a different approach to complement carbohydrate counting. Carbohydrate counting is a repetitive heuristic process in which, through trial and error, individuals refine their ability to predict blood glucose behavior after a meal based on an estimate of the carbohydrates contained in that meal and the effect of specific insulin dose has on their body. A dynamic simulation will allow individuals to recreate various "what if?" scenarios where different situations, such as changes in the caloric content or the insulin dose, can be evaluated by an individual in a safe environment. Besides safety, the potential benefits in this specific situation include greater confidence in dealing with the present case, modifying insulin dose estimates, or modifying caloric intake.

In this paper, we present the development of STUDIA, a mobile app that allows individuals to simulate four-hour postprandial period glucose changes related to a specific meal and insulin dose based on carbohydrate counting and the user's current glycemic condition.

Methods

Glucose simulation

Using the phenomenological-based mathematical modeling technique, we developed a mathematical model of the role of the gastrointestinal tract in glucose metabolism (24). The model has three submodels: a stomach submodel, which simulates food transformation and rate-limiting for the passage of ingested food to the intestine (25); a second submodel of the small intestine, which computes the intestinal glucose absorption rate (26); and a third submodel of the liver, calculating the endogenous glucose production (EGP) and, regulation of glucose ingested from food (27). In addition, this model was coupled with the minimal glucose model, which has been extensively used to study the physiology of glucose metabolism (28). This coupling allows a simulation of the whole body and, includes the effect of exogenous insulin that people with T1DM must use.

Requirements engineering for the App

A requirements gathering process was carried out, in which the necessary and desired functionalities of the application were initially defined. Next, a person-based approach with potential users' profiles was created using expert knowledge, and this information was then used to identify non-functional requirements. Finally, the possible roles of patients and researchers in the application were defined, and based on these roles, the functionalities described were complemented, and the user stories organized.

Software architecture and design

Initially, the mobile application's most essential needs and functionalities were identified, and possible technological stacks that went hand in hand with the requirements were evaluated. Among those selected were Flutter®, React Native®, Kivy®, and Android studio®. Next, the advantages and disadvantages of using each were identified and evaluated under user experience (UX) /user interface (UI), learning curve, flexibility, and the possibility of executing mathematical models with a resolution of differential equations. This last criterion was the one with the most significant weight. Finally, the application's views, colors, and elements were also defined.

Stepper (Step by step) was used to create a mockup of the user inputs before the simulation. Next, a series of views were defined that accompanied the operation of the application, including the start view, historical preferences, and favorites.

The data from one patient with T1DM who used an insulin pump after a meal containing 50 grams of carbohydrates, 33.5 grams of protein, and 35.7 grams of fat, was used to generate simulations to show STUDIA results. In addition, continuous glucose monitor (CGM) readings were used for comparison. Finally, the accuracy of STUDIA was evaluated using the quadratic mean error.

Results

The chosen architecture for the mobile App was Android Studio® with support for Android® devices from 5.1 onwards, connected to AWS® for the connection with the databases and the analysis of the subsequent results. In addition, a custom Java method for solving differential equations was developed.

User interface

STUDIA's user interface consisted of four main features, a login, a previous data search and display, a new record, and a saving simulation feature. The login uses a custom-generated code to guarantee patient anonymity for ethical, legal, and clinical research purposes. In addition, STUDIA complies with Colombian law 1581 of 2012 on personal data protection. The login requires a password, which is only needed the first time the application is accessed. After successful login, the user has two options: review previously stored data or create a new record. For example, if the user chooses to check their historical data, a list of all the user's simulations listed by date and meal is displayed, as shown in Figure 1 . In addition, a glucose graph for the specific stored data will be displayed by selecting one of the previous simulations, as shown in Figure2 .

If the user decides to add a new record, STUDIA will ask for the meal's current blood glucose concentration and estimated carbohydrate content. Then STUDIA will compute the insulin dose based on the individual insulin-sensitive factor and insulin to carbohydrate ratio and thus, simulate the glucose change related to that meal. Finally, the user may save the most satisfying simulation based on the actual insulin dose and meal content, as shown in Figure3 .

Patients’ simulations recorded in STUDIA

Figure 1: Patients’ simulations recorded in STUDIA

Source: The authors

Glucose graph from saved data

Figure 2: Glucose graph from saved data

Source: The authors

New register made for a meal in STUDIA

Figure 3: New register made for a meal in STUDIA

Source: The authors Explanatory note: Image A. Input data module. Image B. Simulation made by STUDIA and saving feature

Administrative interface

The administrative interface has three views where administrators can manage the simulation input variables for each patient and consult, filter, and download the simulation data. The interface is controlled by two roles: the general administrator who can add patients, and the researcher who can view individual patients and stored simulation data. The Angular® frontend developer was used as it guarantees good role management, data protection, and interaction with users. The backend connects with the AWS® service, developed with Node js®. Figure4 shows the administrative interface.

Administrative interface

Figure 4: Administrative interface

Source: The authors

Simulation results

The simulation is generated as shown in Figure3-B. The layout emulates readings traditionally obtained from a continuous glucose monitor, and we believe that this makes it easier for patients to understand. The patient can simulate several scenarios for the same meal and save these for future analysis. In addition, the patient can change the meal's insulin dose or carbohydrate content in each simulation, allowing for different "what if" simulated situations.

Compared to data from CGM, the app can reproduce the postprandial glucose excursions very accurately. STUDIA estimates glucose change for the specified meal with a mean absolute error of 15.26 ± 18.97 mg/dL. The example of simulated glucose dynamics data is shown in Figure5 .

Comparison between CGM reading and simulation

Figure 5: Comparison between CGM reading and simulation

Source: The authors

Discussion

Carbohydrate counting should be the preferred insulin dose estimation technique for patients with T1DM using prandial insulin. However, one of the concerns associated with this technique that could limit its effectiveness is the lack of precision in estimating the number of carbohydrates in a meal. An overestimation could lead to hypoglycemia and the need to eat or drink fast-acting carbohydrates, while an underestimation leads to lower insulin doses and the risk of hyperglycemia (29). The lack of precision could result from many factors such as the person's experience, the type of training they receive, the frequency with which they practice, and the kind of food they consume and how it is prepared (30). Also, other macronutrients like fat (31) and protein (32), which are not considered in traditional carbohydrate counting, can affect postprandial glucose.

Carbohydrate counting can be seen as a decision-making process, solving a problem detected in the desired situation requires one or more decisions to be made, which in turn requires knowledge transformation (33). Thus, successful counting will depend on individuals' ability to anticipate glucose change based on an estimate of a meal's carbohydrate content and insulin needs. But apart from retraining patients in carbohydrate counting, there are not many tools with which patients can safely refine their abilities.

As has been proven in different fields, such as administration and management, sports (34), military (35), emergency responders, and aviation, among others, decision-making processes can be refined using simulations. While the above scenarios are not like the one experienced by a patient calculating an insulin dose, refinement by repetition is. However, in DM, simulation has been limited but successful in improving physicians' performance in treatment (36, 37) but has not been used by patients themselves.

STUDIA is a tool that can help patients refine their carbohydrate counting and provide a platform for clinical research. It also simulates glucose changes using some of the person's characteristics, meal content, and insulin dose as inputs. But for a dynamic simulation to make useful predictions, it must reliably recreate the phenomenon. In STUDIA, simulations are created using a mathematical model.

Diabetes mellitus has been a subject of interest to mathematical modelers for decades. Ajmera and collaborators (38) offer an excellent review of the models available until 2012 and propose a classification into categories according to the information they use for their construction. Clinical Models, structurally simple and usually containing only essential biological descriptions, are intended to emulate available clinical data. Knowledge-Based or Physiological Models, unlike the former, are primarily mechanistic or first principles they are designed to describe different biological phenomena related to glucose control, and they usually have a more significant amount of information based on physiological knowledge of the processes. These models could potentially be clinically valuable. Models can also be classified according to their purpose (39, 40). Some are used to evaluate diagnostic tests, and others, to construct controllers used in artificial pancreas systems. In addition, models can be used to predict the behavior of a condition, for example, diabetes mellitus and its complications, evaluate the pharmacological characteristics of drugs such as insulin, or describe the behavior of glucose in different organs or the whole body in hypothetical scenarios. Finally, some models predict the costs associated with treating diabetes. Based on this, Frietzen and collaborators propose that the models be classified either as Metabolic and Measurement Models or Development Models (40).

STUDIA would serve as a clinical application of a mechanistic or first-principle model to aid patients in treating diabetes. The only other approach similar to using simulation in such a matter, is a pilot study in which patients used a Web-Based Simulation Tool to generate personalized models of glucose metabolism. Unfortunately, it did not significantly change the time in range. Nevertheless, the authors conclude that it could be used to empower people with T1DM (41). This paper exemplifies STUDIA with a single meal from one patient. Still, we plan to test STUDIA's capability to predict glucose excursions using data for multiple meals from patients with T1DM. We also intend to compare the continuous use of STUDIA during four weeks to traditional carbohydrate counting in a clinical trial with a prespecified change in time in range as the primary outcome (ClinicalTrials.gov Identifier: NCT05181917).

Conclusions

We present the first-of-a-kind glucose simulation app based on a phenomenological mathematical model for patients and clinical research use: STUDIA. Simulation may be used to improve carbohydrate counting in people with diabetes mellitus. Complex phenomenological models can have clinical applications. Future work will reveal whether simulation is more efficient than traditional carbohydrate counting in people with diabetes.

Financial support statement

The development of STUDIA was financed in part by a research grant from Asociación Colombiana de Endocrinología, Diabetes y Metabolismo - ACE.

Declaration of conflicts of interest

The authors certify that they have no affiliation nor are they involved with any organization or entity with any financial interest (such as fees, financial aid for education, shares, employment contracts, work as consultants, or any other type of interest) or non-financial interest (such as personal, professional relationships, affiliations, or beliefs) in the topic of interest or any material discussed in this manuscript. Carlos E. Builes- Montaño has received consulting or speaker fees from Sanofi, Novo Nordisk, Novartis, and Boehringer Ingelheim. Jose Garcia-Tirado reports having received industry research support and royalties from Dexcom through his institution.