Evaluating the influence of sleep quality and quantity on glycemic control in adults with type 1 diabetes

Background Sleep quality disturbances are frequent in adults with type 1 diabetes. However, the possible influence of sleep problems on glycemic variability has yet to be studied in depth. This study aims to assess the influence of sleep quality on glycemic control. Materials and methods An observational study of 25 adults with type 1 diabetes, with simultaneous recording, for 14 days, of continuous glucose monitoring (Abbott FreeStyle Libre system) and a sleep study by wrist actigraphy (Fitbit Ionic device). The study analyzes, using artificial intelligence techniques, the relationship between the quality and structure of sleep with time in normo-, hypo-, and hyperglycemia ranges and with glycemic variability. The patients were also studied as a group, comparing patients with good and poor sleep quality. Results A total of 243 days/nights were analyzed, of which 77% (n = 189) were categorized as poor quality and 33% (n = 54) as good quality. Linear regression methods were used to find a correlation (r =0.8) between the variability of sleep efficiency and the variability of mean blood glucose. With clustering techniques, patients were grouped according to their sleep structure (characterizing this structure by the number of transitions between the different sleep phases). These clusters showed a relationship between time in range and sleep structure. Conclusions This study suggests that poor sleep quality is associated with lower time in range and greater glycemic variability, so improving sleep quality in patients with type 1 diabetes could improve their glycemic control.


Introduction
Poor sleep quality and insufficient amount of sleep are common in the general population and people with type 1 diabetes mellitus (T1DM) (1, 2). A shorter duration of the deep sleep phase (3, 4), subjective quality of sleep, excessive daytime sleepiness (1, 2), and higher prevalence of obstructive sleep apnea (5) have been demonstrated in both adults and children with T1DM. The impact of these disturbances on glycemic control in patients with T1DM is an area of increasing interest. Previous studies suggest that sleep disturbances decrease insulin sensitivity, worse glycemic control, and increase glycemic variability (6). Recently, the American Diabetes Association recommended the study of sleep patterns as part of clin-ical evaluation of a patient with T1DM (7). The main objective of this study is to investigate by machine learning techniques the relationship among sleep structure, sleep quantity and quality, and glycemic control in patients with T1DM. Griggs et al. (2020) (8) found in 38 patients that a higher glucose variability was associated within-person with more sleep disruptions or worse sleep. Our work extends theirs by grouping sleep patterns and analyzing the influence on glucose values during the day. Feupe et al. (2013) (9) studied the relation-ship between deep sleep duration and HbA1c level and concluded that they are inversely correlated.
Some previous studies used signal processing techniques to study the influence of physical exercise during the day on the glucose evolution during the following night (10). To find coherence between the patient's circadian rhythms, they used the cosinor technique (a technique used in circadian physiology) and wavelets. Another similar study using the wavelet coherence analysis is   (11). Other studies (12)(13)(14)(15) found significant relations between variability in sleep duration and poor glycemic control.
Our study complements these works by including the different sleep states during the night, grouping them into repetitive patterns, and studying their influence on different metrics of the following day. We apply clustering techniques and language processing techniques.

Materials and methods
The study was approved by the ethics committee of the Prı́ncipe de Asturias Hospital of Alcaláde Henares, Madrid, Spain. The research was compliant with the Declaration of Helsinki guidelines. Written consent was obtained from each participant prior to engagement.

Inclusion/exclusion criteria
Eligible participants were adults between 18 and 65 years with T1DM with at least one year of duration, being on treatment with an insulin pump or multiple doses of subcutaneous insulin per day (MDI), having the availability of a mobile device capable of reading the sensors of the FreeStyle Libre system, and giving informed consent for inclusion in the study. Pre-screened subjects were excluded if they were diagnosed with a significant psychiatric disorder. Subjects in treatment with corticoids or patients that have required hospitalization or surgery on the last six months were excluded.

