Hypoglycaemia prediction models with auto explanation

World-wide statistics show a considerable growth of the occurrence of different types of Diabetes Mellitus, posing diverse challenges at many levels for public health policies. Some of these challenges may be addressed by means of computerised systems which may pave the way to provide practitioners with insight on their patient’s conditions anywhere and at anytime, but also to empower Diabetes patients as managers of their health. These systems for disease management come in many shapes and sizes, being the most promising trends the ones that involve expert systems that comprise specialised knowledge, use predictive models, feature engineering and reasoning. This study presents the state-of-the-art on reasoning and prediction models related with either blood glucose level or hypoglycaemia events. The main findings revealed are that there is room for improvement on predictive models, namely to enhance its accuracy and ability to forecast future events into a wider time frame. On the other hand, reasoning models are understudied and its usage in Diabetes management is reduced. We discuss an architecture that combines a predictive model and a reasoning system, with the objective of alerting of impending occurrences and interpret the current situation to accurately advise the diabetic user.


I. INTRODUCTION
D IABETES is a chronic disease that in 2019 affected approximately 463 million adults around the world (International Diabetes Federation, 2019). Despite all the efforts to stale the growth of this disease, the number of people with diabetes is continuously increasing and it is estimated to reach 700 million in 2045 (International Diabetes Federation, 2019). Alongside these numbers there is the economic impact. Diabetes is reported to have caused expenditures of 727 billion USD dollars in 2017 (International Diabetes Federation, 2019). These facts challenge for innovative solutions capable not only mitigating the origin of new cases, but also providing sustainable medical practices for those already affected by diabetes. Diabetes is characterised by high levels of glucose in the blood, caused by the person's pancreas only producing little or no insulin. If glycaemic values are not controlled, diabetes can seriously decrease the quality of life. In the worst cases, this disease leads to blindness, amputation or heart problems. There are different types of diabetes where type 2 and type 1 are the most common. Each type of diabetes has a specific treatment associated. Given the diabetic's inability to produce insulin, a strict regime and periodic or even continuous verification of glycaemic values is recommended. This regime evolves and adapts each time the diabetic consults a doctor. In these appointments, the medical expert evaluates the evolution of the glycaemic values, among other relevant annotated information, and personalises the current regime, to the diabetic's needs. This process is not optimal since it requires the availability of a medical expert to receive the person, evaluate the data and refine the treatment. Real-time events such as hyperglycaemia (when concentration of Blood Glucose (BG) is high) or hypoglycaemia (when BG is low) 1 , require immediate action which poses a possible problem in the absence of expert knowledge.
Research has tried to provide support directly to the patient, embedding this knowledge at the patient side. Predictive models have been increasingly adopted to cope with hypoglycaemia events. The objective is to empower patients before an event occurs and thus to support them on the decision-making required to mitigate or to avoid the subsequent symptoms. However, in current research, the reasons for the hypoglycaemia to occur are not addressed. Reasoning about why a hypoglycaemia will occur, may help avoid it and educate the patient on a better control. This last point concerns the area of expert systems for health. The objective of predictive algorithms can be divided into three purposes: improving the health care of the population, increasing patient experience, and adding value to health care. A predictive algorithm can be applied to some challenging healthcare scenarios such as: promoting self-management by status interpretation and health education, individual change detection, future event prediction or assisting medical decision-making. Predictive algorithms are based on various techniques, including data mining, statistical, modelling and artificial intelligence. For developing these models different pre-processing techniques, various feature extraction techniques and classifiers are applied.
This approach attempts to glance the future. Considering the user's past data, it trains specialised models to foresee the consequences of the user's current actions. Doing so, these systems create a window of opportunity for the user to avoid possible unwanted occurrences. Therefore, the discovery of patterns associated with future events in combination with feature engineering to understand which features allow reasoning about this field is crucial development for diabetes management.
Reasoning systems, are a part of computer science that given a goal attempts to make logical inferences automatically (Hayes-Roth, Waterman and Lenat, 1984;Wos et al., 1984). In the case of diabetes management, these systems can be viewed as a medical support tool. Diabetes management is a complex task that requires not only expert knowledge, but also experience. There are multiple factors that influence glycaemic values, and often these factors vary from person to person. With this in mind, many projects try to specialise in a particular aspect of diabetes management, insulin calculation being the most popular. In general, reasoning systems, applied to diabetes, seek to advise and assist their users as an expert would.
In this article we will first describe what is the current state of the art for hypoglycaemia prediction models and reasoning approaches for diabetes management. We will then discuss the shortcomings of the current methodologies. After which we will argue that both techniques need to be improved and coupled to provide the diabetic patient with a good support for diabetes management.

