Skip to content

Kalhama/Gluwave

Repository files navigation

Gluwve

Gluwave is a diabetes management app for MDI therapy users that takes many ideas from closed and open loopinng into MDI treatment. Gluwave is designed to work with either CGM such as Libre 2/3, or traditional fingerpricking.

Key features 🚀

  • Smart glucose prediction algorithm
  • 100% web based. No app installation or building from soruce.
  • Integrate glucose from Freestyle Libre 2 / 3, or manually input fingerprick results
  • Calculate insulin on board
  • Log meals

Demo 🎥

Public instance is available for anyone at https://gluwave.com

How to use Gluwave 🛠️

Using Gluwave is simple with following steps

Configure settings

Update your carbohydrate ratio and correction ratio in the settings

Adding entries (glucose, carbohydrate and insulin)

You can add new glucose, carbohydrate and insulin entries from the bottom toolbar.

Example of adding new meal entry:

  1. When was the meal
  2. How big was the meal in carbs
  3. How long do you expect your body to absorb the meal

Main screen

Main screen is split into three sections:

Glucose

First of them is historical glucose and predictions.

You can see more detailed prediction when you click "Eventually -.- mmmol/l"

Insulin

Second section is for insulin on board. Again you can view and edit the insulin entries by clicking the IOB X U on top right.

Warning

All insulin is assumed to be Fiasp. Open an issue for new insulin types

Carbohydrates

Final section is about your daily carbs and how they have been absorbed over time.

If you view the list of carbs you can see how much carbs we actually observed

Algorithm 📊

The algorithm predicts future blood glucose levels based on three factors:

  1. Last Known Blood Glucose: This is the most recent measurement of blood glucose. It serves as the starting point for future predictions.

  2. Remaining Carbs: This represents the amount of carbohydrates from a meal that has not yet been absorbed.

    • It is calculated by taking the total carbs, and reducing the amount already absorbed. However, the amount already observed is always increased at minimum absorption speed, to ensure that all meals fade out in appropiate time.
    • For remaining carbs, the absorption rate is assumed to continue at the recently observed pace, or at the minimum rate, whichever is higher.
      • $rate_{min} = \frac{carbs_{reported}}{decay}\frac{2}{3}$
    • If there are multiple meals, the algorithm tracks and calculates the remaining carbs for each one individually based on their reported absorption rate.
  3. Remaining Insulin: This indicates the amount of active insulin in the body and its anticipated reduction over time.

    • Insulin activity diminishes gradually, following a known decay profile based on the type and doses administered.

The algorithm combines these three factors to predict future blood glucose levels. It does this by:

  • Estimating how remaining carbs will raise blood glucose as they continue to absorb.
  • Accounting for how remaining insulin will lower blood glucose as it decays.

The final prediction is a balance of these opposing effects, providing an estimate of blood glucose levels over time. You can see all three factors in the prediction graph, where

  • green is the prediction without any insulin
  • red is prediction without any food
  • gray is the actual prediction considering both factors

Integrating with Freestyle Libre 2 / 3 📡

If you want to integrate Freestyle Libre into the app you need to run the piece of integration yourself. The documentation for that is covered in here: Github - librelinkup-to-iob-calculator

Credits 🙏

Big credits to folks at Loop. I have shamelessly copied many of their achievements and concepts.

Self hosting with docker-compose 🐳

  1. mkdir gluwave && cd gluwave
  2. wget -O docker-compose.yml https://github.com/Kalhama/gluwave/blob/master/gluwave/docker-compose.yml
  3. Put following to .env
#gluwve
DATABASE_URL=postgresql://postgres:pass@postgres:5432/gluwave?schema=public
DATABASE_URL_UNPOOLED=postgresql://postgres:pass@postgres:5432/gluwave?schema=public
GITHUB_ID=_
GITHUB_SECRET=_
# Get secret and id from: github -> settings -> developer settings -> OAuth Apps -> New OAuth Apps

#postgres, make sure these match with the conn url above
POSTGRES_PASSWORD=pass
POSTGRES_USER=postgres
POSTGRES_DB=gluwave
POSTGRES_DATA_DIR=./db
  1. docker compose up -d

Technology stack 💻

Bug reports, feature requests, support 🐞

Please fill a new Github issuse

Contact 📬

If you want to reach me personally you can reach me via mail max@kalhama.fi

About

Web based open loop application for diabetes management

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •