Hacker News new | ask | show | jobs
by eli-bryan 2096 days ago
I've never been a great sleeper. I knew caffeine could be a factor and I understood, at least intellectually, that caffeine’s half-life clearance meant that some of it might still be floating around my brain later in the day. But I didn't fully grok the dynamics until seeing it play out visually.

So 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