Files
Shoppy/README.md
T
Fretux 460ca60914
Android Release Build / build-android (push) Failing after 7m11s
improve product details and shopping list guidance
2026-11-19 23:49:33 +01:00

45 lines
6.9 KiB
Markdown

# Shoppinguin
Shoppinguin helps adults understand supermarket products in the context of their nutrition and exercise goals. Scan a barcode or search Open Food Facts, then see a product rating, the reasons behind it, and how a serving relates to today's recorded protein and sugar.
## How it works
On first launch, users enter age, height, weight, and an exercise goal. The profile stays in local app storage. The profile screen lets them edit these values, set a personal **total sugar** planning value, manage allergens and dietary preferences, and enable offline mode.
Product ratings now use nutrition (45%), goal fit (20%), ingredients (15%), and allergies (20% when applicable). Only categories with known facts contribute to the numeric score. Missing information limits confidence. Confirmed avoided allergens still block a recommendation. Additives remain an ingredients signal; environmental impact is still displayed in product details but no longer affects the score. The shopping list remains available for planning and checking off products; price entry, totals and budget controls are no longer part of the app. Its nutrition summary uses only products with both a known per-100 g value and a known package mass, reports coverage and missing fields, and ranks the largest known contributors. Basket totals are explicitly not presented as a prediction of daily consumption. Sugar uses the user's planning value, while allergen and vegan or vegetarian cautions reuse the product-rating rules.
The product screen shows protein and total sugar per serving. Users can mark a portion as eaten and choose the stated serving, half or all of the package, 100 g, or a custom amount. The portion can be recorded for today or backdated to an earlier calendar day. The local daily log then updates the Home screen and subsequent recommendations. Entries can be edited or deleted, and earlier dates remain available in the expandable history. A seven-day view supports week-by-week navigation, shows nutrient-specific data coverage, and derives patterns only from logged days with complete data for the relevant nutrient. A scan or a shopping-list addition **does not** count as consumption. When the portion selector opens, it defaults to the stated serving size, then package size, then 100 g when no amount is available. The last fallback is approximate. Daily totals and insights cover only portions logged in the app. A product with missing nutrition values cannot fill those gaps and is never treated as zero.
The daily view also tracks salt and fibre for all goals. The product goal detail shows both without scoring them again because the Nutri-Score already considers them. For endurance goals, carbohydrates per serving contribute to goal fit; no daily carbohydrate prescription is inferred without training duration and intensity. For vegan diets, available vitamin B12 values are shown against the adult EFSA reference of 4 µg/day. Missing vitamin data stays unknown; a missing field never means zero or a diagnosed deficiency. OFF vitamin B12 is converted from grams to micrograms. Manual product editing can add these values from a label.
The profile groups daily values in a separate **Tageswerte** section. Protein is calculated from body weight and exercise goal: approximately 0.83 g/kg for general goals, 1.2 g/kg for endurance, and 1.6 g/kg for muscle growth. These are broad adult reference values, not a prescription. The default 50 g total sugar value is an editable planning value, **not** a clinical limit or a WHO free-sugars target; product data generally reports total sugars, including naturally occurring sugars. Setting it above 50 g shows a short warning explaining that WHO's less-than-50-g example applies to **free sugars** at 2,000 kcal and cannot be directly compared with the app's total-sugar data. Age and height do not change these two calculations. A reliable personal calorie estimate would require more information, so the app does not infer one from the available profile. Do not use the score to manage a medical condition.
The product detail leads with the recommendation, confidence and strongest influences, followed by a compact serving summary and clearly separated shopping-list and consumption actions. Rating details, data quality, alternatives, environmental context and raw product facts use expandable sections so critical information remains visible without forcing every supporting detail into the initial view.
Other useful features remain: manual product corrections, local product cache, offline scans of saved products, alternatives, shopping list, and environmental context.
When the alternatives section is opened, the product detail previews up to two better alternatives of the same specific product type. No alternatives request is made merely by opening the product. Suggestions do not cross broad groups such as soda to water. A lower-sugar soda can qualify even if its Nutri-Score grade is unchanged, provided its overall rating is not materially worse. The search checks related category tags and additional result pages before giving up, then tries product-type or category search terms when needed. The full alternatives view remains available. In online mode the preview sends category tags and, when needed, product-type, category, or name search terms to Open Food Facts; offline it uses only saved products.
## Run
```bash
npm install
npm start
```
Run the automated service tests with `npm test`.
Scan testing barcodes: `3017620422003` and `737628064502`. Online product data comes from [Open Food Facts Switzerland](https://ch.openfoodfacts.org/); the Swiss subdomain supplies the country context for searches. Environmental context uses a bundled [AGRIBALYSE](https://data.ademe.fr/datasets/agribalyse-31-synthese) extract. The app does not upload the personal profile or food log. Barcode and search requests are sent to Open Food Facts when online.
Cached products created before carbohydrate mapping was added are refreshed on the next online scan, even if they were fetched within the usual 24-hour cache window. Opening one from recent products also refreshes its detail view. In offline mode the old entry remains available and is marked stale until it can be refreshed.
## Reference values
- [EFSA dietary reference values for protein](https://www.efsa.europa.eu/en/efsajournal/pub/2557)
- [NIH Office of Dietary Supplements: exercise and athletic performance](https://ods.od.nih.gov/factsheets/ExerciseAndAthleticPerformance-HealthProfessional/)
- [WHO healthy diet: free sugars](https://www.who.int/news-room/fact-sheets/detail/healthy-diet)
- [WHO healthy diet: salt](https://www.who.int/news-room/fact-sheets/detail/healthy-diet)
- [EFSA dietary reference values: fibre](https://www.efsa.europa.eu/sites/default/files/2017_09_DRVs_summary_report.pdf)
- [EFSA vitamin B12 reference intake](https://www.efsa.europa.eu/en/press/news/150709)
- [NIH ODS: vitamin B12 and vegan diets](https://ods.od.nih.gov/factsheets/Vitaminb12-HealthProfessional/)