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.
- 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
Public instance is available for anyone at https://gluwave.com
Using Gluwave is simple with following steps
Update your carbohydrate ratio and correction ratio in the settings
You can add new glucose, carbohydrate and insulin entries from the bottom toolbar.
Example of adding new meal entry:
- When was the meal
- How big was the meal in carbs
- How long do you expect your body to absorb the meal
Main screen is split into three sections:
First of them is historical glucose and predictions.
You can see more detailed prediction when you click "Eventually -.- mmmol/l"
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
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
The algorithm predicts future blood glucose levels based on three factors:
-
Last Known Blood Glucose: This is the most recent measurement of blood glucose. It serves as the starting point for future predictions.
-
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.
-
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
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
Big credits to folks at Loop. I have shamelessly copied many of their achievements and concepts.
mkdir gluwave && cd gluwave
wget -O docker-compose.yml https://github.com/Kalhama/gluwave/blob/master/gluwave/docker-compose.yml
- 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
docker compose up -d
- Framework: Next.js
- ORM and database: Drizzle + postgres
- Forms: react-hook-form
- (Form) validation: zod
- Styles: tailwindcss, sass, normalize.css
- UI libraries: shadcn/ui
- Icons: lucide-react
- Linter: ESLint
- Formatter: Prettier
- Misc:
- Axios
- @tanstack/react-table
- and other at package.json
- Authorization: lucia-auth
Please fill a new Github issuse
If you want to reach me personally you can reach me via mail max@kalhama.fi