🔗 Project website: https://luisgoma4.github.io/Alcohol-web/
This repository presents an academic-oriented implementation of alcohol absorption and exhalation dynamics through data fitting and theoretical modeling in Python.
The project is grounded in pharmacokinetic formulations describing ethanol absorption, distribution, and elimination after oral ingestion. The model focuses on the relationship between ingested dose, absorption rate, elimination rate, and distribution volume in order to predict breath alcohol concentration (BrAC) over time.
The implementation has been designed to serve both didactic and research-related purposes, combining rigorous mathematical modeling with accessible visualization tools.
The computational approach relies on a simplified Michaelis–Menten-type pharmacokinetic model (e.g., Martin et al., 1984), which describes BrAC as:
[ C(t) = \frac{D \cdot k_a}{V_d (k_a - k_e)} \left(e^{-k_e t} - e^{-k_a t}\right) ]
Where:
This formula captures the rise and fall of BrAC:
Experimental datasets can be used for data fitting of (k_a), (k_e), and (V_d) to improve predictive accuracy across individuals.
Python’s SciPy and NumPy libraries are employed for:
The fitting process enables direct comparison between simulated trajectories and empirical BrAC measurements, ensuring both theoretical rigor and practical validation.
The entire modeling workflow is written in Python 3, with emphasis on reproducibility and modularity:
A Streamlit application is provided to enable interactive exploration of the model:
This allows the model to be used in-browser as a teaching and research tool without requiring advanced programming knowledge.
To ensure portability and reproducibility, a Docker container is included:
git clone https://github.com/luisgoma4/Alcohol-web.git
cd Alcohol-web
pip install -r requirements.txt
streamlit run streamlit_app.py
The app works like a mobile app with four full screens. Move between them with the bottom bar, by swiping, or with the Next button:
Model parameters (absorption, elimination, BBR, tolerance, time step…) have standard values and live on the Advanced screen, with a button to restore them. Styles are in style.css.
The interface is available in Spanish and English. Everything the user enters is remembered only in their browser (localStorage); nothing is stored on the server. Forget my data erases it.