<!--
  MAINS — DATA SOURCES AND ATTRIBUTION (source of truth; attributions.html is the hosted rendering)

  WHY THIS FILE IS NOT OPTIONAL. Two of the three food data sources carry licence obligations that
  are discharged by ATTRIBUTION, not by payment:

    · Open Food Facts is published under the Open Database License (ODbL 1.0). §4.2/§4.3 of that
      licence require that anyone using a Derivative or Produced Work be told the database is
      available under ODbL and be given the licence text or a URI to it. Shipping OFF-sourced
      macros in a food diary with no attribution is a licence breach, not a style lapse.
    · USDA FoodData Central is a U.S. Government work and therefore public domain in the United
      States — attribution is not legally compelled, but USDA asks to be cited, and citing it is
      how a user can tell a laboratory measurement from a community guess. This app's whole
      positioning is honesty about where a number came from, so it is cited.

  CITATION CONVENTION (same as the sibling files): every factual claim carries
      <!-- verify: path/to/file.ts:LINE — what that line proves -->

  LINE NUMBERS ARE ADVISORY, THE QUOTED CLAIM IS THE ANCHOR. Every citation names what the
  cited line proves, because line numbers drift the moment anyone edits the file above them —
  several of the files cited here were being edited in parallel work streams on the day this
  was written. If a number no longer lands on the right line, grep for the quoted behaviour;
  if the BEHAVIOUR is gone, the claim in this document is now false and must be changed.

  KEEP THIS FILE HONEST ABOUT WHICH RELEASE SHIPPED. The dataset slugs below are the ones baked
  into the catalog's row ids, so they are not decorative — changing a slug mints new rows rather
  than updating existing ones. If the ETL is re-run against a newer USDA release, the slug and the
  date in this file must move together with it.
  <!-- verify: tools/etl/usda/uuid5.ts:1-10 — "the id IS the provenance key … Namespace and name format are frozen" -->
-->

# Mains — Data sources and attribution

Mains's food data comes from three places: the catalog we ship, Open Food Facts, and the foods you
create yourself. This page credits the first two and states their licence terms.

---

## USDA FoodData Central — public domain