Data gathering and preprocessing
The main objective of this study is to analyze the impact of sleep disturbances on short-term gly-cemic control, glycemic variability, and the frequency of hypoglycemia in a group of patients with T1DM. For this purpose, flash continuous glucose monitoring (performed by Abbott FreeStyle Libre devices) and a sleep study using wrist actigraphy (Fitbit Ionic device on the non-dominant wrist) were carried out simultaneously for 14 days in a group of patients. The CGM data includes interstitial blood glucose levels recorded during the entire time the patient wore the sensor, not only during sleep. Fitbit ionic devices incorporate a light sensor (photoplethysmography, PPG) and an accelerometer to identify sleep stages. From (16), "Fitbit uses proprietary sleep-staging machine learning algorithms applied to motion, heart rate variability, and respiratory rate, with the last two calculated from heartbeat data sensed by PPG". Twenty-five patients were included, although data from three patients had to be discarded, with a total of 243 nights/days recorded. The study analyzes interindividual and intraindividual differences in glycemic control concerning nights with worse or better quality/quantity of sleep.
Three visits were programmed to complete the collaboration of the participants. The study was explained to the participants in a first visit (Pre-screening Visit), and all patients signed an informed consent form. Participants were also committed to continuing with their usual treatment. In addition, sociodemographic variables, anthropometric data, and clinical data were collected from medical records. In a second visit, Visit 1, participants were given a wristband with wristwatch actigraphy (Fitbit Ionic device), and a FreeStyle Libre sensor (first generation, no alarms) was placed for continuous glucose monitoring for 14 days. The sensor was connected to the Abbot Libre View platform. Patients self-completed the Pittsburgh Sleep Quality Index (PSQI) questionnaire to assess habitual self-perceived sleep quality (1). Visit 1 took place between 1 and 30 days after the prescreening visit. Finally, during Visit 2, the glucose sensor and wrist actigraphy were removed. Visit 2 was programmed to be held 15 days after Visit 1. During this period, participants could contact the study's technical staff to solve any technical concerns.
PSQI examines seven components: sleep quality, latency, habitual sleep efficiency, sleep duration, sleep disturbances, use of sleep medication, and daytime dysfunction. With 19 questions, participants rate the components on a scale of 0 to 3, ranging from 0 to 21, with higher scores indicating worse sleep quality (>5 reveal poor sleepers).
Recording of blood glucose data was performed through the Abbott Libre View application. Time-in-range is estimated directly by the FreeStyle Libre systems. In addition, we calculated it from the microdata generated by the meter using the Rosendaal method (17), which assumes a linear progression between two glucose values and calculates the specific value for each minute (linear interpolation). The same method was used to calculate time in hypo and hyperglycemia. The recording of the wrist activity was also performed automatically and digitized by the Fitbit mobile application. Microdata is not available directly from Fitbit, so we adapted the API (Application Program Interface) for recovering detailed information (1).
Glucose sensors were placed on the arm, and the Fitbit device was worn on the non-dominant wrist. The Fitbit and glucose data were synchronized at the closest multiple of 5 minutes. Once synchronized, sleep times spent in each stage were added to resynchronize with the 15 minutes used by FreeStyle Libre data. Days with gaps higher than one hour and a half in glucose were discarded. Fitbit data presented some outliers in sleeping times, mixing nap and night sleeping times for some days. Those days were eliminated manually. Heart rate, steps, and burned calories were collected and synchronized for future studies. Limitations of Fitbit Ionic devices are discussed in section 5 The glucose monitoring variables analyzed in this study are: time-inrange 70-180 mg/dl (TR) in percentage, mean blood glucose (mg/dl) (Mean_glucose), standard deviation (SD), coefficient of vari-ation (CV), percentage of time spent in level 1 hypoglycemia (55-70 mg/dl) and level 2 hypoglycemia (< 55 mg/dl) (T Hypo), time in hyperglycemia level 1 (180-250 mg/dl) and level 2 (> 250 mg/dl) (T Hyper), number of hypoglycemia/hyperglycemia episodes with at least 15 min of duration, Mean Amplitude of Glycemic Excursions (MAGE) and Mean Daily Glucose Differences (MDGD). Figure 1 shows the workflow we have used in this study. First, we recorded the 24-hour time series of blood glucose levels (box B) and the sleep state sequences during the corresponding nights of the participants in the study (box A). After performing the clustering (subsection 2.4) according to the structure of sleep states (box C), we consequently grouped the daily time series of glucose levels corresponding to the nights of each cluster (box D). Then, the glucose time series were averaged by cluster (box E), and we obtained the dynamics of the glucose level that characterize each cluster. As a final phase, the behavior of the clusters is studied in two different ways: on the one hand, a language processing tech-nique is applied to find similarities and dissimilarities (subsection 2.5) in the glucose time series (box F) and, on the other hand, a statistical analysis (subsection 2.6) is performed to compare the glycemic characteristics between clusters (box G).

