Caffeine countdown & Food group servings

From the health coach side of me, I'd love to see if a caffeine 'countdown' would be a viable option. Yes, I know that there are factors that impact it's metabolism, but in general, having a graph or something to show when/how much you have left in your system at any given time would be really helpful. This would be particularly useful for those with sleep troubles, use pre-workout, are breastfeeding, etc. Then people could see the impact of the amount/timing of caffeine intake on their bodies.

The Registered Dietitian in me would really love to see something that would show how many servings from each food group you're getting from the foods you log. I preach balance first, calories next (usually - since my patients aren't even ready for nutrition 101 yet). The USDA food tracker was great for this, but it's been shut down for a few years now and they never had an easy-to-use app. ESHA will do this, but honestly, only professionals use it and I HATED the UI.

Just some far-reaching ideas, I know...BUT they are ideas that no on else seems to have in their apps/sites, so it could be a selling point :)

Comments

  • I was JUST thinking about how I wish there was something that would track the food group servings. It'd really help me with making sure I'm eating more varied and hitting all my food groups.

  • I implemented this myself (python scripts, not generally useful for most users) and find it helpful. There is a lot of metabolic variation person to person, but it does give me a consistent way to estimate how much is left in my system at 10pm. The data is available in cronometer (gold) to via timestamps and amount of caffeine.

  • Hey @AnonJohn ....can I ask how you pulled this off? I'm sure I'm not techy enough to do so, but I think it's awesome that you managed that!

  • Hi @MoonlitMuse. Sorry for delay. Sure! First: One needs to be a gold member to get timestamps (you are). Second, export data as .csv. Third, import the csv into Pandas in python.

    The resulting "dataframe" needs the right field names and a datetime index. I use automated tools. That gets put into the function below, which returns a table estimating the caffeine and alcohol levels at 10pm. Some notes:
    1. Metabolism of caffeine especially can vary a LOT. This has a 6 hour half life, which is middle of the road. I wouldn't value the absolute answer, but it is comparable day to day.
    2. Some foods in the database (e.g. some chocolate) don't have caffeine.
    3. It's built on a half life (** = exponential in python)
    4. It includes the time it takes for caffeine (~1 hour) and alcohol (~½ hour) to get in the blood stream.


    def Anaylze_Servings(df):

    df2 = df.loc[df['Energy (kcal)']>10]
    
    results = []
    # Caffeine and alcohol
    for date in df.index.levels[0]:
        day = df.loc[date]
    
        temp = day.loc[day['Caffeine (mg)'] > 0]
        times = temp.index.get_level_values(level=0)
        timeofday = times.hour+times.minute/60
        deltas = 22-timeofday+1 #1 hour for metabolism / peak
        c = (temp['Caffeine (mg)']*(1/2)**(deltas/6)).sum()
        ic(temp['Caffeine (mg)']*(1/2)**(deltas/6))
    
        temp = day.loc[day['Alcohol (g)'] > 0]
        times = temp.index.get_level_values(level=0)
        timeofday = times.hour+times.minute/60
        deltas = 22-timeofday+.5 #.5 hour for metabolism / peak
        a = (temp['Alcohol (g)']*(1/2)**(deltas/4.5)).sum()
    
        results.append({'Date':date, 'Caffeine @ 2200': round(c,1), 'Alcohol @ 2200': round(a,1)})
    
    results = pd.DataFrame(results)
    results['Date'] = pd.to_datetime(results['Date'])
    results.set_index('Date',inplace=True)
    
    return results