II. METHODOLOGY
In this work, the authors searched and reviewed the state of the art of both prediction and reasoning models applied to diabetes. The models focus on different subjects, as a consequence, search parameters differ, although the search engines used were the same. The authors used the Scien-ceDirect, IEEE Xplore, ACM Digital Library, SCOPUS and PubMed databases to retrieve relevant peer-reviewed publications.
This study aims to provide an up-to-date state-of-the-art on data-based or hybrid models applied to predict either blood glucose levels or hypoglycaemia events by means of data collected from patients with diabetes.
We searched titles and abstracts using: "hypoglycemia prediction" OR "hypoglycemia detection" OR "blood glucose prediction" OR "blood glucose estimation" OR "hypoglycemia estimation" OR "blood glucose detection", for the databases ScienceDirect, IEEE Xplore, SCOPUS and PubMed; and (hypoglycemia OR "blood glucose") AND (prediction OR detection OR estimation), for ACM Digital Library. We used the US version of hypoglycemia for searching as it provides more results. In this paper we use the UK version to conform to UK English 2 . The inclusion criteria were: real data from participants; collected on clinical or daily living contexts; with at least one of these data categories, comprising BG levels (from Continuous Glucose Monitoring (CGM) or Self-Monitoring Blood Glucose (SMBG)), insulin, meal, or exercise information. Information from the selected publications was extracted taken into account the following characteristics: • Study Information: This defines the study's citation and year of publication; • Data: This defines the type of diabetes, sample (number of participants, age range or average age and gender distribution) and source (collected, clinical trial, EHR or dataset); • Prediction: This defines the application where the algorithm is being exploited. It can be short or mid-term predictions, nocturnal, postprandial or other; • Algorithms: This defines the different approaches used to train the model; • Input: This was defined to assess the inputs used to develop the algorithm. This includes BG, meal, insulin, exercise or others. After a search and an eligibility review, 33 studies were included for data extraction and qualitative synthesis.
The reasoning models that fit our criteria are expertsystems with the ability to support patients on the decisionmaking. In this case, the authors did not filter works considering implementation platform or published date. For the reasoning models, we searched titles and abstracts considering the keywords: "expert-system diabetes" OR "expert system diabetes" OR "reasoning diabetes". A careful review of all the titles and abstracts associated with this search was performed. To filter out non-pertinent studies the following inclusion criteria were applied: original studies, studies directed for management of diabetes type I containing user advice. We have obtained 50 results related to expert systems and diabetes management in the initial search. From these we have considered 19 to fit our inclusion criteria. Information from the selected publications was extracted taken into account the following characteristics: • Algorithm: This defines the different methods used by the given approach; • Input: The input required by the given approach in order to function correctly; • Output: Defines the application's feedback to the users.
It can be insulin recommendations, glycaemia read recommendations, generic recommendations or treatment recommendations.

