Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
observablehq.com
Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
1–8 of 8 posts
Re: Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
#2So this is a (simple) simulator, built to visually explore 2 questions:
1. How long can caffeine stay in your system?
2. When will caffeine levels fall back below a threshold with minimal sleep disruption?
The answer is, it depends... so I parameterized the notebook to try different options. Notes on the parameters / lessons learned are here: https://towardsdatascience.com/interactive-visualizing-caffe...
Take this with a big grain of salt. I'm not a pharmacist, physician, chemist, etc, and this hasn't been reviewed by one. But at least for me, being able to turn the dials on a simple half-life model and see the consequences has been eye-opening.
Default params are chosen based on: * https://www.ncbi.nlm.nih.gov/books/NBK223808/ * https://doi.org/10.1038/clpt.1987.126 * https://doi.org/10.1002/cpt197824140 * https://doi.org/10.5664/jcsm.3170 * https://doi.org/10.1111/j.1365-2869.2006.00518.x * https://doi.org/10.1016/0006-8993(95)00040-W
Re: Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
#3Re: Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
#4Are these defaults close to accurate? I've pretty much stopped drinking coffee and think I may have noticed a general improvement.
1. Even though some companies list precise #s for caffeine content, actual caffeine content can vary widely from day to day (259mg - 564mg) according to [1]
2. Caffeine half life varies from person to person, from ~1.5 to ~9.5 hours. So 5 is typical according to [2], but unless you're a smoker or on certain birth control I haven't found anything yet to say which end of the distribution to expect for yourself.
3. Caffeine sensitivity also seems to vary from person to person. And the "sleep threshold" is more of an upper bounds than a target, based on working backwards to figure out how much caffeine subjects had in their system and still saw sleep disruption in [3,4,5]. So participants in [5] slept worse when you'd expect them to have ~25mg of caffeine remaining in their system on avg, but that doesn't necessarily mean they'd have slept normally at 24mg.
These are covered in a bit more detail in the writeup: https://towardsdatascience.com/interactive-visualizing-caffe...
[1] https://doi.org/10.1093/jat/27.7.520
[2] https://www.ncbi.nlm.nih.gov/books/NBK223808/
[3] https://doi.org/10.5664/jcsm.3170
Re: Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
#5Re: Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
#6Re: Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
#7My coffee habit caused a numeric overflow by the looks of it.
Re: Show HN: Interactive: Visualizing Caffeine Halflives and Bedtime
#8My coffee habit caused a numeric overflow by the looks of it.
Yikes! I'd assumed you might reach toxicity before running out of digits! If you post the "share" link from the notebook I'll take a look. Or feel free to email me, my address is in my profile.
Once: you might expect restful sleep after 5am Twice: you might expect restful sleep after 6am Three: you might expect restful sleep after 12am
But 12am (midnight) is before 5am :-), so I assume it overflowed, or it means 12pm (the following day).