Analysis of the sequence of sleep states
Throughout the night, the person transits between different sleep states (wake, light, rem, deep), forming a time series of states or categories (18). Figure 1 (box A) presents this time series as a sequence of colors displaying the sleep states. Each sleep state is represented by a color.
In this study, we want to determine whether there are patterns in the sleep time series during nights that correlate to patterns of blood glucose level evolution of the following day. To search for sleep patterns, we tried different time series clustering techniques (19). Clustering is a group of machine learning techniques that identify clusters in the data. A cluster is a group or subset of elements of a population.
In this work, we applied clustering to group the nights of the participants based on the sequence of sleep states, i.e., each cluster includes those temporal sequences that are most similar to each other (18). Subsequently, we analyzed the evolution of glucose during the following day for each cluster. Finally, we analyzed specific and expected behaviors in the diurnal evolution of glucose values for the different clusters. This last step is explained in more detail in subsection 2.5.   To identify specific behaviors of each cluster, we applied techniques commonly used in language processing (20, 21). To do this, we transform a time series of numerical glucose values into a sequence of symbols. These symbols are obtained after the time series is normalized and reduced by obtaining the average of a number n of glucose values (in this work, n =4) (Piecewise Aggregate Approximation, PAA) (22). A symbol is assigned to each aver-aged point within a dictionary based on the statistical distribution (Symbolic Aggregate approXimation, SAX) (20, 21). Finally, the symbols are grouped into words of a specific size (12 in this work).

Similarity among glucose time series
Next, we identify behaviors specific to each cluster and those familiar to all clusters. Based on the number of occurrences of each "word" in all the time series of each cluster, we obtain the weight vectors associated with each word [Term Frequency -Inverse Document Frequency (23)]. Thanks to the weight vectors, we calculate the cosine similarity (24) and use this value to know if a word is specific to a cluster. In the average time series, we show those cluster-specific segments in cool colors (dark and light blue) and warm colors (red and orange) the similar segments across all clusters. The concept is that words with a very high frequency of occurrence in one cluster and a shallow frequency in the others appear in blue, whether the word appears a lot in all the clusters appears in orange or red. If the occurrence in the other clusters is medium, the color is green or yellow. Hence, we can identify the dynamics of glucose that characterizes a cluster. In Figure 1 (box F), we present a summary of the process for words of size

Statistical methods
In order to find out the possible relationship between the glucose levels and the quality of sleep, several cluster analyses and correlational studies were performed using the R language and related libraries (18,25). These types of models, together with language processing techniques taken from the field of artificial intelligence, make it possible to determine possible patterns between the different variables selected and the nocturnal sleep patterns (26).
On the one hand, the K-means algorithm is used in the various cluster analyses among available data (27): first, considering the variables associated with sleep alone, then the variables associated with glucose levels, and finally, the set of all variables. On the other hand, the correlation analysis takes as a reference Pearson's correlation coefficient. These values have been obtained after processing these glucose records with the R Package gluvarpro (28).
To compare the glycemic characteristics of clusters, we used Welch's F-test (29) using the package from Dag et al. (2018) (30). We performed pairwise tests using Bonferroni's correction (31,32) for the p-values to calculate pairwise differences for each variable between the scores of each cluster (using the same package as before). In addition, we used Shannon's entropy (33) for analyzing the results of the clustering. Shannon's entropy provides an idea of how ordered sleep was. Higher values of entropy indicate higher levels of disorder.

Participant characteristics
Twenty-five subjects participated in this study, of whom fourteen were female and eleven were male. Table 1 shows the characteristics of the participants identified by a random ID and including gender (M=Male; F=Female), age, BMI, HbA1c, diabetes treatment (MDI: Multiples doses of insulin; CSII: Continuous subcutaneous insulin infusion), and years of evolution of T1DM.
The mean age is 38.3 years, with an age range of 18-60.8 years, while the first and third quartiles are 26.4 and 47.9 years. The mean duration of diabetes is 18.1 years with a range of 0.8-39.5 years, and the first/third quartiles are 11.2/24.2 years. HbA1c mean is 7.4% (range 6-9.7%) and 1st/3rd quartiles are 7/7.8%. Body Mass Index (BMI) mean is 24.4 (range 18.5-32.2) and 1st/3rd quartiles are 22.3/ 26.3. Fifteen patients were on continuous insulin pump therapy, and ten were on multiple daily insulin doses. The CGM shows a mean blood glucose of 155 mg/dl, high glycemic variability (CV 36), and a time in hypo and hyperglycemia above target. Table 2 shows the results of the Pittsburgh questionnaire. The results of the PSQI give a poor overall sleep quality in 12/23 patients, being these results concordant with the objective assessment of the actigraphy. Sleep disturbances contribute most to the high PSQI score (sudden nocturnal awakenings or other reasons like heat, cold, pain, nightmares, snoring, coughing, or the need to urinate). This result is also concordant with the actigraphy results, where the mean duration of objective nocturnal awakenings (WASO) is 52 minutes. Nine patients report significant daytime dysfunction (score >1) regarding drowsiness or poor mood for daily activities. One of the participants was discarded because he/she worked in shifts. Table 3 presents the values of the sleep monitoring variables for the participants of the study. Al-though most participants have a sleep efficiency higher than 90%, there are also 3 cases with a value close to 45% and two others with low-efficiency values (58% and 68%). Sleep data from some parti-cipants, such as HUPA007 or HUPA008, were discarded due to inconsistency in the reported data.

