hei-calculator
hei-calculator is a Python package that calculates the Healthy Eating Index (HEI-2015) from dietary intake data stored in CSV files.
It is designed for researchers, students, and public health professionals who want to evaluate diet quality easily.
📖 What is HEI-2015?
The Healthy Eating Index (HEI-2015) is a scoring system (0–100 points) that measures how closely a diet follows the 2015–2020 Dietary Guidelines for Americans.
It includes 13 components covering fruits, vegetables, proteins, grains, fats, and sugars.
- Higher scores → Better diet quality
- Lower scores → Poorer diet quality
📝 Input Requirements
Your CSV file must include these columns:
kcal→ Total energy intake (kcal)F_TOTAL→ Total fruitsG_WHOLE→ Whole grainsV_TOTAL→ Total vegetablesV_LEGUMES→ LegumesV_DRKGR→ Dark green vegetablesD_TOTAL→ Total dairyPF_TOTAL→ Total protein foodsPF_SEAFD_HI→ Seafood (high in n-3 fats)PF_SEAFD_LOW→ Seafood (low in n-3 fats)PF_SOY→ Soy productsPF_NUTSDS→ Nuts and seedsPF_LEGUMES→ Legumes (protein category)G_REFINED→ Refined grainsADD_SUGARS→ Added sugars (grams)SOLID_FATS→ Saturated fats (grams)Sodium/SODIUM/NA/sodium→ Sodium (mg)
📊 Output
The package calculates 13 HEI-2015 component scores and one total score:
- HEI_total_fruits
- HEI_whole_fruits
- HEI_total_veg
- HEI_green_and_beans
- HEI_whole_grains
- HEI_total_dairy
- HEI_total_protein
- HEI_sea_food
- HEI_fatty_acids
- HEI_refined_grains
- HEI_sodium
- HEI_added_sugar
- HEI_saturated_fat
➡️ HEI_total = Sum of all 13 components
The results are saved in a new CSV file with these additional columns.
⚙️ Installation
Install from PyPI:
pip install hei-calculator
🚀 Usage
from hei_calculator import process_csv
# Example usage
process_csv("input_filepath.csv",
"output_filepath.csv")
Output only HEI columns
from hei_calculator import process_csv
process_csv("input_filepath.csv", "hei_output_only_filepath.csv", only_hei_columns=True)
👩🔬 Who Can Use This?
- Researchers working with dietary survey data
- Public health professionals evaluating nutrition programs
- Students learning about diet quality assessment
- Anyone interested in applying the HEI-2015 scoring system
📢 Notes
- Ensure all required columns are present in your CSV file.
- If sodium values are missing, the package sets
HEI_sodium = 0and shows a warning. - Calculations follow the HEI-2015 scoring standards.
📜 License
This project is provided under the MIT License.
Metadata
Release files for hei-calculator 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hei_calculator-0.1.5.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hei_calculator-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / hei_calculator-0.1.5.tar.gz
| Download URL | hei_calculator-0.1.5.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61ca1f472047236b09866963344a6c7102c5e17e5193773638efe17db8530aab
|
|
BLAKE2b-256 checksum How to use checksums |
bcb620710ccd6c69735a1fff4ed34d9a86fe692c138f2e80a08f14cf800d07e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Release files / hei_calculator-0.1.5-py3-none-any.whl
| Download URL | hei_calculator-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d522dbfb953f33bfe7562a492a188c6c63ed6ca26723cf243ac1305000acfba
|
|
BLAKE2b-256 checksum How to use checksums |
b46c72c9b36f96d3f66855321c02b87a31a9e9e7dc8a2861afe554f83f581894
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|