My Authors
Read all threads
This is my artificial pancreas. Changed the cron job last night so it would only run between 9pm and 7am (~ while I'm asleep).
Built a tool 🙆‍♂️ this weekend to annotate the glucose data from @NightscoutProj, so I could build a better view of different things like exercise, alcohol, etc.
Now the graphs have a date attached to them, and the visual design has a bit more breathing space.
Going to be working on the "diabetic report card" next.
Et voila; the "report card" for t1 diabetics (prototype)

Showing both estimated HBA1c (average BG) and a metric called Personal Glycemic State, which includes variability.

The latter (PGS) is infinitely more insightful for a patient. How?
Here's the live data showed alongside the summary blip! Can you see how red days correlate with swings, not just an average?

#T1D #diabetes #wearenotwaiting
The Diabetic Report Card now shows the calendar dates too, and highlights the weekend vs. weekdays (some of us have pernicious lifestyles on the weekend).
The "Analysis" tab is where I label different parts of my diabetic day. There are lots of reasons why diabetic control can be bad -- today I was just tired, and forgot to bolus twice!

Annotations are highlighted in your graph too ;)

#t1diabetes #WeAreNotWaiting
Highlighting parts of your day and seeing the difference in your BGL - why would you want to do the math yourself?

#t1diabetes #WeAreNotWaiting #t1gym
HBa1c is well-known as being not representative of overall Time in Range.

Personal Glycemic State integrates the ups and downs, making it easier to comprehend where you're at.

Here you can see my average is yellow, meaning there's some improvement on the horizon ;)
One thing I hate about diabetes (as an engineer) is that you're basically reverse engineering a black box.

You're running experiments to determine parameters of your body's metabolic model.

Sleep, exercise, the types of food (high GI, low GI)...these all are variable.
For example, did you know that adding fat to a meal slows its digestion (and hence uptake of glucose into the blood)?

mendosa.com/The-Fat-of-the…
Cardio exercise will result in quicker insulin onset for the hours proceeding. Your muscle's stores of glycogen will also be replenished by the body, meaning you need less insulin.
As well as the fact that as you get fitter, you body gets more efficient at using energy. Naturally, your weight plays a factor in how much food/insulin you require too, and as it changes, so will your sensitivities.
This and many other things makes management *extremely difficult*. You're basically emulating all the functions of a pancreas, with the added delays (+1h) of non-human insulin.
As an engineer, I want to think about it using causes and effects, hence building/exploring a diabetic simulator.

And it works for a bit. There are rough rules - insulin follows a nonlinear release curve, carbs follow a linear curve, weighted by GI, exercise is constant 🔥.
And then there are the nonlinearities. Insulin sensitivity will change throughout the day, for complex reasons.

For example, I find that if I've got a high blood glucose level (BG), I'll be more resistant to insulin.

@bustavo has a great post on this bustavo.com/predicting-bg-…
10 years ago, diabetics were running this algorithm in their head, every day. 180 extra decisions a day.

Nowdays, we use a closed loop system. These involve a realtime glucose feed (CGM), an insulin pump, and a controller (an app or rig).

It's autopilot for insulin.
Now it's not a turnkey solution yet. The algorithm still needs your ratios to be correct (sensitivities etc), which involves manual testing. But it's an order of magnitude better than before.
So I began with a simulator to precisely calculate ratios. This failed because it was too reductionistic, ie. it needed more rules about aspects of metabolism I didn't understand.

Now I'm experimenting with something more similar to training NN's. Plain iterative optimization.
Today I finally added treatments from Nightscout to T1 Gym. I also started visualising insulin-on-board. It's different to NS, but feels a bit more intuitive.
Treatments look less noisy as bars. Also removed the IOB area curve, it wasn't conveying the information correctly.

This is starting to be useful!
Finally can visualise temp basals! Still some data normalising to do here, but pretty happy.

✅ Annotate glucose feed
✅ Full picture of insulin/carbs/auto temp basals
🤞 Experimentation begins!
Feels so good to have a "smart logbook" of my diabetic data that I can label and understand. #T1D
Someone on FB suggested I change it from report card to progress report. This makes total sense!

I've been using the colours, less so for the data summary, and more for motivation. I just want those 30 days of greeeeeeeeeeeen.
Iterate, iterate, iterate

We went on a 10km hike today. Thanks to the Loop app, I can enter carbs and get them into my Nightscout pretty easily.

Even though Loop is great, it can't yet inject glucose ;) So you still have to keep track of carbs as a diabetic, for exercise.
Just added a feature so the annotator can sum up how much I've eaten, which I can use as a rough gauge for next time I do 2hrs cardio (hint: v soon).

#WeAreNotWaiting
30 Day PGS is starting to get green 😍

A green PGS is my goal, but it's not showing me the actual progress I'm making on adjusting settings, behind the scenes...
Last week:
* identified I was probably overdosing for breakfast.
* went on 3 runs, a hike, and some rollerskatin'. Starting to paint a better picture of how to plan my glucose around exercise.
Also realising the different categories of "out-of-range events" that would be useful to view progress into.

A) Overdose/underdose - problem with insulin ratios.
B) Missed bolus - my fault.
C) Exercise - separate area for improvement.

Goal: 0 of category A, minimise B/C.
Well, today I finally got T1 Gym working for multiple users. Learnt Firebase's stack (which btw, great libraries/tooling) and moved all configuration / data into a cloud database.

Next step: getting it into the hands of users. Can't wait :)
As for my progress? 5 days of green :)
Onboarding my first 5 users today. Very keen to have people use my product.
Yikes, had a big swing last night while drinking.

Jumped into the logbook, started picking apart what I did wrong.

- Missed bolus for my bacon/eggs English cookup.
- Missed insulin for the various drinks I had.

