### Local DynamoDB

I’m working on a side project that uses DynamoDB. I got tired of waiting for my DynamoDB table changes to complete, so I decided to try…

Looking through an old server from a hosting provider I’m migrating away from, I found an old algorithm I used to estimate blood caffeine concentration.

~~Just a word of warning, I’ve lost the link to the paper I drew this information from. If someone wants to find where my assumptions came from I’ll buy you a coffee.~~ **Update**: I’ve found the reference in an old notebook! Consumption and Metabolism of Caffeine — Biology Online.

Times here are specified to be in seconds from any arbitrary epoch. Since only time differences really factor into the equations it doesn’t matter what your epoch is.

Let $L$ be a constant value allowing us to approximate a person’s blood volume based on their body mass. I found $L = 0.007 \mathrm{\frac{L}{kg}}$.

Let $M$ be your mass and $t$ be the current time. Let $\lambda$ represent the half-life of caffeine in the body and let $\alpha$ represent an absorption coefficient. My estimates for these values are $\lambda = 5\,\mathrm{hours}$ and $\alpha = 1\,\mathrm{hour}$.

Let $a _ i$ and $t _ i$ be series representing doses of caffeine. $a _ i$ represents the amount of the dose while $t _ i$ represents the time of the dose.

The amount of caffeine in your bloodstream can be approximated by:

$\sum_i \left( \frac{ a _ n \exp\left({\frac{-(t - t _ n)\ln 2}{\lambda}}\right) \left( 1 - \exp\left(\frac{(t - t _ n)\ln 0.05}{\alpha}\right) \right)} {ML} \right)$~~Again, ~~ Even though I’ve found the references, that’s not to say that the assumptions I made are any good. I’m not a doctor. Use at your own risk.**I’ve lost the links to my original references.**

Below is the original algorithm. I hope I’ve faithfully translated it back to abstract mathematics. Later I’ll integrate it so that we can evaluate the effects of a slowly-consumed cup of coffee rather than considering consumption as a point event.