Skip to content

Import Canada's CNF, France's CIQUAL and Finland's Fineli - #13

Merged
coderback merged 3 commits into
mainfrom
phase-7
Nov 7, 2026
Merged

coderback merged 3 commits into
mainfrom
phase-7

Conversation

@coderback

@coderback coderback commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to Phase 7: the three national food tables that were waiting for their files, plus a search fix they exposed.

Importers (packages/food-data)

Source Release Foods Other names Servings
cnf Canadian Nutrient File 2015 (Health Canada) 5,690 French CNF's measures ("1 waffle", "250 ml, chopped")
ciqual ANSES-CIQUAL 2025 (Anses) 3,341 with energy French none (CIQUAL has no portions)
fineli Fineli release 20, basic package 2 (THL) 4,231 with energy Finnish, Swedish pieces, portions, dl, tbsp, tsp
  • Each import is idempotent: a second run changes nothing.
  • Health Canada's and Fineli's sites refuse servers, so their release zips are kept unchanged in packages/food-data/data/ (7 MB) and checked by SHA-256 before every import. See data/README.md.
  • CIQUAL is downloaded from Recherche Data Gouv, where ANSES deposits it (doi:10.57745/RDMHWY), and checked by SHA-256. Its 69 MB XML is streamed.
  • Nutrients follow the existing rules: RAE for vitamin A, DFE folate where the table has it, preformed niacin, and carbohydrate as each source gives it.
  • CIQUAL's "< x" (below the lab's limit) is missing, not zero; "traces" is 0.
  • The Food data workflow can run cnf, ciqual and fineli.

Search (packages/backend)

  • A food now also scores on each of its names, not only on the search text that joins them all. So CIQUAL's "Chocolate croissant" leads a search for "pain au chocolat" instead of being buried under products with exactly that name.
  • Duplicates by name and brand are now removed in the query, before the limit. Before, 60 products called "Baguette" filled the limit and left 3 results.
  • Measured locally on 3.4 million foods, the change costs about 15–35 ms (p95 191 → 228 ms).

App and docs

  • Profile → Food data sources credits CNF, CIQUAL and Fineli with the wording and licence each asks for: OGL – Canada, Licence Ouverte 2.0 and CC BY 4.0.
  • ROADMAP, the plan, trust and safety, and the READMEs are updated.

Checks

  • food-data: prettier, lint and typecheck clean; 70 unit tests (25 new, including reads of the full kept releases) and 15 database tests (2 new).
  • Backend: prettier, lint and typecheck clean; 223 unit tests and 96 database tests. The 2 new search tests fail on the old code.
  • App: typecheck clean; lint with 0 errors and the 5 existing warnings; 61 tests.
  • Local import: all three imported into the 3.4M-food database, and searches by country return them (poutine, ruisleipä, croissant, Camembert).

After merging

Once the DIRECT_URL secret is set, run the Food data workflow for fdc, cofid, cnf, ciqual and fineli. Together they take about 170 MB, within the Free plan.

Three new food-data sources, each idempotent and tested on real rows:

- cnf: the Canadian Nutrient File 2015 (5,690 foods), with French names
  and CNF's measures as servings
- ciqual: the ANSES-CIQUAL table 2025 (3,341 foods with energy), streamed
  from its XML files on Recherche Data Gouv, with French names
- fineli: Fineli release 20, basic package 2 (4,231 foods with energy),
  with Finnish and Swedish names and Fineli's units as servings

Health Canada's and Fineli's sites refuse servers, so their release zips
are kept unchanged in packages/food-data/data and checked by SHA-256.
The Food data workflow can run all three.
Search scored a food against its search text, which joins every name
("chocolate croissant ... pain au chocolat"), so a national table's food
found by its French or Finnish name ranked below a product named exactly
that. It now also scores each name on its own.

Duplicates by name and brand were removed after the limit, so 60
products called "Baguette" filled it and left 3 results. They're now
removed in the query, before the limit.
Food data sources lists CNF, CIQUAL and Fineli with the credit and
licence each asks for. ROADMAP, the plan, trust and safety and the README
describe the new imports.
@vercel

vercel Bot commented Nov 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
grit-demo Ready Ready Preview Nov 7, 2026 1:54pm UTC

@coderback
coderback merged commit 7156927 into main Nov 7, 2026
5 checks passed
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.

1 participant