Cloud system for diabetic data analysis

The paper presents a web application which helps the diabetes patients and clinicians to analyze the patient evolution and improve the diabetes treatment. The system reads the blood glucose values from cloud where are uploaded by the patient mobile application. In this way both patient and clinician can share the patient data and it is no longer necessary the patient to visit the hospital.


INTRODUCTION
Diabetes is a silent disease that does not give pain or other symptoms, but is very aggressive and dangerous for the human body if is not treated properly by the patient.Diabetes appears when the pancreas no longer produces the necessary amount of insulin and the Blood Glucose (BG) value increases and remains on a high level.This state is known as hyperglycemia and treating it inappropriately over time leads to blindness or leg amputation.
In order to maintain the BG level in a safety area, the patient should inject periodically a given insulin amount.The problem is that the patient is always in a dilemma because he/she doesn't know how much insulin to intake.If the insulin amount is to small, then the patient remains into hyperglycemia, but on the other hand, too much insulin can kill the patient through hypoglycemia.Is not so easy to find the correct amount of insulin needed on a given situation.The BG level depends on many factors (quantity of carbohydrates intaken, physical activity, stress, hormone cycle, etc.) so the patient should take into consideration all these factors and calculate the correct insulin bolus.
The presented system helps the patient to analyze his/her medical history, the BG curve over time, Hyper/Hypoglycemia events occurred during a given period and other blood glucose statistics.Furthermore, the system builds a patient database which stores all the critical situations with which the patient has been confronted over time and the successful solutions for those cases.When a new case appears, then the patient could ask the database to show the solution for a similar case in order to receive some help on his/her decision.

II. SYSTEM ARCHITECTURE
The first component of the system is represented by a mobile application which runs on patient phone and which collects patient data: meals, physical activity, blood glucose values and other information which help the patient to calculate the insulin injection quantity (Fig. 1).

III. DATA ANALYZIS
The main purpose for the server application is data analyzing.By using this application, the clinician could create a complex image about patient evolution and give advices for improving the treatment.One very useful tool for analyzing the patient evolution is the Glucose Profile chart (Fig. 2).This graph collects the blood glucose values for a long period and then builds a generic day with these values showing the main trends and statistics for that period.For a given minute from this generic day the graph displays on the same vertical axis all BG values having the same given time which are found on each day of the selected time interval.

A. Glucose profile
Based on these values the system can calculate the mean and median value and also the main percentiles [2] of these vectors (Fig. 3).Moving the mouse over the graph, the system automatically calculates the mouse position and the closest BG value for that position.Then the graph displays a Tool Tip which lists the main statistic for that selected time.In this way the clinician could conclude which time zones are most critical for the patient and give the proper advices in order to minimize the hypo/hyperglycemia periods.

B. Data filtering
It's very important for the user to select the exact time period that he wants to analyze.Therefore, each page of the application includes a filter where the user selects the time interval and the data type to be displayed (Fig. 4).Furthermore, the user can select a specific day from the week.For example, if the selected day is Monday, then the application selects data from all Mondays included into the selected time interval.This helps the clinician to analyze the patient behavior specific to each day of the week.

C. Blood Glucose Statistics
This page makes a comparison between two time intervals in order to analyze the patient progress.The page displays the average BG, standard deviation, the HbA1C [3] values and comparisons for hypo and hyperglycemia events.

D. Hypo/Hypeglycemia events
The application identifies automatically the hypo or hyperglycemia events from the BG curve.For the same generic day described on paragraph III.A, the page shows the events number occurred for each hour (Fig. 6).Clicking on an event, more details are displayed specific to that event: BG curve, the event time, the extreme BG value and other context parameters (physical activity, alcohol, etc.).

E. Critical cases analyzing
The system implements also a database which stores for each patient his/her critical cases and their solution.A critical case means that the patient doesn't know how much insulin to inject because he/she is in an unusual state given by unusual actions (big meal, alcohol, cigarettes) cumulated.
A case is considered successful if the BG value remains into a safety area after the insulin injection.That case is analyzed by the clinician and if is considered successful, then the case is saved into database to be used in the future as a solution for that given context.
In order to validate the case, the clinician should have a tool which visualizes the entire context of that case: the BG curve, physical activity (number of steps for each hour), the number of carbohydrates intaken on each meal, basal and bolus insulin and other details like stress, alcohol, cigarettes, hormone cycle, etc. (Fig. 7).Another helpful instrument is the table which lists similar cases with the present case.The clinician could open each case from the list and analyze the solution for that context and then decides if the current case should be saved or not into database.

IV. GRAPHICS ON WEB APPLICATIONS
It is known that a web application is a better solution compared with a desktop application from many points of view: maintenance, installation, user training, visibility, impact, development costs.But not any task could be resolved by a web application due to its limits: every page refresh requires data transferring between server and the web browser, limited internet bandwidth, few software libraries for data analyzing and displaying.
However, during the last years, there is a massive migration of applications to cloud space.One important reason is given by the spread of the latest generation phones that incorporate processing power similar to that of usual computers.In this context, many software developers had focused on building open source libraries which help the engineers to develop web applications with a great user interface.Most of these libraries are developed on Java Script language and HTML5 standard [4] which are supported by the modern browsers.The last version of SVG (Scalable Vector Graphics) [5] combined with the D3.js (Data-Driven Documents) [6] library gives to the software engineer a very powerful tool for graphic development.
The presented application uses extensively these libraries and JavaScript language for both major tasks: data transferring and data displaying.Fig. 8 shows a section of code which builds rectangles for each hour representing the physical activity made by the patient.In order to download data from the cloud database the application implements AJAX (Asynchronous JavaScript And XML) [7] calls which transfer the data in the background without freezing the page during this process.In this way the application runs smoothly having the same performance as a desktop application, but it benefits from all the advantages given by the client-server architecture.

V. CONCLUSIONS
A web application for data analysis specific to diabetes is presented.The application uses the latest JavaScript libraries in graphic representations that allow to build powerful tool for data displaying and analysis.
Data is stored in a cloud database which makes the dialogue between the patient and the doctor easier and more comfortable.

Fig. 3 .
Fig. 3. Displaying the main percentiles of the BG values.

Fig. 8 .
Fig. 8. JavaScript code which displays the patient physical activity.