ECE434 Project - Diabetic Monitor

Team members: Eddie Mannan David Mattingly

Grading Template
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

 Add Extras

09 Executive Summary 09 Packaging 09 Installation Instructions 09 User Instructions 09 Highlights 09 Theory of Operation 09 Work Breakdown 09 Future Work/Conclusions 09 Hackster.io 09 Demo/Poster 00 Not Late

Score: 90/100

Executive Summary
Picture that summarizes the project. Not propper format

This project is a way to easily monitor blood sugar levels for Type 1 Diabetics. In order to use this project, you must be using a Dexcom brand constant blood sugar monitor and have valid accounts with Dexcom. This project will take a downloaded .csv file from the Dexcom website, run computations on this spreadsheet to find an A1C, and display values with both LEDs and an LCD display.

As of 2/9/2023, the project will pull a new Excel file from GitHub and search through all Excel files to find the newest one. Once it gets the newest file, it will run computations on it (turning on a Yellow LED to show that it is working) and display several values on the LCD screen. The values are: Eddie Mannan Dexcom Monitor Date: *Current Date* Time: *Current Time* A1C: *Current A1C* Current Sugar: *Current Sugar* Highest Sugar: *Highest Sugar* Lowest Sugar: *Lowest Sugar* Computation Time: *Computation Time* As of 2/9/2023, the only thing I can't get to work is a way to automate the collection of Excel sheets. Right now, the user has to add a new sheet every time they want new calculations. I would like to have this done automatically, but I haven't found a good process yet.

All in all, this project should be an easy way to constantly display and track a persons blood sugar numbers. If the project can accurately track and clarify sugar values, it will be able to help type 1 diabetics stay healthy and safe.

Packaging
As of right now, we don't have any of formal packaging. It is just the Beagle right next to a small bread board. It would be nice to get it in a small acrylic box of some sort, but we just didn't have the time for that.

Installation Instructions
To install this project, it is quite simple. All you need to do is grab the project from GitHub, run the install.sh file, then reboot to enable to device tree. You may want to check whether uboot_overlay_addr4 is already assigned, as that is the one this project arbitrarily uses for the LCD device tree. The project should begin running automatically every five minutes via the crontab, at the zero- and five-minute. It runs every 5 minutes since that's how often the Dexcom sensor takes a new reading.


 * Link for Additional Hardware
 * Technically speaking, you would also need to purchase a Dexcom G6 Monitor, but if you aren't a diabetic then you really wouldn't have much use for this system. Please follow your doctor's recommendations on treatment systems for diabetes, do not get a certain one just because you saw a neat project to display your stats.

User Instructions

 * Make a copy of the GitHub repo on your own Beagle. This would work best if you were also a type 1 diabetic, since I'm assuming you wouldn't want too see my data, but regardless it will work.
 * Go to Dexcom Clarity, this is where you will download your .csv files for number crunching. Take this file and add it to the GitHub repo. When the Python file runs, it will do a git pull to get the newest file, then figure out and do math on the newest.
 * The python will then display the information on the LCD screen and light up an LED based on the Current Sugar value. Red for high, Green for good, and Blue for low. It will also light up a Yellow LED to show that the code is running.
 * If for some reason something goes awry, an easy fix would be to reboot the bone since it will run the program again on startup.
 * That's it! Should be easy enough to use!

Highlights
The project can determine which file is newest and run it for you, making it easier on the end user. The project will display data both with words and with colors, making it easier to tell the reading from a distance if needed. The A1C is calculated with sugar numbers collected every 5 minutes for the last 90 days. This leads to an array of over 25,000 elements. The program, after setup, will autorun on start and run every 5 minutes by using CronTab.

Here is a quick YouTube demo to visually show all of the features.

Theory of Operation

 * The first step is to add a new .csv file from the Dexcom Clarity website to Git. Once the sheet is added, the program will do a pull.
 * Next, it will look at all the excel files it has and determine which one is the newest, then crunch numbers on that one.
 * Then, it will get some values from the array, sort the array, and calculate the A1C value.
 * These values will then be sent to the LCD screen to be displayed and the LEDs to be updated.
 * The system will then use CronTab to autorun again in 5 minutes since this is how often the Dexcom sensor reads a new sugar value.

Work Breakdown

 * Determine if Python will be fast enough given such a big array - Eddie
 * Find a way to determine which Excel sheet is the newest - Eddie
 * Do the diabetic calulations to determine an A1C and find current/highest/lowest sugars - Eddie
 * Display the data collected on the LCD screen - Eddie
 * Create an install.sh - David
 * Create an setup.sh - David
 * Get the program to autorun - David
 * Optimize the programs runtime - Eddie

Future Work
The biggest piece of future work is getting the Excel sheets. We would have loved to have a way to go to the Dexcom website automatically and get the numbers, but since this is medical data, it is quite a challenging process. So if a solution to that could be found, this project would be close to perfect.

Conclusions
In conclusion, this project could be concidered a great success. The program is able to take an array of blood sugars, crunch the numbers, and return valuble feedback based on those numbers. This could be a great tool to help Type 1 Diabetics manage themselves and stay healthy. One future addition that could make the project MUCH more interesting would be finding a way to make the code got to the Dexcom webiste on its own and download the Excel file every 5 minutes or so. Since this is medical information, we currently don't know if that is even possible, but it would be neat none the less.