Mains's built-in food catalog is derived from **FoodData Central**, published by the
**U.S. Department of Agriculture, Agricultural Research Service**
([fdc.nal.usda.gov](https://fdc.nal.usda.gov)).

FoodData Central is a work of the U.S. Government and is in the **public domain** in the United
States. No permission is required to use it; USDA is credited here because a user is entitled to
know whether a number was measured in a laboratory or modelled from a survey.

Three FoodData Central datasets are ingested, and the app distinguishes between them because they
differ in how the numbers were produced:

| Dataset | Release used | What it is | How Mains labels it |
|---|---|---|---|
| **SR Legacy** | 2018-04 | The legacy Standard Reference: laboratory-analysed generic foods. | "USDA", shown as a verified entry |
| **Foundation Foods** | 2026-04-30 | Newer laboratory analyses with full provenance metadata. | "USDA", shown as a verified entry |
| **FNDDS (Survey Foods)** | 2024-10-31 (survey window 2021–2023) | Prepared dishes whose nutrients are **modelled** from ingredient profiles through survey recipes with yield and retention factors — nobody measured "Pad Thai, NFS" in a laboratory. | "USDA", shown as **modelled**, not verified |

<!-- verify: tools/etl/usda/uuid5.ts:19 — SR_LEGACY_DATASET = "usda-sr-legacy-2018-04" -->
<!-- verify: tools/etl/usda/uuid5.ts:42 — FOUNDATION_DATASET = "usda-foundation-2026-04-30" -->
<!-- verify: tools/etl/usda/uuid5.ts:72 — FNDDS_DATASET = "usda-fndds-2024-10-31" -->
<!-- verify: src/features/foods/data/provenance.ts:19-31 — the whole FNDDS tier ships verified = false BY DESIGN, and renders on the "modelled" rail rather than the verified one, precisely so a survey average is not presented as a measurement -->
<!-- verify: src/features/foods/data/types.ts:152 — a source beginning "usda" renders the "USDA" label -->

**Mains is not endorsed by, affiliated with, or certified by the USDA.** The macro figures shown in
the app may have been adjusted from the published values where USDA's own data contains a
documented defect (for example, rows whose stated energy cannot be reconciled with their stated
macronutrients); those adjustments are ours, not USDA's. Likewise, a vitamin or mineral figure that
Claude estimated for a USDA food, or corrected, is marked ✦ in the app: it is Claude's estimate,
not USDA's figure.
<!-- verify: shared/domain/macroSanity.ts:36-47 — the macro-sanity layer exists precisely because some USDA rows carry genuine data defects -->
<!-- verify: shared/domain/foodProfile.ts — Provenance: corrected / ai_replaced / ai_estimated are the ✦ (Art. 50) figures; a measured USDA figure is tagged with its dataset (DATASET_LABEL) -->

---

## Other catalog rows — Mains curated, and one Thai figure

A few catalog rows do not come straight from a FoodData Central dataset. Each is labelled in the app
by where it came from, never as "USDA":

| Row source | What it is | Licence | How Mains labels it |
|---|---|---|---|
| **Mains curated** | Everyday foods entered by hand by Mains. | Mains' own. | "Mains curated" |
| **Mains curated (brand consensus)** | A figure computed by Mains as a consensus over many USDA Branded Foods label declarations. | Mains' own; built from public-domain USDA records. | "Mains curated (brand consensus)" |
| **USDA SR Legacy (derived)** | A row computed by Mains from one SR Legacy record. | Public domain, like its source. | "USDA SR Legacy (derived)" |
| **Thai Food Composition Database** | One food (fresh baby corn), from the table published by the **Institute of Nutrition, Mahidol University (INMU), Thailand** ([inmu.mahidol.ac.th/thaifcd](https://inmu.mahidol.ac.th/thaifcd/)), the source and copyright holder. | Not an open licence. One published value set is used with this acknowledgement; the table itself is not redistributed, and no shared food profile is built from it. | "Thai Food Composition Database" |

<!-- verify: shared/domain/foodProfile.ts — DATASET_LABEL: seed → "Mains curated", branded_consensus → "Mains curated (brand consensus)", usda_sr_derived → "USDA SR Legacy (derived)", thai_fcd → "Thai Food Composition Database"; SHARED_CATALOG_SOURCES excludes thai_fcd "until its licence is confirmed" -->
<!-- verify: supabase/migrations/20260801100000_0017_catalog_missing_foods.sql — the brand-consensus row: "a robust consensus over USDA Branded" label declarations, source = 'branded_consensus' -->
<!-- verify: supabase/migrations/20260806100000_0022_catalog_fresh_baby_corn.sql — the Thai FCD row: INMU named as source and copyright holder, licence left NULL on purpose ("THIS IS NOT AN OPEN LICENCE") -->

---

## Open Food Facts — Open Database License (ODbL 1.0)

Packaged and branded products come from **Open Food Facts**
([world.openfoodfacts.org](https://world.openfoodfacts.org)), a collaborative, free and open database
built by volunteers.

**Open Food Facts data is made available under the Open Database License (ODbL) v1.0**
([opendatacommons.org/licenses/odbl/1-0/](https://opendatacommons.org/licenses/odbl/1-0/)).
The individual product contents are available under the Database Contents License v1.0
([opendatacommons.org/licenses/dbcl/1-0/](https://opendatacommons.org/licenses/dbcl/1-0/)).

What that means here, in plain terms:

- Any Open Food Facts data you see in Mains remains available under ODbL from Open Food Facts.
- You are free to use, modify and redistribute that data yourself under the same licence.
- Where Mains shows an Open Food Facts product, it is marked as such in the app, and the mark
  travels with the entry into your diary so the source is still visible weeks later.
  <!-- verify: src/features/foods/off/openFoodFacts.ts:32-35 — the ODbL attribution requirement, and the note that OFF-sourced rows are surfaced as Open Food Facts community data -->
  <!-- verify: src/features/foods/off/toPendingFood.ts:24-26 — "ATTRIBUTION SURVIVES THE LOG (ODbL, honest by construction)": the mark rides brand_snapshot into the diary -->
  <!-- verify: src/features/foods/off/openFoodFacts.ts:130 — OPEN_FOOD_FACTS_LABEL = "Open Food Facts", the single human label used wherever an OFF food is attributed -->

<div class="callout">

**Open Food Facts data is community-entered and is not verified by Mains or by Open Food Facts.**
Mains discards rows that are physically impossible and shows at most three suggestions, but a
plausible-looking number can still be wrong. Check the package.

</div>

<!-- verify: src/features/foods/off/openFoodFacts.ts:24-30 — "OFF DATA IS DIRTY (the governing assumption)"; unusable values are dropped, never guessed -->
<!-- verify: src/features/foods/data/useFoodSearch.ts:24-31 — the hard cap of three OFF rows -->

Open Food Facts is contacted **directly by your device**, not through our servers, when you search
or scan; see the [privacy policy §4.5](./privacy-policy.html#outbound) for what that request
carries.
<!-- verify: src/features/foods/off/openFoodFacts.ts:190-195,400-404 — plain fetch() from the client, User-Agent "Mains/1.0 (mains.app)", no Authorization header -->

**Shared food profiles derived from Open Food Facts.** When a packaged Open Food Facts product is
in someone's log, Mains' server fetches that product from Open Food Facts itself and stores a
vitamins-and-minerals profile of it — the product's own figures, plus Claude's estimates of what it
does not list — in a table every Mains user who logs the product reads from. That table is a
database derived from Open Food Facts, and it is made available under the **ODbL v1.0** like its
source: Open Food Facts is credited for it here and on the food in the app, and a copy of the
Open Food Facts part of the table is available on request from support@mains.app. A product
edited on Open Food Facts in the last seven days is not added to it.
<!-- verify: supabase/functions/ai/handlers/off-dossier.ts — the server-side fetch by GTIN (OFF_USER_AGENT "Mains/1.0 (server; support@mains.app)") and the mapping into the stored source_panel -->
<!-- verify: supabase/migrations/20261021100000_0053_food_profiles.sql — an OFF profile row carries license = 'odbl' (CHECK: present exactly when gtin is) -->
<!-- verify: supabase/functions/ai/handlers/food-profile.ts — last_modified_t within 7 days → rejected(off_too_new), answered off_device: the product stays on the device tier -->

---

## Open-source software

Mains is built on React Native, Expo, PowerSync, SQLite and a number of other open-source
components, each under its own licence (predominantly MIT and Apache-2.0). A full dependency
listing is available on request from support@mains.app.

<!-- OWNER: if you would rather publish the list than field requests, `pnpm licenses list` produces
     it; drop the output into an acknowledgements page and link it from here. -->

<footer>
Mains — Data sources and attribution · Last updated 21 October 2026 ·
<a href="./privacy-policy.html">Privacy</a> · <a href="./support.html">Support</a>
</footer>
