Auto-fill Grocy barcode package sizes from OpenFoodFacts + USDA FoodData Central — only when both sources agree.
Find a file
2026-06-21 18:28:42 -04:00
.gitignore Initial commit: grocy-barcode-size (kitchen brain) 2026-06-21 18:28:42 -04:00
enrich.py Initial commit: grocy-barcode-size (kitchen brain) 2026-06-21 18:28:42 -04:00
LICENSE Initial commit: grocy-barcode-size (kitchen brain) 2026-06-21 18:28:42 -04:00
README.md Initial commit: grocy-barcode-size (kitchen brain) 2026-06-21 18:28:42 -04:00
requirements.txt Initial commit: grocy-barcode-size (kitchen brain) 2026-06-21 18:28:42 -04:00

grocy-barcode-size

Auto-fills the package size (amount + unit) on your Grocy barcodes — but only when it's confident, so it never writes a wrong value.

When you scan a new product, Grocy stores a name but no size. This service looks the barcode up in two databases and, only if they agree, fills in "this barcode = 12 fl oz / 1 gal / 16 oz" for you. Different sizes of the same item simply become different barcodes, each remembering its own size.

Why "only when confident"?

Grocy stores a barcode's size as a default — a wrong one silently pre-fills the wrong amount on every future scan until you fix it in Product → Barcodes. So a wrong auto-fill is worse than a blank one. This service refuses to guess: it writes a size only when OpenFoodFacts and USDA FoodData Central both answer and agree (within ~10%). Otherwise it leaves the barcode blank for a one-time manual entry — which Grocy then remembers forever.

Coverage reality: national brands fill reasonably; store brands (ALDI, Great Value, Kroger…) usually have no data in either source, so those stay manual. No database has all grocery sizes — this just safely captures the ones that are knowable.

📖 Setup & usage live in the Wiki.

Roadmap

  • Optional confidence tiers (trust a single source for low-stakes items).
  • More size-string formats + richer unit handling.

License

GPL-3.0 — see LICENSE.


Built with help from Claude (Anthropic, Opus 4.8). Part of a self-hosted Mealie + Grocy "kitchen brain."