III. MODELS AND SYSTEMS FOR GLYCAEMIA PREDICTION
The majority of models described in this section aim to predict glycaemic values. The accuracy and time frame varies depending on the predictive model. Some of these works (Botwey et al., 2014;Fox et al., 2018;Mhaskar, Pereverzyev and Walt, 2017;Plis et al., 2014;Zarkogianni, K. et al., 2015) predict, classify and label glycaemic values. Others aim to predict hypoglycaemia events (Bertachi et al., 2018;D. Dave et al., 2020;Jensen et al., 2019;Reddy et al., 2019;Vehí et al., 2019). BG prediction is the estimation of future BG values based on present and past inputs. For this, several approaches have been proposed by the scientific community: physiological models, data-based approaches, and a combination of both, the hybrid models (Hidalgo et al., 2017).
The data-based models are in general more accurate (Novara et al., 2016). These models have been proposed using pattern recognition techniques and experimental data. However, there may be exceptions as shown in Mirshekarian et al. (2017).
The major challenge for the predictive models is related to the variable impact that the collected variables have on the glycaemia value. The effects of insulin intake, meals, physical activity and other events in glucose dynamics are different for every person (inter-subject variability) and even in the same person there are changes over time (intra-subject variability) (Faccioli et al., 2018). According to this, the models for BG can be categorised into two groups: individualbased models trained on an individual's specific data, and population-based models trained on pooled data from many people expecting they will generalise well enough to allow them to be used in previously unseen individuals.
Despite the efforts in this area, no specific method provides total reliable event predictions, thus an increasing number of approaches have been proposed for inputs and techniques fusion in the hope to represent spatial and temporal input-output dependencies. The availability of personal devices and wearable devices allowed the data collection of several individual inputs provided by the user. Among them, we find CGM systems, smartphones, smartwatches, wristbands, among others. It allows the collection of real data on clinical or free-living context. Some studies have used simulated data (from virtual patients) using BG software simulators AIDA 3 and UVA/Padova 4 . CGM systems usually measure BG levels at a fixed instant time, e.g., every 3 or 5 minutes, as such, the majority of studies work with time-series approaches. Past reviews (Felizardo et al., 2021;Oviedo et al., 2017;Woldaregay et al., 2019) in this subject show that uni-variate approaches are commonly used predicting the future BG only based on past BG data. But these reviews also show that studies started to combine different data such as therapies, meal, exercise, and contextual information. Different datasets were used but few are accessible, e.g., OhioT1DM (Marling and R. C. Bunescu, 2018) and DirectNet datasets 5 . There are several approaches for the predictive task, including Artificial Neural Networks (ANN), supervised learning, statistics or probabilistic models, auto-regressive models, evolutionary models, adaptive filter models, deep learning, hybrid, and ensemble. Table 1 shows some information about each study: year of publication, data information and prediction model. Most studies between 2014 and 2020 used ANN based models, deep learning, and ensemble models. Table 2 shows detailed information about the prediction model, inputs category and prediction outcome of ANN based models. ANN approaches are used due to its great capacity to model the various non-linear and non-stationary glucose dynamics. Several approaches of ANN are addressed, including extreme learning machine (ELM), jump neural networks (JNN), multi-layer perception (MLP), recurrent neural network (RNN), and self-organising map (SOM). As an emerging theory, ELM presents a better generalisation performance, a faster learning speed, a good performance in regression applications and in large datasets or multi-class application. According to Mirshekarian et al. (2017), ANN approaches, with gradient-based learning methods and back propagation, are difficult to train due to vanishing gradients, a problem that is often compounded by small datasets. So, some approaches start to use Long Short Term Memory (LSTM) units, which are not affected by the vanishing gradient problem, embedded into Deep Learning (DL) frameworks they can capture the complex dynamics system, particularly, when it is difficult to derive the mathematical expressions of the system. Table 2 show detailed information about the prediction model, inputs category and prediction outcome of DL based models.
Despite the good results and potentialities of ANN based and DL based approaches, some authors continue to use Hypoglycaemia prediction models with auto explanation V. Felizardo, D. Machado, N. Garcia, N. Pombo and P. Brandão supervised learning (SL) approaches. Random Forest (RF) and Support vector machine (SVM) are commonly used for glucose concentration prediction (D. Dave et al., 2020;Reddy et al., 2019;Vehí et al., 2019). RF presents some advantages useful for this kind of predictions: reduce overfitting, flexible to both classification and regression problems and works well with both categorical and numeric attributes. SVMs also present interesting advantages for this task, e.g., the reliability of Support Vector Recursion (SVR) for predictions (Hamdi et al., 2018). Table 2 shows detailed information about the prediction model, inputs category and prediction outcome of SL-based models. Nevertheless, every prediction algorithm has its own advantages. So, sometimes it is necessary to combine different prediction methods to cover the disadvantages. Table 2 shows detailed information about the prediction model, inputs category and prediction outcome of ensemble approaches. In this category we find different approaches of ensembles. In order to address the complexity of factors affecting glucose response some studies (Contador et al., 2020;Dong et al., 2019;Montaser et al., 2020) used clustering associated with other kind of models to better characterise scenarios with similar responses. Other studies used regression models and auto-regressive models (Auto-regressive model with output correction ( The feature extraction and feature selection are crucial techniques to obtain good and optimised prediction algorithms and to understand the effects of some inputs in the predictions in order to later try to reason about these effects. The meals content of individual diets and how carbohydrates affect BG is one of the basis of diabetes treatment. Proper exercise plays an important role in BG control and reduces the risk of cardiovascular events. Reasoning is targeted inference where inputs are carefully selected, organised, and the inference is used to generate the desired result. Table 3 shows different approaches of how BG prediction studies select features and the improvements achieved. From the studies with feature selection, we can conclude that some information like insulin, meals, exercise, and time of the day are relevant when combined with BG to improve the performance of the models. Regarding the prediction outcome, it is common to use the Prediction Horizon (PH). This can define the models according to two categories: short term, when the PH is less than 180 minutes; and mid-term, when the PH is more than 180 minutes and less than 24 h. PH is the future time window in which the predicted glucose concentration is determined by a model. The thresholds of each category do not have a standard definition so, in this literature study we used the above thresholds. Some recent studies focused on specific periods of the day, providing prediction of glucose concentration or events: nocturnal (Bertachi et al., 2018;Jensen et al., 2019;Vehí et al., 2019;Zecchin et al., 2016), postprandial (Montaser et al., 2020;Vehí et al., 2019;Zecchin et al., 2016) and during exercise protocol (Reddy et al., 2019).

IV. REASONING APPROACHES
As important to know that something will happen, is to know why it will happen. By analysing the user's data thoroughly, it is possible to retrieve knowledge that can help users to improve their glycaemic control. If available to medical experts, the conclusions obtained by these methods, can even be used to better understand the user's needs, and adapt the user's current diabetes' monitoring plan.
Expert knowledge is an ever-increasing necessity. In various areas such as engineering, finance, science and medicine, experts are a fundamental piece. As our base knowledge increases, the necessary expertise to handle this knowledge also increases. In some cases, teams of experts are needed to handle and work with a particular system. Expert knowledge is therefore an uttermost valuable asset. With today's demand of experts, it is unreasonable to expect an expert to be perpetually available. Nonetheless, certain occurrences require the continuous attention of an expert.
Expert systems are automatic consulting systems (Akerkar and Sajja, 2010) that attempt to emulate an expert's decisionmaking (Todd and Group, 1992). Expert systems have been implemented in numerous areas from agriculture (Elsharif and Abu-Naser, 2019; Al-Qumboz, Mohammed and Abu-Naser, 2019) to computer security (Lunt and Jagannathan, 1988) and health (McAndrew et al., 1996;Velicer and Prochaska, 1999). In the scope of diabetes, expert-systems have been, for a long time, a useful tool to interpret data and retrieve information. For instance, the SESAM-DIABETE project, an interactive educational expert-system capable of providing personalised advice and therapeutic recommendations for insulin diabetic patients was available in 1989 (Levy, Ferrand and Chirat, 1989). Table 4 shows details about different studies: the used algorithm, the required input, and the output.
Generally, expert-systems related to diabetes focus on bolus adjustments. These systems, evaluate the user's data, trace the user's profile, calculate and recommend insulin dosage adjustments (Ambrosiadou, Alevizos and Ziakas, 1993; Ambrosiadou, Goulis and Pappas, 1996; Cosenza, VOLUME X, 2021 El Fathi et al., 2020;Fortwaengler et al., 2013;Lehmann, T. Deutsch et al., 1994;Rudi and Celler, 2006). Projects like the DIABETES (Ambrosiadou, Goulis and Pappas, 1996) system can even explain, to users, the therapeutic recommendations given. The treatment recommendations made by the system were evaluated against the recommendations of an expert. The results showed that in 22% of the cases there was a full disagreement; 31% of the cases had one parameter in disagreement and finally, in 47% of the cases the medical expert fully confirmed the expert system's conclusions. The authors explain that in some cases, a conclusion that has resulted in a total disagreement may not be wrong, in some cases the system suggests a correct, but more complex route that diverges from the more direct expert's approach. Other expert-system approaches, related to diabetes, can also advise basal rate adjustments (Reinke, Price and Galley, 2011) and advise changes to meal and insulin administration scheduling (Lehmann, T. Deutsch et al., 1994).
Less frequent, there are approaches that aid users to better their glycaemic management, giving general advice, which is usually abstract or related to meal, exercise and glucose value test guidelines (Angelides, 2013). Advising in the diabetes context is a complex task, since it will influence the user's health. Possibly, because of this, most approaches avoid specifying what the user should do, instead, the application will show the user general best practices as advice (Al-Ghamdi et al., 2011;Hashemi, 2012;Mbogho, J. Dave and Makhubele, 2013;McCausland et al., 1999). The project 4 Diabetes Support System (Marling, Wiley et al., 2011) tries a different approach. This system is a case-based approach to diabetes self-management. In this project several problems related to diabetes are identified and defined as cases. Cases are constituted by an identified problem, a determined solution to the problem and a verification of the problem's resolution. This case is then translated to logical rules. The created rules identify the problem, apply the determined solution and verify its success. In order to update and evolve this system, the impact of the solution is verified. If the known solution does not solve the identified problem or if a better solution is uncovered, then it is possible to reach the case and update its parameters to translates the new, better, solution. In this manner, it is possible to advise diabetics with a good level of confidence. This project was developed during seven years and had three clinical research studies (Marling, Wiley et al., 2011). The project MyDiabetes (Machado et al., 2017) 6 is a mobile application that contains an expert-system. This system did not follow a case-based approach, instead, the authors translated existing medical rules and guidelines to logical rules, that compose the expert-system. This approach takes advantage of the records introduced by the user in the mobile application, to evaluate the user's state and advise accordingly. Although there are important contributions made by the different presented projects, there is a lack of results 6 MyDiabetes https://mydiabetes.dcc.fc.up.pt/ (in Portuguese). on the impact these systems have on glycaemic control.
A limitation regular expert systems have is their static nature. The rules and knowledge integrated in the expert system are not dynamic and can only be changed after a software update. Considering the learning abilities of datamining and machine-learning, these systems, if integrated within an expert system could give it the opportunity to adapt and better the knowledge contained in it. The "4 diabetes project" (Marling, Wiley et al., 2011) has two branches dedicated to the use of data-mining for prediction. During the project's second study, a common diabetes problem was addressed, glycaemic variability. This blood control problem is linked to hypoglycaemia unawareness and to oxidative stress which leads to long-term diabetic complications. The system can identify twelve types of glycaemic variability, using multiple different rules. It was not possible to create a generic rule capable of identifying this problem. The authors refer that there are numerous metrics for glycaemic variability characterisation, but there is no consensus on a technique to be used in clinical practice. Still, for physicians, the identification of this problem becomes trivial when in the presence of a BG plot. In order to reach a global method for identification of glycaemic variability, the authors decided to apply machine learning. To create a system capable of recognising glycaemic variability, the authors considered the quantifiable aspects of this problem. The metric chosen to quantify the glycaemic variability was the Mean Amplitude of Glycaemic Excursion (MAGE). This metric captures the distance between the local maximum and minimum of a BG plot. Considering this metric insufficient, the authors devised two other metrics: the distance travelled and the excursion frequency. Distance travelled captures the overall daily fluctuations, and excursion frequency counts the number of significant glucose deviations in a day. Two physicians, also authors in this work, classified BG plots as excessively variable or not, based on their expert knowledge. The same plots were also scored by MAGE and the two other metrics. The classifications obtained for 218 BG plots were then used to train multiple machine learning algorithms. Among the tested algorithms, the naive Bayes classifier used was able to match 85% of the physicians' ratings.
The "4 Diabetes Support System" also addressed glycaemic value prediction. To achieve this goal, SVR was used. The choice of SVR is bound to its ability of incorporating contextual features, without the assumption of feature independence. The results obtained showed that SVR is capable of achieving better results than a baseline model that uses the present BG as the prediction for future values.
These prediction systems' results, if integrated in an expertsystem, could be used to prevent future occurrences, but also as input data. For the expert system, knowing that certain occurrences are reasonably believed to happen, can be even more meaningful than simple data. In the case of the referred systems, the expert-system would be able to obtain data about glycaemic variability, and a projection of future glycaemic values. With this information, the system could be pro-active and better advise the user. Additionally, the system could use this information to refine variables such as insulin sensitivity or carbohydrate ratios.

V. DISCUSSION
The field of prediction models and reasoning applied to diabetes is rich and varied in approaches. Considering the described research, in general, most options tend to focus on aiding, or solving a particular diabetes related issue. Only a few, such as the 4diabetes project attempt to include different modules that encompass different diabetes related issues. The prediction models approaches contribute to identify the features that affect the patterns associated with risk of future events.

A. PREDICTION MODELS
Prediction models have made significant progress in transforming available data and clinical information into valuable new knowledge allowing new patterns discovery and whatif scenarios definition. These new findings can give some reasoning about the effects of concurrent actions. The distribution of inputs presented in the tables of the different approaches shows that several papers combined features from different types of input. However, there are some studies that use BG alone due to inter-subject variability in variables. Therefore, we highlight some studies that use different sources for feature and contextual information integration. Features based on BG in the last 30 minutes is clear to have a PH of 30 and 60 minutes (Alfian et al., 2020;E I Georga et al., 2015;Eleni I. Georga et al., 2015). The contribution of other features, like meal, insulin or exercise, are lower but not insignificant (Eleni I. . Their importance increases for predictions with a PH of 60 minutes (Eleni I. . Zecchin et al. (2016) show that, for postprandial predictions, the combination of CGM values with meal and insulin intake achieves better results. Regarding exercise, Zarkogianni, K. et al. (2015) achieved better results adding exercise to glucose features. Reddy et al. (2019) show that the most important features for hypoglycaemia prediction are higher heart rate at start of exercise, the increase of energy expenditure and the lower glucose values at the start of exercise. Exercise time-based features explain better the glucose concentrations in short-term predictions (Eleni I. . The study by Pavan et al. (2020) used some additional features like insulin-on-board and carbohydrates-on-board to carry information about the dynamics of slow insulin absorption and carbohydrates slow impact on BG. Similarly, this study used physical exercise-on-board to describe physical activity intensity. The integration of the Error Imputation Module using these additional features improved the predictions. Cappon et al. (2020) presented personalised features to give personalised predictions. The most important features are CGM and insulin or the correction boluses (all patients have these features). For some patients other features are added depending on what PH (30 or 60 minutes) is aimed for. For one patient the combination of features is the same for the two PH (CGM, insulin and reported meals). In Alfian et al. (2020) the contribution of time domain features shows potentialities for predictions. Also, the use of time of day includes some novel features highly connected to glucose dynamics (Eleni I. . However, in He et al. (2019), the results show that meal and insulin intake and time provide more dominant causal correlations than sleep and exercise on BG inference. In Jensen et al. (2019) the feature subset with the highest results is reached using four features: slope of linear regression and minimum value of the evening (9-12 pm) before the event, minimum values of the three nights before the event and body mass index at baseline. Based on selection methods, D. Dave et al. (2020) show the importance of contextual features such as hour and day when observation was made. Few studies (Marling, Wiley et al., 2011;Reddy et al., 2019) address reasoning or explanations about predictions results. This is crucial to understand how other features like insulin, meal and exercise influence the BG dynamics and their effects on prediction models. From selected studies, Reddy et al. (2019) present a rule for recommendation during aerobic exercise, which they identified after the prediction during physical exercise. This recommendation consists of: if the glucose is below 180 at the beginning of the physical exercise and the heart rate above 120 during the exercise, there is risk of hypoglycaemia. We will discuss reasoning and its importance in the next section.

B. REASONING APPROACHES
Traditional standalone expert-systems for diabetes management and counselling that are comprised of static systems either rule-based, case-based, or fuzzy, are currently in decline.
Recent approaches to this topic utilise data-mining and machine learning algorithms, more autonomous and dynamic to create modules that can then be used to advise diabetic patients. These approaches are usually specialised, attempting to tackle specific diabetes related issues. Regarding the approaches presented previously, they focus on two topics: bolus adjustments (Ambrosiadou, Alevizos and Ziakas, 1993;Ambrosiadou, Goulis and Pappas, 1996;Cosenza, 2012;El Fathi et al., 2020;Fortwaengler et al., 2013;Lehmann, T. Deutsch et al., 1994;Rudi and Celler, 2006) and glycaemic advice (Angelides, 2013;Al-Ghamdi et al., 2011;Hashemi, 2012;Mbogho, J. Dave and Makhubele, 2013;McCausland et al., 1999) for better glycaemic control. Most do not have concrete evaluations of the impact of their approach. Nonetheless, the ones that disclose their results, prove that these systems have a positive impact on the user's diabetes management.
The "4 diabetes project" (Marling, R. Bunescu et al., 2012;Marling, Wiley et al., 2011), in contrast, possesses reasoning models and prediction models. The system is composed of a case-based reasoning system for glycaemic control and VOLUME X, 2021 therapeutic adjustments, a glycaemic variability classifier, and a blood-glucose prediction component. The different modules were not tested as a unit. Marling, R. Bunescu et al. (2012) report accuracy levels of 77.5% in a first test, and 97.9% in a second test, for the case-based system. The glycaemic variability classifier, the best classifier, also evaluated in two tests, obtained a 93.8% accuracy. Finally, the prediction model, being a work-in-progress, was only described, not mentioning practical results. Nonetheless, as the authors convey, this module, once available, could be valuable to take preventative actions.
Reasoning modules can be accurate and beneficial to detect and act on particular occurrences. Despite this, diabetes management consists of more than singular occurrences. The authors believe that, in order to help diabetic patients to better manage their diabetes, it is necessary to combine both reasoning and prediction in a more complete approach.

C. IMPROVE AND COMBINE APPROACHES
In our view, what is needed is the combination of glycaemia prediction and explaining the potential reason for the prediction of a dangerous event.
While managing diabetes, diabetic patients should avoid episodes of hypoglycaemia or hyperglycaemia. Hyperglycaemia episodes on the long term can damage the nerves, blood vessels, tissues, and even organs. Hypoglycaemia is significantly more dangerous on the short-term. Reaching this glycaemic state, in severe cases, can lead to loss of consciousness, seizures and ultimately to death. Given its severity, it is important to not only predict hypoglycaemic episodes, but also to understand the actions that led to this consequence. Uncovering the causes of hypoglycaemia for a given user, can be the first step to educate and ultimately change the user's routine for the better. To achieve this, the authors propose combining a predictive module with a reasoning module.
Our current reasoning component is a rule-based system, in Prolog, composed of logical rules, obtained from medical protocols and guidelines. The current system has access to the MyDiabetes app's database and, after each new record, evaluates the user's current situation. If it concludes that the user requires guidance, it sends an advice through the mobile app as a notification, indicating the recommended medical approach for the current occurrence.
Our current prediction component, for hypoglycemia events, uses discrete information fusion and a predictive model consensus. This component uses as data the glucose levels, the insulin therapy, meals, exercises, and other information related to time-dependent information, for example, the record's date and time, the type of meal, and the glucose level variability, considering the previous records. Predictive models are trained and tested using machine learning. The consensus decision of the predictive models is given in a personalised way to the patient, indicating the risk of a hypoglycemic event that may occur within the next 24 hours (window).
Our goal is to connect both components. The predictive model receives data from users and detects possible future hypoglycaemia occurrences. Then it supplies this information to the reasoning system that, knowing that a hypoglycaemia will occur, searches the user's data for possible motives for this occurrence. The motives can be simple daily actions such as exercise or incorrect insulin intake, or connected to deeper patterns related to the day of the week and the user's routine, that culminates in a hypoglycaemic occurrence.
We aim to develop this approach in the MyDiabetes smartphone application. Using a mobile application not only facilitates the access to the user's data, but also provides a convenient mean to alert and advice the user.
The first steps will involve adapting the prediction work done 7 to run on a mobile platform. The proposed architecture is shown in Fig. 1. The offline trained model would run online on the smartphone, in the machine learning system. Based on the input data it will predict potential hypoglycaemias and inform the reasoning system. The reasoning system, based on the available data, will warn the user providing advice and a possible reason for the hypoglycaemia. The current reasoning engine (Machado et al., 2017) is to be tuned to use the more relevant variables for explaining the future hypoglycaemia result.

VI. CONCLUSION
In this article we reviewed the work being done for glycaemia prediction and for reasoning in diabetes management for patients. As discussed, there is still a need to improve the predictions, to make them more useful within pragmatic horizon times and accuracy. Regarding reasoning systems they are still lacking in its usage for diabetes management.
Our focus is on type I diabetics, as there is more information being collected by these patients than type II, and they are in need of a more permanent advising. Type I disease management has several decisions to be taken along the day, whereas for type II this decision taking is less stringent. This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2021.3117340, IEEE Access V. Felizardo, D. Machado, N. Garcia, N. Pombo and P. Brandão In some cases diabetics type II are treated with type I methodologies, namely when the disease control deteriorates. In those cases, the proposed approach can also be applied to them. We briefly propose an approach to incorporate prediction and reasoning, to provide a more whole counselling to patients. They would be able to, using their regular smartphone, receive warnings regarding future episodes and explanations with possible reasons that lead to those events. This future work aims to not only interconnect both approaches but also to improve the predictions and the accuracy of the reasoning in the provided advice.
VIRGINIE FELIZARDO is currently a PhD student in Computer Science and Researcher in Assisted Living Computing and Telecommunications Laboratory -ALLab, a research laboratory (since 2010) within the Instituto de Telecomunicações at the University of Beira Interior (UBI), Covilhã, Portugal. She graduated in Biomedical Sciences (UBI, Covilhã, Portugal) and, in 2010, received M.Sc. in Electrotechnical Engineering -Bionic Systems (UBI, Covilhã, Portugal). Her research interests include sensors for biomedical applications, biomedical instrumentation, Health monitoring, Medical signal acquisition, analysis, and processing, Ambient Assisted Living, predictive algorithms and machine learning.
DIOGO MACHADO is a PhD student at the Faculty of Sciences of the University of Porto and supported by a scholarship from the Fundação para a Ciência e Tecnologia of Portugal. He obtained his M.Sc. also at the Faculty of Sciences of the University of Porto. He has worked as a researcher for Instituto de Telecomunicações. NUNO M. GARCIA holds a PhD in Computer Science Engineering from the Universidade da Beira Interior (UBI, Covilhã, Portugal) (2008) and is a 5-year B.Sc. in Mathematics / Informatics (Hons.) also from UBI (1999)(2000)(2001)(2002)(2003)(2004). He was an entrepreneur (1988)(1989)(1990)(1991)(1992)(1993)(1994)(1995)(1996)(1997)(1998)(1999)(2000)(2001)(2002)(2003)(2004), member of the Research Team at Siemens SA (2004)(2005)(2006)(2007) and Nokia Siemens SA (2007-2008, and Head of Research at PLUX SA (2008)(2009)(2010). Currently, serving as Vice Dean of the Faculty of Engineering at UBI (2018-), he is an Associate Professor with Habilitation at the Computer Science Department at UBI (2010) and Invited Associate Professor at the Universidade Lusófona de Humanidades e Tecnologias (Lisbon, Portugal, 2010-). He was the founder and is a researcher of the Assisted Living Computing and Telecommunications Laboratory (ALLab, 2010), a research group within the Instituto de Telecomunicações at UBI. He was also co-founder and is Chair of the Executive Council of the BSAFE LAB -Law enforcement, Justice and Public Safety Research and Technology Transfer Laboratory, a multidisciplinary research laboratory in UBI (2015). His main interests include Next-Generation Networks, predictive algorithms for healthcare and well-being, distributed and cooperative algorithms, and the battle for a Free and Open Internet.
NUNO POMBO is an Assistant Professor at University of Beira Interior (UBI), Covilhã, Portugal. His current research interests include: information systems (with special focus on clinical decision support systems), data fusion, artificial intelligence, and software. He is the coordinator of the Assisted Living Computing and Telecommunication Laboratory (ALLab) at UBI. He is also member of BSAFE Lab, and Instituto de Telecomunicações -IT at UBI. During this time he worked in identity management, communication networks, middleware development and currently on ad-hoc wireless networks for sensors/actuators and protocols for these networks; medical informatics and mHealth; and network security. He has participated in several national and international projects (DAIDALOS, Future Cities, Future Health, VR2Market, NanoSTIMA, etc.); where in some there was development of prototypes (app for diabetes management, health kiosk, adhoc network for smartphones).