Add per-meal calorie cap (1000 kcal) + kcal/protein display
- SKILL.md RATIONAL PORTIONS: add ~1000 kcal/meal cap; trim starch/cheese/halloumi/lentil (not protein) if over; use scripts/calc_meal.py to check - scripts/calc_meal.py: estimate protein/kcal/fibre/satfat for a meal's items, flag over_kcal (>1000) + per-item max_per_meal breaches (unit-aware); gates daily sends - scripts/verify_portions.py: now also flags KCAL CAP violations via calc_meal - references/calories.md: per-portion kcal/macro estimate table (source of truth) - references/email-template.md + meal-history.md: show Est. kcal + Protein per card/entry - daily cron prompt: compute + record kcal/protein_g on each entry, show kcal in email, enforce 1000 kcal cap before send (pushed via cronjob update)
This commit is contained in:
@ -121,6 +121,19 @@ def main():
|
||||
f"{it['name']} {it['qty']} is >=70% of its cap and supplies "
|
||||
f"{pg:.0f}/{total:.0f} g ({pg/total*100:.0f}%) of meal protein "
|
||||
f"— not a balanced plate")
|
||||
# 3) calorie cap check (uses calc_meal helper if available)
|
||||
try:
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"calc_meal", os.path.join(SKILL_DIR, "scripts", "calc_meal.py"))
|
||||
cm = importlib.util.module_from_spec(spec); spec.loader.exec_module(cm)
|
||||
res = cm.estimate(meal_items, inv)
|
||||
if res["over_kcal"]:
|
||||
violations.append(
|
||||
f"KCAL CAP {e['date']} {e['meal']} '{e['name']}': "
|
||||
f"~{res['kcal']:.0f} kcal exceeds 1000 kcal/meal")
|
||||
except Exception:
|
||||
pass
|
||||
if violations:
|
||||
print("FAIL: rational-portion violations:")
|
||||
for v in violations:
|
||||
|
||||
Reference in New Issue
Block a user