Difference between revisions of "PRE2016 3 Groep8"
|Line 731:||Line 731:|
=== Project Proces and Evaluation ===
=== Project Proces and Evaluation ===
We could say that we learned a lot by doing this project. And that’s not only about diabetes and data learning techniques but also on doing projects and
We could say that we learned a lot by doing this project. And that’s not only about diabetes and data learning techniquesbut also on doing projects and them. Looking back the hardest thing we faced was start and plan a project from scratch. Normally some case description but now we were totally free to determine our project would be about. Therefore many changes in the project plan were made during the course. However, our subject was rapidly chosen, because one of our group members is a diabetic and told us about the problems he faces and his ideas what could be done in order to improve this.
We first started with a brainstorming session in order to state what our project would be about and what our deliverables would be. At first we wanted to develop a smartphone application that could automatically determine someone’s insulin dose needed by learning to ‘know’ a person over time. A kitchen scale should be connected to this app, so the food intake easily could be taken into account.
We first started with a brainstorming session in order to state what our project would be about and what our deliverables would be. At first we wanted to develop a smartphone application that could automatically determine someone’s insulin dose needed by learning to ‘know’ a person over time. A kitchen scale should be connected to this app, so the food intake easily could be taken into account.
Revision as of 22:03, 12 April 2017
- 0957735 Ainse Kokkelmans
- 0895428 Joris Veens
- 0955135 Jolien van der Thiel
- 0957168 Joris Verhagen
- 0960769 Ineke Kil
- 0959019 Bjorn van Rixtel
Welkom to the Wiki page of PRE2016 3 Group 8!
For the USE-project ‘Robots Everywhere’ we are investigating in the personal optimization of the formula used to calculate the insulin for diabetics. In order to finish this project a lot of research is done on different fields. The results of the literature studies and the results of the project can be read on this wiki page.
Focusing on the literature studies the following main topics are investigated:
1) Background information on diabetes, focused on mainly three topics; the biological background of the disease, the problems of newly diagnosed patients and changing rhythms that could occur during diabetes treatment.
2) Existing techniques in order to control the blood sugar level, targeting the way the blood sugar level is measured, the (normal) method to determine the needed insulin dose and the dosing of the insulin.
3) State of the Art solutions for our problem focused on artificial intelligent systems and data mining techniques in diabetes.
With a view to the results of the project, the following things can be found on the wiki page:
1) The diabetes formula, focused on three topics; why an AI solution, a Diabetes data analysis with a changed ‘learning’ formula and the implementation of rational thinking in the new formula.
2) The deliverable, a WebApp. In this part mainly the purpose and implementation are explained in combination with some design restrictions based on a User-research. Furthermore the final result of the project is presented here.
3) A recommendation on future developments and improvements.
Also taking the USE aspects of this course into account, the following things can be read on this page:
1) A study into the three USE aspects, respectively the User, the Society and the Enterprise.
2) An ethical analysis of the project. This chapter focusses on mainly two really important things; how to handle with medical data on a safe and responsible way and what are the errors which could occur in the project result.
More than 1.2 million people in the Netherlands have diabetes. That is about one out of every fourteen people and everyday about 169 people are newly diagnosed.  Although it is treatable with medicines or insulin, it is a chronically disease you are confronted with everyday. Depending on the type of diabetes, people have to insert insulin before every carbohydrate intake (from meals or snacks) and insert insulin to keep their insulin level stable overnight, when fasting or inbetween meals. A diabetes patient always has to keep track of the number of grams of carbohydrates that have been consumed. On the basis of a formula, it can be calculated how much insulin is needed to keep ones blood sugar level on healthy terms. However, this is a standard formula with assumed constants that don't take important factors that influence the sugar metabolism into account. These constants determine how much insulin is needed for every gram of carbohydrates. This formula should actually differ for every person and change from time to time when these influences are taken into account. Another problem that diabetes patients face is that it is also intensive work to always keep track of the food or carbohydrates you have eaten, especially for a plate full of hot steaming food... Furthermore especially young children and teenagers are a bad audience when it comes to the diagnosis of diabetes. It's hard for them when they get diagnosed with the disease to get used to life as a diabetic. This particular part of the diabetic audicience therefore will be our main focus during this project.
The development, success and consequences of a technology have always been shaped by the coherence between the User, Society, and Enterprise aspects in engineering. The key to developing a good technological solution is to find one that complies with the individual needs and desires of these three actors. Therefore, it is essential to create a clear image of each of them, before working towards a technological solution to our problem.
Different User groups (that consists of those who use the technology) formulate different desires and demands for the functioning of the technology around their needs as consumers.
- Primary users
In our case, the specific primary users that we will target, is the group of patients known to have diabetes type 1. The reason we chose this user group specifically is because they will profit the most of the solution we will develop. This is because those with this diabetes type are the most dependent on a proper estimate of their needed insulin intake, since they are incapable of producing any on their own. Furthermore, we do not intend to exclude those with diabetes type 2. Yet, since they are less dependent on such a technological solution (they do produce insulin to some extent), our primary focus will remain on type 1 diabetes patients. In order to be more specific, we will focus on new diagnosed younger patients during this project. Younger children and teenagers potentially have more difficulties in getting used to being a diabetic. Our solution, a application that determines the optimal insuline dose for a person specific, will be also equipped with some lifestyle tools in order to help this target audience. More about this topic can be read in the next chapter, 'Newly diagnosed with diabetes'.
We expect the primary user’s needs, that shape the desires and demands of the technological solution, to be centered around three main requirements: its usefulness, accuracy and user-friendliness. Next to that, we will look into some less direct, but not unimportant requirements as well, such as: protection of user privacy and build-in safety features (for example not displaying an advice when the user input is too unrealistic).
- Secondary users
The secondary user to which this technology will apply, are the primary user’s doctors and other medical staff (such as pharmacy personnel). This User group will be in indirect contact with the technology, yet their desires and needs are of importance too.
We expect the secondary user’s needs to be centered around two main requirements: the ability to check and/or influence the direct output to the primary user (as a safety measure and for feedback on advice improvement) and the ability to look into the total collected primary user’s data (for the doctor, in order to give a more accurate medical advice for example).
- Tertiary users
The tertiary user consists of those who will be producing and maintaining the system. They are the ones that will benefit by the profits they make from investing in this technology. Needs that we expect to apply to them are: its easy maintainability and cleaning and a high marketable value.
The Societal aspect is formed around all societal problems surrounding our problem. In our case, the most predominant one is the reduced risk of heart disease, high blood pressure, strokes and pancreas malfunctions. The societal benefit will mostly consist of lower costs in the healthcare industry by lowering the health risks of a large group of diabetes patients. The lower costs in the healthcare industry will then be calculated into the price of society's healthcare insurance. This is purely a financial impact that the solution carries. A positive side-effect of the lower health risks of the patients is that their family and friends can enjoy them more as persons and do not see them as a victim of a life changing desease anymore. As with every solution within healthcare, it makes the disease more bearable and have less of an influence on society.
There are multiple enterprises that could profit from a technological solution to this problem. Developers and investers in this technology could make profit from selling it to the primary user.
Furthermore, it could also be of interest too some semi-government institutions such as "Het Voedingscentrum", which strives for a healthier lifestyle for all. Institutions such as “Het Voedingscentrum” and others that try provoking a healthy living could benefit from the research that can be done on the primary user’s collective data.
The most convenient enterprises for which this product could be of interest, are of course enterprises that already have a diabetic application on the market. These enterprises already have the experience with conceiving an CE-certification and can easily address the target group. Our application can either be a addition to their current application or can be used to improve or even replace their current product. It is beneficially for them to expand their current assortment of applications on the market to keep their current 'clients' and hopefully bind new ones. An additional motivation for them to buy our product is to prohibit that another enterprise or institute brings it on the market, thereby possibly worsening their own position on the market.
Examples of these enterprises ExperIT, mySugr and Sweetbee. ExperIT is now on the market with an application called 'HelpDiabetes'. HelpDiabetes is a carbohydrate counter with Dutch, English and French food composition tables. The user puts in the the amounts of food that were consumed and the application calculates the number of carbohydrates the food intake consisted of. Additionally, it is possible to do a calculation of the for the patient needed amount of insuline. This calculation is based on the users' personal carbohydrate - insulin ratio's, correction factor and active insulin. However, this calculation is similar as many patients do nowadays by hand. Patients have to fill in all this information and their is no algorithm which can detect a relation between insuline intake and carbohydrate absorption. If ExperIT would add our algorithm to optimize this calculation, it would be a real addition to their product. 
Our algorithm might be a real concurrent to the current application of mySugr. mySugr has a different approach than most diabetic applications, especially in the USA. In Europe they work similiar to the application 'HelpDiabetes', as described above. The user fills in his or her data and the application keeps track of it over time and calculates the patients bolus insulin. However, the version that is available in the United States of America does not calculate your bolus for you but provides you with a personal diabetes coach. This coach can provide the user with personalized advice anytime or so mySugr promotes: 'Analysis of your data while you live your life. If the algorithm we develop might take over this analysis of the data, it would mean that extra payment for a personalized coach becomes redundant. This is why it might be fruitful for mySugr to invest in this product themselves, so that others stay behind them in this market. It could also help them broaden their target group, because not all people who live with diabetes are interested in having a real person as coach via their smartphone. In any case, it would be a good investment for them for the European market since they do not offer personal coaching in this continent. 
The last example which will be discussed here is Sweetbee. Sweetbee is the provider of two applications that can be useful for diabetic patients. The first is the Carbcounter and the second is the Platemate. The Carbcounter and Platemate both fulfill the function of the counting and keeping track of the carbohydrates that have been consumed. The Platemate also adds the option of keeping track of your blood sugar level. Especially interesting about this application is the way of input for the amount of food. This is done in a very visual way by really putting the food on a plate and the amount adjustment is done by adjusting how much space the food takes in on the plate.(see image ...) Of course, it can be questioned whether such a way of input is precise enough for a diabetic patient. This application is now missing the full globe of aspects by which a person with diabetes can be helped and primarily focusing on the carbohydrates counting.The chances for Sweetbee of improving their product are present by making use of our optimizing algorithm. Adding this to their current product can finish the complete picture and make their product distinguishable from the dozens of other diabetes apps that are already on the market. 
Our goal is to optimize the formula which calculates the amount of insulin a person with diabetes needs. The optimization will be tested by a diabetes application (web-app) which we will make ourselves. Our concept idea can be visualized in the figure below. We want to create an all-in-one user-friendly diabetes application which enables a patient to get a right personalized dose of insulin in an easy way. Instead of monitoring a patient all day long, we want to develop an algorithm that is based on and learns from the feedback it gets.
Because most people have a kind of fixed day rhythm, an algorithm could recognize this after some time and adapt to this. The adaption is based on the feedback that the software will get. This is the glucose level of the blood, after a period when insulin was injected. The glucose values always have to be in a certain range. And by coupling the data from the amount of insulin injected and the glucose level afterwards, the algorithm could learn to “know” somebody, because not everyone reacts the same on a certain amount of injected insulin. By receiving feedback over a longer period, the algorithm learns to recognize someone’s behavior too. Because of most people have a weekly fixed day schedule and for instance mostly sport on Monday, the algorithm could learn by making use of the feedback it will always need to give more insulin on Monday.
At the start of using the application, the patient has to fill in his or her carbohydrate intake during a day and his or her blood glucose level for a longer period. From this information the algorithm learns what the blood glucose level will be depending only on the amount of carbohydrates that the patient has ingested on a day. This information will be used to let the user know how much insulin must be inserted.
This piece of artificial intelligent learning software, has the possibility to be implemented in an insulin pump, which is something a patient definitely has to wear all the time. Because of the fact that the algorithm learns to know its patient by receiving feedback in the form of training data, it will calculate a personalized and therefore better and healthier dose of insulin that has to be given by the pump. The only thing the user has to do is measure their glucose level and possibly indicate a day where the patient is not following their normal rhythm (due to illness or menstruation for example).
Additionally, the input of what the user has eaten, and thus what the carbohydrate ingestion is, should be simple. This can be done with text input inside the application. The program also remembers what the user often eats at a certain times of the day, so if a user wants to fill in what they have eaten, they receive suggestions of specific meals or snacks.
As extra help, the application could be linked to a kitchen scale with Bluetooth. If a patient scoops up dinner on his or her plate while it is on the scale, the application immediately knows how much grams of the food that they are going to eat. What the food that the user is weighing is, can be selected on the smartphone application. But since our main goal is the optimization of the formula, with the application only as a test tool, we will not look further into this.
To test the developed software we’ll make a web-app and “train” it with the year data of one of our group members. For us it is not possible to implement this for instance in a real insulin pump, but by making the app, we could have I look if it works or not. Furthermore we could investigate more in opportunities and possibility’s the implement our solution in real live existing and user friendly systems.
Background information on diabetes
Diabetes - what is it and what is the biology behind this disease?
Diabetes is a chronical disease that occurs when your blood sugar level, or blood glucose level is too high. Blood glucose is the main source of energy for one’s body and is extracted from the food you eat. In order to control the level of blood glucose in your blood, the beta cells in the pancreas produces a hormone called Insulin. Insulin is a hormone that plays a major role in the metabolism and is used in order to transport the blood glucose into the cells, so the glucose can be used to synthesize energy. When your body doesn’t produce (enough) insulin, the glucose stays in your blood and doesn’t come in to the body cells. If this is the case, you are diagnosed with diabetes. Overtime, having too much glucose in your blood will cause some serious health problems. In short term it could cause ketoacidsosis and hyperosmolar hyperglycemic nonketotic syndrome and in the long term also permanent organ damage and malfunction could occur.
Diabetes arises when the body doesn’t produce (enough) insulin. Therefore diabetes can be mainly separated into two types, type 1 diabetes and type 2 diabetes. As one can expect, the difference between those two types lies in the insulin production. If the body produces no insulin at all, type 1 diabetes is the case. If the body has a lack of or doesn’t produce insulin well type 2 is the case. Type 1 diabetes is mostly diagnosed in children and young adults (usually this type of diabetes is congenital), however it can occur at any age. Type 2 diabetes is the most common type of diabetes and can be developed at any age, but is mostly seen by middle aged and older people. Furthermore there are a few more (special) cases of diabetes, like gestational diabetes which can develop in a women’s body when she is pregnant or diabetes related to cystic fibrosis.
The development of type 2 diabetes is most often preceded by pre-diabetes. Prediabetes is a condition in which the blood glucose level are higher than normal but not high enough in order to be diagnosed with diabetes. Prediabetes usually occurs in people who already have insulin resistance. Insulin resistance is a condition in which muscle, fat and liver cells do not respond properly to insulin and therefor have a worse glucose absorption from the bloodstream. In order to treat this deviation the body will need higher levels of insulin to help glucose enter into the cells. The beta cells inside the pancreas will try to produce more and keep up with the increased demand for insulin, to keep the blood glucose level in the healthy range. This will work out as long as the beta cells are able to produce enough insulin to overcome the insulin resistance. Type 2 diabetes pops up when also the beta cells fail in meeting the increased demand of insulin. In order to properly understand the role of insulin in the body balance of the glucose level, we will have a short look to the glucose transport to the inside of the cells and the corresponding metabolism at molecular level in the next paragraph.
The most important energy source for the cellular metabolism is glucose. Glucose can enter the inside of a cell by making use of a special protein, a so called glucose transporter, which transports the glucose molecule through the cell membrane. Only certain cells are sensitive to insulin, this are the skeletal muscle cells, the liver and body fat cells. Inside one of these cells, energy in the form of ATP (Adenosine Tri Phosphate) is produces when a glucose molecule undergoes the glycolysis reaction in a cell mitochondrion by making use of phosphoric oxidation. In a normal body, the beta cells of the pancreas add insulin to the bloodstream after a meal in response to increased blood glucose levels. After that, the insulin molecule binds to an insulin receptor protein at the outside of the cell membrane. The insulin receptor gets activated and triggers a series of events inside the cell itself. This signal is processed by a cascade of reactions, called the phosphorylation cascade. This reaction results in the recruitment of liposomes, which contain a collection of glucose transport proteins. These liposome vesicles will fuse with the cell membrane, and therefore more glucose transporter proteins are added to the cell membrane. Because of this more glucose can and will enter the cell in order to be transformed into energy or converted in to glycogen in order to be stored as a reserve for future use of the body. As a result the blood glucose levels will decrease and the pancreas will reduce the secretion of the insulin hormone. Without insulin in the blood, the receptors in the cell membrane will become deactivated and the glucose transporters will be recycled again in the liposome transport vesicles.
By using this intercellular metabolism, a healthy body is able to keep the blood glucose relatively constant. Among people who have a certain form of diabetes it could be that this metabolism is disturbed. Together with the existing shortage of insulin this will lead to malfunction of the metabolism. The insulin receptor proteins on the membranes of each cell don’t react properly on the recognition and binding of an insulin molecule. As a result none or too less liposome transport vesicles are activated which leads to a shortage of glucose transporter proteins in the cell membrane. Because of this, too less or none glucose enters the cell. In turn, this leads to an increase in the blood glucose level and a possible shortage in energy. Because of the lack or shortage of insulin and the malfunction in the metabolism, the best way to treat this disease is by adding more insulin to the body, to ensure that as much as possible insulin receptors get activated in order to keep a health balance in the sugar metabolism of the body.
In the figure below, the fusion of a liposome with the cell membrane, the activation of an insulin receptor protein in the cell membrane, a glucose transporter protein in the cell membrane with a glucose molecule and an insulin receptor protein with an insulin molecule can be seen.
Newly diagnosed with Diabetes
Being recently diagnosed with diabetes, especially diabetes type 1, can be quite overwhelming or being a shock for people. You’re diagnosed with a chronical disease that will never pass and asks a for a lot of change in your lifestyle, both physically and mentally. In particular for young children and teenagers a diabetes diagnose could have a major impact. Where adult people try to relativize earlier and accept that they have to deal with the disease, children could become rebellious, depressed or even get the feeling that they failed. Children are very likely to compare them self with other children of for example their school classes or sports teams. A diagnosed child will compare itself with other non-diagnosed children. By doing this a child could develop feelings that he or she is an exception or that he or she failed. At the end this kind of behavior will have a bad effect on the development and treatment of the disease. Neglecting of the disease could for instance lead to neuropathies or numbness in the limbs. Thus in conclusion it can be stated that it’s very important to for especially children and teenagers to learn how to deal with the disease and how to get in and get used to the daily rhythm of a diabetes patient.
When you are recently diagnosed with diabetes type 1 as a child in The Netherlands, you will be brought into contact with a so called ‘children’s diabetic team’ in a hospital or in a center for diabetes. Such a team consists of a pediatrician, a children’s diabetes nurse a dietician and a psychologist. This team is very important for you as (new) diabetic patient. They help you through the first diabetic period of your life, until you will make the change to an internist (a specialist in internal medicine). If it is just known that you’re a diabetic, you will have a lot of contact with the children’s diabetic team. In the beginning this could be like every day or sometimes multiple times a day. The children’s diabetic team will search, together with the child and it’s parents, how the disease best could be treated and helps you to understand and get used to the disease. Together they make a care plan, which for instance includes the amount of blood glucose measurements the new patient has to do and the HbA1c value is set as goal (the HbA1C value is an average number of your blood glucose level of the last two or three months, therefore it is a good indication how well the diabetes treatment works for you.
Diabetes in your dialy life
Fitting diabetes into your daily life could be a real big challenge, because it brings lots of changes and you have to take a lot new things into mind. When you are new to diabetes a lot of questions could arise. You will need to get used to these questions in order to live like and do things like you did before you got diagnosed with diabetes. Some examples of these questions could be like:
• How do I need to measure my glucose level?
• Where do I need to prick?
• What do I need to do when my value is to high (hyper) or to low (hypo)?
• What do I need to do when I have a party?
• What do I need to do when I go out for sports?
• What do I need to do when I am ill?
A second thing in order to handle diabetes in a right way is nutrition. It’s not enough to only know much about insulin and glucose levels. On the first place it’s important to note what and when you ate something, in order to calculate the correct amount of insulin needed. On the second place it’s important to get a proper understanding and feeling for (types of) food and nutrients. If will come into handy when you know how your body will react onto the food and nutrients you ate. The body of a diabetic person could react different to some nutrients or product then the body of a healthy or normal person does. You will need to eat more nutrient balanced meals and have to make more healthier food choices than the average person will do. In the case of diabetes many tips to make the right food choices exist, some of the most important of those are:
• Eat regular meals: Spacing meals evenly throughout the day will help control your appetite and blood glucose levels – especially if you are on twice-daily insulin.
• Opt for slowly absorbed carbohydrates: All carbohydrates affect blood glucose levels, so be conscious of how much you eat and opt for carbs that are more gradually absorbed.
• Cut the fat: Eat less fat – particularly saturated fat, as these types of fat are worse for your heart.
• Cut back on sugar: Having diabetes doesn’t mean you need to eat a sugar-free diet, just aim to have less of it. However sugary drinks are excellent to treat a hypo.
• Reduce your salt: Having too much salt increases risk of high blood pressure. This in turn increases your risk of heart disease and stroke, which people with diabetes are already at higher risk of.
Another third important thing in order to handle with diabetes is physical activity. You will need to understand what sports and other activity does with your body and your blood glucose levels. Doing sports when you have diabetes won’t cause any problems, but only asks for some attention. Physical activity is important and good for anybody, but actually it can be said that it might be even more important for a diabetic person because:
• The insulin in your blood will be better absorbed.
• Your blood sugar levels remain better.
• It reduce the risk on diabetic complications on higher ages.
• It keeps you in a good physical condition.
So if you are new to diabetes this is –together with the foods- a good thing to keep in mind. Doing some extra exercises and pay some more attention on what you will eat will for example pay off in a better insulin management in your blood and in the long run a better blood sugar level (HbA1c). It could be a bit overwhelming when you need to take all those, sometimes pretty big, lifestyle choices into account. Therefore some help in the shape of for example a scheduling assistant or overview maker could be use full.
In a proper diabetes treatment the children’s diabetic team will regularly check the health condition of a child. These checks consist of consults which will take place right after the diagnosis of the disease, once in three months, once in a year and once in the five years. In the tables below the most important points per type of consult can be found.
How could the application be helpfull?
The application we are developing right now couldn’t be only helpful by the determination of the optimal and personal amount of insulin needed. According to the paragraphs above there are a lot of things that –especially children and teenagers- encounter when they get diagnosed with diabetes. Some really big life style changes are needed in order to have a suited treatment for the disease. So next to the determination of the optimal amount of insulin needed, the application could also have the following functions:
• Information about the disease
• A FAQ and what-to-do-if page
• Nutrition tips and advice
• Sports advice and eventually a scheduling assistant
• Contact page or connection with the children’s diabetic team
• Some simple points form the checklist, like: weight and height (so growth can be tracked), blood glucose level tracking with HbA1C determination and note the number of hypo’s and hypers.
Diabetes and changing rhythms
By use of data analysis it is tried to determine patterns and phases in a person's sugar metabolism. However, it should not be forgotten that years of research have gone before us. A look at results of research in diabetic patient's sugar metabolism can help give an idea what kind of results are to be expected. This can help validate our model. There are many aspects in someones life that can influence the reaction on insulin. Think about vacation, menstrual period, but also standard seasonal variations.
One of the studies looked at was 'A summer Vacation from Diabetes: Evidence From a Clinical Trial'. This study examined the metabolic trend and possible factors associated with a change in Hba1c levels during the summer period. HbA1c levels shows the average glucose blood level over the last 2 to 3 months. The study was done with 40 intensively treated adolescents, age 12 to 20, with diabetes type 1. The results of the study were increased HbA1c values by a mean of 0.73% from May to July and afterwards a decrease by a mean of 0.75% from August to October. So, when the subjects went back to school.
The most plausible explanation for the worsening of diabetes control in the summer is a change in routines and lifestyle. The study also included a questionnaire for the participants of the study and this supports this assumption. The teenagers with the fewest consistency in their summer schedules had the most decline in metabolic control. Adjustments in the diabetes regimen should have been made to to maintain a steady metabolic control during the summer vacation.
Factors of this inconsistency in lifestyle are changing sleeping rhythm, inconsistent diet and less physical exercise. In summer, some teenagers may sleep late and therefore awaken with higher fasting blood glucose levels. This might be corrected by moving, for instance, the supper intermediate insulin dose closer to the new bedtime. Participants with a very inconsistent diet could perhaps be helped by using quick-acting insulin before each meal, also known as a basal-bolus plan. And adolescents who were very active at sport clubs during the year, might have to compensate for this decrease in exercise by inserting extra or larger insulin doses. 
Blood glucose screening results, obtained using two different screening procedures, are reported from two occupational groups. Post-prandial blood glucose levels were measured in 3346 subjects aged 45 years or more employed by the Greater London Council/Inner London Education Authority. In women, mean blood glucose levels were higher in the afternoon than the morning (p<0.05). Ninety-fifth centile levels were substantially higher in the afternoon in both sexes, though the differences were not constant in all age and sex sub-groups. In both sexes mean glucose levels were highest in the winter (December–February, inclusive), but seasonal variation did not significantly affect the proportion exceeding the ninety-fifth centile for the total population. In the Whitehall study, the blood glucose was measured in men, in the morning, 2h after a 50-g glucose load. Significant seasonal variation in mean blood glucose values occurred, with highest values in winter and lowest in spring (March–May, inclusive). However, there was no significant difference by season in the proportions exceeding the arbitrary cut-off levels of 7.8 and 11.1 mmol/l. 
The article about the seasonal variation suggest that during the summer glucose values are lower and in the winter higher, while the first study suggests differently. Important is that the first study was by young adolescents, where the relevant factor was the change in life style not the fact which season it was. The seconds study on seasonal variation was done with adults who have less of a changing rhythm during summer period, so really the influence of seasonal difference was measured. These results can also be verified by the fact that warmth lessens your need for insulin and results in a faster absorption of insulin. Which is why the diabetesvereniging Nederland advises to measure extra carefully on a day in the sun to avoid that too much insulin is taken and risking a hypo. 
Having an extra hard time controlling their blood glucose level during the week prior to their menstrual period, is not uncommon for women with diabetes. Especially for women who are suffering from symptoms that can be correlated to premenstrual syndrome (PMS). The glucose level of a woman is controlled by hormones and so is the regulation of the menstrual cycle. An interference between those hormones can results in irregular blood sugar levels. This is for both women with diabetes type 1 as type 2. Most commonly, the glucose levels will rise during the week prior to menstruation, so that is just after ovulation. When the period begins the blood sugar levels will often drop again. This change is probably caused by an increase of the hormones estrogen and progesterone, which hinder with the way insulin works.
However, there are also studies that show that is because of a change in eating pattern that women have difficulty with controlling their blood sugar levels. Many women have an enlarged longing for foods containing much carbohydrates in the days before their menstruation. This can also cause the rise in glucose in the blood. Although, these studies also shown that this cannot be the only cause for the, so called, premenstrual hyperglycemia. There are also other theories that report that change in insulin sensitivity during a women’s menstrual cycle was very small and that is was probably caused by psychological stress.
So, just as for every body process different factors may play a role. Also, not every women has those problems of blood sugar control during their menstrual cycle. Some girls and women have consistent effects as to how their period affects blood sugar whereas other women may find that the effect on blood sugar varies from one month to another.
In pursuance of discovering a correlation between menstruation and diabetes a note of the start of a woman’s period should be made and should be looked for emerging patterns glucose levels and the menstrual cycle over time. This might be a good addition to the application. If women were also to put in the starts of their menstrual cycle additional patterns might be discovered. It could also be looked at whether indeed there is an increase in intake of carbohydrate rich food. If this were the case the diabetic women could be alerted of that. Extra consciousness of this might help her stick to her regular diet and help control her blood sugar level. 
Existing Techniques of controlling the blood sugar level
Since the treatment of diabetus is going on for a long time, a lot of new technologies were created for measuring the current blood sugar level of the patient and determining the necessary dose of insulin for the patient. These old and new techniques are summarised below:
Measuring the blood sugar level
- Blood sampling:
The most popular and easiest way of measuring the current blood sugar level of a patient is using a lancet. With this device, which is shown below, the patient can prick the scin to draw a small sample of blood which will be analysed by a blood glucose monitor or blood glucose test strips. In many cases, the blood glucose monitor and the lancet is one device. The blood which is sampled from the patient is directly monitored to determine the blood sugar level. Another less used possible way of measuring the blood sugar level is an (almost) continous measurement. In this case a patient wears kind of a badge with a needle inside on his arm (which has to be replaced in two weeks). This badge measures the blood sugar level every few minutes and the data is stored in a pocket reader. This reader could give a patient more insight in his or her blood glucose level over time, but it is also a more convenient way of blood sampling because the finger pricks aren't needed anymore.
- Artificial pancreas:
An artificial pancreas is supposed to automatically control the blood glucose level of the patient. It does this by replicating the endocrine functionality of a healthy pancreas since this system is generally not working properly for diabetes patients which is the reason why patients need the insulin doses. The artificial pancreas is implemented on the skin and, together with an insulin pump, gives an insulin dosage to the patient. There are different approaches to the "Artificial pancreas" such as the "medical equipment approach" (determining insulin dosage via closed loop control data from a continious blood glucose sensor), the "bioengineering approach" (creating a biological correct pancreas from real cells which is implemented under the skin of the patient), and the "gene therapy approach" (giving the patient a genetically changed virus which causes cells to become insulin-producing cells. In this project, the artificial pancreas is seen with the "medical equipment approach" in mind. This fits our approach to this project the best.
Determining the insulin dose
Once the glucose level is determined using one of the mentioned methods above, the patient needs to determine the insulin dose. This can be done in multiple ways as well. The most common ones are explained below:
- Manually calculating:
Manually calculating is perhaps the oldest and most common method of determining the correct insulin dose. To calculate the insulin dose, the patient needs several known variables. These are the 'blood glucose level' which can be measured and (often) displayed by the lancet, the 'target blood glucose level' which is below the measured blood glucose level, the 'carbohydrate intake' which is the amount of carbohydrates that the patient is going to eat in the upcoming meal (for which he is injecting insulin), the 'carb-to-insulin ratio' which is personalised and gives the amount of grams that are covered by one dose of insulin for the patient, and a 'correction factor' (also called the 'insulin sensitivity') which gives how much the patients blood sugar level lowers with one dose of insulin. This factor is not unique to the patient since it is an estimate, but it is different from patient to patient. With this information, the patient can calculate the number of insulin units he or she has to take for covering eaten carbohydrates using the following formula:
Insulin doses = (amount of carbs in the food)/(carb-to-insulin ratio)
To calculate the amount of insulin doses for lowering the patients blood sugar level, the following formula can be used:
Insulin doses = (current BG - target BG)/(insulin sensitivity)
If a patient has a high blood sugar level and he or she needs to eat, the patient can combine the two formulea into one which calculates the total amount of doses needed:
Insulin doses = (amount of carbs in the food)/(carb-to-insulin ratio) + (current BG-target BG)/(insulin sensitivity)
Take not that an insulin pump, as those that are used today, still depend on this way of calculating the insulin those. This means that although the insulin pump automatically gives a short-working insulin dose to the patient, it still depends on the input from the patient and simple calculations.
- Using an application:
Modern cellphones and computers can often calculate the insulin dose for the patient using an application. These applications require the exact same inputs as mentioned in the "manually calculating" part. The formula used is then also exactly the same. This means that even though cellphones and computers have a lot more calculating power than the patient has, it does not use this in calculating the correct dose of insulin. What the application does add, in some cases, are some diet recommendation and a better way to keep track of the patients blood sugar level with the use of generated graphs from the data etc.
Giving the dose to the patient
Once the correct insulin dose is calculated (in any sort of way), it has to be given to the patient. This can be done in multiple ways as well. The most common ones are explained below:
- Manually injection with a pen
By far the most common way of receiving the insulin dose as a patient is injecting him or herself with a special diabetus pen. This pen often contains a rotating disk on which the patient can determine the dose and a very small needle through which the insulin travels to the body. There are reusable and disposable insulin pens but both work in the same way and don't need any individual explanation. The insulin pen is nowadays rather affordable and paid for by the healthcare insurance in the Netherlands, which means that normal needles and syringes are not used as much as they used to.
- Using an insulin pump
A rather new technology but already in use by patients is the insulin pump. This device gives short-acting insulin. An insulin pump, which is shown on the image below, is connected to the patient by a cathether placed under the skin. When the pump is connected, the patient can receive short-acting insulin. The patient can increase the dose with buttons on the pump itself. This is to compensate the carbohydrates from a meal. The pump can also treat high blood glucose levels by taking a bolus. This is also determined by the patient him- or herself. It is important to note that the pump does not automatically correct the dose for everthing that the patient undergoes (such as meals and activities). The dose calculation is still done by the patient itself. The insulin pump has some advantages and disadvantages with respect to normally getting your insulin. These are stated below:
The website from the American Diabetus Society gives multiple advantages . The main one is that the patient does not have to bother with individual insulin injections which can really interfere with the patients life. Other advantages are:
- Insulin pumps deliver insulin more accurately than injections do.
- Insulin pumps result in fewer large swings in your blood glucose level since the doses are applied in a constant way.
- Insulin pumps allows the patient to be flexible about when and what he or she eats since the insulin pump directly corrects the insulin level in the body.
- Insulin pumps allows the patient to excercise without having to eat large amounts of carbohydrates.
The insulin pump does come with some disadvantages however. These are also given by the American Diabetus Society .
- Insulin pumps can cause weight gain to the patient.
- Insulin pumps can be expensive (and certainly are when they are not included in the patient's insurance).
- The insulin pump is connected to the patient most of the time. This can be bothersome.
In short, although the insulin pump solves some of the problems for the patient, it does not solve the biggest one which is manually increasing the insulin dose.
- Using an artificial pancreas
The artificial pancreas is a recent technology which is still in development. The artficial pancreas takes over the endocrine functionality of a healthy pancreas. The new pancreas is supposed to create insulin for the body and ease the incidentals of diabetus for the patients.
State of the Art Solutions
Artificial Intelligence Systems in Diabetes
Currently the most known AI approach in diabetes is the approach from PEPPER  (patient empowerment through predictive personalized decision support). PEPPER is a newly launched three-year research project, funded by the EU Horizon 2020 Framework. It’s goal is to create a portable personalized decision support system to empower individuals on insulin therapy to self-manage their condition. PEPPER employs CaseBased Reasoning to advise about insulin bolus doses, drawing on various sources of physiological, lifestyle, environmental and social data. It also uses a Model-Based Reasoning approach to maximise users’ safety.
Case-Based Reasoning (CBR) is a consolidated artificial intelligence technique, extensively applied in medicine, that tries to solve newly encountered problems by applying solutions learned from similar problems encountered in the past.
The system will be integrated with an unobtrusive insulin patch pump and has a patient-centric development approach in order to improve patient self-efficacy and adherence to treatment.
In the figure below, two architectures can be seen. These methods principally don’t differ quite much. In a nut shell, the PEPPER systems provide a portable personalised decision support system for insulin dosing that combines data from multiple sources such as body-worn sensors and manual inputs. These body-worn sensors for instance are the activity monitors that can be seen in the picture above. The manual inputs are given to the system by making use of a phone or handheld and consist of personal inputs like for instance the time someone sported, the amount and kind of food someone ate or the whether or not consumption of alcohol. The CaseBased Reasoning module is designed to provide a personalised insulin dose which adapts over time.
Another, similar apprach of AI in diabetes is the METABO  approach. The METABO approach is a diabetes monitoring and management system which aims at recording and interpreting patient's context, as well as, at providing decision support to both the patient and the doctor. The METABO system consists of (a) a Patient's Mobile Device (PMD), (b) different types of unobtrusive biosensors, (c) a Central Subsystem (CS) located remotely at the hospital and (d) the Control Panel (CP) from which physicians can follow-up their patients and gain also access to the CS. METABO provides a multi-parametric monitoring system which facilitates the efficient and systematic recording of dietary, physical activity, medication and medical information (continuous and discontinuous glucose measurements).
Based on all recorded contextual information, data mining schemes that run in the PMD are responsible to model patients' metabolism, predict hypo/hyper-glycaemic events, and provide the patient with short and long-term alerts. In addition, all past and recently-recorded data are analyzed to extract patterns of behavior, discover new knowledge and provide explanations to the physician through the CP. Advanced tools in the CP allow the physician to prescribe personalized treatment plans and frequently quantify patient's adherence to treatment.
Data Mining Techniques in Diabetes  
Data mining is the process of selecting, exploring, and modeling large amounts of data to discover unknown patterns or relationships useful to the data analyst. Medical data can be trained using data mining techniques to predict the diabetes. For this, dataset has to be preprocessed to remove noisy and fill the missing values. The management of diabetes is very well suited to a data mining approach, because of the availability of electronic health records and monitoring facilities a huge data sets are available for research. However, because diabetes is a lifelong disease, the available data for one individual may already be huge and very difficult to interpret.
Data mining are very useful techniques consists of a variety of methods like computer science approaches as multidimensional databases, machine learning, soft computing and data visualization and statistical-based methods, like hypothesis testing, clustering and regression. Data mining can be classified in two different “goal-tasks”. First of all this is description with the purpose to extract understandable patterns and associations from data. The second goal-task is prediction with the purpose to forecast one or more variables of interest, in the diabetes case this will be the blood glucose level.
The usual way to review the outcome of a certain therapy scheme starting from the analysis to the blood glucose is to check if someone shows a cyclostationary pattern. On other words, if someone shows a daily behavior that is almost the same over the monitoring time. The blood glucose pattern summarizes the patient’s own response to a certain amount of insulin. Mostly this is visualized by plotting the blood glucose data on a 24-hour scale or by computing the frequency histograms of the blood glucose measurements.
However, the problem is that a series of blood glucose data mostly isn’t cyclic or stationary. It’s has kind of a stochastic nature that leads to confusing data. Because of this a combination of signal processing and artificial intelligence is well suited. First of all a filtering approach, known as a structural analysis needs to be applied. Structural analysis decomposes a time series into a collection of signals with known “temporal structure”. This means that each blood glucose (BG) measurement can be expressed as a sum of separate components: a trend component (T), a cyclic component (C) and a stochastic component (E), for each measurement (i).
The problem of extracting Ti and Ci can be solved mathematically in different ways, including Kalman filtering, least-squares fitting, and Bayesian smoothing. By using the same technique it is possible to also separate daily cycles from weekly or monthly cycles, which may correspond to changes in the lifestyle during the weekend or through the year. Given the availability of trend and cyclic components, it is possible to pose some interesting clinical questions: (1) is there a trend in BG data, (2) Is there one or more cyclic behavior in BG data? Even more interestingly, it is possible to combine trend and cycle information with the absolute value of BG?
Following a data mining approach, a way to answer these questions is to apply an artificial intelligence technique known as temporal abstractions (TAs). The principle of TAs is to provide an interval-based representation of monitoring data: time-stamped data are processed into time intervals during which a certain event occurs. In the case of the blood glucose monitoring it’s a useful to apply three different kinds of TAs: state TAs (high / low value), trends TAs (increasing or decreasing) and complex TAs (daily patterns). The application of TA methods can therefore be seen as a way to search for patterns in continuous monitoring data.
The choice for AI
Historically, four main approaches to Artificial Intelligence (also known as AI) have been developed. The approaches are separated along two dimensions. Firstly, the difference between thought process and reasoning (1 & 2) versa behaviors (3 & 4). Secondly, the difference between human performance (1 & 3) and ideal performance or rationality (2 & 4).
1. Thinking humanly
The approach to ‘thinking humanly’ is developing an program that thinks like a human. There is however a big obstacles with this approach, in contrast to the goal of the project. The approach is based upon in-depth knowledge on the actual workings of human minds. An Artificial Intelligent system in this form does not yet exist due to lack of knowledge about what is going on inside our own human brains. A common approach to ‘thinking humanly’ is the reverse engineering approach to true artificial intelligence is called “whole brain emulation”. By detailed studying and mapping of a human brain, a low-level “brain model” is created, and its state is copied into a computer system. The difficulty however, lies in creating an artificial neural network. The human brain has up to one hundred billion neurons and 7000 synaptic connections to other neurons. It would require an extremely powerful computer and a lot more detailed knowledge on neurons and how they function. In 2005, the “Artificial Intelligence System”-project made a simulation of a “brain” with 1011 neurons. It took 50 days and 27 processors to simulate for 1 second. This gives a clear image of how far away we are from creating artificial intelligence through brain modelling. Therefore, it is not an feasible for this project.
2. Acting humanly
The approach to ‘acting humanly’ was introduced by Alan Turing, with his so called Turing test. The Turing test was passed if the computer, after being asked some questions by a human interrogator, cannot be told apart from a person. An AI that is ‘acting humanly’ therefore requires natural language processing, knowledge representation, automated reasoning and machine learning. The reason why this approach was not chosen, is because it is not really applicable to the goal. For the diabetes patient, it is not relevant whether or not the insulin information given is from a computer, or from a computer that is seemingly identical to a human.
3. Acting rationally
A rational agent is one that acts to achieve the best expected outcome. The reason this approach to AI is not taken, is since it is not really applicable to the goal as well. This is since the program just has to give a conclusion, and does not have to act upon it. The program should provide an optimal advice, but does not have to inject the user with anything. Therefore this option is turned down as well.
4. Thinking rationally
The approach for ‘thinking rationally’ originated from the Greek philosopher Aristotle. He called it ‘right thinking’. It is based on syllogisms, that provided patterns for argument structures that always produced correct conclusions given correct premises. Since, this approach is a lot more suitable for the goal than the others, this approach is taken.
Diabetes data analysis
Different reaction to insulin over a day
People react differently to insulin during a day, for example in the evening more fast-working insulin in needed, as the base slow-working insulin may be depleted. Currently this is done by manually entering different factors for the formula during different time slots. While this technique does work, it has some inefficiencies. Especially at the boundaries of the time slots, where it may be beneficial to choose one time slot over another to obtain a better result.
We wanted our system to take these regions into account automatically, based on the eat pattern of the user. For this we used k-means clustering. While analyzing the data, some interesting pattern emerged. Not only did it discover the different time periods for breakfast, lunch and dinner, but some points showed similarities based on carbohydrate intake. measurements with a low carbohydrate intake were more similar to each other than to the time periods. Also around dinner time, measurements with high carbohydrate intake were more similar to measurements of lunch time. The different clusters can be seen in the image below. Here the glucose measurements were clustered based on time, glucose level before and after, carbohydrate intake, exercise and illness. In the graph the different clusters are depicted with different colors, the x-axis represents the time of day (in integers) and the y-axis the amount of carbohydrate intake.
Exercise, illness, stress, and being on your period can also affect reaction to insulin. When we search for more clusters, some of these show. For example in the figure below, measurements where the user exercised are placed in a different cluster. The same happens for illness. stress and menstruation were not in the available data set.
First approach: simple linear regression
For each detected cluster a there could be a different insulin dose based on the same intake of carbohydrates. So we want to find a formula (or factors for a formula) for each cluster. Our first idea was to use simple linear regression using the ordinary least squares method. For this we applied the regression to each cluster separately.
The first attempt we ran the regression algorithm with the goal to directly output a insulin dosed. This based on the amount of carbohydrate intake, current glucose level, the glucose level of the next measurement, exercise and illness. This did not lead to a satisfying result. This was probably because the absolute glucose levels were taken into account, which resulted in nonsense doses for points measurements with an outlying glucose level.
We tried to make it better, by learning on the difference between current and future glucose level, instead of absolute values. This lead to a somewhat better result. The predicted insulin dose would have prevented most hypos. For measurements were the actual taken dose of insulin caused a hypo, the prediction dose would be smaller, thus probably preventing the hypo. Also for measurements that were stable, so the current and next measurements were close and in a normal range (5.0-8.0 mmol/Liter) , the prediction was in most cases equal to the actual dose. But for measurements with a high blood sugar (>8.0 mmol/Liter), the predicted dose was too low. So overall this approached seemed to result in a underestimated dose.
The previous results could be caused because simple linear regression does not handle measurements errors in the predictor variables well. The glucose levels have a measurement error, as the glucose measurement device is not perfect. We conducted a small experiment to see in what way there was a measurement error (constant or normally distributed). More on this can be found in section[link to measurement experiment](experiment).
While linear regression can not handle measurement errors in the predictor variables, it can handle them in the criterion variables (variable that should be predicted). So we tried to predict the difference in glucose based on carbohydrate intake, insulin intake, exercise and illness. We trained on the maximum and minimum difference based on the measurement errors. This yielded a simple model that predicted the future glucose level. This model seemed to work great at first. It lowered the doses if a hypo occurred in the test data, and increased the doses when a hyper occurred. Although sometimes the algorithm would increase the doses by to much, creating a new possibility for a hypo. But when we learned on a more recent data, the model did not give any useful results. Prediction varied wildly.
The reason for this is probably that the predictor variables are not independent. This was a bit of an oversight for us. The amount of carbohydrates and insulin, are most definitely not independent. So we needed a new approach.
Second approach, Orthogonal Distance regression
In contrast to simple linear regression, orthogonal distance regression can handle measurement errors in the predictor variables. also is it possible to create a non-linear models. This is helpful, as not all predictor variables are independent. With orthogonal distance regression(ODR) we can try to fit the data of a user to the currently used formula (carbohydrates/carbohydrates-insulin-factor) + (current glucose level - target glucose level)/insulin-sensitivity. This results in a more accurate formula, that can better extrapolate on the data. For training the target glucose level is replaced by the actual glucose level of the next measurement.
To apply ODR we used the ODR module of the python package Scipy. This module is a python interface for the FORTRAN-77 library ODRPACK. This library uses a modified version of a Levenberg-Marquardt algorithm. This algorithm is used to solve non-linear least square problems. Based on a data set containing predictor and response variables, it tries to find the parameter beta for a function f(predictor_variables, beta) where beta minimizes the sum of squares of the deviations from the function. The algorithm uses an iterative method, adapting beta via gradient descent to converge to a minimum. The algorithm starts from an initial guess, in this case the initial guess for beta is set to the insulin-carbohydrate ratio and insulin sensitivity choses by the diabetes expert of the patient. The is combined with a total least square errors method to accommodate for measurement errors in predictor variables. The total least square method differs from ordinary least square method in that it looks at the deviation in distance to the regression function, and not in absolute values of the response variable. This makes this method suited for applications where the predictor variables contain measurement errors.
Natal van Riel, an expert in the field of metabolic network modeling, recommended us a way to test the predicted insulin doses. By changing your daily eating rhythm, you can test the accuracy. If the formula is over-fitted this will lead to the wrong results. So according to him, if in these circumstances you obtain a good result, it is a good indication that the algorithm works.
So the test user changed his daily rhythm by eating diner for breakfast, snacks for lunch, and bread (normal breakfast) as diner. The user used the insulin dose recommended by the program. We looked at the results blood sugar level of the next measurements (a few hours after the meal and insulin intake). If these glucose levels where in a healthy range, it gives an indication that the program might work. Unfortunately, we only have the data of one patient and a very limited testing period, so more research is needed to see if this method can help multiple patients.
For this test we used measurement data of 2 weeks to learn on, this set contained 36 data points.
Also, during the period of this program, the base long-working insulin dose of the test user was changed. We looked if we could see a different in fast-working insulin doses before and after the change. We are interested in how many data points are needed to adapt the formula to the new circumstances.
The first results seem to be very promising. From guessing based on previous measurements, the carbohydrates ratio at lunch is around 7. According to the regression it is 7.029, so this is a good indication that the program gives meaningful results. For the 3 clusters that were discovered from the training data, different values for insulin-carbohydrate ratio and insulin sensitivity were obtained. For breakfast the insulin-carbohydrate ratio was 5.26, 7.03 in the afternoon, and 6.26 in the evening. So this shows that the different clusters are beneficial, as the ratios vary greatly between them.
In the figure below the different ratios between 3 clusters is depicted, for this graph, the current glucose is set to 10.0 mmol/liter, while the target is 5.5 mmol/liter.
Also the insulin-sensitivity differs between the clusters. In the morning it is 1.68, while in the afternoon it is 5.42. This means that in the morning the test user is less sensitive for insulin, so more insulin is needed to counteract high blood sugar. For the evening the insulin-sensitivity discovered is 1.45e07. This is obviously not a useful result. It may be the case that the carbohydrates estimate of diner is often wrong, so the data is not representative. Also there may be more variance in the evening, for example the test user sometimes eats peanuts in the evening, which may causes anomalies. If the program learns on more data points, the insulin-sensitivity converges to normal values (between 1 and 10). In the following figure, the insulin dose is plotted against the current blood glucose level, with a constant carbohydrate intake of 50 grams. This gives and idea of the reaction to insulin in the different clusters.
The clusters of the measurements in the training data are displayed in the figure below. The colors in all the graphs in the results section refer to the same clusters.
From the previous observations we can conclude that the different clusters are important, as the deviation in carbohydrates-insulin ratio and insulin-sensitivity vary between the clusters.
After testing with a new eating pattern, the model doses predicted by the model resulted in stable glucose levels in a healthy range (4.0-8.0 mmol/Liter). After eating diner in the morning the blood glucose level of the test user went from 11.6 to 4.8 after the meal. In the afternoon the user ate a bag of chips, together with the recommended insulin dose this caused the blood sugar level to decrease a bit to 4.4. After eating bread and soup in the evening the blood sugar increased to 6.8. So the blood sugar remained pretty stable during the day, and within healthy bounds. The user kept using the program in the days after, and obtained similar results.
These results are promising, and give a good indication that the program can give a good estimate for the insulin dose, that was better than the insulin dose recommended by using the old factors of the test user.
We also looked at how the changing of the base long-working insulin dose had an impact on the user, and if and how the formula adapted. In a time span of 2 weeks before the dosage change, the formula estimated a carbohydrates-insulin ratio of 8 and an insulin-sensitivity of 1.07 for both morning and afternoon (1 cluster in this timespan). for the evening these values are 7.44 and 5.68.
When we train on a timespan of 1 week before the change, and one week after, we get the following values:
If we compare these measurements to those of the timespan after the change, used in the previous results, we can see that for the morning and the afternoon, the values are already more like the measurements after the change. The evening is different, but in the used data set, the data was sparse, and not complete in the time span around the change. Especially in the evening there are not many usable measurement points, and there are more points after diner for snacks in this period.
Still we think these are quite good results. and indicate that the formula can adapt in a relatively short time, making it for example usable when going on a holiday.
But this also shows some problems, over a short period of time not everything is well presented, as there may be few data points under specific circumstances. For example there are no data points were the user exercised around the change of long-working insulin. So the new formula does not know anything about how the user reacts to insulin in these circumstances. Here the old method can be used, just removing a percentage of the insulin dose, based on a guess. It may also be possible to combine data over a long time, together with estimates over a shorter period.
Uses for the program
With the formula implemented in the program a insulin dose can be calculated. The formula contains a parameter for the target blood sugar level. This makes it possible to use the formula, together with the actual insulin intake(can differ from prediction due to rounding to full units) to make a prediction of the blood glucose level. This can be combined with the measurement error of the measurement device to get a predicted blood sugar range. If the next measurement of the user significantly differs from the prediction, the user can be informed about possible causes. Also advice can be given about how to avoid these deviations in the future, to obtain a more stable blood sugar level. This is Especially useful for newly diagnosed patients, the importance of this can be read in section !!!!!!!!!!!!!!!
The formula automatically adapts over time, as it takes new measurements into account.
There is still a lot that can be done to optimize the calculation of the insulin dose. One of the most pressing matters, is the testing of the current implementation on different people. Now we only have data of one patient, we would like to research this method on other people and compare the results. Unfortunately we were not able to obtain data of other patients during the time span of this project.
Another great improvement would be a better way to determine the carbohydrate intake. Currently in most cases this is quite a rough estimation. It would be a valuable addition if the program could recognize food intake (for example by pictures). Or an easy way too input what the patient ate. For example the program could remember what the user has eaten previously, and suggest similar options, when one of the ingredients is entered. Also food recommendations based on time can be given.
It would also be interesting to observe the blood sugar level of a patient over a longer period of time, while this patient uses the self-adapting formula. This may give an indication if the formula can be used to help patients obtain a more stable blood sugar level.
How rational thinking is implemented
For calculating a recommended insulin dose, the formula makes use of the patients data. We use 2 machine learning techniques to create this recommendation. Machine learning is a part of Artificial Intelligence. The first technique is clustering, this is an unsupervised learning technique that looks for similarities between measurement points of the patient. Similar points are then grouped together. Then a supervised learning technique is applied, namely regression. This uses knowledge about the data, in particular how the different attributes are related. The glucose level is dependent on the previous glucose level, insulin intake and carbohydrate intake. But also exercise, illness and stress can have an influence on the glucose level. So for each cluster the data about these attributes is used create a formula that describes their relations. The type of relation is already provided (standard formula), but the factors of this formula are decided upon by the learning techniques.
Purpose & method of implementation
As stated before, the goal of this project was not only to create a rational thinking AI which calculates the amount of insulin a person with diabetes needs, but also to find a way of implementation. A good rational system will not better anyone’s lives without a way for people to use it.
There are several ways to implement such a rational system. It could be implemented into either the measurement systems or the insulin dispensing systems. Both contain the same obstacle: the list of devices available for diabetes patients is endless. Choosing one (or a group of) devices was not only difficult, but also seemed pointless. The rational thinking AI is completely independent from any physical device, so why make it so?
The most logical way to proceed seemed to be developing some form of website or application that can be accessed and used by anyone, everywhere. This way, the project had the biggest impact and could provide a healthier lifestyle to the most amount of people. Ultimately, a web-application was chosen. This, for its universality: it can be used as a website or application on most devices that have internet access. Thus, broadening the targeted audience.
Design restrictions of the app
As mentioned above, our target group needs a stimulation to correctly start with their diabetes treatment in the beginning of their lives. We want to stimulate this with an attractive, interactive, complete/informative, and easy to use application. We have choosen for a web-app because it can not only be accessed by mobile phone but also by a laptop/computer or a tablet. The web-page can then be opened within an app which simulates an app environment without the need for two different programs. Lastly an informative web-app can be achieved by providing statistics on the patients blood sugar level and insulin doses and by generating graphs for easy-to-understand and easy-to-read information for the patient.
- Attractive: To make the web-app attractive, a free template is used that has a calm design so that the user does not get distracted by bright colours and an overdose of information.
- Interactive: The app will be made interactive in that it shows plots and gives advice to the patient. This is done because it motivates the patient to use the web-app, which makes sure that the diabetes medication will start off on the right foot (the usefulness of this has been described in chapter ABCABC), and because it gives the patient more insight about their medication and blood sugar levels throughout their lives.
- Complete and informative: To keep the patient motivated and to give the best advice about diet and excercise, the web-app needs a complete recordkeeping of the patient and a way to use this data in an interesting way. The user might want to see information about their blood sugar level over time or how much the insulin dose has risen on average after one year. The easiest way to show this information is in graph-form. This has to be made possible by us.
- Easy-to-use: The easy-to-use property that the app should have is closely linked to its attractiveness. An attractive and calm web-app has buttons where the user expects them, graphs where the user wants to see them, and desired inputs when the user actually has the information for them. We want to achieve this by using the template and by looking closely at other apps that have a function that is close to ours (whether this is medical or not is not important). When we have made a plan on where all the settings and buttons need to be, the app has to be tested in its easy-to-use property. This can be done in the last week since although making the app more easy-to-use is an important aspect, the layout can easily be tweaked in the web-app developer program.
There is done some research in the field of diabetes and the use of an app by patients. Some researches are explained, which could be used in the project.
In a research from RIVM (Rijksinstituut voor Volksgezondheid en Milieu) diabetes patients are questioned. Around a third of the patients uses an app to support them to regulate their blood sugar level and these people are positive about the use. The patients state they don’t use health apps if they are time-consuming, not user-friendly or untrustworthy. Privacy of the personal data or the quality of the app aren’t seen as an issue. Important conditions to use such apps therefore are good instructions and guaranteed trustworthiness.
According to the research from the RIVM (Rijksinstituut voor Volksgezondheid en Milieu)most of the Netherlands diabetes patients are not using an app, because they don’t know it exists, don’t know how the app works or are unsure about the trustworthiness. Around 30% does use an app and they are in general satisfied. They experience benefits from the digital diary and other tools the apps offer. There appears to be a big difference in age. Of the young people up to 20 years around 66 percent uses an app and of the 75-and-older only 6 percent. Patients mostly use the apps to regulate their blood glucose levels and the majority of whom use the app for simple functions like counting carbohydrates in food or keeping a diary. Apps which are linked with insulin pumps are barely mentioned. The research indicates that healthcare providers and patient organizations don’t advise about diabetes-apps or use it in treatments. Patients from the research find their information online or in the Appstore, because websites from multiple diabetes-organizations don’t mention the use of apps.
Lars Koster from the Diabetesvereniging Nederland shows in recent research with TNS-NIPO that a considerably group of patients with type 2 are in need of information about apps and new developments. According to Câthy Jansen (initiator of ééndiabetes.nl) type 1 diabetes patients mostly look for a good connection between an app and the insulin pump or sensors.
According to research from the German Research2guidance, there are worldwide around 45.000 developers of medical and health-apps, last year 3 milliard of those apps were downloaded and diabetes has the most potential in this area. Interestingly the pharmaceutical industry is not successful in the development of apps. The big guys have made over 60 apps per manufacturer, but these aren’t used in general. According to the research the pharmaceutics don’t listen enough to the need of the user, only emphasis on their product and are the apps only available in a few counties.
There is also research done in the influence of exercise on the insulin dose a patient needs. In October around 3100 people participated in the national diabetes challenge. These people with diabetes type 2 trained months and the results were an analyzed. The patients were checked for weight, medicine uses, waist size and blood glucose values. They were given a step counter, which looked at the amount of exercise someone did. Data was received from before and after the challenge and compared. A movement in weight, amount of steps, change in glucose levels and changes in medication were seen. According to internist Henk Bilo: “the health of participants improved and the blood glucose levels decrease”. In a healthcentre in Nijkerk there weren’t big changes in the glucose levels, but patients used half of the diabetes-medication from the beginning of the challenge.
The final product
Especially while handling such delicate user information as their medical records, a secure environment is of utmost importance. The app (called DiaMeter!) therefore password protected and has a log in screen. The information the user will put in, will be saved on a secure server. This way, the user can access their personal data from any device, anywhere, without compromising their personal information.
The first page you get to when you log in, the homepage, is the most important page of the application. This, since it incorporates the rational thinking system that has been developed. Based on user research, that lead to the conclusion that difficult usage was one of the main reasons for people not to use diabetes apps, this part has been kept as simple as possible.
The options to select are the current measured glucose level, an estimate of carbohydrates the next meal will contain, the activity level, for women their period information and whether or not the user is feeling ill.
Entering the mentioned information will result into a pop-up window containing the advised amount of insulin, the user could take.
Personal data overview
Both for the patient and their doctor it can be useful to review the data that has been entered into the application. DiaMeter! Provides an easy way to overview this in the tab ‘My Personal Data’. It contains an overview of their food intake and insulin doses in the past day, week and month:
Furthermore it tracks their activity level:
And it provides an overview (for women only) of the carbohydrate intake during their period. The relevance of tracking period data has been explained earlier on in chapter [….].
The lifestyle part
A quick recap to the original problem definition, goal and target group of this project. It is especially important for young children and teenagers, when first diagnosed with diabetes, to be guided through the first couple of years. Research showed that, when the first years are well-guided, the diabetes is easier to manage in later years as well. Therefore, a ‘lifestyle’ part has been built into the application.
The lifestyle part consists out of advice on what to do when having a hypo or a hyper:
Nutrition advice, in order to provide the user with a list of foods to indulge or stay away from:
And a page with information on how to correctly measure your glucose levels:
Future Developments & Improvals
The biggest obstacle for creating an interchangeable applications that people around the world can use at any given moment lies in the responsiveness of patients to the properties of meals. The current way that food properties are taken into account with insulin calculation is with the amount of carbohydrates that are present. This in itself is an average indicator of the actual expected blood sugar level since patients react differently to the same foods. An extensive research has been done by biomedical experts in Israel about personal nutrition advice by predicting the glycemic responses of patients. With an 800-person cohort, a big difference in post-meal glucose levels were observed. Not only life-style differences were held accountable for this. According to the researchers, differences in post-meal glucose levels also included genetics, insulin sensitivity, exocrine pancreatic, glucose transporter levels, and gut micro-biota.
To create an interchangeable application that is for everyone directly applicable, one needs to take all these factors into account. The research devised a machine-learning algorithm that integrates blood parameters, dietary habits, anthropometrics (measurement of the human individual), physical activity, and the in this paper researched gut microbiota. The resulting algorithm was used on an independent 100-person cohort and it was concluded that the use of the algorithm resulted in a better prediction of post-meal blood glucose levels. The algorithm (or one that has the same function) could be used in an application that calculates a necessary insulin dose because it would improve the prediction of glucose levels after meals and can thus better prescribe the dose.
The research however, was very extensive and we were unable to attain the knowledge, the data, and the time to fully look into its possibilities. That is why we concluded that our focus should lay on creating a data regression algorithm/agent that is focused on a single user. The application will be applicable for every user but before the patient would be able to use it, we, as the developers, would have to manually create and implement a dataset and gather personal information about the patient to implement this into the model. If the project would be continued by any who is interested in it, implementing a machine-learning algorithm (such as that from the researchers from Israel) would be a great first step to correctly predict insulin doses for everyone.
There is definitely a possible future role for artificial intelligence and machine learning algorithms in glucose monitoring and diabetes care. Eventually a breakthrough may not be far away. But in order to come to a breakthrough in this field of research, mainly two things are important and need some more attention. Those two things are the understanding of the sugar metabolism with respect to the food intake and the way the glucose level is monitored.
For insulin therapy, food is the most important factor. Beside other factors like stress, illness or even genetics, the food intake is the heavyweight in the determination of the blood sugar – insulin balance. In order to develop an artificial intelligent algorithm, more understanding of the biological processes involved and food itself are needed. Knowledge about the exact composition of nutrients in a particular piece of food even as knowledge of the body reactions to this compositions. The main factor in the latter point is the way in and the time it takes before the carbohydrates are released and absorbed by the bloodstream.
Next to research on the field of biology, also computer science and image processing could play a large role in the food-part of insulin therapy. These sciences could have a large contribution by making insulin therapy more user-friendly. Imagine an app on your smartphone that only has to make one picture of your plate and then exactly determines the amount of nutrients in the dish and knows about the way the body will react to that particular composition of nutrients. If this is possible it could play a major role in the optimization of insulin therapy and probably make it more accessible for diabetes patients. Nowadays, there are already smartphone applications that try to do those things. But they still have a lack in quality and knowledge, so data received from these current apps is not suited from the optimization of insulin therapy. Thus a lot of research in the field of biology and computer sciences with the eye on image processing is definitely needed.The other part of interest is the way glucose is currently monitored. Currently this is mostly done with a finger prick a few times a day. In the future, however when an artificial algorithm has to predict the glucose level and or needed insulin dose based on your (eating) behavior loads of data are needed. Such an algorithm won’t work correctly if only a few data points per day are accessible. In order to predict and learn about someone’s an almost continuous set of data is needed.
So the current way of measuring has to be replaced by something that measures the blood glucose level (near) constantly. Techniques like this do actually exist. A good example of this is the FreeStyle Libre Flash-Glucose Monitoring System of Abbott. This system consist of a pin like thing that stays on your arm for about two weeks (and then it needs to be replaced) which is connected with a little devices that notes your blood glucose level every few minutes. The device makes some nice graphs and shows your glucose level of the last eight hours. Also the device is able to store the data of the past three months. At the end this system will give someone a good insight in their changing blood glucose level over the day.
When all the things mentioned in this chapter are combined one could say that they created a truly interchangeable life-changing application for diabetes patients. Due to the extensive and expensive research that has already been done on this subject, it is safe to say that this prospect would take at least a decade to become a reality. In the meantime research should continue on making the insulin dosage therapy as easy and accurate as possible for the patients.
Medical applications in the Netherlands
Medical applications have a continue growing contribution in the healthcare market. Many consumers in the Netherlands use applications like ‘Moet ik naar de dokter?’, ‘Huidmonitor’ and the ‘iP plaslijst’. Even 60% of the doctors in our country says to make use of medical apps. Although the goal of those applications is to improve the quality and efficiency of patient care, certain risks of misdiagnosing are attached to them. 
To avert such risks there is the CE marking in the European Economic Area (EEA). This marking is mandatory for applications that make a medical claim. It ensures that medical devices suffice the European requirements for safety, health, environmental and consumer protection. Without this mark a medical device is not allowed to be commercialized. However, the CE-marking should not be confused with a quality mark. It does not guarantee the quality or clinical relevance of the product. 
The use of not CE-marked medical products can have consequences for many parties. Developers and doctors can receives fines. Institutions will be addressed upon the base of the law for quality of healthcare institutions. When a patient suffers damage because of the use of a not CE-marked medical product (so also applications), it is a professional misconduct of the doctor. In that case, the product developers will also be liable. 
An example for our situation can be that because of a programming mistake, the algorithm in the applications gives consistently too high values. If someone with diabetes suffers from this because he or she administers wrong doses insulin, this can lead to a claim. 
Is our app a medical device?
Whether our idea for applications should have a CE-marking can be checked with the flowchart in figure 1.
Figure 1,  This will lead to the conclusion that the application for our goal definitely will be seen as a medical device. It does (not???) contain a measuring function??
Liability of the producer
As a starter the producer of the application is primarily responsible for it legitimate bringing to the market of the application. This means, among other things, taking care of the CE-marking as mentioned in the paragraph above.
Besides, on the basis of article 6:185 BW, the producer of a product is responsible for the damage caused by a malfunctioning product. However, the question rises whether a medical application can be viewed as a product. A product is defined as a moveable property, but a medical application does not have this required materiality. Assuming that the rules for product liability are applicable on a medical application, man can think of mistakes in the production process, design mistakes or instruction mistakes. For the successfully addressing of the producer on article 6:185 BW, it is the patients task to prove that the producer marketed a malfunctioning application and that the application caused harm. Although the burden of proof is with the patient, it is wisely for the producer to be very careful by making and maintaining of the software to limit it’s liability. 
Liability of the care giver (hulpverlener)
In most cases it is the caregiver who chooses which kind of medical device will be used. This makes the care giver responsible for it legitimate using of a medical device during the treatment. This includes the use of a medical device with CE-marking and the correct use of the medical device. A care giver is also liable when, according to objective standards for a reasonable acting care giver, he or she could and should have acted differently. Like situations in which the care giver gives insufficient explanation about an application that is used on his or her initiative, causing the incorrect use of the application leading to shows of incorrect results in the application. Additionally, it is the care givers responsibility to not unthinkingly take over diagnoses that the application gives, even if it carries the CE-mark. 
Errors in the advice
As mentioned in the chapter 'Ethics - liability', we as the creators of a medical advice app bear a certain responsibility for the results or calculations that the app gives. When the app gives a wrong insulin dose, the patient might encounter negative side-affects. Even though the web-app will not be finished for publication after this course, it is still important to take a look at the errors that might occur with the measuring devices. The blood glucose level gets measured by a so called 'Blood glucose monitor' which has a certain error when measuring which translates into a maximum and a minimum value around the measured number. When the patient measures, for example, a blood sugar level of 8 mmol/L, the value can either be below 8, exactly 8, or above 8. For every measured value, this error can be taken into account for the further calculations that use this value.
The blood glucose monitor that we are going to look at for this small analysis is the 'Accu-Chek Aviva Expert' since this is the monitor that was used in the data analysis. The Aviva Expert meets the 2013 ISO standards for blood glucose accuracy . The 2013 ISO accuracy requirement states that 95% of the blood glucose results should not differ more than 0.83 mmol/L from a laboratory result for concentrations up to 5.6 mmol/L and 20% for concentrations of 5.6 mmol/L or more . This means that when a patient would manually calculate the insulin dose, which uses the measure blood sugar level, he or she would get 3 different numbers as a result. For our program, the accuracy of the blood sugar monitor is included in a different way. Since the measurements before and after the insulin is given, are inputs that would improve the approximation for insulin doses for new blood sugar levels, we have to make sure that we take the errors into account. The measurement before and after the insulin is given both have three values which lay on top of eachother on a time scale. The actual value lays somewhere inbetween these three.
The image underneath shows an example:
In this graph, the blue dot is the measured value, the red dot above the lue dot is the maximal error and the red dot below the blue dot is the minimal error. Keep in mind that this is a graph from made up data and can thus not be used for any kind of quantification. The errors from the 2013 ISO standard are implemented in the Python script.
To check whether the deviation of the monitor indeed does not exceed the 20% stated by the product specifications, a little test was performed. A random person of our group was taken as test subject. The test subject measured her blood glucose level with the same Accu-chek Expert that was used for the generation of the data where on the analysis is performed. The blood glucose level test was performed ten times directly after each other in the same manner. The results are noted in the following table:
A standard error analysis was performed on the results. The values differ between a minimum of 5.4 and a maximum of 6.7 with a mean of 6.06. The standard deviation is 0.4061, giving a variance of 0.1649. The minimum value deviates 0.66 [mmol/L] of the mean and the maximum value 0.64 [mmol/L]. All the other values deviate less. The limit is set a differentiation of 20% which results in 1.21 [mmol/L] for a mean of 6.06. So, all the results fall in this range. So taking the error mentioned before given by the fabricator, should suffice.
Planning & Proces
The Gant Chart
At the beginning of the project, a so called Gant Chart is made. This chart represents the original project planning per week in colored blocks. So in the Gant Chart different colors can be seen: deadlines are marked red, wiki related tasks are marked black, milestones are marked green and all the remaining tasks are marked grey.The deadlines are in week 2, 3 and 8, these are the presentations. Almost every week a black box can be seen, the findings done in that week will there be placed on the wiki to make sure the wiki-page stays up-to-date. Important milestones are finishing the literature study in week 5, finishing the code for the optimization of the formula in week 6, finishing the app in week 6 and finishing the wiki and testing the app in week 7.
Project Proces and Evaluation
We could say that we learned a lot by doing this project. And that’s not only about diabetes and data learning techniques, but also on doing projects and planning them. Looking back the hardest thing we faced was start and plan a project from scratch. Normally you have some case description but now we were totally free to determine what our project would be about. Therefore many changes in the project plan were made during the course. However, our subject was rapidly chosen, because one of our group members is a diabetic and told us about the problems he faces and his ideas what could be done in order to improve this.
We first started with a brainstorming session in order to state what our project would be about and what our deliverables would be. At first we wanted to develop a smartphone application that could automatically determine someone’s insulin dose needed by learning to ‘know’ a person over time. A kitchen scale should be connected to this app, so the food intake easily could be taken into account.
The first thing we encountered was that our idea was way too large to perform during this course. We underestimated the complexity of the disease and our target group, all diabetes patients, is a bit too large. Therefore we adapted the target group to people who are newly diagnosed with diabetes and especially children. This because this is the most sensible group of patients and a good start in diabetes treatment results mostly in a better control of the disease in the future.
Because of the target group adapted, we adapted also our deliverable. From a smartphone app we switched to a webapp, since such application is accessible with more platforms. Instead of only calculating the right insulin dose and taken the food intake into account we decided to also add a lifestyle part to the app. This is done with respect to our ‘new’ target group. So the app would become a ‘total’ device that helps new diagnosed patients to get to know the disease and themselves and supports them when needed with additional information and tips for a better lifestyle.
In order to get more information about our project subject an interview with Natal van Riel is done. He’s a researcher at the department of Biomedical Engineering at the TU/e and focuses on the modelling and understanding of body mechanisms, like the sugar metabolism. He is doing similar research like our project. After the interview we came to understand that we never would be able to develop a full AI algorithm that would be able to perfectly determine the suited insulin dose that could be used by everybody. Diabetes is such a complex disease that researches spends billions on research like our subject and still aren’t able to predict the right insulin dose. However, our idea, learning from previous data, could still work sufficient, Natal said. It’s possible to determine a good indication for a new insulin dose based on old data. However the algorithm won’t be generic. The algorithm needs to be adapted a bit for every person who uses it.
Also we looked for more test data. This however was a problem. We contacted some hospitals and especially some diabetes nurses. We asked for data and / or if they could fill in a questionnaire. This however wasn’t possible because of the fact that we were handling medical data in combination with the patients privacy. Also Natal van Riel was not allowed to give us any data in order to test our application.
In reaction to this we did some more research in diabetes and the needed data techniques. The focus of this was on what’s needed in order to get such a perfect algorithm that really understands a person and could be used generic. So at the end we made a first attempt in personalizing the insulin formula, that actually works great for 1 person. Thereby we made a recommendation on what should be done in the future in order to get an algorithm that fully works for every patient.
So in conclusion, a lot of our planning and (research) goals changed during the project. Subjects seemed to be much broader and harder then we initially thought. Also collecting test data and doing research by making use of a questionnaire in hospitals was harder than we thought at the beginning of the project. But finally we came up with a working WebApp and an extensive literature study we are proud of.
 ‘Medische apps, is certificeren nodig?’, Nictiz, 7-06-2013, Anton Ekker and Barbara van Rest.https://www.nictiz.nl/SiteCollectionDocuments/Whitepapers/13005%20Whitepaper%20medische%20apps.pdf
‘Civiele aansprakelijkheid voor het gebruik van medische applicaties’, Tijdschrift voor Gezondheidsrecht, 27-10-2016, Mr. A.J. Zijlstra. http://www.sectionz.nl/cms/LAUXTERMANNADVOCATEN/media/pdf/TvGR_2016_40_07_schoon-zijlstra.pdf