So much easier having it in one place, visually.
Ugggggh that big red blotch on my streak tho'
Managed to figure out how drinking works. Need to dose for beers, but then liver gets occupied later in the night, so then I have to eat food/turn off the basal.

Last pic was of when I didn't understand this phenomena.
Got some rich user feedback today from 4 folks. Bug reports from two -- there's missing data in the charts.

👉 Given how mainstream looping will be with @Tidepool_org's Loop, I wonder why the #WeAreNotWaiting community hasn't come up with any standards? eg. RFC's
This is something that's particular popular in the tech ecosystem, eg. BitTorrent Improvement Proposals, RFC's, W3C specs etc.

And no, Nightscout's swagger.yml does not count 😅
I'm still navigating the problem space of t1 diabetes. Just spoke to a lady today who had STELLAR control. I could tell by her report card 😂

Related that I only just understood something as seemingly basic as alcohol. She told me she's had it for 30yrs & only got it at yr 15 😱
Saw my endo(chronologist) today. HBA1c of 8.5 November last year, now she says I'm on track for 6.5. 💫

Thinking about what I've done in those 6-9mo, I can say that only in the past 3 have I really understood the patterns better.
Here's the rough expertise I've refined--

👀 Patterns - exercise, drinking🍺 , low GI foods (pizza) and protein, hyperglycemic (high BG) insulin resistance

🔢 Settings - basal rates, morning sensitivity, correction ratios
There is of course nuance to all of these areas:

Drinking - dark beers have more carb than light ones

Exercise - makes insulin act quicker, so if I have a low GI food (bananas) pre-run, I'll usually only bolus halfway through, instead of at the time
And then sometimes it's just mishaps. Like when the pump site falls off, and then you reinsert it and the site starts bleeding.

So then you go low after, because heck, how much insulin has really been delivered? You don't know.
So with that, how would I define the patient journey to good time in range?

You have roughly 3-4 good days each week to optimize + improve. This includes reserving some downtime (you don't want burnout) and room for error (eg. things out of your control).
Of those 3-4 days, you're probably going to work down this list:

(1) Basal testing, in three 8h blocks (ie. morning, daytime, nighttime). This involves fasting, so it's humane to only test one block each day.
(2) Bolus testing, focusing on morning (since dawn phenoemena is a kicker), then lunch and dinner. Again, another 3 days worth.

There's room for error here, if you're not astutely aware of carb content. eg. I recently learned onions have just a little carbs in them
(3) Exercise. This should only require 1-3 workouts to get right. Figuring out how many carbs you need to sustain 60mins of cardio, and then the after effects of how it affects your insulin metabolism (more/less insulin, speed of action).
(4) Bolus testing but for protein (steaks) and low GI / fatty foods (pizza).

Both of these usually require some sort of dual wave bolus delivery on a pump. I set it at 2H, delivering 50% now and delivering the other 50% over 2h. Might be different for others.
(5) Drinking. Working out how much sugar is in your drinks (light beers = ~10g), the effects on your levels, whether you dose for that, and the threshold at which your liver stops gets too busy processing the alcohol that it no longer releases background glucose (mine @ 3 beers).
(6) Correction testing. You want to be getting better at dosing accurately, and correcting less, which is why this is later in the list. Again, it involves testing morning, lunch, and nighttime. ~3 days.
(6 cont.) As well as this, when you're high, you're more resistant to insulin. This is understated IMO and leads to a lot of frustration. Sometimes I'll need 1.5x to 2x more insulin to correct a high level. I still don't understand how much, though now I'm aware.
The background advice which makes this 2-5x easier:

❗️eating at intervals, rather than snacking. Cause-effect becomes so much clearer.
❗️reducing variance around start/end of day, eating the same breakfast/dinner
❗️eating low GI foods (lentils) which don't spike your levels
This is my framework I've built/applied this past 3mo. What's missing?

- adjusting behavioural patterns of bad mgmt (ie. bolusing less because you're scared of going low in a social setting)
- illness, stress, hormones, womens health (periods)
- quality of sleep
Traditional healthcare sucks at supporting patients, frustrates doctors and wastes their time.

I shouldn't be receiving PDF's of scanned printouts over email as an appointment reminder. Or god forbid, the actual post.

Appointments every 3mo? How about improving every week
How about a platform where:
- you can actually label your sugar levels and quickly identify patterns
- ask questions to your endo **in context**, like it's a Google Doc.
- progress through a defined rubric, rather than having the same convo 20x over at the doc's
I'm imagining the rubric looks like this -
There should also be a patient-curated, doctor-vetted knowledge base around common areas. I'm talking about:

- how alcohol works
- how fat affects digestion speeds
- women's health
- apps you can use to count carbs
- community-recommended strategies (eg. when going out)
- loop
The most modern healthcare product I've interacted with is @babylonhealth. Simple, Skype for GP's, same-day appointments, you describe the symptoms in the booking form itself. Prescriptions go straight to your local GP. Wastes nobody's time, just brilliant.
broke: using brainpower to manually enter data of insulin, food into hand-built Excel spreadsheets

woke: using brainpower to analyse patterns, optimize health, collaborate seamlessly
Here's your stack:

* FreeStyle Libre for realtime CGM
* @Tidepool_org uploader to get pump/CGM data in normalised formats.
* T1 Gym to visualise/diagnose/progress the journey.
* Healthcare specialists (endos) to answer Q's and vet knowledge.
* Community knowledge base.
That's it. That's the tweetstorm.
Spent some time brushing up the UX of loading screens and adding some branding. A bit more polished now :)
Missing some Tweet in this thread? You can try to force a refresh.

Keep Current with Liam Zebedee ⟠

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!