From research papers to app

By

In my free time, I've been focused on a very specific problem: how do I know how much caffeine I've consumed? I've built a tea caffeine calculator, a mate one, and now I'm building a mixture of a CLI/REST endpoint/package to help other people calculate the caffeine content of various types of beverages. However, what I want to talk about here is not the app itself, but where and how I got the data in there.

Although we can easily find data telling us about how much caffeine regular beverages have, in reality they can vary a lot. Coffee changes based on the type of coffee bean you are using, where it's from, and how you prepare it. Mate changes a lot based on how finely your mate is ground. Tea changes based on the type of tea and whether you are preparing it Western, gongfu, or grandpa style.

The first problem is that the only way to know how much caffeine we are consuming is to measure the caffeine itself in each cup or mate. But we can still get a better average than most websites give us. As an example, you can search Google right now. It will say that 50g of yerba mate has from 150 to 260 mg of caffeine. However, if you know the exact details of your mate, like if it's a Brazilian Native one, the scientific data tells us that in reality it's near 55mg, while an Argentinian one is near 290mg. With the maximum recommended per day being 400 mg, we can see how much the regular internet average gives us can cause some mistakes, making users drink less or more of their beverage than they want.

The second problem is, if you go to the scientific data, you'll see that most of the research is conducted using very specific parameters. They use controlled temperature, grams, and the tea/mate/coffee comes from a very specific area or even brand or farming. In summary, the data is so detailed and complex that to get the real caffeine we would need to go to the user and collect a sample of what he is really drinking. So, there is a need to simplify the data so that it can be useful to the user, but not so much that we circle back to being as useless as the regular web information is. What I did was select the main information that we can get from the user, like type of tea, grams used, volume, and create an algorithm that calculates a better average caffeine value for it.

To solve all these problems, I had to read and collect data from different articles, select those that make sense, and simplify them. As you can guess, no algorithm can calculate the exact value for natural products. In architecture and urbanism, we even use safety percentages on natural structural materials so we can be safe. The same is true for any natural food or drink. Knowing better what you are consuming can help you make better decisions for your health and enjoy your caffeine in a more mindful way.

For those who want to check, the repo that I'm working on is Caffeine Mega App