PKoffee - Coffee Productivity Analysis
A Conda package implemented in python for analyzing the relationship between coffee consumption and productivity through statistical modeling and visualization.
Project inspired by Le Café - Oldelaf for the S3 School 2026.
Features
- Data Analysis: Load and analyze coffee consumption vs productivity datasets
- Multiple Models: Fit various mathematical models (quadratic, Michaelis-Menten, logistic, peak functions)
- Visualization: Beautiful violin plots with model overlays using Seaborn
- Model Comparison: Automatic R² scoring and ranking of models
- Type-Safe: Full type hints for better IDE support and code quality
Installation
pixi install
Quick Start
from pathlib import Path
from pkoffee.data import load_csv
from pkoffee.productivity_analysis import fit_all_models
from pkoffee.visualization import plot_models
# Load your data
data = load_csv(Path("coffee_productivity.csv"))
# Fit models
fitted_models = fit_all_models(data)
# Create visualization
plot_models(data, fitted_models, output_path=Path("results.png"))
Command Line Interface
# Analyze
cd analysis && pixi shell
# fit models and save to toml
pkoffee analyze --data-file coffee_productivity.csv --output fitted_models.toml --show-rankings
# plot models predictions
pkoffee plot --data-file coffee_productivity.csv --models fitted_models.toml --output analysis.png --y-max 7
Project Structure
pkoffee-sol/
├── src/pkoffee/
│ ├── __init__.py # Python package
│ ├── cli.py # Command line interface
│ ├── data.py # Data loading utilities
│ ├── fit_model.py # Model definition and fitting
│ ├── fit_model_io.py # Model writing/reading to file
│ ├── log.py # Logging utilities
│ ├── metrics.py # Model evaluation metrics
│ ├── parametric_function.py # Mathematical models as parametric functions
│ ├── productivity_analysis.py # Coffee analysis
│ └── visualization.py # Plotting functions
├── tests/
│ ├── test_data.py
│ ├── test_fit_model.py
│ ├── test_fit_model_io.py
│ ├── test_metrics.py
│ └── test_parametric_function.py
├── README.md
├── pixi.toml
├── pixi.lock
└── pyproject.toml
Models Implemented
- Quadratic:
f(x) = a₀ + a₁x + a₂x² - Michaelis-Menten (Saturating):
f(x) = y₀ + Vₘₐₓ·x/(K + x) - Logistic:
f(x) = y₀ + L/(1 + e^(-k(x - x₀))) - Peak:
f(x) = a·x·e^(-x/b) - Peak2:
f(x) = a·x²·e^(-x/b)
Development
# Activate the environment
pixi shell
# use development dependencies like jupyter notebooks/ipython
jupyterlab
Tests
# Run tests
pixi run test
Linting
# Linting
pixi run lint
pixi run format
License
MIT License
Metadata
Release files for pkoffee 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pkoffee-0.1.0.tar.gz | 18.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pkoffee-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.2 kB
Release files / pkoffee-0.1.0.tar.gz
| Download URL | pkoffee-0.1.0.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe55754e651302b4c146625980d295a2520803bc3cb48e4f3f28148681a43d19
|
|
BLAKE2b-256 checksum How to use checksums |
e002d800239f7515f84609be2b0e2d29dc6a87dfa1522cd91b2d7a71f5ba6f6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / pkoffee-0.1.0-py3-none-any.whl
| Download URL | pkoffee-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
367f106e5870934eeb78653c21fe1ac2ae8f4fdfff2a437764bdc27cfcd518e7
|
|
BLAKE2b-256 checksum How to use checksums |
640e8052e28bfbf743cec9988d7648cde8adf17162ebefbb895b74079d4efcb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|