Open Food Facts 想解决的核心问题不是“把包装拍照存档”,而是建立一套可翻译、可比较、可追溯的受控语义体系,让全球志愿者贡献的脏数据能收敛到同一个坐标系里。这件事的难点从来不是存储,而是语义对齐:如何让“全脂牛奶”“whole milk”“Milch”指向同一个分类节点,并在其上叠加营养计算、质量评分和多语言查询。
API 的代际演进很能说明问题:v0 是“全字段一把梭”的松散 JSON;v2 引入 JSON Schema 校验和 fields 裁剪;v3 重新设计了响应结构(明确的 status / errors / warnings),schema 以文件形式随仓库维护。三代并存,本身就是数据债与兼容性压力的活化石。
graph TD
A[客户端 / 移动 App / 第三方] --> B[Mojolicious 路由层]
B --> C{"请求类型"}
C -->|"读取产品"| D[API 控制器(v2/v3)]
C -->|"编辑产品"| E[产品写入流程]
C -->|"检索"| F[搜索模块]
D --> G[字段校验与序列化]
E --> G
G --> H[MongoDB 产品文档]
G --> I[PostgreSQL 用户与会话]
G --> J[Taxonomy 多语言词表]
E --> K[营养分 / 加工分级 / 质量评分]
E --> L[图片存储与尺寸派生]
K --> H
F --> H
Product Opener is the server software for Open Food Facts and Open Beauty Facts. It is released under the AGPL license and is being developed in Perl, HTML and JavaScript as Free and Open-Source Software.
It works together with Robotoff, Open Food Facts’ AI system (in Python, which can also be installed locally) and the Open Food Facts App (which can work with your local instance after enabling dev mode), as well as Open Food Facts query and the upcoming openfoodfacts-auth. For a full architecture diagram, please read https://github.com/openfoodfacts
What is Open Food Facts?
A food product database
Open Food Facts is a database of food products with ingredients, allergens, nutritional facts and all the tidbits of information that are available on various product labels.
Made by everyone
Open Food Facts is a non-profit association of volunteers. 25,000+ contributors like you have added 1.7 million+ products from 150 countries using our Android, iPhone and Windows Phone apps or their camera to scan barcodes and upload pictures of products and their labels.
For everyone
Food data is of public interest and must be open (i.e., available to everyone). The complete database is published as open data and can be reused by anyone and for any use. Check out the cool reuses or make your own!
We strive to thoughtfully design every feature before we move on to implementation, so that we respect Open Food Facts’ graphic charter and nascent design system, while having efficient user flows.
We meet online on Mondays at 17:00 Paris Time (Europe/Paris), which is CET (UTC+1) or CEST (UTC+2 during Daylight Saving Time). For easy conversion in local time, check 17:00 in Paris.
If you’re new to Open-Source, we recommend you to check out our Contributing Guidelines. Feel free to fork the project and send us a pull request.
Writing tests
Code review
Please add new features to the CHANGELOG.md file before or after merge to make testing easier
Reporting problems or asking for a feature
Have a bug or a feature request? Please search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue. You can ask directly in the discussion room if you’re not sure.
Translate Open Food Facts in your language
You can help translate the Open Food Facts web version and the app at:
https://translate.openfoodfacts.org/ (no technical knowledge required, takes a minute to sign up).
Helping with HTML and CSS
We have templatized Product Opener, we use Gulp and NPM, but you’ll need to run the Product Opener docker to be able to see the result (see the How do I get started? section).
In particular, you can help with issues on the new design.
Frontend Build Scripts
For most contributors using Docker (recommended):
You don’t need to run any npm commands manually! When you run make up, a container called dynamicfront automatically handles building and watching your frontend assets (CSS, JS, and icons).
Join our discussion room at https://slack.openfoodfacts.org/. Make sure to join the #productopener and #productopener-alerts channels. Stéphane, Pierre, Charles or Hangy will be around to help you get started.
Contributors
This project exists thanks to all the people who contribute.
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Become a sponsor
Open Food Facts Personal Search project was funded through the NGI0 Discovery Fund,
a fund established by NLnet with financial support from the European Commission’s Next Generation Internet programme.
评论