Skip to content

Add the shared food module - #1

Merged
kalfasyan merged 1 commit into
mainfrom
module
Nov 3, 2026
Merged

kalfasyan merged 1 commit into
mainfrom
module

Conversation

@kalfasyan

Copy link
Copy Markdown
Contributor

The food tables Troye and Shoppa share, moved out of Troye's backend/foods without its database code.

From Troye, unchanged in behavior: the USDA reader and bundled table, the NEVO reader (CSV, Excel, zip), Normalize, plural stemming and name scoring (now exported as Stemmed, FieldScore, CoversAll, HasOtherWord), and the Open Food Facts parsing.

New:

  • Client{UserAgent} with Product(ctx, site, code) and Export(ctx, url); each app sends its own User-Agent. Product also works with OpenProductsFacts and OpenBeautyFacts.
  • ReadExport(r, countries, add) keeps products without nutrition, with Food.Nutrition false. Troye filters on Nutrition and Plausible to keep exactly what it kept before.
  • Food gains Quantity (package size), Categories (OFF category tags) and ImageURL (the small front photo).
  • OFFPhotoAttribution for the CC BY-SA photo credit, next to the ODbL one.
  • USDARenamed(t) replaces Troye's RenameUSDA, which needed the database.

Not here, on purpose: storing, importing and ranking stay in each app.

After merging, tag v0.1.0 so Troye and Shoppa can require it.


Generated by Claude Code

Reads Open Food Facts (export and live lookups, including Open Products
Facts and Open Beauty Facts), the bundled USDA table and NEVO downloads,
and has the search helpers. Products without nutrition are kept, with
Food.Nutrition false, and products now carry their package size,
categories and a small photo URL.
@kalfasyan
kalfasyan merged commit 3e97e21 into main Nov 3, 2026
1 check passed
@kalfasyan
kalfasyan deleted the module branch November 3, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants