DEV Community

Cover image for Mom's Blood Sugar Log
kateleext
kateleext

Posted on

Mom's Blood Sugar Log

Last week, I signed up for Codecademy out of a sudden nudge. I didn't expect to be building anything remotely useful that soon, yet a short 5 days later, I ended up with a simple yet functional blood glucose log that I'd always wanted to build for my diabetic mother. Here is my first ever terminal program, built as my portfolio project for Codecademy's CS101 course.

First, I created a class Records to contain all the variables that come with a blood glucose record, including the timestamp and conversion calculation from my mom's mg/dL reading to the more widely used mmol/L metric. Class variables such as the start times of different meal periods also allow the data to be automatically tagged across the three meals + midnight instances when my mom gets her dose of insulin.

the class Records

The bulk of the program includes three main functionalities, including:

  1. Create a new log by entering the latest reading
  2. Retrieve all logs from a given date
  3. Calculate the 2-week average reading (that is indicative of overall glucose levels)

The records are all stored in a .csv file that could be easily printed for my mom to take to the doctor's office.

3 Main Functionalities

Last but not least, I put the running program into a loopable script() that called the functionalities previously defined. With the rerun() function, my mom can also return to the main menu and check the log after putting in the record.

Script

Though the datetime and csv modules took a lot of googling to get around, I am thoroughly pleased with the result of this project. I look forward to learning other languages in the future that will enable me to create a more user-friendly GUI, such that my mom could actually use the application!

Here's the program running in full:
Alt Text

The code file and version history can be found on https://github.com/kateleext/blood_log

Latest comments (0)