Sleep and glycemic control characteristics
Following the consensus on sleep quality assessment of the National Sleep Foundation (34), three vari-ables were used for evaluating the sleep quality: the number of awakenings during the night, WASO or Wake After Sleep Onset and the sleep efficiency (as the ration of total sleep time to time in bed (35). Table 4 shows the sleep characteristics of the participant. Sleep quality was categorized as poor if at least two of three mentioned criteria were met, i.e., sleep efficiency < 85% or Wake After Sleep Onset (WASO) > 40 min or a number of awakenings > 4. The sleep characteristics of the participants show large inter-individual differences, and only 48% of the patients have a good overall sleep quality, although the mean sleep duration is not low (mean of 7.15 hours). Of the 243 nights analyzed, 77% (n = 189) were of poor sleep quality and 33% (n = 54) of good quality. It should be noted that eight patients had no night with good sleep quality. The factor that most determined poor sleep quality was the duration of nighttime awakenings, with a mean of 52.81 minutes. Table 5 shows the percentages of time spent in sleep phases of Light, REM and Deep. Light phases percentage ranges from 45% to 60.8% with an average of 54.14%. The average time spent in the Deep phase is 15.08%, with a maximum of 20.19% and a minimum of 11.72%. Finally, participants spent an average of 18.49% of the time in bed in the REM phase, ranging from 8.62% to 27.24%. Table 6 shows the overnight glycemic characteristics of the participants. Patients presented low values of time in range, with an average of 59.97 ± 14.74%, which is an indication of poor glycemic control. The high values of the average CV (36.45 ± 8.76) and standard deviation of the mean glucose (55.85 ± 14.) are also concordant with this appreciation.

Association between sleep quality and blood glucose
In Figure 2, the upper triangular view of the correlation matrix for different variables recorded in this study is displayed as a correlogram. Red/blue colors for showing negative/positive correlation, and low/ high intensity indicating the absolute value of the correlation. In addition to the expected correlations, we can point out several facts. Both poor and good sleep qualities have no significant correlation with any other variable. A positive correlation of 0.8 was found between the standard deviation of sleep efficiency and the standard deviation of mean blood glucose. In addition, the standard deviation of sleep efficiency has a positive correlation (0.66/0.62/0.65/0.61) with the standard deviation of glucose, the coefficient of variation, the time in range, and the time in hyperglycemia. There is a positive correlation (0.55) between the coefficient of variation and the mean time spent in hypoglycemia.
As mentioned, we used the clustering techniques to find patterns in sleep behavior. We experi-mented with a different number of clusters, having found k =4 to be the best option, showing a clear relationship between sleep structure and glucose variables. With k =3, we have a cluster with very broad glucose patterns, whereas, with k =5, the relationship between sleep structure and the different glucose variables is confirmed with no additional information, remaining the main clusters the same. With k =4, the number of nights grouped in each cluster was: 33, 78, 41 and 91.
In the left column of Figure 3, we can see the four sleep clusters, while the right column shows the average glucose dynamics in the days corresponding to each cluster. Remind that in the right column, the specificity of the glucose patterns is shown with intense blue color, while the patterns common to all clusters are shown in red. Because we take glucose level samples every 15 minutes, we have 96 samples per day. In the horizontal axis, we mark the main hourly correspondences. In order to correctly compare the sleep clusters, we show a total of 44 possible states per night (horizontal axis, on the left column).
We calculated the Shannon's entropy for the four clusters resulting in the following order (from highest entropy to lowest): 1,3, 2, and 4. Figure 4 shows the results of the main glucose variables for each cluster. On the one hand, the four clusters have slightly different sample sizes. On the other hand, we cannot assume that the clusters will have the same variance. The result of Welch's F-test indicates that we can reject the null hypothesis that each cluster has the same mean value.
After the statistical tests with Bonferroni's correction, we obtain several observations. Regarding time in Range, there is statistical significance between Cluster 1 and Cluster 4. We found significant   Welch's F-test, the pairwise tests found no significant differences. One explanation could be that the applied Bonferroni's adjustment was too severe (36,37). Another variable related to glucose variability, the standard deviation of glucose levels, presented significant differences for Cluster 1 and Cluster 3 versus Cluster 2 and Cluster 4. So, from these statistical results and the parallel observation of Figures (3 and 4 several conclusions arose. Clusters 1 and 2 ( Figures 3A, C) have the longest sleep state sequences, the highest nocturnal glucose levels and a maximum peak around noon. Clusters 3 and 4 ( Figures 3E, G), with the shortest sleep state sequences have the lowest nocturnal glucose levels and a maximum peak around sunset. In addition, these are the two clusters with the lowest time in hypoglycemia ( Figure 4B). In the case of Cluster 3, this is mainly because this cluster has the longest time in hyperglycemia ( Figure 4C), while Cluster 4 is the cluster with the longest time in range ( Figure 4A). Cluster 1, with the highest Shannon's entropy and the longest sequence of states (40), has as distinctive characteristic a very pronounced drop in glucose levels prior to the night and, at the same time, the most accentuated nocturnal rise (displayed in dark blue in Figure 3B). In addition, it is the cluster with the lowest time in range ( Figure 4A), the highest time in hypoglycemia ( Figure 4B), coefficient of variation ( Figure 4D) and standard deviation ( Figure 4F). Cluster 3, with the shortest sleep sequence (16 states), has the unique characteristic of a pronounced drop in glucose level during the night ( Figure 3F). It is also the cluster with the highest time in hyperglycemia ( Figure 4C) and, therefore, the highest mean level of glucose ( Figure 4E). In Figure 4F, we can see that the lowest standard deviation corresponds to clusters 2 and 4. This could be related to the fact that these two clusters have the sleep state sequences with the lowest Shannon's entropy. The shortest time in hyperglycemia and therefore lower mean glucose level (Figures 4C, E)  corresponds to Cluster 2, which has a low level of Shannon's entropy and a medium length of the sleep state sequence ( Figure 3C).

Discussion
This study shows that in adults with T1DM, subjective and objectively assessed sleep quality is poor, as occurs in 77% nights analyzed with actigraphy and 52% patients report Pittsburgh index > 5. In a previous epidemiological study using the Pittsburgh survey to measure subjective sleep quality (1) in a sample of 222 patients, authors found that 41% have poor sleep quality (Pittsburgh index >5). According to our study's observational data, sleep quality variability in adults with type 1 diabetes is associated with more significant variability in nocturnal blood glucose levels.
Similar findings have been reported in a group of adolescent patients using actigraphy and CGM, where sleep fragmentation, earlier awakening, and longer duration of WASO are associated with greater glycemic variability and longer time in hypoglycemia (8).
To our best knowledge, this is one of the first studies using machine learning techniques to analyze the relationship between sleep structure and times in normo-, hypo-, and hyperglycemia and to show that better sleep structure is associated with longer time in the glycemic range during that day. Our results confirm those of a previous study in 20 adult patients (38), showing that poor sleep quality is associated with greater glycemic variability. However, they found no association between sleep quality and time in range. This study only analyzes the relationship between sleep quality and glycemia with a linear mixed-effects model. The application of machine learning clustering reveals that nights with a higher disorder of the sleep structure presented lower time in range and a higher percentage of time in hypoglycemia. Increased time in the deep sleep phase was correlated with lower HBA1c and less time in nocturnal hypoglycemia in a previous study (9).
Other previous studies that do not use continuous glucose monitoring also suggest that sleep disturb-ances worsen glucose control. In particular, patients with short sleep duration (<6.5 hours) reported higher HbA1c than patients with longer sleep duration (>6.5 hours) (14). Social jet lag (major changes in the duration and timing of sleep between weekdays and holidays) was associated with worse chronic metabolic control (39). Some studies demonstrate the influence of sleep quality or duration on glycemic control in children. However, the findings among the different authors are not the same: it has been reported that a longer duration of the light sleep phase is associated with higher mean daily blood glucose, more episodes of hyperglycemia, and higher HbA1c (4), and that increased nocturnal awakenings (40) correlate with high glycemic variability.
Most of these studies have limitations in that they were conducted on a small number of patients, some only used subjective sleep assessments, and only two studies in adults simultaneously performed continuous glucose monitoring and polysomnography.
There are several possible mechanisms involved in poorer glycemic control (41). Decreasing the duration of the REM phase would produce lower nocturnal glucose consumption, given that in the cerebral REM phase, glucose consumption is similar to awake. In contrast, in the cerebral non-REM phase, glucose consumption is much lower. In the general population and patients with diabetes, sleep deprivation, fragmentation, and decreased deep sleep are associated with decreased insulin sensitivity, possibly mediated by increased cortisol and Growth hormone (GH) levels. In patients with T1DM, higher nocturnal levels of growth hormone, adrenaline, ACTH, and cortisol than in the control population have been reported (3). In an experimental study, the partial restriction of a single night of sleep (4 hours) de-creased peripheral insulin sensitivity measured by the hyperinsulinemic-euglycemic clamp in patients with T1DM (42).
Although it has been proposed that continuous glucose monitoring may alter sleep quality due to hyper-or hypoglycemia alarms, in this study, the CGM did not have alarms, so the likelihood of inter-ference of the CGM on sleep quality is very low. Finally, sleep disturbances could worsen glycemic control by an indirect mechanism related to patients' behavior and cognitive functions. An association has been described in children and teenagers between a shorter duration of sleep and a decrease in the frequency of self-monitoring and insulin bolus administration (43).

Limitations
The use of Fitbit devices is controversial. The previous generation of Fitbit devices was equipped only with body movement sensors and, therefore, were unsuitable for recording sleep stages. How-ever, new generations incorporated heart rate recording and a light sensor, so the Fitbit Ionic models greatly improved the ability to identify sleep stages. In fact, they are considered sleep-staging models (16). However, the data is not available directly from the web. Instead, programming an API is necessary to obtain the data. Although the code was tested thoroughly, a deeper validation with other wrist devices of higher complexity would be beneficial.  Correlation matrix for all the variables recorded in this study.
Botella-Serrano et al. 10.3389/fendo.2023.998881 Frontiers in Endocrinology frontiersin.org would be necessary to study better the differences on sleep patterns based on age. This study did not look at possible differences between patients treated with MDI or CSII. Separating patients by treatment would further reduce the number of nights used to analyze each group as we clustered by night rather than by patient. Future work should include larger samples to investigate such possible relationships.

Conclusion
To our best knowledge, our work is the first study that, using artificial intelligence and statistical techniques, has found a relationship between sleep structure and times in normo-, hypo-, and hypergly-cemia. Our main conclusion is that better sleep structure is associated with a longer time in the glycemic range. Future studies are needed to confirm these findings in a larger patient population and investigate the mechanisms involved in the decreased time in range and increased glycaemic variability caused by poor sleep quality. We believe that sleep disturbances should be a factor to be assessed in the clinical practice of patients with type 1 diabetes and that strategies should be designed to treat these disturbances. As future work, we are considering conducting a study to investigate further the relationship between sleep and glycemia by age group. Intuitively, variables affected by age, such as habits, responsibilities, social influences, etc., may produce significant differences in sleep patterns and diabetes outcomes.

Data availability statement
The raw data supporting the conclusions of this article will be made available by the authors, without undue reservation.

Ethics statement
The studies involving human participants were reviewed and approved by Hospital Universitario Prıńcipe de Asturias. The patients/participants provided their written informed consent to participate in this study.

Author contributions
MB-S: Experimental design. Medical analysis. JV: AI techniques, programming, figures, writting. AS-S: statistical analysis OG: AI analysis, writing JIH: AI analysis, writing and Funding. All authors contributed to the article and approved the submitted version.

Funding
This work has been supported by: Fundacioń Eugenio Rodriguez Pascual 2019 grant -Desarrollo de sistemas adaptativos y bioinspirados para el control gluceḿico con infusores subcutańeos continuos de insulina y monitores continuos de glucosa (Development of adaptive and bioinspired systems for glycemic control with continuous subcutaneous insulin infusors and continuous glucose monitors). The Spanish Ministerio de