stem 1

During the first two and a half terms during our junior year at Mass Academy we participated in STEM1. This consisted of taking a science fair project from idea generating to data analysis and conclusions as well as everything in between. The project could fall under any subject out of STEM. We were given the task of creating a research question and hypothesis write a project proposal that included either a research question with doing research and writing a literature analysis to demonstrate the research. Then we had to create a methodology,test,collect data, do data analysis, create conclusions, and write a thesis. The time management and organizational skills that we acquire during this process will be essential in helping us in our future endeavors. Click below to view the supplementary documents for my stem project.

Designing an algorithm to calculate preferred glucose and insulin levels based on exercise intensity and time


The overall aim of this project is to refine the current hybrid closed-loop algorithms for calculating insulin to be more versatile for exercise. The expectation is to create a program that will be able to effectively determine the correct course of action based on intensity and time length of exercise.

engineering goal:

Exercise can be an unpredictable factor in diabetes management because it can cause large fluctuations in blood glucose.

engineering objective:

The goal of this project is to engineer an algorithm that would calculate a correct management regimen based on intensity and or length of exercise.

graphical abstract

background infographic

This is my background infographic

procedure infographic

This is the general infographic for the procedure


Type 1 Diabetes is an autoimmune disease that typically presents itself in children who are five to seven years in age as severe dehydration, fainting spells. Diabetics must predict future glucose levels and manage them with insulin doses throughout the day (Atkinson et al., 2014). Current management has advanced with the Continuous Glucose Monitor and the Insulin pump, which track glucose levels and give insulin respectively (Doyle et al., 2014). Large fluctuations in blood glucose make glucose trends harder to predict thus making management difficult, thus exercise can be an unpredictable factor in diabetes management. The goal of this project was to engineer an algorithm that would calculate an optimal management regimen based on intensity and or length of exercise. This process began by first developing a model that would predict glucose levels without exercise. In development of this, the model was tested and edited multiple times by checking the accuracy against another portion of data from the set. Next, the goal was to adapt this model to glucose exercise data, however, due to time constraints this did not occur. The results did not meet the overall engineering goal, while there was an attempt to create a first model to predict glucose without exercise levels, it only had an average accuracy of 30-40%. From these results, it can be concluded that the algorithm was not effective. If the design had achieved the desired goals, it could be a more cost-effective and accessible alternative to the getting alternative expensive management devices.


-Type 1 Diabetes: An autoimmune disease where pancreatic beta cells are attacked, so no insulin made

-Insulin: a hormone needed to grant cells access to blood sugar (glucose)

-If there is too much or too little blood glucose, it can cause damage to the cardiovascular system and cause hypoglycemia and possible hospitalization

-Current management: a needle to check blood and manual insulin shots multiple times during day

-Other types of management: Continuous Glucose Management, Insulin Pumps, and Also online insulin calculators

-Insulin amount depends on insulin sensitivity (effectiveness of insulin), height, weight, age...etc

-Exercise uses a lot of energy and needs sugar, so sugar levels can decrease quickly during exercise, hence the project's focus


To the right, is the infographic for the general design process, and below is the specific progress made so far

-Data Acquisition: A search for a dataset with a lot of sample glucose measurements along with the general times they were taken at

-Version 0.5: Began with a rudimentary design where the predictions are based on averages of glucose levels at different time ranges

-Research into java libraries that could handle regression algorithms and familiarize with the language (Deeplearning 4j and Weka)

-Version 1: Using Weka to develop a model to predict glucose levels based on various times during the day

Test: Using Weka to test the model against another dataset from the same source

research proposal

A written version of the project outline as was originally proposed.

literature review

A compilation of all the background research done before the testing began.


This is a picture of my figures from my data analysis.


-Unfortunarely, the end result did not meet criteria

-I underestimated the time required to learn Weka and its documentation

-I had difficulty in finding viable glucose data that recorded with exercise

-Created an algorithm that could make predictions on glucose levels based on times

-t-test: was paired and two-tailed and was testing for similartiy (so higher values are better)

-p-values were all very small (0.0004) and p>0.0.0008), shows lack of accuracy in algorithm

-Average Percent error: 30-40% with outlier of 160% as an outlier, also shows lack of accuracy


-Results are inconclusive

-Conclusions are difficult to make: because percent error rates and p-values vary a lot so it is difficult to determine what was effective

-Final Notes and Conclusion: Although the intended result was not reached, progress was made. If the desired goals are to be achieved, it could be a more cost-effective and accessible alternative to the getting alternative expensive management devices. Benefitting many Type 1 diabetics

-In hindsight, the algorithm may have been inaccurate because the model was based off of one patient and then applied to other patients whose bodies followed different patterns