brutus / boozelib

a Python module to calculate blood alcohol levels
GNU General Public License v3.0
8 stars 2 forks source link

Alcohol degradation too high? #5

Closed aapris closed 3 years ago

aapris commented 3 years ago

The source code and documentation tells that Alcohol degradation average is 0.15 g/kg per hour (0.0025 per minute). https://github.com/brutus/boozelib/blob/afead0169562f57a24e2f68074b5a8e9bfd9b57a/src/boozelib.py#L84

This seems too high, most sources say that alcohol is eliminated from body about 0.1 g/kg.

Roughly one gram of alcohol per ten kilograms of bodyweight is metabolised in one hour in the case of an adult in normal condition. https://www.mycalculators.net/health/alcohol-calculator/how-long-does-alcohol-stay-in-your-system

Although rates vary widely, the “average” metabolic capacity to remove alcohol is about 170 to 240 g per day for a person with a body weight of 70 kg. This would be equivalent to an average metabolic rate of about 7 g/hr - - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3484320/

However, the page https://www.nutrientsreview.com/alcohol/absorption-metabolism-elimination-factors.html says The average alcohol elimination rate in mild and moderate drinkers is estimated to 0.015 g/100 mL blood/hour. Maybe the invalid value 0.15 has been derived from the code here?

brutus commented 3 years ago

For disclosure: I wrote this almost 10 years ago as a quick project to play around with Python packaging and I have no medical background at all :sweat_smile: I googled some texts and passed my results by a friend with a biology background for some measure. Sorry, but I can't remember the original source and failed to document it.

A quick (german language) Google search still turns up these or similar values quiet often (e.g. Wikipedia - english and german and police sources state 0.1—0.2 promille per hour so ~ the value I use in the code); but yes, I too came across texts with values closer to the ones in the articles you linked.

Anyway, the values I use here as defaults are in the high end and I'm inclined to lower them…

The first text you linked suggest 0.0017 as default value for ALCOHOL_DEGRADATION, the second a rather wide range from 0.0017 to 0.0024… The "responsible" thing to do might be to aim for the lowest, but that's also quiete a stretch as a default… :shrug:

What do you suggest?

aapris commented 3 years ago

I also have no medical background, but all other calculators gave so different results comparing to this, so I decided to file this issue. :) If I multiply boozelib's result with 0.6666, I get almost identical results comparing to the other calculator I've been using.

Because changing ALCOHOL_DEGRADATION to some other value (e.g. 0.0017) would break up existing apps which use boozelib, I'd probably add optional argument alcohol_degradation argument with default value 0.0025 to this function: https://github.com/brutus/boozelib/blob/3a129eb50b47de9f8e6c1fc2462bc6f2b5702aa4/src/boozelib.py#L96

def calculate_alcohol_degradation(*, weight: int, minutes: int = 1, alcohol_degradation: float = ALCOHOL_DEGRADATION) -> float:
    """Return the alcohol degeneration (in gramm) over time.
    For a person with *weight* (in kg) over the given *minutes*.
    """
    return alcohol_degradation * weight * minutes

Then I can instantly override current default with 0.0017, which I think is more correct. :)

And I might add also (in next version 0.7) warnings.warn("alcohol_degradation argument will be mandatory in future version 0.8", DeprecationWarning) warning just before return line, if the user of the library uses current ALCOHOL_DEGRADATION value and later make this argument non-optional. Or something.

brutus commented 3 years ago

@aapris sounds good :+1: I'll get to it this weekend.

Quick Update: https://github.com/brutus/boozelib/commit/ab9f1fa93976224786156706f895d1596193a3cc I'll build a new release later :sweat_smile: