-
Food Rescue App Documentation
-
About. A publicly visible document for project planning, feature planning and knowledge management for
the open source Food Rescue App.
-
Source. This document is viewable as a
Dynalist document on the Internet, in a more comfortable form with list folding. That is also where to
edit the document.
-
Project Resources
-
Documentation
-
Source Code
-
Websites
-
Databases
-
Obvibase (manually written food rescue content)
- Needs upgrading to the Pro plan to share with others with write access.
-
Goal and Motivation
- What is it?
- a food edibility informer
- Problem to solve
- Food waste is a problem for society as a whole, with enormous consequential damage to the
environment and the climate. For example, over 12 million tons of food are thrown away every year
in Germany alone,¹ and about 40% of that in households. A key factor is the best-before date. If it
is exceeded, many throw away even unspoiled food because of uncertainty. The best-before date is an
overly carefully date chosen by manufacturers, often even amounting to deception of the consumer:
at the request of supermarket chains, manufacturers sometimes provide products that are produced at
the same time but carry different best-before dates.
¹ Figures from 2015, according to a study by the University of Stuttgart. See: article
on zeit.de.
- Unspoiled food needs a real chance of being eaten. This is not only climate protection and
environmental protection, but ultimately also relevant for the global implementation of the human
right to adequate nutrition. Hunger is only a distribution problem!
- Approach
- The aim of the project is to develop a solution that builds consumer confidence in food,
regardless of the best-before date. Specifically, it will be an application on mobile devices
(“smartphone app”) that quickly and conveniently informs how long food can actually be kept and how
its edibility can be reliably assessed. Consumer protection in the information age means rich
information instead of a single date. Among other things, information on the normal behaviour of
food during storage and processing should be included. That knowledge can often no longer be
assumed among consumers, since many of the more complex processes in domestic food processing (such
as canning) have been displaced by industry.
- Users will access this information by reading the GTIN barcode that is available on all
packaged food into the application, using the camera of their mobile device. This is convenient,
fast and practical, and differs from the existing approach of project “Eat By Date”, where this information is presented on a website in
the form of an encyclopedia.
- This project is non-financially supported by the open source project "Open Food Facts", founded in 2012. Open Food Facts provides a
mobile application for displaying data about food products, and also already has a large community
of relevant users, documented by over 500,000 installations of the Open Food Facts Android
application. Specifically, the collaboration with Open Food Facts aims for the project to be
implemented as additional functions in the existing Open Food Facts Android application. If
necessary, implementation as a separate application with API connection to Open Food Facts is also
possible.
- In any case, users will have the opportunity to contribute and update information about the
storage life of food items by themselves. This prevents the database from becoming obsolete, and
corresponds to the way in which the existing Open Food Facts database is set up and maintained with
information about nutrient content, ingredients, allergens, etc.. All information will be provided
free of charge and under the same open licenses that are already used in the Open Food Facts
project.
- Producers and laboratories will also be able to contribute information. Whether the application
will explicitly support the publication of shelf life tests depends on how readily manufacturers of
food products sold in Germany will respond to our requests to publish the results of these tests.
At this point it should be noted that a political requirement for the publication of such shelf
life tests would significantly increase the benefits of the application described here. But even
without such detailed data for individual products, useful information can be offered at the level
of product categories (such as "fruit juice, pasteurized").
- Goals
- For everyone
- less wood waste
- contribution to climate protection
- contribution to environmental protection
- For users
- Confidence when handling stored food.
- Rescue food and feel good ("dumpster diving at home").
- Possible impact
- The idea can have several types of impact:
- climate protection
- ecosystem protection
- groundwater protection
- Note that this idea is meaningful because it allows an individual developer or a small group to
have a much larger benefit for ecosystems, climate protection and ending global hunger than going
into ecosystem restoration, farming or similar endeavours in the "physical world".
- From a 2019 study "Ernährungsreport" of the German ministry of nutrition and farming (as
referred by welt.de), food waste
composed of items that are still edible in principle has the following composition in Germany
(excluding the farm level):
- fresh fruits and vegetables: 34%
- self-prepared meals: 16%
- bread and baked goods: 14%
- drinks: 11%
- dairy: 9%
- ready-made meals and deep frozen food: 7%
- other: 9%
- According to the same study, the reasons given by consumers for throwing away these still
edible food items are: concerns about food expiration / edibility after storage (58% of cases), too
large portion sizes (21%), bad amount selection at the time of purchase (12%). It can be assumed
that, in the majority of cases where consumers were concerned about edibility of edible (!) food
after storage, and expired best-before date raised these concerns. When throwing away for example
rotten vegetables, it is not counted in this statistic. In a minority of cases, consumers might
wrongly assess a food item to be inedible, while in fact it is. For both sources of the edibility
concern, better information can help.
- With this information and the 40% of food wastage happening in households (also referred in
that study), we can calculate the possible maximum impact of an app that properly informs about
food expiry, which currently causes 58% of food wastage in private homes: 40% × 58% = 23.2% of all
food waste in Germany could be avoided.
- Later, the app can also help with tips for proper amount planning for cooking and shopping, and
for food preservation when too large amounts are around. That would solve the two other main
reasons consumers give for wasting edible food, causing 21% and 12% of food waste, respectively.
Altogether, that could save up to 40% × (58% + 21% + 12%) = 40% × 91% = 36.4% of all food waste in
Germany.
-
Plan
- Official milestones
- (M1) Definition of requirements. In the beginning, it will be decided which information
about the storage life of food should be provided via the mobile application. That depends on the
practical relevance of the information, on consumer protection regulations and on the details of
the cooperation with Open Food Facts.
- (M2) Data structure agreement with Open Food Facts. Since the collected data on the
storage life of food should be contributed to the Open Food Facts database, a suitable data
structure is agreed on with the Open Food Facts core team. From what we discussed so far, the core
team is generally open to this type of data, but details still need to be discussed and
agreed.
- (M3) Implementation of the software. The planned program functions are first implemented
in a copy ("fork") of the Open Food Facts codebase. We will repeatedly seek the opinions of
developers from the Open Food Facts team to facilitate the later integration of our code.
- (M4) Data research. In addition to the implementation of the software, we collect easily
available data on the storage life of food items. These should relate to food items that are in
widespread use, in order to give the application a high practical value right from the start.
- (M5) Integration of the software. We contribute our code extensions to the official Open
Food Facts Android application, their server software and potentially their web frontend.
- (M6) Data entry. All collected data is now added to the database via the official Open
Food Facts application. It will be possible to contribute data in multiple languages (including
German). The initial data entry within the scope of this project will not necessarily consist of
only data in German, since Open Food Facts is a worldwide project with English and French as its
main languages.
- (M7) Implementation for iOS (optional). If there is still time available, the same
software functions will also be implemented for the Open Food Facts application for Apple iOS
devices.
- Timeline
-
2020-03-01: Project start.
-
2020-03-15: Website launch.
-
2020-03-17: Meeting with Open Food Facts in Paris. #discarded
- 2020-04-15: Agreement on all data formats and the API with Open Food Facts.
- 2020-04-25: User interface defined.
- 2020-05-25: Test 1.
- 2020-05-15: Test 2: the first, internal test of the software.
- 2020-06-01: Test 3: Alpha release available for testing.
- 2020-07-15: Test 4: Release Candidate 1 available for testing.
- 2020-08-01: Test 5: Release as part of the official Open Food Facts app.
- 2020-08-21: First filling with data and text completed.
- 2020-08-28: Texts of the first filling also available in English.
- 2020-08-30: Final test before the Demo Day.
- 2020-08-31: Demo day.
- Target Group
- The beneficiaries of the project include everyone who prepares food in private households and
would be willing to use a mobile device ("smartphone" or "tablet") - in other words, all citizens
who already use such a device regularly and in a variety of ways.
- In order to reach this group, the project is being implemented in cooperation with the Open
Food Facts community. This is the world's largest open data community in the food sector and
consists mainly of consumers. The central tool of this community is a free and open source Android
application that has been installed more than 500 000 times. By integrating the software functions
developed in this project there, all these users automatically receive these functions with the
next update of their Android applications. It can be expected that many users of this application
will discover the new functions during normal use of the application, since this functionality is
visible immediately after barcode scanning on food packaging (which is the main function of the
application). It has to be noted that, while this is the plan, we might discover during the project
that our envisaged data are not compatible with the conventions and expectations of the Open Food
Facts developers, in which case the software functions would become part of a third-party mobile
application that belongs to the Open Food Facts ecosystem.
- Added value
- When and why do people use our product?
- When they want to rescue / eat expired food items but are unsure how.
- Why is our product important for society?
- Reducing food waste is a contribution to environmental and climate protection and fairness
of resource ditribution.
- User lens
- What user groups did we reach? And how many users do we have?
- existing Open Food Facts app users: 5000 at the end of the grant support period, ≥100 000
at some time later due to updates of the Open Food Facts app
- new Open Food Facts app users: 500 at the end of the grant support period
- How and where do we find our users?
- Updates of the Open Food Facts app.
- Medium-term web publicity by means of high-quality articles about rescuing food that then
generate organic traffic for finding the app.
- Reviews on food blogs, recipe websites etc..
- Team lens
- What is needed for the project to live on after the end of the grant support? Which partners,
contributors and team members do we have to find for that?
- The maintenance of the contributed code will be ensured by the core team of the Open Food
Facts project. Open Food Facts requires donations, contracts from public bodies etc. for
continuously funding its operations. Contributions of article content about food expiry, and
the translation of these articles, would ideally happen by the users of the app, but this can
be as difficult as Wikipedia finding authors. So ideally there would enough funding to keep one
author writing these articles.
- How do we achieve this?
- Translation tasks can be made more efficient by using automatic translation tools and then
editing the results. Also, a small crowdfunding feature could be integrated into the app to
enable funding for the expansion of certain articles. With some funding but not enough to pay
an author permanently, writing sprints for active volunteer authors from the community could be
organized, in the form of attractive real-life events.
- Tech lens
- What core features and functionality did we develop?
- Showing the expiry period in the product facts when viewing a product in the Open Food
Facts app, and support for entering them using the app.
- The tab "Shelf Life" in the Open Food Facts app.
- A shelf life label providing summary information in the overview mode for a product viewed
in the Open Food Facts app.
- A web interface for the above information, on the Open Food Facts website.
- What are the most important steps on the way there?
- Defining the type and format of the data in collaboration with Open Food Facts.
- Implementation.
- Release of the code as part of the upstream application "Open Food Facts for Android".
-
Features
-
About
- A list of all accepted and proposed features of the Food Rescue App project. Features that deserve
more detailed discussion or planning are additionally linked to their own subnode.
- Features should only be described functionally, from a user perspective, yet without details about
how they would be implemented.
-
Done
- Offline use for the mobile app.
- The mobile app should work completely offline. For that, all data would be provided as a SQLite
database bundled with the app.
- Content of the bundled SQLite database:
- Food rescue knowledge items. Each with literature references, translations in other
columns, the area that the knowledge item belongs to, and the food categories to which they are
applicable.
- Literature references. The works of literature referenced in the knowledge items.
Literature references would include the full quote, but that would not be included into the
published version of the SQLite databases because it is copyrighted content.
- Translation of barcodes to food categories. References would be made to the most
specific categories, which are then connected to more generic ones with a hierarchy.
- Food categories hierarchy.
- Referencing authoritative sources.
- For the per-category information articles about edibility, storage and waste salvaging, Open
Food Facts will require the information contained there to have "fact status". A simple and proven
way to achieve that would be to apply the Wikipedia authoring standards about use of authoritative
sources, neutral tone etc.. Because both kinds of texts are about established facts, and not about
opinions, original research and the like.
- Food rescue content source formats.
- Asciidoctor #accepted
- Asciidoctor is a perfect choice for a nice-to-edit markup syntax because it is designed as
"DocBook written as plain text". DocBook is the markup in the Food Rescue App native format,
and since the Asciidoctor tool (1) is a Ruby gem and (2) can convert Asciidoctor text to
DocBook, all of the development work for conversion is already done.
-
Asciidoctor
syntax is chosen over the original AsciiDoc syntax because it is a more modern,
compatible superset and the de-facto standard as of 2019 (see). It includes some Markdown
compatibility syntax, which would be used as the default in the project.
- The Asciidoctor files would be named `.adoc` and managed directly in Git.
- CSV+Asciidoctor #accepted
-
Reasons for CSV.
- By using CSV format, way, non-developers can contribute content with a reasonably
comfortable editing workflow. For local editing, they would check out the CSV file from
Git, edit, commit to Git using the Github web interface. For online editing, they would
just edit an Obvibase online database, which is
even more comfortable, allowing many occasional collaborators.
- CSV is already heavily used as the source format for Open Food Facts products, so it
fits well into the ecosystem.
- The only multi-value field in food rescue content topics are the Open Food Facts
categories, and these can be encoded as one category per line in a multiline field
value.
-
Reasons for Asciidoctor. (For use in the main content CSV column, which is the only
field needing any formatting.)
- It is used as the DocBook compatible source format in this application already
(see),
so also using it inside CSV is natural.
- To allow people to choose an editor they like, formatting should be done using a
text-based markup language, rather than relying on any limited visual formatting that some
CSV / data table editor tools might support.
-
format
documentation
- BibTeX #accepted
- A widespread format for literature databases.
- Used because it is the native format of asciidoctor-bibtex, the literature
management solution for Asciidoctor.
- third-party content formats #accepted
- For imported content, for example from FoodKeeper App, no format can be
enforced. Instead, import scripts would be developed to automatically import these source
formats to the food rescue content database.
- CSV+Markdown #discarded
- DocBook XML #discarded
- DocBook is used as the Food Rescue App native format,
so writing in DocBook seems an obvious choice.
- However, writing in DocBook is too technical for many potential contributors, and "not
nice" to edit for everyone. So the equivalent, plain text markup language Asciidoctor is chosen
instead.
- DocBook XML bibliographies #discarded
- Discarded after moving to Asciidoctor as the DocBook compatible source format, for which
asciidoctor-bibtex is the
bibliography management solution an BibTeX the format.
- Since bibliography entries have many fields, semantic markup makes sense here even if
DocBook Topics are never used for data entry.
- Standard DocBook tools can be used to transform the raw bibliography to a rendered version
that can be included into the SQLite3 database.
- This also makes it easy to generate PDF and EPUB versions later, as the bibliography is in
the right format already.
- DITA XML #discarded
- DITA is a XML format for writing technical documentation. But compared to DocBook, it has
two drawbacks: (1) its unnecessary
complexity, a tribute to its origins in big business (IBM) rather than the open source
scene; (2) its lack of elements so that it often has to be extended (see).
- TEI P5 XML with extensions #discarded
- TEI is the most widespread standard for semantic text encoding in academia (example). All
knowledge items would be put into one single TEI XML document, like a book. Own additional XML
elements will be used where needed, esp. to include machine readable knowledge representation
etc..
- The problem is the unnecessary complexity of this format – a tribute to its origins in
academia rather than the open source scene. But it would provide what is needed, including rich
ways to describe citations and the bibliography. (overview). This
includes referencing cited
pages.
- LibreOffice Calc spreadsheets #discarded
- The improvement of using this format over CSV would be some limited visual text formatting
(bold, underline, colors, hyperlinks) and visual table formatting of headers etc.. However,
this is not worth it, as it's a messy format not meant for data storage. The visual formatting
can still be used after running a custom CSV-to-ODS import script.
- For proper management with Git, use the `.fods` Flat XML format rather than `.ods`
(see). For later collaborative authoring of
this document, use an online installation of Collabora Office.
- LibreOffice Writer (with custom styles) #discarded
- The styles would have to be basic, using Markdown compatible formatting for data entry.
Each knowledge item would use literature references and be tagged with Open Food Facts
categories and knowledge item categories.
- The advantage is that this approach also directly allows creating books and e-book
documents for use outside the Open Food Facts software. Just that the structure in this book
would follow the categories used by Open Food Facts.
- For proper management with Git, use the .fodt format rather than .odt (see). For later collaborative authoring of this document,
use an online installation of Collabora Office.
- Problem: transforming from the messy LibreOffice XML format to something clean. So
why not write directly in that clean format, such as DocBook XML.
- YAML+Markdown / JSON+Markdown #discarded
- The idea is to use documents in an object storage format like YAML+Markdown (with a YAML
Schema) or JSON+Markdown (with a JSON Schema). This would be directly managed in Git.
- Problem: one would have to introduce a custom syntax and parser for literature
references. Also, editing is not visually comfortable and also requires adherence to a strict
text format, and thus not much better than editing XML source.
- Open Food Facts wiki #discarded
- This would use the OFF wiki as a web
browsable and web editable version of the knowledge base ("Wikipedia style"). From there, the
content would be automatically and regularly taken over into the Open Food Facts database,
stored into a field of "categories" records.
- The information would be stored in a separate namespace ("FoodRescue:" or Storage:" or
"Edibility:"). In there, there would be one page for each category, and one sub-page for each
sub-category.
- At least at some time in the past, there was a system in place by which translations of
nutrient names were managed in a code block of a wiki page, then used on the openfoodfacts.org
website. See:
https://en.wiki.openfoodfacts.org/Translations_-_Names_of_nutrients
https://en.wiki.openfoodfacts.org/Translations_-_Index_page_-_Danish
https://en.wiki.openfoodfacts.org/index.php?title=Special:AllPages&from=Reuses+of+Open+Food+Facts
- For the German versions of the content, it would be possible to have a deicated German wiki
set up. But it might be better to provide translations as sections of the same wiki page. Or as
sub-pages, with the main page being the English one. So the URLs would be, for example:
https://en.wiki.openfoodfacts.org/Alcohol/Wine for the English version
https://en.wiki.openfoodfacts.org/Alcohol/Wine/de for the German version
See relevant source materials in the subnodes.
- @teolemon: "We have a French wiki, but we try and use the English one. so that we can
share as much info without the barrier of language."
(https://openfoodfacts.slack.com/archives/C02LKEZ9R/p1441975857000011)
- @stephane: "@teolemon suggested, it is probably best to use
http://en.wiki.openfoodfacts.org for the time being. We have a French wiki
http://fr.wiki.openfoodfacts.org but it is mostly not used now. You can create pages in
Spanish on the en.wiki"
(https://openfoodfacts.slack.com/archives/C02LKEZ9R/p1442927234000027)
- Food rescue content native format.
- The native file format of the Food Rescue App is a SQLite3 database with a specific table
structure. The main food rescue content field contains DocBook XML semantic markup, while all other
fields are not sub-structured. To render the food rescue content to screen, applications have to be
able to parse and transform a subset of DocBook 5.1 XML.
- DocBook is a project that emerged for the documentation of open source software, so it is not
overengineered and has a reasonable complexity (see). It is also
very widespread in open source projects, making it a good choice in yet another open source
project. It is also supported out-of-the-box by XMLmind XML Editor. Also, in version 5.1 it
supports all necessary features: topics, citations with page numbers,
bibliography etc.. Finally, it's perfect for generating PDF, EPUB and HTML versions of the food
rescue content with the usual DocBook tools.
- SQLite3 being the native format means that the first step is converting source content into it:
content is authored in various source formats by project collaborators and third parties
(see) and
a script then imports all source files into a SQLite3 database.
- SQLite3 being the native format also means that this format is used as the basis for all
further processing and conversion steps, including: (1) export to other formats, such as DocBook,
(2) live usage in software applications, (3) distribution for live usage in software applications,
(4) data analytics and sanity checks. For that, the SQLite3 format must contain all relevant source
data, without losing any semantics of source data. For example, saving pre-rendered bibliography
entries to the database is not enough.
- An alternative would be to store Asciidoctor formatted text in the database rather than DocBook
XML. However, that's not a good idea as DocBook XML is a simpler to parse equivalent. Also, there
is no native Java or C++ implementation of the Asciidoctor format (though something via JRuby is
available). Anyway, Asciidoctor is clearly meant as a source format, not a presentation
format.
- Food rescue, storage, preservation and salvaging information per category.
- Topics as unit of knowledge. One unit of knowledge written and stored as a whole and
attached to the same set of categories is called a "topic" here and in the software.
-
Additional columns for structured data in a semantic form. Most topics will consist of
information in natural language text. Some relevant data is however applicable to all categories
of food and can and should be given in a semantic form rather than as plain text, enabling
further automatic processing to calculate and show badges, labels, danger levels etc.. This
information should be provided in dedicated database columns, including:
- danger of food poisoning (unnoticeable toxic changes over time)
- storage duration under various conditions
- average storage life of food items in the same category
-
Attaching to categories. Open Food Facts has detailed categories of products already, and
they are applied like tags: each product can be in any number of categories. By attaching the
expiry information to these categories, it will be simple to provide all food items with relevant
expiry-related information.
The most important categories of food to focus on are, in this order: fruits, bread, vegetables,
cheese, yoghurt, milk, eggs. This is from a study about food waste on the household
level (figure 1).
- Rendering topics as bullet points. In general, topics will be short and very specific,
rendered as a bullet point with a line header in bold, as also seen in this very document. The
DocBook Topic title is the line header, the content is the bullet item text. It is ok to have even
20 topics per section, for example "Pantry storage", "Fridge storage", "Freezer storage" etc.. If a
topic becomes too complex to be rendered like that, then its abstract will be rendered like that,
and its title linked to a separate document that renders only this topic.
- Specific to general. Attaching the information to both specific and general categories
allows to write about the most general methods ("smell and taste") in the most general categories
of food items, and that information will then be displayed along more specific information (if
available). The app would show the most specific content first, then moving to content from the
more and more general categories. This way, a user can stop reading when encountering information
that they have seen before.
- Detail levels. This information should come in multiple levels of detail, from a
one-glance label that indicates if a food item's storage life is "problematic" or not, to
summaries, to all the details incl. references to journal articles etc..
-
Unproven content. To be able to show content that is not authoritative and potentially
dangerous, there should be a special inline tag, rendered with an orange background or similar.
People would be able to configure the app to also show this content after confirming they
unerstand the risks. This can be implemented using the DocBook profiling attributes for conditional
text. Possibly, people would only be shown the unproven content after successfully going through
a course and test that proves they understand all the basics of food safety. That could be an
online course in the browser at the end of which they get a key to unlock this content in the
app.
- Rendering with placeholders. Knowledge items should be rendered using the generic name
of food items in the associated category. So, they would mention "cheeses" in the rendering even if
the knowledge item is applicable to more categories, by using a simple system with placeholders.
That makes the texts more readable without redundant storage.
- Traditional knowledge. There is no need to limit food rescue information to what is
known in and applicable for highly industrialized countries. Instead, also include traditional
knowledge from interviews with skilled cooks and farmers from all over the world. This is quite
simple to do – just hire somebody from a developing country on Fiverr to ask their parents and
grandparents for their knowledge about food storage and preservation.
-
Content sections. Knowledge items with food rescue information would, in addition to food
categories, be tagged by the content sections they are meant to appear in. When rendering the
knowledge items, they are aggregated not by category but by content section and sorted "most
specific to most general" within these. Each knowledge item is then rendered as a bullet point.
Proposed content sections to show, in order and with the corresponding value for use inside the
database, CSV files etc.:
-
Risks and caveats (`risks`). A risk assessment in case of making mistakes during the
edibility assessment, and an assessment of how simple or difficult the assessment of a
certain category of food is. This (risk and simplicity) should be displayed in a
fast-to-understand way, using a kind of self-defined categorization scheme. The idea is that
the "risk-free and easy" cases should be encouraging for new users to try, to then work their
way up to the others over time. Also including information about special dangers for small
children, elderly people or pregnant people or other groups in case of eating spoiled food
items. Because that seems to be a concerns of many consumers (inspiration here).
-
Edibility assessment (`assessment`). Instructions to assess the edibility of food
items. Including how to detect edibility / toxicity issues with non-expired food items, for
example the problem about mould inside hazelnut kernels and inside pistachio, and the dangers
posed by that. Or the danger of ergot in grain, as the app should also be good for gardeners.
(One idea for presentation could be to use flowcharts rendered from a definition in
pseudocode – see.)
- Symptoms and causes (`symptoms`). When people know already how to estimate the
edibility of the item at hand but detect a change that they don't know how to deal with, then
this section is for them. It lists symptoms in a compact way, with pictures, and then the
causes and their edibility impact after clicking on the symptom. Example symptoms: the proteine
crystallization on capers, the white bloom on chocolate, moulds of different types, spots on
walnut kernels etc.. Should also include all kinds of plant diseases and imperfections that
occur during growth.
-
Rescuing spoiled and damaged food (`post_spoilage`). Instructions for how to rescue
half-spoiled food, or food that has spoiled but where that does not make consumption
dangerous. Spoiled food may include food contaminated with dirt and germs after falling down.
Examples:
- How to prepare potatoes with sprouts safely.
- How to use soured milk.
- How to use overripe fruit for alcoholic fermentation.
- How to remove mold where that is safely possible (bread, hard cheeses, jam etc.).
- How to boil some types of potentially spoiled food to make it safe to eat.
- How to clean different types of food after it fell down or otherwise became dirty. For
example, pieces of chocolate may be cleaned under running warm water so that some chocolate
melts away and takes the dirt with it.
- How to assess, treat and use food after fridge or freezer had been defunct for a
certain time.
-
Donation options (`donation_options`). Suitable ways to donate this food item,
selected from the closest drop-off locations that accept this type of food item (depending on
if it requires refrigerated or frozen storage). See the related feature about donating surplus
food.
- Edible parts (`edible_parts`). Information about what parts of food items are edible
and not. For example, cherry kernels are toxic, while the stalk of broccoli is edible.
Including information about how to prepare usually non-eaten but edible parts of food items.
For example, the core of broccoli stalks can be eaten raw and tastes like celery.
-
Cleaning out packaging, and cleaning pots and plates (`residual_food`). Residual waste
in food packaging is another food waste problem, and optimizing package designs for better
clean-out is supposed to
have a very good ROI. Before that happens, tips that show customers how to clean packages
would achieve the same goal. For example "shake empty honey jar with warm milk". In addition,
some tips would be given how to clean out pots and plates, such as wiping clean with bread.
- Pantry storage (`pantry_storage`). Informing consumers about the right storage
conditions and expectable storage time is also an important method to avoid food waste. This
section would give rough estimates about storage duration in various standardized storage
conditions (warm and humid, warm and dry, cool, and in the other sections about fridge and
freezer storage etc.). It is important to include all general storage conditions encountered
globally, including tropical and desert conditions and instructions also for people without a
fridge, without a freezer and under unfavourable climatic conditions (hot and humid, mostly).
Also, this section would include instructions about how to store a food item, here in the
pantry. Detailed instructions can often be given as a link to an article on the web.
- Refrigerator storage (`refrigerator_storage`). Like section "Pantry storage", but
about fridge storage. For example, how and where to store various vegetables and fruits in the
fridge. And how long seafood, raw meat prepared meals and other perishable items are storable
in the fridge under what conditions. Basically, how does storage time combined with temperature
("degree hours") affect the storage duration of food items that need cold storage.
- Freezer storage (`freezer_storage`). Like section "Pantry storage", but about
freezer storage.
-
Other storage types (`other_storage`). Like section "Pantry storage", but about
storage options beyond pantry, fridge and freezer that do not deserve an own section each
because few products will have information here. It includes, among other:
- Storage in the root cellar. Using the "dig into the sand" method or
similar.
- Storage of preparations. This is relevant for all leftovers of meals in the
household, and for other cases like: storing eggs after boiling, storing the egg yolks or
whites after using the other parts, storing meat after cooking, storing raw milk after
boiling etc..
- Storage of large amounts. Commercial traders might also use the app. For them,
extra tips for storing and handling large amounts of food would help.
- Preservation instructions (`preservation`). Storage instructions exclude special
shelf life extension treatments, but this is documented here now. Including techniques for
freezing and canning, giving links to detailed instructions and recipes where adequate. In many
cases, preservation instructions can be given as a link to an article from the web, plus a
summary. For cases where food safety is critical (such as for pressure canning, meat canning
etc.), the article should come from a trusted / authoritative source.
- Preparation instructions (`preparation`). Instructions for cooking and other
preparation means that are relevant for food safety. Such as safe minimum temperatures etc..
This is not about recipes.
-
Reuse and recycling ideas (`reuse_and_recycling`). Even when food was spoiled,
throwing it away is not necessarily the only option. The same applies to inedible parts of
food items, spent coffee grounds etc.. This section informs about potential uses. Any
additional use before ultimately throwing away something is waste avoidance and resource
protection. Examples include:
- recipes to use residues from juicing
- using spent lemon halves for washing dishes (avoiding detergent)
- using coffee grounds as fertilizer
- home-composting all kitchen scraps and food waste
- food waste burial as an alternative to composting
- burning nut shells and many other kinds of kitchen scraps (except bones and meat) in a
wood stove
- home-growing fruits and vegetables as a way of full-circle waste utilization
- biogas production for cooking from kitchen wastes, and using the remainder as compost
tea (will only be used in low-infrastructure areas, but the app is just as well meant for
these areas)
- ways to recycle the nutrients contained in feces and urine (as links to web articles;
this will only be applicable to some areas, but for these some areas a composting toilet or
urine as nitrogen fertilizer can be very helpful)
-
Production waste (`production_waste`). A lot of food waste is implied in the
production of food, for example when feeding 10 kg corn and soy to cattle to produce 1 kg of
meat. Information would be given as a 95% CI range with a typical value for the category;
such data is available from scientific studies. Where it can be estimated more exactly, as a
smaller range or exact value would be given for a specific product. Ways to determine the
value more exactly are for example the origin of beef (which allows to include the typical
feed there, e.g. grass on marginal land vs. soy), certification of meat (free-range cattle
for example), origin of almonds (to know if they required irrigation) etc.. There would also
be an option for "I grew this myself with homemade compost", which would be the only one that
creates no waste. Information that can be included here to combat upstream food waste:
- how much food is consumed to produce a given food item
- how much water and energy is consumed to prouce a given food item
- greenhouse gases emitted to produce a given food item
- food items that can serve as alternatives with less upstrem waste, and links to recipes
for using them
- Packaging waste (`packaging waste`). Information about the degree of harmfulness and
wastefulness of the packaging materials, and ways to reduce that. For example, reuse and
upcycling ideas for packaging material, including for beverage cartons etc.. And telling people
when the packaging is especially harmful because it protects a product much more than needed;
best example, bottled water compared to drinking water from the pipeline supplied to everyone's
house. That tip would only be presented when the system can be sure that the piped water is
potable – for that, the user would choose their region in the app settings.
-
Now
-
About
- Essential features to implement until 2020-08-31. Roughly in order of implementation.
- Standalone mobile app.
- The app should be a standalone app (not part of the Open Food Facts Android app), because it
should be able to work offline, and that can be argued for data privacy reasons of not collecting
IP addresses.
- Implementation technology
-
Proposal: (best one so far) Create a small standalone app in C++, using Qt for
Android, incl. QML for the user interface. That way I can learn both C++ and Qt5, which will
help me with developing desktop applications under Linux. The problem might be how to use the
HeartDroid expert system when developing the app in C++. For more details see the feature
proposal for a cross-platform
app.
- Proposal: Implement this app as another build variant of the Open Food Facts Android
app. This way, taking over selected features into the official Open Food Facts app is simple as
no code from that app has been removed – just hidden in a way so it did not get included into
the build. For example, taking over the online query mode but not the offline data storage into
the official Open Food Facts app is simply by changing in the code what happens in which build
variant.
- Proposal: Base it on a stripped-down version of the OFF Android app. That should
simplify later integration with their app, as the naming, folder structure etc. will already be
compatible. Also, be keeping the code and data structures for querying the Open Food Facts
server, the app is prepared for the future feature of including other information (packaging,
nutrients, ingredients) into the edibility evaluation.
- Proposal: It should be written in Java and come with a small self-made Java library
to render content obtained from the SQLite database. With that library, similar functionality
can be added to the official Open Food Facts app if they are open to it, or included into their
API responses otherwise.
- Card-style display of food rescue information.
- This is esp. suitable for the app format where there is little screen space available and one
needs big buttons and not small hyperlinks for comfortable interaction.
- The food rescue content for one product would be structured by (1) headings for the different
content
sections, (2) multiple cards in each content section, each displaying summary information for
one food rescue topic, (3) full details of the food rescue topic incl. literature, error spotting
information etc. after clicking on a card.
- The card text would be supplied in database column `topic_contents.summary`, renamed from the
current `topic_contents.title` which is not needed because topics are generally very short. In
contrast to a title, card text can be slightly longer and use a limited set of formatting (bold
print, perhaps some icons).
- In addition to the text, a card would show what to expect when clicking on the card to see the
topic details, such as "(details, sources, risks)", with "risks" in red so people won't miss
it.
- Since the detailed information can be critical for food safety (example) users
should be triggered to look at the card detail view, if there are details.
- Some cards might link to external sources (blog articles etc.). That's ok if this is indicated
on the card.
- Donating surplus food.
- A way to donate / give away food that one does no longer want / need / is in danger of expiring
/ is just too much. Then one can go and pick it up in the neighborhood. Can also be combined with
Second Food: "Donate to Second Food".
-
Proposal: #accepted Provide information about drop-off points for food donations by
private individuals. This should use a map view with data provided by OpenFoodBank, and include
(1) locations, (2) opening times, (3) accepted types of food (pantry, refrigerated, frozen). This
data would be provided by users of OpenFoodBank depending on what data they enter into their
profile, and would constitute the OpenFoodBank service offer for private individuals. In
addition, data about FoodSharing Fairteiler drop-off
points can be included. Since this data does not require interaction with a third-party server
(beyond map display) or account creation, it is suitable for inclusion in the offline Food Rescue
App as well as into the Open Food Facts app. This information would be displayed in its own
section of food rescue information.
- Proposal: As above, but additionally include the dataset of Foodsharing "Fairteiler"
points where people can drop off their food donations. Again, this dataset would be included as an
offline dataset.
- Proposal: #discarded Provide a food donation feature for private individuals that works
without explicit account creation. Instead, the account would be created in one click, using a
device ID, the Android device's Google Account or similar, and all messaging related to pickup or
delivery of the food items would happen inside the app, similar to how it's done in the BlaBlaCar
app or in eBay small ads for example. This would utilize the public area of Open Food Bank, so that
all items offered by individuals can be ordered by anyone (not just organizations of needy people).
That makes sense, as the primary concern is to prevent the food items form being thrown away. The
time that an offer stays active would be pre-filled automatically by the system based on the
preceding edibility assessment, to make sure no "really rotten" products are on offer and to
automatically remove offers that find no takers.
- Proposal: #discarded In addition, there would be the option to log in with e-mail
address and password into an OpenFoodBank account for institutional offers, using the closed-off
"wholesale" area of OpenFoodBank where only charitable organizations can access the offers. It may
be better to create a new app for this purpose (re-using the Food Rescue App's framework) to make
it focus on this single purpose; or it may make sense to integrate this feature into Food Rescue
App to allow shops to do an edibility assessment before donating surplus food (but in practice,
there will probably be very little need for that).
- Allowing users to check food rescue information for errors easily.
- Since Open Food Facts is a user generated database, mistakes are quite frequent. As that
influences what food rescue information people see, that could lead to dangerous consequences. For
example, if the storage life information of crispbread is shown to a user who purchased ground meat
that made it by mistake into the crispbread category.
- To allow app users to recognize these mistakes in time, each piece of food rescue information
should tell to which products it applies – at least when viewing it in a more detailed mode.
- Conversion workflow for food rescue content.
- Transformation tools. No special purpose software will be used to transform content for
distribution. Rather, simple SAX parsing and transformation in Ruby scripts. Alternatively, XSLT
transformation might be used, but as this introduces a new technology that should only be done if
it simplifies the tool complexity considerably.
- Source format transformation for distribution. The information from the `info` XML
element and the topic type will be stored into database columns of `knowledge_items`. Machine
readable knowledge representation is also removed and instead aggregated and used to train a model.
Everything else – the actual text content – is rendered to HTML and stored in column
`knowledge_items.text`. This leads to the least amount of processing compared to storing XML;
except if a HTML display widget is able to display XML with an associated stylesheet directly.
- Source format transformation for display. The HTML snippets and relevan values from
other columns are rendered into a HTML template at the time of display.
- Bibliography transformation for distribution. When storing the food rescue content into
the distributable database, the bibliography enties will be rendered to HTML and stored into
database table `bibliography`. A bibliographic style for rendering the entries is employed to
reduce the amount of data to store and to be able to store it all into one column. Knowledge items
refer to bibliography entries by ID, which is also recorded into a m:n table
`knowledge_items_bibliography`. The full text quotations are not stored into the database.
- Bibliography transformation for display. For display, a page shows a subset of
applicable knowledge items, and the associated bibliography entries as a linked list at the bottom.
That bibliography list is generated on the fly by merging the bibliography lists of all knowledge
items.
- Cross-platform application (mobile, desktop, web).
-
Implementation technology. Qt5 is used for implementation. In particular, from within the
Qt ecosystem, with QtQuickControls2 are
used, not Qt Widgets and not QtQuickControls1. The use of Qt Quick (here QtQuickControls2)
implies using QML. The reason for QtQuickControls2 is that according to here only this – the
newest – technology allows to create Android apps in the native looking "Material" design, which
is is Google's look&feel for Android apps. The same "Material" design will be used on iOS, as
there is no native-looking iOS design yet (only the default Qt look "Default" and the Windows 10
look "Universal").
-
Reasons for Qt. It is the choice with by far the best cross-platform compatibility (see
below). Also Qt is a stable toolkit that is not vanishing anytime soon, insured both by being an
open source project and by having a profitable business model. Alternatives that lead to embedded
web applications (Electron etc.) are unacceptable. The only other main alternative would be
Flutter, using JavaScript compiled to native applications. However, its desktop support is only emerging as of 2020-05 and it does not
support mobile platforms beyond the commercialized Android and iOS platforms. There is also
Xamarin, but likewise it only supports
Android and iOS, and Linux is not even supported as a development platform, and on top of that it
relies on .NET and C#.
-
Implementation language. The frontend of Qt applications can be described in QML (with
some embedded JavaScript). The backend is usually written in C++, but other choices are possible.
For example, Ubuntu Touch Qt applications can be written in Rust, Go, Python or JavaScript
(see). Also, there are Ruby
bindings for Qt and ways to execute Ruby code on Android, so even Ruby could be used (but it
would be very experimental). In order to tie in with the larger Qt developer community and
perhaps attract some contributors from there, sticking with C++ seems preferable.
-
Supported platforms. Qt5 with QML allows to support:
-
Major mobile platforms (Android, iOS). It is totally possible to use Qt5 to write a
cross-platform mobile app for both Android and iOS. See for example this report.
-
Minor mobile platforms (Ubuntu
Touch, Sailfish OS, LineageOS,
Windows Phone, Blackberry). Support for these is the unique strength of Qt, compared to
all other cross-platform frameworks. Ubuntu Touch integrates Qt as the main way to write
native applications (see)
and it's similar for SailfishOS (see). similarly
This is great, because it is a kind of moral obligation to not become captured in
commercialized platforms like Android and iOS – supporting them is necessary for reach, but
at the same time and with the same codebase one must always support truly open platforms like
Ubuntu Touch and Sailfish OS (which at least plans to become fully open source).
-
Major desktop platforms (Windows, OS X, Linux). Qt5 supports many desktop platforms,
and when using QML, all of them can be targeted with the same code. That includes Windows,
Mac OS X, Linux etc.. See many examples (some incl. source code) in the Qt showroom, and some more here. Also see
the desktop / Android cross-platform
instructions by the KDE project, incl. a tutorial and a repository of ported KDE applications.
-
Web application. This is about an application that serves HTML+JS+CSS. With some
tricks, this can be one of the platforms targeted with Qt5 QML. For details see feature
web
application.
-
Web server. For general web use, including for integration with
the Open Food Facts Android app, a server application with a RESTful API should be
created from the same codebase. That is easily possible, as only plain C++ code is needed, no
Qt.
This server software can re-use much of the C++ code of the Food Rescue App for mobile and
dektop platforms, namely data retrieval and HTML rendering. The software for the web server
platform can be the same as the same executable as the GUI software for the Linux platform,
just with a switch to run "headless". But perhaps it is cleaner to place the re-used code
into a C++ library and create a separate command-line application using that library. That
would also open up the possibility to create a Ruby gem with native extensions for that
library, and then to implement the web server software in Ruby. A similar thing might be
possible with language bindings for Perl, which fits better into the Open Food Facts
ecosystem. In any case, the same SQLite database is used for data retrieval that is also
included in the Food Rescue App mobile application, so updating the data storage is
effortless.
-
Challenges and solutions
-
Amount of JavaScript in QML. It is possible to define the UI's behavioral aspects in
JavaScript embedded into QML. However, this is not mandatory, as the behavior can also be
defined by C++ code. It is however also not detrimental because in adition to the usual
interpreted execution with a JS Runtime, "QML and JavaScript code can be compiled into native
C++ binaries with the Qt Quick Compiler." (see). So in total, it could be good to define all
behavior in QML-embedded JavaScript that would be defined in JavaScript in a web application
– so anything that does not need to happen on a server. Because that could be a great path to
allow Qt to target the web platform directly; for details see feature web
application. At the same time it's good to limit the JavaScript to just trivial code,
which means that non-JS developers can use this system immediately.
-
Application file size. For desktop applications under Linux, file size is not a
concern as the Qt library is only included once via package dependencies. Similarly, file
size is not a concern on mobile platforms that come with Qt libraries (Ubuntu Touch, Sailfish
OS). For desktop applications under Windows, file size is not a concern because everything is
messed up on that platform anyway (and desktops have enough space). However, file size
is a concern for Android and iOS, as the simplest Qt app APK file is about 7.8 MiB
(tested, using the "Tetrix" Qt example). Note that the NightClock app is only 3.3 MiB but only because it
is no longer a Qt app but got re-implemented in Kotlin.
Static binding while eliminating all unused Qt code would be the way to go to reduce the file
size dramatically.
-
iOS apps with the Qt open source version. There is a rumor that a commercial Qt
licence is needed to create iOS apps that are published in the App Store because Qt'2 LGPL
would be inappropriate for apps published in the Apple App Store (see). However, that is wrong
on two levels: (1) No problem arises at all for fully open source apps, because that
automatically fulfills the re-linking requirement of the LGPL (see) and (2) a closed-source app in
the Apple App Store can fulfill the LGPL re-linking requirement by providing its object files
so users can link them statically (as required for iOS) against a modified version of Qt
(see).
-
How to incorporate the HeartDroid Java library. The standard way under Qt is seemingly
to use Qt Android Extras,
which enables calling Java code via JNI (see the examples). It might work also with
swig bindings, or by compiling Java into a native library. Some hints are provided here. One could also transform the Java library to
Kotlin and then compile using Kotlin/Native. But the clean
option might be to find, or even implement, a C++ library that provides such an expert
system. Even if that means that the initial version of the Food Rescue App does not include
an expert system.
- Compacting the bundled data.
- Before eventually having to move to in-app downloads of
data packages with a subset of the whole product data each, it will be possible to bundle
all relevant Open Food Facts data into an app of <10 MiB download size, avoiding the
complexity of in-app downloads.
- This requires measures to boil down the SQLite database used during development into a
distributable version. A script would take this job; it would be the same script that would later
be employed to also generate data packages for in-app download.
-
Measures
By proposed order of implementation.
- Mindful index creation. There should only be those indexes in the database that are
needed by the queries to be fast enough.
- Not including countries. The information in which countries a product is on sale is
not relevant in the distributed app, only to later generate per-app data packages. This removes
the need for the `product_countries` table (1.2-1.4 million entries, 2 integer columns).
- Only in-use categories, and products with in-use categories. When generating the
database in a version that is meant to be used in the app, only include categories that are
referenced from at least one food rescue topic, and only include products that reference at
least one such category. For all other products, the app cannot provide any food rescue
information.
- Limited categories per product. Remove category associations beyond (say) two to
four per product. A limited number avoids the need for a separate table `products_categories`,
which saves the space for the foreign key column and its index. These few categories would be
the most specific categories. And from among the most specific categories, ideally those that
lead to the largest number of food rescue knowledge items (but that would require many
calculations testing).
- Delta storage of GTIN codes. For more compact storage of the GTIN code data, the
products table would contain a consecutive primary key (like now), a column for the full code
that is only filled every (say) 100 products and a code column that only stores the delta from
the last full code value. Remember that SQLite values take only space when they exist, and
depending on the value. Savings would be about 7 Byte (original) - 2 Byte (delta) = 5 Byte,
which for 1,200,000 products means 6 MiB difference on disk.
Retrieval would be quite simple: `SELECT * FROM products ``WHERE id IN [6400..6500]`` AND
<lastfullcode> + code = ``<target_code>`. The `<lastfullcode>` would be a
sub-select to find the largest value in `fullcode` that is still smaller than
`<targetcode>`.
For even more compact delta storage, that column could store the difference to the previous
row, not the previous row with a full value. But then, retrieval of a row with a given code is
more difficult, requiring multiple bisectioned attempts (with summing in SQLite) or probably
slower sequential summing in 100 returned values until finding the match.
-
Adjusting page_size before compression for downloads. A page size of 512 instead of
1024 has been reported to save 7% in one case.
- Better compression of downloads. Instea of relying on the standard compression of
`.apk` files, one would pre-compress the database files before, yielding smaller download
sizes. This would also be a side effect of on-device database compression, which see.
- ------------------------------ everything below is non-essential
---------------------------
Transfer the feature to the "Maybe now" section when reaching here.
- Shortest category name only. Remove synonymous category names in the same language,
except keeping the shortest one to display in the app. This allows to place this name into a
database column in table "categories", instead of having a table `category_names` as required
in the database during buildup and development.
-
On-device database compression. On-device storage size is worse than download size, so
ideally the same compression used for downloads would also be useful for compressed local
read-only storage, allowing selective decompression on demand. The demand would arise only
for doing the most detailed assessment, while the most used parts would be stored
uncompressed.
-
Proposal. Use one compressed SQLite database per 1000 products, unpacked on demand
into a SQLite memory database. The database files would be packed into a combined archive
with a modern compression algorithm – there are PPM compressors that take hours to
compress, with files that can be half the size of bzip2 archives. For a good overview,
see: Data Compression Programs by Matt Mahoney.
ZPAQ is a good candidate here, and it
is in the public domain, has excellent compression, and supports selective decompression
of files (while the compression ratio benefits from compressing all files into one
archive).
-
Proposal. There are multiple commercial extensions for handling compressed SQLite
databases (1, 2, …) but there seems no need for
these, and the compression algorithm used there would also be suboptimal.
-
Expectable results. In a test with bzip2, a 5.4 MiB database with the typical food
rescue content was reduced to 32% its size. Using ZPAQ instead at the highest compression
ratio would probably result in a further reduction to 79% of the bzip2 size, so the final
file size would be 32%×79% = 25% of the original. (This is based on the comparison of
ZPAQ and bzip2 for compressing 10 MiB file "osdb" containing "database, synthetic data,
binary"; see.)
-
String compression for knowledge items. In this case, instead of compressing the whole
SQLite file one would compress lengthy strings individually and store them as BLOBs into the
database. There is no loss of functionality as no feature requires searching through the
knowledge items in text form.
-
Proposal. A simple implementation would be with the SQLite zipfile module (if
available on Android), which allows decompression from BLOBs (see).
-
Proposal. Try `smaz` for English text, and equivalents for other languages.
Because "smaz works well on English text because the compression dictionary is prebuilt
rather than generated for the specific data" (see).
-
Proposal. For better compression, see the text compression benchmark. That is geared to
much larger texts, though. But to profit from the increased efficiency of compressing
large texts, perhaps there is a way to have a shared symbol table for all compressed text
strings, while still allowing their individual decompression.
-
Shipment without indexes. Excluding the database indexes and rebuilding them on the
device seems to result in a lot better compression (see).
- Find more space saving potential with `sqlite-analyzer`. It will show information
about the database and what takes up how much space in it.
- Finding products without barcode scanning.
- The app should include a search box to enter food category names ("bananas" etc.) with
auto-suggest support, for the cases when barcode scanning does not provide a result.
- Options include image recognition or (probably faster and more accurate) to enter the food item
as text, such as "banana".
- This feature cannot be properly integrated into the Open Food Facts app, which is another
reason for also having a standalone version. See: "Open Food Facts contains only information about
packaged food. For average values of produce (for example, tomatoes or bananas) and other food
products, you can use one of the official national nutrition databases instead." (source).
The best option for making products without a barcode accessible from within the Open Food Facts
app would be to modify the free-text search so that packaged produce is shown first.
- It is not a problem however to rely on the Open Food Facts category taxonomy for assigning
knowledge items to products. Because OFF does contain fruits and vegetables if they are packaged.
Consequentially, it also has the product categories for these; for example bananas.
- Later, voice entry would be an attractive option.
- Later, image recognition (probably server-side, or on the device) can be integrated as a way to
find fruit and vegetable products at least. However, it will probably not save any time compared to
typing or voice entry, so will not be meaningful.
- Food rescue badge.
- A labelling system to summarize food rescue information, including a good graphical design for
the badge and its color coding, that informs users at a glance about its real-world storage life
duration and how careful one has to be when it expires. This would be placed into the product's
summary view in the Open Food Facts Android app, which covers only the lower 20% of the screen
after scanning a product.
- The label can include a minimum extended shelf life, calculated by the expert system based
on the product's category and its design shelf life.
- Showing the product's design shelf life.
- The OFF database contains expiry dates and product entry dates but they are not yet shown
anywhere and include some data quality issues to resolve first.
- From this, a minimum duration of the design shelf life can be calculated. Given only one
measurement it will not be exact, but already help to rescue some food. Example: when crisp bread
is meant to last 12 months and it is 2 weeks over the date, it is very probably safe to eat.
- Implementation: Including a column "shelf life duration" into the products table of the SQLite
database. Use a space-saving compact format, such as three letters: "12d", "10w", "12m", "10y". The
expiry date is not contained in the OFF CSV export, so this information would have to be imported
from the MongoDB dump (and later ideally should be included into the CSV export).
- Framing for user data transmission.
- Framing is important to make people agree to data transmission, for example about how much food
they rescued. Just explain why this is important for the project, for the environment and for the
common goal etc.. Frame it in terms of what the user group finds important, in this case
environmental protection etc..
- Gamification / motivation features for rescueing food.
- For displaying the effect of the app in a motivating way, a good example is the banking app of
the bank "Tomorrow". There, their number of planted trees is displayed right below the bank account
balance.
- Internationalization of the cross-platform app.
-
Instructions when
using Qt for Android as the implementation technology.
- Translation management system for food rescue content.
- Required for the food rescue content. Categories, ingredient names etc. will be translated
within the Open Food Facts project (using their tools) and just imported.
- The process should allow for original content to be created in any language, and for changes to
be made in any translated version. Translation will then ensure the content is first translated to
English resp. the change is incorporated into the English version, and from there to other
versions. This should make it much simpler for international contributors, as not everyone is
fluent enough in English.
-
Process (proposal)
This is the process defined by the OAXAL standard, but it remains to be seen how much of this is
supported with open source software yet.
- While authoring the original document, use XSLT to strip xml:tm elements and to add them
automatically lateron.
This is the usual process in use (source). As a probably better
alternative, XMLmind could be set up so that the xml:tm elements are not visible in visual
editing mode.
- Use xml:tm tags inside the source document and XSLT (or a Ruby script equivalent) to
transform that to XLIFF files.
- Create translations for new content with a Ruby script and a machine translation API,
marking them as a fuzzy match that requires proofreading.
- Create TMX Level 2 files with the translation memory from existing XML files, and import
them to OmegaT.
This is the main use of xml:tm here: avoiding the redundant storage of translation memory
inside OmegaT.
- Translate the XLIFF files with the open source software OmegaT (the best for translation
mgm), which helps due to translation memory (and exact matching due to xml:tm identifiers,
hopefully).
- Create a new output file using the resulting XLIFF file and the structure from the original
document, using another XSLT transformation.
- Problem: How to do translation management for the source data contained in CSV
files?
-
Tools
- Ebook, book and static website versions of the food rescue content.
- Ebook, book and static website are, in a way, three more "platforms" supported by the Food
Rescue App, in addition to Android, iPhone, desktop platforms and the web via a web application.
That can be useful in kitchens, in factories and restaurants, in developing areas where people do
not own a smartphone, for teaching purposes, to print out a part of the content and hang it to the
wall, and for similar cases.
-
Content structuring
- Rescue notes by category. One chapter treating 80-150 categories of food in a
self-made hierarchical chapter structure that us built from a manual selection of Open Food
Facts categories (which may have slightly different names for the purpose of the book though).
In the section for each of these categories, content is shown for a selection of multiple Open
Food Facts categories in the way it would be generated by the app (means, combining the
knowledge items applicable to all categories in the selection).
- Rescue notes for specific food. Containing sub-chapters in an alphabetic list, one
chapter for each sub-type of food item that deserves some special notes not yet covered in the
section by food category. Each sub-chapter would correspond to an Open Food Facts category,
ideally from their taxonomy, not necessarily one that has a WikiData equivalent.
-
Implementation.
- An ebook can be generated from the food rescue database with automated means in EPUB, PDF
and DocBook formats. The DocBook format can be viewed directly for example with Yelp, the Gnome help browser.
- A static website can be generated with automated means, allowing to be installed offline
easily (as a directory).
- A script would export the SQLite3 database directly to a DocBook Book document, or first to
DocBook Topic documents which are then combined via a DocBook Assembly document. The Assembly
document would use a chapter structure based on food categories. In contrast to the app, a book
or static website will contain knowledge items redundantly, once for every category they apply
to. This is however not a problem as this is generated redundancy.
- Note that generating a DocBook Book document directly might be better as it might be
difficult to create the final output purely with XSLT tools, requiring quite some hacking to
render each topic as an item in a list and to calculate the order of topics in this list
("specific to general").
- Once the output is in DocBook file format, standard DocBook tools can be used to convert to
PDF, EPU and HTML formats.
- Most building blocks of this are already implemented; see FoodRescueRopic#to_docbook, which
generates one DocBook topic file for each food rescue topic.
- Technically, the implementation would consist of scripts and new `make` targets in
repository foodrescue-content.
- Publicity.
- Recommendation by Open Food Facts. It would be great to have Open Food Facts recommend
the standalone app.
-
List of reuses. Can be self-added to the list of Open Food Facts reuses.
- Documentation-to-repo workflow.
- A scripted, automatic process that takes over the project documentation as prepared in Dynalist
to files in a Github repository. Including conversion to Markdown, handling of internal links
etc..
- Since all Dynalist documentation is unrelated to a specific Github repository, it seems best to
include it into a new, overarching repository "foodrescue".
- The easiest might be to include (a part of) the Dynalist backup file into the repository
alongside a script that converts it to several linked Markdown files. These output files would be
include in repository even though they are redundant because it allows viewing the documentation
directly via Github, which is helpful for people starting to use the software.
- Displaying knowledge items in the Open Food Facts Android app.
- Very relevant for good initial reach of the app.
- This is only about displaying the human-readable food rescue information. Integrating the
expert system functionality into the OFF app is another task, and
might not be done.
-
Proposal (best so far): Microservice architecture. The best implementation in terms of
development time and system architecture would be that the OFF app obtains the food rescue
information from a separate server software. That server application would be the cross-platform
Food Rescue App built for the web server platform (see). It would
provide an API that takes a barcode and returns a complete HTML document with all the food rescue
information.
The OFF team will probably insist that the official OFF app only talks to the OFF host, but this
is not a problem: they can install that server software on their host. Still, developing this
server software and the associated client is simple: just run the client with configuration to
talk to an own development server for retrieving the food rescue content.
- Proposal: Retrieval from SQLite by the existing Product Opener server software. Provide
the SQLite database to Open Food Facts for installation on their server, and extend their Perl
based server software to provide a separate API for returning food rescue content about a product.
This would only be called when opening the respective tab. This way, only a low amount of work is
needed on the server as the data does not have to be imported into MongoDB. Since it's not data
about products, it makes sense to not include it into MongoDB, the MongoDB and CSV database dumps
etc.. In addition, the "Rescue Info" tab would contain a link for installing the Food Rescue App at
the bottom, promising extended features and offline storage.
- Business model.
- Since the app saves users actual money, it should be possible to somehow make a business model
for this app.
- Since the app will be the world's best food rescue tool and since the developer does not need
much money (≥500 EUR a month is fine), the app could become an "own meaningful product" with
relative ease, allowing to live off meaningful open source work. Which is the dream of a
developer.
- In Germany, each person discards ~82 kg of food per year in Germany in households (source), of wich 37,3 kg are avoidable
(source).
Assuming a moderate price of 2.68 EUR/kg for fruits and bread dominated food waste, the app could
save 37.3 kg × 2.68 EUR/kg = 100 EUR per person per year, or 200 EUR per household per year, given
an average
household size of 2.0 persons in Germany. If the app can capture 12% of that (24 EUR per
household per year, or 2 EUR per household per month), it would already be a great business model,
theoretically allowing millions per month in turnover.
- Proposal: #accepted The app should make it clear that it is a community-supported open
source product, and show the current funding situation, such as "3,000 EUR in user support
available, utilizing for 100 hours of tasks development work according to the following list" or
"development has stalled because no community funding is available right now; donate to restart the
development at 30 EUR/h". If users are happy with the app and data as it is, no problem for them if
it's stalled, otherwise they will donate. The app makers guarantee one hour of work per 30 EUR of
donations, and show in real-time how much work they do for which donation and what the results are.
Also, users can vote (in the app or on a website) for priorities of what should be implemented;
because when people see what they get for their money, they might be more motivated to contribute.
This seems to be the most long-lasting business model, as these donations can also be used for
extending the Open Food Facts database once all relevant food rescue knowledge has been collected
and translated.
- Proposal: The app should include a Patreon-style regular support feature, where people
get extra content as a thank-you for their support (while the app itself and all data stays open
source and without a paywall). This could be handled via LiberaPay.
-
Proposal: A grant in another round of Prototype Fund for developing an extension. Suitable
ideas include: expert system,
translation
management system.
- Proposal: Include a feature that tracks locally how much food the app helped save (by
asking the user for the outcome of each app use). It would estimate the value of the saved food,
and when that exceeds a certain threshold, it would ask the user for a contribution of 5% of that
(which should be around 5 EUR, so the threshold should be 100 EUR). Contributions would be made by
one-time in-app purchases, or better by PayPal or direct credit card payment because then there are
no fees involved. The app can even be a bit annoying by showing the "please make a 5 EUR
contribution" reminder at random every 2-7 times at startup. It could even stop to function, but
that would be less great.
- Proposal: The app should include a feature for regular donations inside the app, using
monthly in-app payments with a credit card. Automatic donations will make sure people don't just
forget their commitments to make donations, and setting up in-app payments is simple as most people
have a credit card registered in their Android device already. The problem with this compared to
LiberaPay or similar platforms is the excessive amount of fees Google would take.
- Proposal: Use Bountysource or similar to let people crowdfund for feature additions and
questions to be answered by the app. Link people from the app to there. They will be more inclined
to donate when they can influence what their money does to the app.
-
Proposal: A grant by a government ministry. Similar to how the FoodKeeper App is provided by a
U.S. Government department.
- Proposal: Allow people to ask questions about food rescue directly from within the app
(with photo and bounty amount assigned). The app makers will answer these within hours, adding the
answer to the open source data.
- Proposal: Make it possible to donate rescued food to the app makers.
- Proposal: Sell the app, or have a for-money version of the app in the app stores. This
is possible, and would not even require to publish the app's source code by using Qt under a LGPL
v3 licence. And even when publishing te full source code, non-developers are still basically forced
to buy it because they lack the skills to build the app themselves (until maybe a competitor takes
the source code and uploads a version for free). However, putting a price tag on an abundant
resource and making it artificially scarce is ugly. We rather wan 5% of users donating 20 EUR each
than 100% of users paying 0.99 EUR each.
-
Maybe now
-
About
- Optional features considered for implementation until 2020-08-31.
- Content ID.
- During development, for debugging and for feedback and bug reports by users it would be helpful
to easily trace back displayed content in the Food Rescue App to its source in the foodrescue-content repository.
- For that, each database record in the SQLite3 database with food rescue content should include
a content ID. The content ID can be made up from the source filename (or file path) and a
file-internal ID string, which might be "<database_table>:<primary_key>", the value of
a CSV file ID column or similar. Such an ID would probably be stored in two columns (file,
infile_ID) or three columns (file, table, ID).
- Expert system.
- By design, the app fulfills the role of an expert system: it should contains all knowledge
items locally on the device, in both human readable form (text with literature references) and
computer readable form (facts by connecting with categories, and rules).
- So ideally, there would be an open source expert system that could be used as the basis,
perhaps there is something both for the server side and Android client app side. Options:
- Heartdroid as the suitable base software for an expert system feature.
- https://heartdroid.re/
- https://bitbucket.org/sbobek/heartdroid
- https://github.com/sbobek/heartdroid
- https://heartdroid.re/hwed/ (the visual knowledge editor)
- https://onlinelibrary.wiley.com/doi/full/10.1111/exsy.12328 (research paper introducing
Heartdroid, saying "To the best of our knowledge, HEARTDROID is the only working
open‐source rule engine for mobile platforms.")
- Dissertation paper introducing Heartdroid: "Methods for modeling self-adaptive mobile
context-aware systems", https://www.researchgate.net/publication/311575943
- Developed in Java, so it fits well into the system.
- Note that the performance of Heartdroid is 10 s execution time for models up to 2000
rules. This is visible from the graph in the PhD paper, p. 155. Also that limit is set to
be the maximum for user retention on p. 152 of that paper. This means that the other paper
uses base-e logarithm in its figure 9, because then it's the same result: e^2.3 = ~10s.
See: https://onlinelibrary.wiley.com/doi/full/10.1111/exsy.12328#exsy12328-fig-0009
- Other options for base software for an expert system feature.
- Heartdroid paper, table 1 shows a comparison of all rule-base inference engines with
mobile support as of early 2018:
https://onlinelibrary.wiley.com/doi/full/10.1111/exsy.12328#exsy12328-tbl-0001
- https://stackoverflow.com/q/4930680
- CLIPS4Android, https://github.com/gomezgoiri/CLIPS4Android . But seemingly no longer in
development. The base software CLIPS is however well-known.
- https://github.com/DrItanium/DROID-CLIPS . Same as for CLIPS4Android.
- Brain4it, https://joinup.ec.europa.eu/solution/brain4it/about . But here, all the logic
("AI") is on the server.
- https://github.com/topics/expert-system , but nothing else found for Android.
- The benefit of utilizing an actual expert system ("rules based inference engine") is that there
is no need to define any flow charts manually. Instead, the inference engine will ask what it needs
to know, in the right order, automatically.
- At the start, the mobile application would not yet implement the expert system, but only show
the human readable knowledge items, aggregated together and presented after scanning a product as
proposed above. There would not be any manually defined interactive flow charts or elements –
that would be added by the expert system functionality, which is clearly optional within the scope
of this project but also the most interesting part to get to.
- The great thing about using an expert system is that the app can be called "intelligible and
full-privacy artificial intelligence".
- Ideas for expert system rules:
- Wiki-like web application for data entry.
- Editing CSV with online ad-hoc databases and offline spreadsheet applications is acceptable for
data entry for a small team, but not the most comfortable thing in case the group of editors would
grow to include many community members. So ideally, a wiki-like application for editing the food
rescue content in AsciiDoc format would be used.
- Proposal: Gollum. This basically ticks
all the boxes: wiki software, open source, written in Ruby, used and supported by a large
organization (Github), able to use AsciiDoc as a native format, and storing its data in a Git
repository. Git data storage allows to use Gollumn as online editor for data stored in repo
food-rescue-content and imported from there with a script to the SQLite3 database.
- Proposal: Gollum and extra fields. The problem with plain wiki editing will be that
there is no tabular editing. So values like author, version date and Open Food Facts categories
have to be encoded into AsciiDoc metadata fields or similar, not unlike editing DocBook XML
directly. That will make the use uncomfortable for occasional editors. To solve this, Gollum can be
extended so that these extra fields are edited using form fields but would still be encoded into
the AsciiDoc document when saving.
- Proposal: Github wiki. This is an installation of Gollum, saving its data to a folder of
the Git repository on which the wiki has been enabled. So it's the same as using Gollum, just
without the need for doing an own installation. Notably, it understands AsciiDoc format.
- Magnet links via Google Search.
- Ideally, users should be able to check all knowledge item content in primary sources, also in
case they want to study more of the details. For that, as far as possible only works that are
available online should be cited.
- This is not possible for many books because, while they are available online, these are
questionable sources. To be able to link to them legally, the link should go to a Google search, of
which one of the first results then is the work in question. That is often possible by searching
for a 5+ word phrase of the content – basically a poor man's magnet link.
- Photo upload to Open Food Facts.
- People cannot be expected to enter anything on a mobile device, and this is much more
efficiently one on a desktop computer using the existing Open Food Facts web application.
- But when a product does not exist in the database, the app can ask people to take pictures of
the product, ingredients table, nutrition table, best before date etc. and upload them, together
with the scanned barcode. That is a good contribution to expand the Open Food Facts dataset.
- Counter for rescued food.
- Basically a feedback form at the bottom of the knowledge article about a food item's storage
life, saying: "Did this help you to decide if your food item is still good to eat?", with the
following options to answer: "Yes, and I saved it." / "Yes, but I had to throw it away." / "No, I'm
still not sure." But of course with better wording and some good gamification – it should make
people proud if they rescued food, but also accomplished if they went through the app's information
and then decided to play it safe. From this, detailed statistics about the rescued food can be
made, including the weight, caloric energy content, approximate market price and approximate
embodied carbon emissions of the rescued food. This makes it simple to argue for the success and
continuous development of this feature.
- There should be a question about what the customer wants to do with the scanned product: "I'll
eat it / not sure, can I donate it to somebody? / I have to throw it away". Donating will enter it
on the openfoodbank.net marketplace. "auch wenn der bezug von spenden über ofb für endkunden direkt
erstmal nicht möglich ist, sollten spenden für jedermann möglich sein. da passt die realmhd app
perfekt. wenn ich ein gescanntes produkt aufgrund des überschrittenen mhds nicht essen mag, kann
ich es über die app spenden. die app müsste anzeigen, wer das produkt in meinem umkreis in empfang
nimmt (oder z.b. zu spendenboxen von organisation x am orty vereist). die box geht dann auf, wenn
der barcode gescannt wird. so könnten organisationen nur spenden bekommen, welche sie auch haben
möchten."
- Using categories outside the Open Food Facts taxonomy.
- Currently, only 37% of all products in Open Food Facts have assigned categories, and those that
do might not use the "official" categories from the taxonomy. Or they might use some official
categories but also others, and the latter would include relevant information not encoded in the
assigned official categories.
- By expanding the official taxonomy of categories (either locally or contributed upstream), the
information contained in these inofficial categories is also utilized. Expanding the taxonomy means
sorting in additional categories as either a synonym or sub-category of an existing category.
- Before doing this, one should estimate the number of products (first in Germany) that would get
category information at all, and the number that would get additional category information.
- Bibliography management application.
- Not sure if this is meaningful, but it could help as an interface to enter the bibliography
more comfortably.
-
Proposal: Zotero. Zotero seems a good
choice as it is a widespread, actively maintained, open source application. It would also help
with reading, as it includes PDF annotation features and ways to reference or include the full
text PDF files. Hopefully there are ways to import a bibliography from DocBook, and to export it
there, so that the DocBook file is the authoritative version managed on Github.
- Photos of food symptoms.
- The app can also contain photos of food symptoms, including spoilage and harmless changes.
These can be very small (<10 kiB per picture) by using the open source BPG format, using a white background
etc.. That allows to include a few hundred pictures into the SQLite database of an offline app
without blowing up the download size by much.
- Collecting expiration dates and other printed-on information.
- This data would be contributed to the Open Food Facts database. Such a feature would esp. also
make sense to add to the Open Food Facts app itself.
- Data structure proposals
- Proposal: Multiple recordings of the data printed on individual product items should be
recordable. That prevents having to introduce versioning for the whole product data records,
and makes such data more accessible compared to versions. Namely, all recordings are accessible
as a set, which makes it simpler to make automatic calculations (maximum observed expiration
period etc.). The proposed data type would be a hierarchy as follows: (see subnodes).
- `item_info` (because this is about information relating to individual items rather than
the product type)
- `0` (array start, recording no. 0)
- `entry_date` (when the information recorded below was entered; filling fields
below meant for derived content later would not change its value)
- `itemtext_picture` (a picture of the text contained on a product, similarly to
pictures of ingredient lists etc.)
Most food items have only one location where manufacturers print something on the
individual, already packaged food item. This includes an expiration date and often
other codified information about batch, production location, production date and
time etc.. So it makes sense to introduce one more picture data type to let users
collect this information, making it available for later transcription and reverse
engineering by others.
- `itemtext_prefix` (the text that is part of the packaging print and introduces
the print-on information, such as "Best before:")
- `itemtext_fulltext` (verbatim text as contained in `itemtext_picture`)
- `production_date` (derived from a part of `itemtext_fulltext`, normalized to a
date datatype)
- `expiration_type` (options: best_before, use_by, no_date; could also be stored
outside the array once per product, but it seems more systematic this way and also
allows to track changes from no_date to best_before and similar cases)
- `expiration_date` (derived from a part of `itemtext_fulltext`, normalized to a
date datatype)
- `expiration_period` (derived from a part of `itemtext_fulltext`, normalized to
a duration datatype)
- `expiration_period_calculated` (taken over from `expiration_period` if
available, otherwise calculated from `entry_date` and `expiration_date`)
- (later, various fields for food traceability
codes would also be added here, each decoding a part of `itemtext_fulltext`
just as the other fields above do)
- `1`
- …
- Proposal: "many products list just the production date and the duration" as per
https://github.com/openfoodfacts/openfoodfacts-server/issues/1589 . So there has to be a way to
deal with this when gathering data. This could be done by setting "expiration_date_type =
calculated" and "expiration_duration = some duration", with durations given in ISO calendar
date format.
- Proposal: There should be another field "expiration_date_type", with values "use_by" and
"best_before" and "absent". The "absent" key is useful to express that the product has no
storage life related date at all. For examples packaged, fresh produce. For already recorded
food items, this can probably be determined from the product categories quite reliably as there
will be legal requirements which products need to have which type of date.
- Proposal: The production date is often hard to decode as manufacturers do not use a
standard format. So perhaps, a field that contains the printed-on data verbatim would be good
for a start, and this can then be decoded as time goes by. Even better, a picture type can be
added to record this information, and others can then extract it from the picture.
- Showing input data for the user to check.
- Open Food Facts is a user-generated database that may contain errors. To prevent errors from
leading to potentially dangerous mis-estimations of edibility, the app should show all input data
used by its algorithms for the user to check.
- That would usually mean: product categories, later also some (but not all) ingredients, the
absence of some ingredients, the packaging and preservation type etc..
- To be able to check the product categories, it will be important that all categories of
products available in a certain country are also translated to the language of that country.
- Downloadable data for food products per country.
- The data would be downloadable as SQLite files from within the app. Each would contain the Open
Food Facts products available in one or more countries. There would be one data package for each
country with more than 10 000 product records (ca. 1 MiB storage requirements). At this time, that
would mean 9 per-country data packages and one data package for all other products (see).
- People would be able to use multiple data packages in parallel if they want. In that case, the
app will query each database in turn.
- There would be some overlap as some products might be available in multiple countries. However,
that overlap seems small (for language reasons alone).
- Web application (also optimized for mobile use).
- A public, mobile-optimized website that gives access to the full functionality, including the
expert system features. People would enter or scan barcodes or product category names to see the
associated food rescue information.
- This is a good solution to reach (1) desktop users, (2) people who want to use
the functionality occasionally on a mobile device, without installing an app; (3) people on
iOS, as native iOS support is unrealistic
right now.
- This is also a good solution for marketing. The food rescue information will in many cases be
the world's best knowledge about rescuing specific food items. Consequentially, when making that
available on the web and not just inside the app, it can be expected that search engines will bring
a lot of traffic to them over time. By hinting from the web version to the app makes it a major
publicity instrument for uptake of the app usage.
- Integrating in-browser barcode scanning is possible with QuaggaJS, a barcode scanning library implemented
completely in JavaScript. This seems preferably to the web application taking a picture and
transfering it to the server for barcode recognition because (1) scanning barcodes often takes
multiple attempts with adjustments, which is fast only when doing real-time scanning and (2)
client-side scanning avoids uploading images, which are much larger than the text string recognized
from them.
- Integrating the expert system is possible because "HeaRTDroid is a rule-based inference engine
both for Android mobile devices, and desktop solutions … it's a
p]ure Java implementation that allows for integration with any Java code" ([see). A better
option might be to wait for the "Server mode with TCP/IP protocol and REST API" of Heartdroid,
which is currently under development (see). Because that
allows to write the mobile website in any language. Similarly, HearRTDroid could be invoked as a
command line program on the server side, returning a food edibility estimation as a result and also
a list of database IDs of knowledge items to display alongside.
-
Proposal (best so far): Provide this by letting the Qt5 cross-platform
Food Rescue App also target the web application platform. This seems to be possible by using the Wt
framework and standard Qt QML files. A more manual way would involve qmlweb or PureQML. In
any way, an interesting technological challenge to explore. Any QML / Qt based solution would
result in a web application with a server-side API and a client-side Single Page Application.
- Proposal: Could be developed in Ruby on Rails (or a Ruby micro-framework like Sinatra)
for development to be reasonably fast. The server-side application would use the exact same SQLite
database as the mobile app, just including all product data rather than only those for a specific
country. A Ruby gem with native extensions around a C++ library extracted from the cross-platform
Food Rescue App could be used as a library to make the implementation faster. Alternatively and
probably cleaner, these features would be implemented in pure Ruby, only relying on the sqlite3
gem.
- Proposal: Perhaps there is a mobile website version of Open Food Facts which could serve
as a basis.
- Comment / question feature on knowledge items.
- There should be a comment feature in the app to tell what's missing or knowledge that should be
added. People won't do any major editing from the app anyway, so that is not needed.
- Proposal: this could take the form of a feedback form below the articles on edibility and
storage life where users can input unanswered questions. Users will then be notified in their app
when somebody researched and entered the answer. The list of currently unanswered questions would
be shown below the article, to make it clear what research and authoring work contributors are
welcome to do.
- Usage tracking to estimate rescued food.
- The "counter for rescued food" feature above required user input to work, which will not come
in many cases. To better estimate how much food gets rescued, one could also make an estimate based
on usage data from the food rescue features, registering when somebody goes to the "Shelf life"
tab, and how much people scroll and read there. This kind of tracking however has a bad reputation
for a reason, so either there should be a surefire way to anonymize these statistics, or data
should be collected in a different way. For example, people might have to fill the feedback
form of the "counter for rescued food" feature for a former food rescue attempt in order to see the
"Shelf Life" information for another product.
- Mandatory use.
- There will probably be global foo shortages in autumn / winter 2020 / 2021. This could still
easily not lead to mass starvation in poor countries when rich countries fix their food waste
issue. Mandatory use of a food edibility estimation tool in households would be a first step.
-
Later
-
About
- Features that will not be realized until 2020-08-31, but perhaps later.
- Additional types of input data for showing food rescue content.
- In the initial version, knowledge items to display (and also the corresponding expert system
rules to select) are selected based on food category information alone. However, other information
are also relevant to estimate edibility, especially when evaluated by expert system rules.
-
Proposed additional types of data
- Combinations of categories. In Open Food Facts, categories are not super detailed.
Instead, combinations of categories are use. So instead of having a category "grated parmesan
cheeses", the product would be placed into both "parmesan cheeses" and "grated cheeses". And
instead of "pasta meals", one would use categories "pasta" and "meals ready-to-eat". As can be
seen from these examples, the expected storage life can be estimated much more exactly with
these combinations. In addition to "AND" combinations, one would also need "AND NOT"
combinations, such as "parmesan cheeses AND NOT grated cheeses" to apply to block parmesan
only.
- Design shelf life. If 10% more is safe it means very different things …; relevant
fields include expiration date information, which is not yet included in the CSV.
-
Common name. Designates the type of product; often the same as a product category, but
sometimes more specific; see field doc, relevant field
`generic_name`.
- Macronutrients. Because for example foods high in proteine are at higher risk of
causing food poisoning; relevant fields include `fat_100g`, `carbohydrates_100g`,
`sugars_100g`, `proteins_100g`.
- Packaging. Glass jar, metal can, protective athmosphere, … . For example, food
rescue content could be attached to a combination of "category: sauces" and "packaging: glass
jar / metal can" to apply to non-instant sauce products, for which there is no category.
- Required storage. Refrigerated, frozen, cool and dry, … .
- Preservatives. Relevant fields include `ingredients_text`, `salt_100g`,
`alcohol_100g`.
- Preservation type. Canned, pressure canned, pasteurized, … .
- Water content. Can perhaps be calculated, if everything that is not a macronutrient
or micronutrient must be water. Could also be added as a range to categories. Could also be
input by the user with a measuring device for the actua product under scrutiny, and can be
contributed from there to the Open Food Facts database.
- Available storage and preservation technology. It makes no sense to show fridge and
freezer storage information to people who don't have one, for example in developing countries.
So there should be a user settings section to choose what storage and preservation technology
one has available. This would also help people to store food properly when they temporarily
don't have their usual storage tech; for example in a disaster, on a camping trip etc..
- Offline storage. Depending on what information is needed, it can be included in the
offline SQLite database of the app, not requiring online access. For example preservatives (as E
numbers), protein content (in mass percent) and design shelf life (as duration) can be stored
compactly.
-
Database model. The current proposal is to store the conditions to select a topic in a
table `topic_visibility`, with columns `category_id` and `extra_conditions`. The latter would
reference a database query that a product has to fulfill in order to show the food item. (See
⦿ for details.)
- Storing complex conditions in normalized form in a database is complex and messy and still
usually not powerful enough and should be avoided. Instead, complex conditions can be stored in
text form as boolean expressions. That usually creates issues with parsing them, but not when
storing full database queries as done here.
- Storing full database queries is equivalent to storing their result in a table
`topic_products`. However, storing just the query is much more compact (~200 B rather than
>~10 kiB on average), basically a form of algorithmic compression.
- To reduce storage demand further, the database query would not be stored directly into
column `topic_visibility.extra_conditions` but rather into a separate table, referenced with a
name like `in_jars`. That allows to re-use the same query many times and also helps to keep the
database content human readable.
- To reduce storage demand further, during the deployment process the database queries can be
saved as binary BLOBs using a custom ZIP-like compression format with a pre-defined symbol
table that contains SQL keywords etc. and is defined when expo. The symbol table would be
defined while exporting the database for deployment, and would be stored in code. That way,
high compression ratios can be achieved for individual SQL queries.
- The database queries can be arbitrarily complex, selecting the associated products based on
whatever information is available about them in the offline database. The most common forms
would be "multiple categories" and "not in another category". In this case, any one category
required for being associated with the topic would be placed into
`topic_visibility.category_id` and the others into the `extra_conditions` column in such a way
that the query in that column is re-usable.
- Example for database storage: `topic_visibility.category_id` referencing category "Parmesan
cheeses" and `topic_visibility.category_id` referencing a query `grated_cheese` containing:
`SELECT product_id FROM products INNER JOIN categories ON … WHERE categories.name = "Grated
cheeses" AND product_id = ?;`. Including a parameter `?` that can be filled in when running the
query allows to avoid letting the database return hundreds of rows. Instead, it will tell if
the currently scanned product should show the considered food rescue topic or not, by returning
the product ID or nothing.
-
Data input and interpolation. Some of the proposed additional data is not (yet) available
in Open Food Facts. The cleanest solution would be to add new fields to Open Food Facts and
manually enter the additional types of data there, by looking at the product pictures (see:
Adding Open
Food Facts data). However, that is a lot of effort and takes time. Until then, it could be a
good idea to deduce this data approximately from other data (see: Interpolating input
data) and mark it with a degree of uncertainty, which the expert system can handle.
-
Current relevance. So far, only the ingredients could help to better inform edibility
estimations. Here, the amount of protein etc. is alread encoded pretty well in the category.
Information about preservatives would help. Other information first needs a major data entry
effort in the OFF database to be useful; for example, only ~7000 products are marked as "in metal
can" (see) so far. Also, packaging codes
are very messy and would have to be tidied up after introducing a taxonomy. So at the current
time, this feature would add little benefit for the effort and other features should be added
first.
- Categories for home-made food items.
- Since their shelf life is much different from commercially packaged or preserved food, there
should be extra categories for this.
- These would only be accessible by entering "homemade …" into the search bar to find a category
suggestion.
- Interpolating input data.
- Interpolation would help to fill in missing data (with attached higher uncertainty) until
somebody will fill it in manually from observations about the product. This is esp. useful for data
that can not be directly observed from labelling and would have to be measured, such as water
content etc..
- A good example of clustering Open Food Facts data is the Gaussian Mixture clustering see in the
Kaggle notebook "Hidden
treasures in our groceries". It infers product category from macronutrient composition.
-
Proposed interpolations
- Design shelf life. Can be deduced from the design shelf life of similar products,
based on category, packaging type, preservation type and macronutrient composition. Also, too
low values (by observing an expiration date shortly before expiry) can be corrected by
comparing with the most similar products.
- Completing the Open Food Facts dataset.
- The Food Rescue App will eventually contain more information than just product categories in
its database, as that enables more accurate edibility assessments (see feature proposal "Additional types of
input data").
- This data should be added to the Open Food Facts dataset and imported from there. A lot can be
added from already existing pictures (such as "preservation type: canned", expiration date etc.).
Other data could only be added from pictures after taking new and more product pictures, for
example in stores. Whatever the case, data entry from pictures could be a good job for freelance
digital workers in lower-wage countries, if there is funding to pay them.
- It makes sense to focus the efforts on completing the Open Food Facts dataset for one country
first before moving to another.
- In-app download of data packages.
- The app would offer free in-app downloads of the SQLite databases, with variants for all
countries, per country, and also per language (English, country's main language or both). That
reduces the local storage requirements. In the initial version however, only a single global
database would exist, and be packaged right into the app.
- There should be a server-side software that generates updated versions of the SQLite databases
for download by the app. Alternatively, that could be done manually with scripts once per month. If
done server-side, data storage would be in one large PostgreSQL database, and updates from the Open
Food Facts CSV export, their category taxonomy etc. would be imported automatically. The server
component would also include a web interface (ideally just generated without programming, perhaps
using Ruby and the generated admin interface) to add new knowledge items, and that would be the way
how people contribute to the content of the project.
- Data selection for packages
- Country-specific products. Remove all products that are not sold in the target
country.
- Local language versions only. Both knowledge items and category names would only be
included in the language (or languages) of the target country.
- Versions with common products only. There could be a version where products with
less than a configurable number of scans in the last year are removed. Because for these
products, the added convenience of barcode scanning does not outweigh the storage space usage,
given that very probably these products would never be scanned by users (because perhaps they
are no longer produced). For these products, people can search by category themselves.
- Decision: This is not a priority right now, as bundling all intended data for all Open
Food Facts products together with compression for download and storage will lead to ~6.5 MiB data
in download size and size on disk, assuming a 25 MiB SQLite databases with 75% compression
according to tests. Since this feature makes the app more complex to use, avoiding it is better
until download size hits approx. 15 MiB.
- OCR to help with barcode reading.
- To help in cases where a barcode cannot be recognized, the software could also read the digits
printed below the barcode using OCR. That can be done without being error prone because the last
digit of any GTIN code "is a check digit, which follows the standard modulo 10 calculation"
(see).
- Web application feature for content authoring.
- Currently, authoring food rescue content is done by editing CSV files or DocBook XML files with
various tools (see).
- If that turns out to be deterring potential collaborators, it would be better to integrate
content authoring features into the web application version of Food Rescue App. There is no need to
integrate it into the mobile version, as nobody does scientific or technical writing on the
go.
- Using the web application, content would be directly added to and modified in its SQLite3
database. It would then be exported and added to the Git repository, which would still serve as the
authoritative datasource from which all content is built (namely, after also integrating updated
content from other sources such as Open Food Facts products and categories, the FoodKeeper App
etc.).
- This also allows to further automate the build process. Also, the translation management system
could be integrated, but that would be rather difficult.
- Plausibility checks of expert system results.
- As a way for the developers to check the quality of the recommendations even though not all
cases can be tested, there should be an automated testing function that calculates results for many
combinations of input parameters and evaluates the outputs with automated means. For example,
increasing the amount of time that a test product's expiration date has passed should worsen the
edibility estimation gradually. If it becomes unstable instead, something with the expert system
rules is wrong.
- These checks can and should be implemented as rules into the expert system itself. If one such
rule is triggered, the system would tell the user: "These results are inconsistent and probably not
reliable – procceed with care."
- Pre-calculated results of the expert system.
- All edibility estimations that do not rely on user input can be made by the expert system ahead
of time, and the results can be saved into the SQLite database. That gives instant results and also
allows to check the calculations for plausibility before distributing the database. Such a result
could be for example "+2 weeks in the fridge, +5 months in the freezer".
- For more precise results, the user would optionally answer some questions (expiration date,
observed changes etc.) and have the expert system calculate a new result live. In many cases, a
user will be happy with the quick result though, esp. when it claims much more storage life beyond
the expiration date than has passed so far.
- Expert system that learns from user feedback.
- There is the option to make the expert system learn from user feedback: "The expressiveness of
the HMR+ allows to keep large parts of the application's logic as a rule‐based model. This allows
for fast reconfigurations of the system on‐the fly, without a need to recompile a source code. Such
adaptability may be understood as an ability of the system to modify its logic (e.g., with machine
learning methods) or user interfaces and user experience (with callbacks mechanism)."
(https://onlinelibrary.wiley.com/doi/full/10.1111/exsy.12328)
- Microbial growth simulators as part of the expert system.
- Simulators for microbial growth and storage test results provided by companies can be
integrated into the application. The application would then be able to take in data from sensors
(current pH, current water content, current water activity, time-series temperature, time-series
relative humidity) as input for these simulations. Time series data would come from web-connected
sensors attached to the food items or can also be extrapolated from location, historical weather
data and building type.
- The application would then combine everything (and extrapolate over knowledge gaps) using its
expert system and Open Food Facts data about food items with similar ingredients (storage test
results, pH, water content, water activity and user experience with the expiration date etc. would
be added to Open Food Facts).
- That would probably make it a suitable system even for professional use, avoiding a lot of food
waste even in commercial and wholesale settings.
- Displaying expert system results in the Open Food Facts Android app.
- Because the Open Food Facts uses a client-server architecture, this requires to implement the
expert system server-side. Which is a major effort, so this feature is for later.
- As an alternative, the expert system could be implemented server-side right from the beginning.
But that is less great compared to an app that can work completely offline, and it is also complex
(requiring tighter collaboration with the OFF team).
- Recommending hypocaloric diet to rescue food.
- There is indeed a lot of food waste because people in affluent countries eat more than they
need. The way to rescue this food is to not eat it. The app might recommend that, either based on
the calculated BMI of the user, or based on diet tracking.
- For diet tracking, the simplest option is to use the mobile device to scan everything while
shopping. It will sum up the calories, and tell the user to stop shopping when the threshold (based
on shopping period and number of people in the household) is reached.
- Probably it's not a good idea to make this recommendation often, as people could think this is
insulting and might stop using the app. But as an ultima ratio measure, it's necessary. Basically,
when the app might become aware that global hunger is above a certain threshold, it would activate
this behavior.
- Ability to report unclear / misleading / dangerous edibility estimations.
- Esp. relevant when a user experienced food poisoning as a result of using the app.
- Generic resource rescue system.
- Beyond rescuing food, the app could care for rescuing all kinds of other products and
resources.
-
Resources to rescue
- Drugs / medication. Like food, most drugs don't go bad at their best-before date.
The difficulty is to know which might become dangerous, which just become weaker (and might
need higher dosing) and which do not change at all.
- Clothing. How to upcycle clothing. How to donate it to the closest gift shop
etc..
- Intelligibility of the expert system.
- The principle should be that every rule entered into the expert system is also documented with
a human-readable knowledge item which also mentions its sources. Ideally all knowledge would be
both human and machine readable, making for an intelligible AI system.
- Later, it would ideally be possible to show the rules used by the expert system's reasoning and
their relative contribution to the decision in a kind of "explainer screen".
- This is not a priority as it will probably not be requested or valued by the typical users –
they don't care about "understandable AI" as they are not techies.
- Using expiry dates for shopping list planning.
- Another way to fight food waste with the help of the OFF app and expiry information would be a
feature that warns about shopping list items or shopped items if they are in danger of rotting away
before being eaten. That estimation would be made based on a configured number of people and meals
and perhaps with feedback of what had to be thrown away during past shopping trips. Not everyone
writes a shopping list before shopping, but (1) people can just very quickly select their usual
items from past shopping lists and (2) people can also add to the shopping list during the shopping
by simply scanning the item. The inspiration is from here. Probably, this feature
has no place in the current OFF Android app. But perhaps there is an existing, open source, OFF
based shopping list app where it can fit in. Another problem is that this feature proposal
could be too tech-centric. People might just not use it as it might never be comfortable
enough to use. It might find its niche in purchasing operations for small restaurants, maybe.
- Showing per-category expiry distributions.
- From per-product expiry dates, diagrams for each category can be created that show shelf life
durations of all other products in the same category, and where the currently analyzed product
falls in. That should already allow users to know when they can be more relaxed about a specific
product, and would allow them to rescue some food items.
- Comparison of declared shelf life between products.
- Edibility assessment for wild plants and animals.
- Many wild herbs are actually edible, for example stinging nettle. Also wild mushrooms
etc..
- This would complete the feature set: an offline expert system that can be used to determine
what type of plant or animal one is looking at, and what the dangers of eating it would be. The
dangers also should include the dangers of misidentification and the risks involved – means, if
there are plants that look similar and are poisonous.
- This would also accurately inform about the dangers of various wild food, such as the radiation
danger of eating wild-grown mushrooms in Europe due to the Chernobyl incident, and the
recommendation to limit their ingestion to a certain amount.
- For identification, there could be a collaboration with a plant identification software by
accessing their API. The accuracy of these services is not more than 95%, which is not enough for
cases where there is even a remote chance of a dangerous misidentification. So it would be
presented as a guess, with a checklist of steps for the user to confirm the plant by comparing
various plant parts to pictures, counting and measuring plant parts etc.. Options:
-
PlantNet. Provides an API at my.plantnet.org, with relatively generous usage quotas. The
app itself is not open source, but the contributed user data (observations of plant species
with a picture) is licensed under CC-BY-SA 2.0 (see, in section "Intellectual
property rights").
- PictureThis.ai. Not open source, but a
well-known and feature-rich plant identification software.
-
more options
- In addition to showing the edibility, the nutritional data of these wild plants and animals
could also be shown. But that would be better done by a different app.
- Generic mobile expert system for products.
- Later, this application could become a more general expert system for mobile devices, not
limited to food edibility. It would be relatively easy to extend it to other reasoning about
products (ethical buying, esp. about food, presenting an alternative to certification
schemes).
- AsciiDoc syntax variant with single Unicode control characters.
- The idea is to edit the source, but always using single Unicode characters as control
sequences. The editor's code highlighting would then be used to provide visual feedback ("WYSIWYM")
via font color, fontweight, font size etc., quite similar to programming editors. Just that
advanced syntax hihlighting would also include changing the font size tomultiples (1, 2, 3) and
fractions (0.5) of the width and height. Since the font would still be monospace, cursor navigation
would still be as comfortable as in "normal" programming, while information density on one screen
would be higher and more comfortable.
- This is a completely new way for a plaintext markup language like Markdown, AsciiDoc, XML etc..
It is still based on editing the source format, but allows better visual feedback and less clutter
than any alternative. It is especially much less bloated than XML, but as systematic as XML.
- Since the control sequences are very short, there is very little visual clutter. And since
Unicode characters are used for the control sequences, there is hardly ever a need to escape
characters, and no danger of running out of control sequence characters. So there is no need for
ugly doubling, triping and other combinations. Also, as start and end characters are visually
matching but different from the start and end characters of any other "tag", it solves the issue in
programming etc. of having to count parentheses to determine if a section is correct. It might be
best to use Unicode characters from the private use area rather than misusing existing ones.
- To enter the control sequences, one would (1) either use toolbar buttons to enter the Unicode
characters, (2) or use custom Compose key sequences under Linux, (3) or use "backslash formulas" as
in LyX to enter control characters by name, (4) or use copy&paste from previous sections.
- Fictional, minimal example, with an AsciiDoc equivalent. (It's more useful when replacing more
ugly syntax.)
AsciiDoc: `Hello World, look at this link`
AsciiCode: `Hello ❰World❱, look at 【this link ∥ http://example.com/】`
Presentation: Hello ❰World❱, look at 【this link ∥ http://example.com/】
- For existing work in similar directions, but with programming languages, see:
APL (programming
language))
Unicode in Function
Names and Operator Symbol
Ruby feature request #8437
-
Discarded
- Flow charts defined in a formal language.
- The SQLite database would also contain the definitions for flow charts for the quick tests of
edibility. (But that is a feature that can also follow later, as it's just for comfort and not a
necessity.) These flow charts would then also contain a function asking if the user was able to
rescue the food item as the last question. This data will be aggregated locally, and once per month
the user is asked if they want to contribute that to the statistics.
- Integration into an Open Food Facts iOS app.
- Marked as "optional" in the original project plan.
- There is a native iOS app,
which is in active development as of 2020-04-20. This is certainly not a priority, as the iOS
market share is 14% vs. 86% Android (see).
- There is also a cross-platform OFF Cordova app (the system
previously called "PhoneGap"). It would be possible to add the food rescue features here, even
offline because SQLite incl. preloading is available: "On Cordova …, the native SQLite database is
often a popular choice, because it … offers more flexibility in backing up and pre-loading
databases, because the SQLite files are directly accessible to app developers" (see).
- However, (1) Cordova is a bad technology choice in general as it's basically a packaged
web app, (2) the Cordova app is marked as alpha software and its latest commit is from
2018-09-11; (3) the Cordova app is the former, now legacy, official app of Open Food Facts
(see) and (4) it is not anymore the focus
of the OFF team, as they say "We'd very much like to] have native apps for speed and access to more
advanced features" ([see).
-
Decision: There is currently no good way to implement iOS support, as doing so would
require contributing to the native app, which is a hard-to-justify effort at the moment. So far,
the better alternative is an optimized mobile
website or a Qt5 cross-platform
app.
- Online information retrieval in the app.
- This is relevant only after implementing that data is not bundled with the app but downloaded
from within the app later. Because then, before downloading any data package, the app would query
the Open Food Facts server instead. Some users might prefer this mode as it saves them storage
space.
- This feature is also a good preparation for later integration with the official Open Food Facts
Android app, where both the barcode-to-category translation and the expert system functionality
would happen on the server.
- This feature is also relevant for a later use of more data for
edibility estimations, as all the data can be obtained form the Open Food Facts API. However,
the feature is not essential for that, as the data can also be included offline.
- Decision. Not a good idea. An offline app does is a good is a good USP and does not have
to also work online. It would require extra permissions at the time of installation to support
this, which might create trust issues compared to a pure offline app. And users who don't want the
app can simply use the web version (which is needed anyway).
- Android app using Jruby.
- No up-to-date, usable technology choice exists even though this is possible in principle.
- Possible implementation technologies
- Droiuby. Possibly the most mature,
but unmaintained since 2014. Also, it might be based on an Android toolchain that is no longer
offered by Google, similar to how the Ruboto 1.x version became unusable.
-
Ruboto. Latest version from early 2019 only has
a proof of concept and only supports Android 8+; see. The earlier Ruboto 1.x versions
cannot be used anymore because "Ruboto 1.x is based on the previous generation of the
toolchain which is not available anymore from Google. " (see).
- RhoMobile Ruby APIs.
Unmaintained since 2012.
- jrubyc --java. A way to translate
Ruby code to Java, and then to use that to compile an Android application.
- JRuby. The engine all of the above use;
actively maintained, but hard to use on its own.
-
Component Documentation
-
C++ development
-
development
environment (incl. build system)
- code documentation
- Doxygen
- Used for API documentation of C++ code. Written in Qt, apparently.
- code style
- C++ language
- C++ standard library
- useful libraries
-
Discount (Markdown library in C / C++, as used in
the KDE Kirigami application Kookbook)
-
Content authoring
- AsciiDoc / Asciidoctor writing
- CSV+Asciidoctor writing
-
About
- Needed to produce CSV files with embedded Asciidoctor, which is one of the source formats
for food rescue content.
- Collaborators are free to use whatever tool they like from this list. The only important
thing is that all data ends up in the authoritative data store fairdirect/foodrescue-content in
CSV+Asciidoctor format.
-
Columns
- ID.
- Text.
-
Text type. Values conform to the planned content
sections of food rescue content. See there for the allowed values.
- Categories.
- Author.
- Date added. An ISO 8601 date.
- Version date. An ISO 8601 date.
-
Obvibase
- Obvibase is an instant-use, web-based database that allows real-time collaboration. It is
not open source, but provides a free version that is probably sufficient (3 databases of 1 MiB
each). The commercial plan is 4 USD per user per month.
- Supported features: Multi-value fields are possible via nested tables. Multiline
values are possible (use `Shift + Return` to create a linebreak). Export is possible by
exporting each table to CSV. Since CSV also allows multiline field values, no problem
here.
-
Unsupported features: Direct export to SQLite3 is not possible, but can be added by
combining all exported tables in a custom script. Other limitations are listed here.
-
Airtable
- Very similar to Obvibase, but more complicated and more feature rich. Like Obvibase, it is
SaaS freemium software and not open source
-
LibreOffice Calc
- Provides good table editing functionality as needed: import from and export to CSV,
multiline field values, data filtering, freezing header rows etc..
- Allows opening, editing and saving a CSV file without having to go through any export
dialog.
-
Grubba #potential
- Grubba is a no-coe online database builder. It is free to use as a SaaS solution, but not
open source software. Export to Excel files is possible, so in principle it can be used to edit
CSV files.
- It might not provide the required large, multi-line text fields for writing articles. To be
evaluated.
- Ruby on Rails #potential
- When a tool has to be chosen for which coding is needed, then this framework together with
the admin generator gem is a suitable one because it's based in Ruby, like the rest of the food
rescue content tools.
-
OpenXava #potential
- An open source application where you define a data model in simple Java code and it
generates a web application to edit data in a relational database model with multiple connected
tables. Seems mature.
- However, as this involves coding, a relational database on a server etc., that might make a
simple Ruby on Rails or similar application more attractive to stay within the same programming
framework.
-
Content bibliography
- asciidoctor-bibliography
- The second tool that allows to add BibTeX bibliographies to Asciidoctor documents. Not part of
the official Asciidoctor toolkit.
-
repo
- asciidoctor-bibtex
- The first tool that allows to add BibTeX bibliographies to Asciidoctor documents. Part of the
official Asciidoctor toolkit.
-
repo
- BibTeX
-
Content import and storage
- DocBook format
- DocBook editing
- About. DocBook is no longer used for content authoring. It is still the target format in
the database, so some editing will be required.
-
XMLmind XML Editor
- It supports DocBook 5.1 out of the box.
- It's a bit ifficult to use in visual mode, but this could be improved by using DTD for a
relevant subset of DocBook, by providing a cheatsheet etc..
- It is not open source, but free to use for open source projects (see). No open source XML editor with
visual block editing mode has been found (see), so this is the best
bet so far.
- MS Visual Code (with extensions)
- Used as the IDE as well (see).
-
DocBook Editing and Processing for Eclipse (DEP4E)
#potential
-
(more
options)
- AbiWord #discarded
- AbiWord can save to and load from DocBook XML files. But it has too many limitations: (1)
it can load from and save to DocBook `book` documents, but not DocBook `topic` documents; (2)
it cannot parse the file if there are additional elements in
`<bookinfo>…</bookinfo>` elements; (3) it has no support for literature references
at all; and probably many more points like that.
- LibreOffice #discarded
- LibreOffice can save to and load from DocBook XML files. But it has too many limitations:
(1) it can load from and save to DocBook `article` documents, but not DocBook `topic`
documents; (2) it does not generate `<info>…</info>` elements, and if editing these
into the XML source LibreOffice will destroy them when opening them the next time by
interpreting these as textual content; (3) it does not render literature references with the
correct elements in the output; (4) it does not include the bibliography list in the output;
and probably many more points like that.
- Proposal: A custom Ruby Script could be used to convert between the DocBook XML format for
LibreOffice and for topic storage.
- Proposal: Use DocBook articles for content storage, in exactly the way generated by
LibreOffice. However, this is not possible as it does not store `info` elements, the
bibliography index etc., so a lot of postprocessing would be needed.
- Proposal: Extend the LibreOffice DocBook export code to include an option of exporting to
DocBook topics in the way needed here.
- LyX #discarded
- Using LyX as DocBook editor is only possible in version 1.2.0 (see). The current version is 2.3.x.
- Also, installing LyX brings in all the LaTeX packages (650 MiB of stuff), so it's not a
great choice for people who only want to edit DocBook and not need it for LaTeX stuff.
- DocBook processing
- DocBook viewer
- DocBook XML editor
- Ox
-
Pandoc (allows converting from DocBook to EPUB, HTML, PDF, ODT,
AsciiDoc, AsciiDoctor etc.)
-
DABS #potential
-
checkXML5 #potential
-
meinproc5 #potential
-
asciimintjs, a tool to convert AsciiDoc
documents to other formats, including PDF via LaTeX #potential
-
Antora, a build tool for Asciidoctor projects, written in
JavaScript #potential
- Open Food Facts products import
-
data download page
-
general field
documentation
- expiration date field documentation
- OFF products currently contain a field "expiration_date". See for example:
"expiration_date: "25/05/2016"" in
https://world.openfoodfacts.org/api/v0/product/5014044006350.json .
- The expiration date, even when contained in the database, is currently not shown in the OFF
web interface. Example: https://world.openfoodfacts.org/product/4001686386613
- The expiration date is entered into the field probably verbatim as shown on the product,
not converted to any standard date format yet. See for example:
"07/2017" in https://world.openfoodfacts.org/api/v0/product/4001686386613.json
"25/05/2016"" in https://world.openfoodfacts.org/api/v0/product/5014044006350.json
- Currently, 137 022 products out of 1 173 731 products (11.7%) have their expiration date
information completed. See: https://world.openfoodfacts.org/state/expiration-date-completed .
For others, this information can still be extracted from the product images. However, usually
that's not the case as there are only images of the product front plus the ingredients list and
nutrition table, while the expiration date is usually contained on a side or similar. Again,
however it seems possible that the non-cropped versions of pictures showing the ingredients and
nutrition info are also accessible somewhere (see:
https://en.wiki.openfoodfacts.org/OCR/Results#Kind_of_images_processed ).
- The data quality of field expiration_date is often questionable as it is not recorded (and
often no longer inferable) at what date the expiration date "measurement" was made and entered.
For example, product 4001686386613 has expiration date "07/2017". The only information about a
recording date is "entry_dates_tags[0]", here "2013-04-25". That does not fit together though,
as even candies won't have 4 years of expiration dates. So probably, "expiration_date" was
filled during an update, and it is no longer recorded when.
- MongoDB database dump
- Download: https://world.openfoodfacts.org/data
- This is the only full data dump of product data. The CSV does not contain all columns.
- MongoDB contains only (!) a collection of products, nothing else. All other structure, for
example of categories, is defined in text files at
https://github.com/openfoodfacts/openfoodfacts-server/tree/master/taxonomies .
- fields related to categories
- categories
- categories_lc
- categories_hierarchy
- categories_tags
- categories_prev_hierarchy
- categories_debug_tags
- example
- ```
"_id" : 20525002,
[…]
"categories_tags" : [
"en:plant-based-foods-and-beverages",
"en:beverages",
"en:plant-based-beverages",
"en:hot-beverages",
"en:herbal-teas",
"en:teas"
],
"categories_hierarchy" : [
"en:plant-based-foods-and-beverages",
"en:beverages",
"en:plant-based-beverages",
"en:hot-beverages",
"en:herbal-teas",
"en:teas"
],
[…]
"categories" : "Aliments et boissons à base de végétaux,Boissons,Boissons chaudes,Boissons
à base de végétaux,Thés,Infusions",
[…]
"categories_lc" : "fr",
```
- CSV database dump
- Download: index page, direct download
link
- Size: 2.3 GiB as of 2020-03.
- CSV does not contain all data (see). For example, the
expiration_date field is probably not contained, as seen in the CSV
column header.
-
CSV field documentation
-
instructions for
conversion to PostgreSQL
This imports the whole CSV file into one table, without normalization.
-
relevant columns for Food Rescue App
Using the field names in the CSV file header as seen 2020-04-21.
- `code`: the GTIN code of the product
- `categories_en`: comma-separated list of English-language categories; may contain tags
where an English name is not available, such as "fr:pate-d-amende", which should be ignored
as this is a data consistency error
- `countries_en`: comma-separated list of English-language country names in which the
product is for sale; relevant for generating SQLite databases per country
-
not relevant columns for Food Rescue App
- `categories`: not relevant, as this contains French (!) category names only,
omitting any category where only an English (or other language) name exists
- `categories_tags`: not relevant, as we use the full names to identify
categories, as done in the categories.txt taxonomy definition file
- `main_cat`: not relevant, as this is simply one of the categories; also, it is
recorded in tag format, which is not what we need (e.g. "en:refrigerated-meals" or
"fr:noir")
- Open Food Facts categories import
- categories.txt
- This is the authoritative data source for the category taxonomy. It is manually maintained
in the Github repository.
- Directory: openfoodfacts-server/taxonomies
- File page:
https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/categories.txt
- File download link:
https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/categories.txt?raw=true
- File download command
```
wget
https://github.com/openfoodfacts/openfoodfacts-server/blob/master/taxonomies/categories.txt?raw=true
-O categories-txt.1-downloaded.txt
```
- The file contains some syntactic errors as it is manually maintained.
- categories.result.txt
- Location: openfoodfacts-server/taxonomies
- Generated by openfoodfacts-server using the categories.txt etc. files from the same
directory as input. The server parses and sorts the file (by language and then name of parent
categories), adds country information and other calculated information. No important
information is added compared to categories.txt.
- The file should be syntactically uniform and correct as it is automatically generated.
- categories.result.sto
- Location: openfoodfacts-server/taxonomies
- Generated by openfoodfacts-server using the categories.txt etc. files from the same
directory as input. The server performs name normalization to convert names to "tags"
(lowercase strings with dashes), expands category names with synonyms etc.. No important
information is added to the categories.
- These files are read with Perl function `retrieve()` (see),
which means they are Perl data structures in the binary format of the Storable Perl module.
- To convert these to other data structures, one would probably have to write a small Perl
script and convert to a text file.
- JSON categories API
- This is by far the simplest-to-use and most tidy definition of the categories
taxonomy.
- Also contains 1165 "sameAs:" references to WikiData entries, out of 27514 categories. Each
entry has only 0 or 1 "sameAs:" reference (because the number of those with exactly one
reference is also 1165, as found by Vi command :%s/"sameAs":\[[^,\]]*\]//ng ). These
are not in the textfile definition, so it is unclear where this relationship is defined in the
server software.
- URL
- http://world.openfoodfacts.org/categories.json
- documentation
- https://documenter.getpostman.com/view/8470508/SVtN3Wzy#categories
- example usage
- https://github.com/openfoodfacts/openfoodfacts-python/blob/master/draft.py
- example record
- ```
{
"products": 19421,
"url": "https://world.openfoodfacts.org/category/sauces",
"id": "en:sauces",
"name": "Sauces",
"sameAs": ["https://www.wikidata.org/wiki/Q178359"],
"known": 1
}
```
- categories information in the JSON products API
- example 1
- Source: https://world.openfoodfacts.org/api/v0/product/20525002
- ```
categories: "Pflanzliche Lebensmittel und Getränke, Getränke, Pflanzliche Getränke,
Heißgetränke, Kräutertees, Tees",
[…]
categories_lc: "de",
[…]
"categories_hierarchy" : [
"en:plant-based-foods-and-beverages",
"en:beverages",
"en:plant-based-beverages",
"en:hot-beverages",
"en:herbal-teas",
"en:teas"
],
```
- example 2
- Source: https://world.openfoodfacts.org/api/v0/product/20525002.json
- ```
"categories_tags" : [
"en:plant-based-foods-and-beverages",
"en:beverages",
"en:plant-based-beverages",
"en:hot-beverages",
"en:herbal-teas",
"en:teas"
],
[…]
"categories_hierarchy" : [
"en:plant-based-foods-and-beverages",
"en:beverages",
"en:plant-based-beverages",
"en:hot-beverages",
"en:herbal-teas",
"en:teas"
],
[…]
"categories" : "Pflanzliche Lebensmittel und Getränke, Getränke, Pflanzliche Getränke,
Heißgetränke, Kräutertees, Tees",
[…]
"categories_lc" : "de",
[…]
compared_to_category: "en:herbal-teas"
```
- all categories by number of products in them
- JSON
- https://world.openfoodfacts.org/category/categories
- HTML
- https://world.openfoodfacts.org/categories
- ratio of product records with category information
- 36.8% (448 224 of 1 216 377 products)
- Source: `wc -l` for the original and filtered CSV file.
- SQLite3
-
Content translation
- xml:tm (in-document translation memory markup)
- This is a standard to define translation memory right inside XML documents.
- To be transformed to XLIFF and back to the target XML format using XSLT: "xml:tm is designed to
work directly with XLIFF. xml:tm effectively pre-digests documents for XLIFF so that you can create
XLIFF documents by means of an XSLT transformation." (source)
- The argument here for xml:tm is to avoid redundancy: the Git repo should only contain the XML
documents in various languages, and the translation memory (in
- Introduction of the idea and process: Translating XML Documents with xml:tm,
2004-01-07
- Standard document: XML:TM
1.0
-
OAXAL Reference Architecture,
showing how xml:tm and XLIFF are meant to interoperate.
-
OmegaT (translation mgm system)
- OmegaT is the best available open source translation management tool, see Wikipedia.
- XLIFF is the most widespread XML standard for translation interchange.
- It supports XLIFF Level 2, which allows translating while keeping inline tags intact.
-
Okapi Framework (translation format
conversions)
- It should be possible to use this to convert xml:tm to XLIFF, or if not, to extend it
accordingly.
-
xtm.cloud (full OAXAL implementation, commercial)
- Not in use here currently. It's a commercial service that would cost 30 EUR/user per month
(source).
- Interesting, because from their 2011
presentation it seems that they impemented the full OAXAL standard, incl. xml:tm.
-
Content viewing
-
Yelp, the Gnome help browser, able to show
DocBook documents
-
Convergent GUI development
- Android deployment and debugging
- Qt development environment
- Qt Creator
-
aqtinstall (tool to install Qt across
platforms)
- CMake
- qmake
-
Not used.
- Because (1) Qt Creator supports qmake just as well as CMake, (2) CMake is recommended
for Kirigami application development and (3) Qt 6 will switch to CMake.
- Qt development (general, esp. Android)
- Qt Quick (QML, QRC, QuickControls2, …)
-
The QML Reference
-
.qrc files
-
articles about developing
mobile applications with QuickControls2
-
German article "Mobile Apps mit
Qt Creator"
- The article describes how to create performant, modern looking cross-platform mobile apps
using "Qt QuickControls 2", QML and Qt Creator (and no Android Studio!), with a real-world example for Android and iOS.
- example apps for mobile platforms
A good way to start an app is from a well-documented, cross-platform, open source Android and iOS
application.
-
QtWS 2019 Conference App. This is the
continued and extended version of the QtCon 2016
Conference App, which is disussed in the Linux Magazin article "Mobile Apps mit Qt Creator" and
also on the
author's blog. They share the same codebase, but this extended versions adds about 100
commits. APKs are available from Google Play and directly from the Github Readme. See also
our own installation
instructions.
The app is the perfect match for a template / example / scaffolding mobile app with Qt5+QML:
- It is cross-platform (tested on iOS and Android but may work on others as it's
Qt).
- It also compiles easily for a desktop target and provides a very useful desktop
experience out of the box. Great during development and testing, and to create a desktop /
mobile cross-platform app.
- It has a very fast UI with a nice "mobile like" look, using the newest Qt UI controls
called "Qt Quick Controls 2" that provide a native look and feel to mobile apps. The UI has
a good finish and one can feel the German perfectionism in it (it's author is German).
- It uses QML for the UI elements.
- Its general navigation is very suitable for a typical app to present information, and
already includes a card-like navigation system.
- It has has some nice (but optional) navigation goodies for one-hand use on a
smartphone.
- It's licenced under "Unlicence", which basically means public domain.
- The QtCon 2016 app has a relatively
reasonable size (15 MiB for the Android APK) while the QtWS 2019 app is ~44 MiB. The reason for that large
size is a 33.6 MiB library `libc2gQtWS_x.so`, probably containing the conference content
incl. images. And in addition many other dynamically linked libraries, mostly Qt. That can
be much smaller by static linking and including unused code. So this size is not an issue
for apps based on it.
-
ekke repositories. Many nice
Qt5 example mobile apps, from the maker of the QtCon 2016 and QtWS 2019 apps recommended
above. The six example apps also come with accompanying blog posts.
-
Kaqaz. Uses QML and is made
for both desktop and mobile platforms and Ubuntu Touch. Also, it uses SQLite3. So for these it's a good
reference, but overall its finish level and mobile UI suitability is much lower. Also, the
licence is GPL. See also the source code.
- PaveCool.
-
Function Plotter.
A minimal example. See also the source code.
- Kirigami
- MauiKit
-
Not used.
- It seems to add just unnecessary complexity. Kirigami should be enough as it has the same
goal and is the base software used by MauiKit. Avoiding one layer of complexity is good! Also,
Kirigami developers sometimes backport MauiKit functionality ("Camilo and Marco worked on
expanding some Kirigami features inspired by Maui apps. This includes pull back headers and
footers"; see).
- The "Multi-Adaptable User Interfaces Kit", a small framework on top of Kirigami but with the
same intentions. Basically a fork of Kirigami that extends it further.
-
product website
-
issue tracker
- example applications
- Fluid
-
Project documentation and licencing
- Dynalist
- Used for all project documentation that is not directly related to code.
- Github `README.md` and other Markdown files
- Used for documentation that should be immediately accessible to visitors looking at the source
code repository.
- Markdown
- REUSE
- A tool to make sure all files are suitably annotated with licence information that enables
simple reuse.
-
website
-
Ruby development
- build system
- code documentation
- code style
- development environment / IDE
- MS Visual Studio Code
- ruby-vscode
- The best available VS Code plugin for Ruby support.
-
documentation
- Ruby language
- Ruby standard library
-
Software design, GUI design
-
Open Food Facts project
- slack channels
- OpenFoodFacts uses Slack for collaboration internally and with the open source community.
- \#expirydates
- https://openfoodfacts.slack.com/archives/C0A1SE6Q7
- Charles Nepote: "The discussions related to your project can take place in \#expirydates
channel IMHO."
(https://openfoodfacts.slack.com/archives/C02KVRT2C/p1583313975033400?thread_ts=1583274883.031800&cid=C02KVRT2C)
- \#general
- https://openfoodfacts.slack.com/archives/C02KVRT2C
- Charles Nepote: "Of course, you can also post in this \#general channel to communicate
general news about the project."
(https://openfoodfacts.slack.com/archives/C02KVRT2C/p1583313975033400?thread_ts=1583274883.031800&cid=C02KVRT2C)
- \#bestbeforedates
- https://openfoodfacts.slack.com/archives/C17324N0L
- teolemon: "Creating a channel about best before date dates […] which are too conservative
and make us throw away stuff"
(https://openfoodfacts.slack.com/archives/C17324N0L/p1462729437000005)
- test site
- URL
- https://uk.openfoodfacts.net/
- https://world.openfoodfacts.net/
- HTTP Basic Auth
- server software
- https://github.com/openfoodfacts/openfoodfacts-server
- https://en.wiki.openfoodfacts.org/Product_Opener
- https://en.wiki.openfoodfacts.org/Infrastructure
- Overview of their server setup:
https://en.wiki.openfoodfacts.org/Project:Personalized_Search#Software_Bill_of_Materials
- Android app
- This is a native app: "a Java/Kotlin version on Android, and an hybrid version on iOS currently
developed in HTML and JS with Apache Cordova / Phonegap for iOS, with a native iOS] Swift version that needs volunteers"
([source)
- source code
- https://github.com/openfoodfacts/openfoodfacts-androidapp
- packages
- https://f-droid.org/en/packages/openfoodfacts.github.scrachx.openfood/
- https://play.google.com/store/apps/details?id=org.openfoodfacts.scanner
- installation
-
https://github.com/openfoodfacts/openfoodfacts-androidapp/blob/master/README.md#installation
- background information
- https://en.wiki.openfoodfacts.org/Mobile_Apps
- https://github.com/openfoodfacts/openfoodfacts-androidapp/graphs/contributors
- iOS app
- https://github.com/openfoodfacts/openfoodfacts-ios
- cross-platform Cordova app
- "Latest commit 2018-09-11"
- https://github.com/openfoodfacts/openfoodfacts-cordova-app
- https://en.wiki.openfoodfacts.org/Mobile_App/Development_Notes
- "We currently have native apps for Android, iOS and Ubuntu Touch. We also have an HTML-based
app for other mobile OSes based on Cordova and PhoneGap. We'd very much like [to] have native apps
for speed and access to more advanced features."
(https://en.wiki.openfoodfacts.org/Mobile_Apps)
- "a Java/Kotlin version on Android, and an hybrid version on iOS currently developed in HTML and
JS with Apache Cordova / Phonegap for iOS, with a [native iOS] Swift version that needs volunteers"
(https://world.openfoodfacts.org/contribute)
- On
https://en.wiki.openfoodfacts.org/Product_Opener#Apache_Cordova_mobile_app_for_Android.2C_iOS_and_Windows_Phone
it says that the Android app is Apache Cordova ("Phonegap") based. However, the link there now
forwards to https://github.com/openfoodfacts/openfoodfacts-cordova-app-old-with-blob . So it seems
that this is a legacy attempt at an Android app, and that indeed the current Android app is the
native one.
- wiki
- https://en.wiki.openfoodfacts.org/
- https://en.wiki.openfoodfacts.org/Special:AllPages
- https://en.wiki.openfoodfacts.org/Special:Statistics
- relevant articles
- https://en.wiki.openfoodfacts.org/Expiration_dates
- https://en.wiki.openfoodfacts.org/Food_Traceability_Codes
- https://en.wiki.openfoodfacts.org/Global_storage_taxonomy
- https://en.wiki.openfoodfacts.org/Verification/Noteworthy_Products
- "We also have a wiki that we use to collaboratively document Open Food Facts and its
sub-projects. We also use the wiki to manage translations
(https://en.wiki.openfoodfacts.org/Translations) and to work on the taxonomies / hierarchies
(https://en.wiki.openfoodfacts.org/Global_taxonomies) of categories, labels etc."
(https://world.openfoodfacts.org/contribute)
- The wiki is not really active currently. As of 2020-03-03, there were 284 content pages and 12
active users in the last month. See: https://en.wiki.openfoodfacts.org/Special:Statistics
- The French wiki is even less active. As of 2020-03-03, there were 69 content pages and 1 active
user in the last month. See: https://fr.wiki.openfoodfacts.org/Sp%C3%A9cial:Statistiques
- user guide
- Contributed by bcatelin (Slack username, https://app.slack.com/team/U02L1297N ).
- https://catelin.net/off/user-guide/
- data dumps
- Kaggle datasets
- The same that's available on the Open Food Facts website, but an old version.
- https://www.kaggle.com/openfoodfacts/world-food-facts
- API
- New API docs.
- https://documenter.getpostman.com/view/8470508/SVtN3Wzy
- Legacy API docs.
- https://en.wiki.openfoodfacts.org/API
- Other API and field docs.
- https://world.openfoodfacts.org/data/data-fields.txt
- API example answers. Both return JSON, but there are differences.
- https://world.openfoodfacts.org/api/v0/product/5014044006350
- https://world.openfoodfacts.org/api/v0/product/5014044006350.json
- issue trackers
- general server issues
- https://github.com/openfoodfacts/openfoodfacts-server/issues
- API issues
- https://github.com/openfoodfacts/openfoodfacts-server/labels/api
- issues for next API milestone
- https://github.com/openfoodfacts/openfoodfacts-server/milestone/8
- blog
- official blog
- Not really active. Two posts since 2018-04.
- https://en.blog.openfoodfacts.org/
- raw blog
- A good way to contribute an article (written on the OFF wiki) that may eventually be
published on the official OFF blog.
- https://en.wiki.openfoodfacts.org/Raw_blog
- donation pages
- https://world.openfoodfacts.org/donate-to-open-food-facts
- https://world.openfoodfacts.org/better-food-choices-for-a-better-health-lets-mobilize
- third-party software
- https://en.wiki.openfoodfacts.org/Reuses_of_Open_Food_Facts
- Kaggle notebooks
- 508 explorations of the Open Food Facts dataset, with Python mostly, using the Kaggle
online datascience environment.
- https://www.kaggle.com/openfoodfacts/world-food-facts/kernels
- statistics and analysis
-
Instructions
-
About
- Contains instructions for project-specific tasks.
- For general documentation and how-to information about tools, see under "Documentation".
- How to grep through the `foodrescue-content` source code?
- The problem is that the repo also contains many, very large text files that don't contain source
code. A solution is to ignore all files too large to contain source code.
- Another problem is that we don't want to search in generated documentation, so we exclude
`./doc`.
- find . -path ./doc -prune -o -size -100k -type f -print | xargs grep "pattern"
- How to run YARD for the `foodrescue-content` repo?
- generating documentation for public elements:
- yard doc --markup markdown
- generating documentation for public, protected, private elements:
- yard doc --markup markdown --protected --private
- generating the most complete documentation
- yard doc --markup markdown --protected --private - LICENSE.*.md
- showing undocumented elements
- How to test importing FoodKeeper data?
- ```
cd ./Repo.foodrescue-content/scripts;
sqlite3 ../build/foodrescue-content.sqlite3 <<< 'DROP TABLE IF EXISTS topics; DROP TABLE IF
EXISTS topic_contents; DROP TABLE IF EXISTS topic_authors; DROP TABLE IF EXISTS topic_literature; DROP
TABLE IF EXISTS topic_categories; DROP TABLE IF EXISTS literature; DROP TABLE IF EXISTS authors;'
./frc-import-foodkeepertopics ../content-topics-foodkeeper/foodkeeper.sqlite3
../content-topics-foodkeeper/foodkeeper_extra_data.csv ../build/foodrescue-content.sqlite3
```
- How to test importing OFF categories?
- ```
cd ./Repo.foodrescue-content/scripts;
sqlite3 ../build/foodrescue-content.sqlite3 <<< 'DROP TABLE IF EXISTS categories; DROP TABLE
IF EXISTS categories_structure; DROP TABLE IF EXISTS product_categories; DROP TABLE IF EXISTS
topic_categories;'
./frc-import-categories-txt ../content-categories/categories-txt.1-downloaded.txt
../build/foodrescue-content.sqlite3
```
- How to find the right OFF category for a food rescue topic?
- Think about what food products your food rescue topic should be shown for.
- Edit any product in the Open Food Facts web application (example) and in
the category-field, type any word that you would expect in the category you want to assign. Select
suitable categories from the suggestions. Triple-click on the category names in the field to select
their text so you can copy & paste the category name to a different program.
- If the above did not help: In the Open Food Facts online
search, search for keywords that you expect to appear in the name of relevant products. For
example, search for
cheesecake. Visit some relevant products from the search results and look at their categories. For
example, you might find a category
cheesecakes.
- Choose the best matching category (or, in some cases, categories). This means:
- The chosen category must be part of the Open Food Facts category taxonomy. That is the case for
all categories linked in normal font from a product's page, but not for those linked in an italics
font. All important major categories are part of the taxonomy, or will become part of it after it
becomes apparent that they are important. Only the taxonomy categories are imported into the food
rescue database, so if allowing all other categories, spelling errors in category names would not
be detectable anymore.
- It is important that the chosen selection of categories does not include products for which
your food rescue topic is not relevant, or for which it is even misleading. It would lead to
malfunction of software using this content, for examply by showing the expected storage duration of
crisp bread for fresh meat, which is way too generous and potentially dangerous.
- Ideally, a single category that includes all products relevant for your food rescue topic. Or
one that might leave some out.
- If there is no single category that contains all or nearly all of the relevant products, you
can assign several ones. It is ok if some products appear in more than one of the assigned
categories. The food rescue topic will still be shown only once.
- If a category is a good match, there is no need to also include any of its sub-categories.
Because every product in a sub-category is logically also contained in the parent category. For
example, if you assign category cheesecakes, there is no need to also
assign category caramel
cheesecakes.
- There is one exception from the rule of assigning no subcategories of an already assigned
category. Namely, if a category fits well but a sub-category fits conceptually very well (while
also being too narrow), assign both. This will emphasize your topic when matching a product in the
more specific category, showing it earlier in the list of food rescue content displayed for such a
product.
- How to make agreements with Open Food Facts on data structures?
- Some of the data structures used in this project have to be agreed on between this project and the
Open Food Facts core team. These proposals are being actively discussed in the Open Food Facts Slack
channel #expirydates.
- How to collect data about food products without the Open Food Facts app?
- Useful for data for which is there is not yet a field in the Open Food Facts app. Below are
options for software that can be used.
- CmpTable Generator + Ucom Free Barcode Scanner
- The current solution.
- https://play.google.com/store/apps/details?id=com.shirobakama.cmptable
- https://sites.google.com/site/shirobakama724/cmptable-generator
- Data format: The first two blocks show columns and rows. Then values are listed, to be entered
into the field identified by "column ID" and "row ID" shown in the line before the actual line with
the data value.
- Omni Notes + Ucom Free Barcode Scanner
- Omni Notes
- https://omninotes.app/
- https://f-droid.org/en/packages/it.feio.android.omninotes.foss/
- https://play.google.com/store/apps/details?id=it.feio.android.omninotes
- Ucom Free Barcode Scanner
- https://play.google.com/store/apps/details?id=hk.ucom.barcodecamera
- Ucom Free Barcode Scanner is the most suitable of all barcode scanner apps that can act as a
keyboard. It is relatively small, free, serves no ads, and has useful options. Also, launching the
scanner needs just one button.
- Issue: None of the available barcode scanner keyboard apps can scan into the Omni Notes note
body field, only into its note title field. But that is workable already. Seems to indicate an
issue with Omni Notes; reported on https://github.com/federicoiosue/Omni-Notes/issues/748 .
- Vorratsübersicht
- https://play.google.com/store/apps/details?id=de.stryi.Vorratsuebersicht
- Mobile Inventory FREE
- https://play.google.com/store/apps/details?id=hr.foton.brzainventura
- Storage Manager : Stock Tracker
- https://play.google.com/store/apps/details?id=ch.huber.storagemanager.free
- X SCAN PET
- Allows to scan barcodes and record information about them (incl. a photo) into Excel
files.
- This is the paid version of SCAN PET, removing the annoying ads and the crippleware issue of
always being told to buy the paid version …
- https://play.google.com/store/apps/details?id=com.maiko.xscanpet
- CSV Editor
- https://play.google.com/store/apps/details?id=jp.blogspot.halnablue.csveditor
- CSV Editor
- https://play.google.com/store/apps/details?id=com.cleveroad.tablelayout
- How to use the Vorratsübersicht app to collect expiry date information?
- Install the app
from Google Play.
- Use the app to collect expiry dates.
- The app does not record the date of data entry, neither when creating a new article nor when
creating a new storage item (a number of articles plus an expiry date). Workaround: create expiry
dates alternatingly to mean "expiry date entry date" and the associated "expiry date". When
converting the data, that will have to be converted accordingly to two different fields.
- Create a database backup under "Settings".
- Transfer the database backup to a Linux computer.
- Note: The pictures are contained right in the database.
- Start SimpleSSHD on the Android device.
- rsync -avzzhP --inplace --info=progress2 -e 'ssh -p 2222'
192.168.179.27:/storage/emulated/0/Download/*.VueBak
/home/matthias/Projects/Real_MHD_App/DataCollection/
- Enter the one-time password that will be shown in the SimpleSSHD app on the Android
device.
- Rename the file to *.sqlite3
- Convert the file to a table format.
- sqlite3 Vue_2020-03-05_1551.sqlite3 .tables
- sqlite3 Vue_2020-03-05_1551.sqlite3 .dump
- How to access the Open Food Facts MongoDB database?
- Install MongoDB:
- `sudo apt install mongodb`
- Download a recent MongoDB database dump (needs ca. 1.7 GiB):
- `wget https://world.openfoodfacts.org/data`
- Unpack the ODD MongoDB database (needs ca. 11.5 GiB):
- `tar -xzf openfoodfacts-mongodbdump.tar.gz`
- Restore the MongoDB dump into a database "off" (needs ca. 7.8 GiB incl. indexes, 30 min for the
import, at least 2:00 hours for generating the indexes):
- `mongorestore -d off -u username -p password dump/off/`
- Connect to the database with the Mongo Shell:
- See the "Getting Started" guide for the initial steps:
- https://docs.mongodb.com/manual/tutorial/getting-started/#getting-started
- How to see the MongoDB database structure?
- `echo 'db.products.find().pretty()' | mongo off | less`
- Source: https://stackoverflow.com/q/14713179 , https://stackoverflow.com/a/6000360
- How to use the OFF JSON API for products?
- API example answers. Both return JSON, but there are differences.
- https://world.openfoodfacts.org/api/v0/product/5014044006350
- https://world.openfoodfacts.org/api/v0/product/5014044006350.json
- How to convert from SQLite to FreeMind?
- The following will copy a Freemind-compatible indented text format from the output of a SQLite
command. Each record of the result set will be one FreeMind node with one subnode per field. (The
example is about category records, but the category hierarchy is not mapped to a FreeMind node
hierarchy.)
- For this to work, the indentation character must be a proper space character, no non-breaking space
etc.. Source: https://dba.stackexchange.com/a/264847
- `sqlite3 foodrescue-content.sqlite3 < <(echo -e ".mode csv \n.separator \"\\\\n \"\n SELECT
name, id, product_count FROM categories WHERE product_count >= 1000 ORDER BY product_count DESC;") |
xclip -selection clipboard`
- How to convert the OFF categories to SQLite3 manually?
- Set up the SQLite3 database structure.
- CREATE TABLE IF NOT EXISTS [data] (
[url] VARCHAR NULL,
[products_count] INT NULL,
[id] VARCHAR NULL,
[taxonomied] INT NULL,
[name] VARCHAR NULL,
[sameAs] VARCHAR NULL
);
- Download the categories from the JSON API:
- http://world.openfoodfacts.org/categories.json
- Adapt the outer structure so that the whole file is one large JSON array of the form
[{…},{…},{…},{…}].
- Pretty-print the JSON:
- `python -m json.tool categories.json categories.pretty.json`
- Adapt the "sameAs" field to contain a string, not a JSON array.
- Upload to Numidian Convert and convert to a SQLite file:
- https://numidian.io/convert/json/to/sqlite
- Use the following two commands in vi to convert to one SQL statement per line. This will give
proper statement numbers in case of errors.
- `:%s/),$/);/g`
- `:%s/^(/INSERT INTO data VALUES (/g`
- Create the SQLite database:
- sqlite3 categories.sqlite < categories.SQLite.sql
- Access the SQLite database:
- Set a suitable column width. The following is suitable when showing all columns of the table.
- `.mode column `
- .width 20 7 20 4 30 20
- Run some queries.
- `SELECT name FROM data WHERE sameAs NOT NULL;`
- `SELECT COUNT() FROM data WHERE id LIKE 'en:%' AND taxonomied = 1;`
- `SELECT * FROM data WHERE id LIKE 'en:%' AND taxonomied = 1;`
- `SELECT COUNT(*) FROM data WHERE id LIKE 'en:%' AND taxonomied = 1 AND sameAs NOT NULL ORDER BY
products_count DESC;`
- `SELECT COUNT() FROM data WHERE id LIKE 'en:%' AND taxonomied = 1 AND products_count >= 1000
ORDER BY products_count DESC;`
- What are useful SQL commands for the Food Rescue App database?
- remove product related tables
- `sqlite3 foodrescue-content.v02.sqlite 'DROP TABLE IF EXISTS products; DROP TABLE IF EXISTS
product_categories; DROP TABLE IF EXISTS countries; DROP TABLE IF EXISTS product_countries;'`
- show the last inserted product
- ```
SELECT * FROM products WHERE id = (SELECT MAX(id) FROM products);
```
- show a topic
- ```
SELECT * FROM topics INNER JOIN topic_contents on topics.id = topic_contents.topic_id;
```
- copy categories in a format suitable for pasting to FreeMind (details)
- `sqlite3 foodrescue-content.sqlite3 < <(echo -e ".mode csv \n.separator \"\\\\n \"\n
SELECT name, id, product_count FROM categories WHERE product_count >= 1000 ORDER BY
product_count DESC;") | xclip -selection clipboard`
- copy categories in a format suitable for pasting to LibreOffice Calc
- `sqlite3 foodrescue-content.sqlite3 < <(echo -e ".mode csv \n SELECT name, product_count
FROM categories WHERE product_count >= 1000 ORDER BY product_count DESC;") | xclip -selection
clipboard`
- What are useful SQL commands in the FoodKeeper App database?
- show all products in their categories
- `SELECT
Name, Name_Subtitle, Category_Name, Subcategory_Name
FROM
PRODUCTS INNER JOIN FOOD_CATEGORY
ON PRODUCTS.Category_ID = FOOD_CATEGORY.ID;`
- How to update the indentation in XMLmind XML Editor for the currently edited XML document?
- Switch from XML source mode to a mode with a stylesheet (for example "View → DocBook") and then
back to the XML source mode.
- How to select the categories for the chapter structure when publishing as book / website?
- The following criteria are used:
- Category is an Open Food Facts (OFF) category.
- Category has an English name.
- Category is included in the OFF category taxonomy (JSON field "known" = 1).
- Category has at least 1000 products assigned to it.
- You can apply these selection criteria with a SQL query after importing the categories.json file
into a SQLite database. The query for the above criteria would then be:
- sqlite3 db.sqlite < <(echo -e ".mode csv \n.separator \"\\\\n \"\n SELECT name, id,
products_count, url, sameAs FROM data WHERE id LIKE 'en:%' AND known = 1 AND products >= 1000
ORDER BY products DESC;") | xclip -selection clipboard
- The top-level categories should be broad and cluster items together well by "level and type of
danger". For example, both "meat products" and "dried products" make sense in parallel, even though it
is not too clear where to insert "dried ham" then.
- Do not include categories where products in them could have wildly different shelf lives and
storage instructions – because then no meaningful text regarding storage life can be written for that
category. For example “alcoholic beverages” can contain both spirits (that never spoil) and natural
wine (that spoils in a day). And "fish fillets" can contain both smoked and fresh fish, with very
different storage life.
- Do not include categories where storage life and storage instructions are not significantly
different from a superior category. For example, it makes no sense to include “herbal teas” in addition
to “teas”, as storage life and for all dried tea is the same.
- How to see Android SDK packages that are currently installed?
- The command below will show the output without line wrapping, which is much better to read in this
case. You can see the rest of the long lines by pressing "Arrow Right".
- ```
sdkmanager --list | less -S
```
- How to do a "make clean" with CMake? #cmake
- How to install Qt Creator for Android development from the Ubuntu 19.10 repositories?
#qtcreator
- Notes
- The below will install Qt Creator 4.8 under Ubuntu 19.10, which is the version available in the
repositories. If you can, better install under Ubuntu 20.04 LTS, where Qt Creator 4.11 is available
(ca. 14 months newer; see).
- The below will also install relevant Qt examples for Android development, while excluding other
examples. For that reason, we avoid installing packages `qt5-examples`, `qt5-doc` and
`qt5-doc-html` as each of these would bring in documentation and other material from unnecessary
examples.
- Sources
-
(1) Install OpenJDK 8, which is a dependency of Qt Creator.
- Later versions will not work – see. And when not
doing the `update-alternatives` step, command line utilities that do not inherit the Qt Creator
Java path (such as `sdkmanager` when started manually) will fail to run.
- ```
sudo apt install openjdk-8-jdk
sudo update-alternatives --config java
```
-
(2) Install `sdk-tools-linux-4333796.zip`.
Do not install the new edition of this, called "commandlinetools 1.0" as provided on the Android Studio download page (reasons).
- Download and unpack the package to the place that will later also host the Android SDK:
```
cd /opt/android-sdk/
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip
```
- Make the `sdkmanager` command accessible system-wide:
```
sudo ln -s /opt/android-sdk/tools/bin/sdkmanager /usr/local/bin/
```
-
(3) Use the now-installed `sdkmanager` to download the SDK packages required by Qt Creator
(source).
- Choose the Android SDK platform that suits your target device, for example
`platforms;android-23`. The correct API level number for your Android version can be found
here. Also, the version of
the build tools has to match the version of the Android SDK platform. And finally, according to
the
official Qt Creator installation instructions: for Qt 5.12.0 to 5.12.5 [which applies to
Ubuntu 19.10] […], the correct versions of packages to install is as follows:
```
sdkmanager --install "platform-tools" "platforms;android-29" "build-tools;29.0.2"
"ndk;19.2.5345600"
```
- Batch-accept the licences (see):
```
yes | sdkmanager --licenses
```
-
(4) Make the Android SDK and NDK installation folders writable.
- Reason: "Make sure to unpack the Android SDK and NDK to a writeable location that Qt Creator
can access later. Otherwise, Qt Creator won't be able to use sdkmanager or find all components even
if they were installed manually." (source)
- Command to execute, with the username of the user running Qt Creator usually:
```
chown username:username -R /opt/android/sdk/ /opt/android-ndk/
```
-
(5) Install Qt Creator and its dependencies and documentation.
The `:i386` architecture dependencies are needed on 64 bit architectures; otherwise Qt Creator will
not find Android devices to deploy to (see).
- ```
sudo apt-get install qtcreator qt5-default build-essential qtcreator-doc libstdc++6:i386
libgcc1:i386 zlib1g:i386 libncurses5:i386
```
-
(6) Install all Qt modules incl. their header files.
- ```
sudo apt install libqt5gamepad5-dev libqt5opengl5-dev libqt5sensors5-dev libqt5serialport5-dev
libqt5svg5-dev libqt5websockets5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev qtbase5-dev
qtbase5-dev-tools qtdeclarative5-dev qtdeclarative5-dev-tools qtlocation5-dev qtpositioning5-dev
qtquickcontrols2-5-dev qtscript5-dev qttools5-dev qttools5-dev-tools qtwayland5-dev-tools
qtxmlpatterns5-dev-tools
```
-
(7) Install relevant Qt examples for Android development.
Note that for each example, three packages are needed: source files, API docs (used for the help
system) and HTML docs (used for the example index in the welcome page etc.).
- ```
sudo apt install qtbase5-examples qtdeclarative5-doc qtdeclarative5-doc-html
qtdeclarative5-examples qtquickcontrols2-5-doc qtquickcontrols2-5-doc-html
qtquickcontrols2-5-examples qtsensors5-doc qtsensors5-doc-html qtsensors5-examples
qtxmlpatterns5-doc qtxmlpatterns5-doc-html qtxmlpatterns5-examples qtconnectivity5-examples
qtconnectivity5-doc qtconnectivity5-doc-html qtdatavisualization5-examples qtdatavisualization5-doc
qtdatavisualization5-doc-html qtmultimedia5-examples qtmultimedia5-doc qtmultimedia5-doc-html
qtsvg5-examples qtsvg5-doc qtsvg5-doc-html qttools5-examples qttools5-doc qttools5-doc-html
qtwayland5-examples qtwayland5-doc qtwayland5-doc-html qtxmlpatterns5-examples qtxmlpatterns5-doc
qtxmlpatterns5-doc-html
```
-
(8) Install Qt for Android. (Needed because the Ubuntu repositories contain only "Qt 5.14.2
(GCC 5.3.1 … 64 bit)", the desktop variant. For Android, we need a variant compiled for ARMv7 /
ARMv8.)
- Install aqtinstall, an unofficial
instalelr to install any platform version of Qt on any platform. This is needed because the version
of Qt provided in the Ubuntu repositories does not provide the Qt Maintenance Tool that could be
used as an alternative.
- Use `aqtinstall` to install Qt 5.14.2 for Android. Version 5.14.2 is the version contained in
Ubuntu 19.10, chosen here because it saves disk space by not needing two Qt versions for desktop
installed. However, you can also install any older or newer version. Just make sure the versions
chosen for desktop and Android match if you want to test the same codebase on these two platforms
in parallel.
-
(9) Configure Qt Creator
- Under "Tools → Options … → Devices → Android", configure the paths to the Android SDK and
NDK.
- Under "Tools → Options → Kits → Qt versions", configure the paths of your new Qt
installations.
- Connect your Android device by USB cable and under "Tools → Options → Kits → Kits" make sure
there is an auto-generated kit for this device.
- In a new, existing or example Qt project, go in the sidebar to "Projects → Build & Run" and
configure the project for the Qt Creator kit corresponding to your Android device.
- Before deploying to an Android device for testing, emable `adb` debuggon on the Android device
and then follow "Selecting
Android Devices".
- How to install and compile the Qt World Summit 2019 Conference App? #qt
- Clone the `android-openssl` and `statusbar` repositories according to these instructions.
- Open `c2gQtWS_x.pro` and adapt the references to the `android-openssl` and `statusbar` project
includes (means, the `include( ….pri )` statements.
- Compiling of `qrc_data-assets.cpp` (the file automatically generated from `data-assets.qrc`) needs
a lot of memory – more than 5.5 GiB at the same time. This is only because many images are included
there. To fix this and make compilation go smoothly without exhausting memory, simply remove all
references to `speakerImages/*` files from `qrc_data-assets.cpp`. The app will complain at runtime "QML
Image: Cannot open: qrc:/data-assets/conference/speakerImages/speaker_….jpg" when viewing speakers, but
everything else works fine.
- As of 2020-05-30 (commit `07738af`), the app is meant to be used with Qt 5.13. To get it to work
with the new Qt 5.14, follow these steps.
- How to build a Qt for Android app from the command line? #qt
- Create an APK file for installation on an Android device:
```
make apk
```
- Create an Android App Bundle (APKs for multiple mobile architectures combined)
```
make aab
```
- Run tests on Android:
```
make check
```
- Install the Android APK to the mobile device:
```
adb install -r file.apk
```
- Source: Qt for Android
better than ever before
- How to build a KDE Kirigami application under Ubuntu as a desktop application? #kirigami
-
Application specific hints
- Kirigami Gallery. On Ubuntu
19.10, needs `git checkout a67c49e` before, which selects a version from 2019-09.
-
applicationitem. As found in the main Kirigami repo. Needs extra switch
`-DBUILD_EXAMPLES=ON` to be built (see).
- Kongress. But it needs Ubuntu 20.04 as Ubuntu 19.10 comes with a too old, incompatible
version of KCalendarCore.
- ```
sudo apt install cmake extra-cmake-modules kirigami2-dev qtbase5-dev qtdeclarative5-dev
"qml-module-qtquick-*"
```
- ```
git clone https://invent.kde.org/example/example.git
```
- ```
cd example && mkdir build && cd build
```
- ```
cmake ..
```
- ```
make
```
- Both `cmake` and `make` may complain about missing Qt5 and KDE development files ("Could not find a
package configuration file provided by "…") or missing include files. Look the right ones up and
install them, then try again.
- list for Qt development packages: `apt list "libqt5*-dev" "qt*-dev"`
- list of KDE development packages: `apt list "libkf5*-dev"`
-
[DRAFT] How to build a KDE Kirigami application under Ubuntu as an Android
application? #kirigami
- Application specific hints
- ```
sudo apt install cmake extra-cmake-modules kirigami2-dev qtbase5-dev qtdeclarative5-dev
"qml-module-qtquick-*"
```
- If your distribution provides a version of ECM ("extra cmake modules") lower than 5.62.0,
instead follow these instructions to install the
latest version. This was necessar under Ubuntu 19.10.
- ```
git clone https://invent.kde.org/example/example.git
```
- ```
cd example && mkdir build && cd build
```
- ```
cmake .. \
-DQTANDROID_EXPORTED_TARGET=kirigami2gallery \
-DANDROID_APK_DIR=./src/ \
-DECM_DIR=/usr/local/share/ECM/cmake \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/ECM/toolchain/Android.cmake \
-DECM_ADDITIONAL_FIND_ROOT_PATH=/opt/qt/5.15.0/android/ \
-DCMAKE_PREFIX_PATH=/opt/qt/5.15.0/android/lib/cmake/Qt5Core \
-DANDROID_NDK=/opt/android-sdk/ndk/21.1.6352462/ \
-DANDROID_SDK_ROOT=/opt/android-sdk/ \
-DANDROID_SDK_BUILD_TOOLS_REVISION=29.0.2 \
-DCMAKE_INSTALL_PREFIX=/home/matthias/Projects/Fairdirect.Food_Rescue_App/
```
- ```
cmake .. \
-DQTANDROID_EXPORTED_TARGET=applicationitemapp \
-DANDROID_APK_DIR=./examples/applicationitemapp/ \
-DECM_DIR=/usr/local/share/ECM/cmake \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/ECM/toolchain/Android.cmake \
-DECM_ADDITIONAL_FIND_ROOT_PATH=/opt/qt/5.15.0/android/ \
-DCMAKE_PREFIX_PATH=/opt/qt/5.15.0/android/lib/cmake/Qt5Core \
-DANDROID_NDK=/opt/android-sdk/ndk/21.1.6352462/ \
-DANDROID_SDK_ROOT=/opt/android-sdk/ \
-DANDROID_SDK_BUILD_TOOLS_REVISION=29.0.2 \
-DCMAKE_INSTALL_PREFIX=/home/matthias/Projects/Fairdirect.Food_Rescue_App/
```
- ```
make
```
- `cmake` and `make` will complain about missing Qt5 development files ("Could not find a package
configuration file provided by "Qt5…"). Look the right ones up in this list and install them. (Additions to the list:
qtquickcontrols2-5-dev ).
- ```
make create-apk-kirigami2gallery
```
- ```
adb install -r ./kirigami2gallery_build_apk/build/outputs/apk/kirigami2gallery_build_apk-debug.apk
```
- How to start developing a Kirigami application with Qt Creator? #kirigami
-
About
- The following instructions make you start from a blank template application derived from the
Kirigami Gallery application. But you can just as well start from any other Kirigami application
and start extending it rather than emptying it out first.
- These instructions use Qt Creator as the IDE. That makes sense, as it has special support for
graphical editing of QML files. But since the build system does not rely on any files supplied by
Qt Creator, any other IDE can be used as well.
- Make sure you can build the Kirigami Gallery application unmodified as a desktop and Android
application.
- Copy the Kirigami Gallery application to a new directory for your project.
- In Qt Creator, do "File → Open File or Project …" and open `CMakeLists.txt` in your project's
directory. When asked, only enable the "Imported Kit" build kit.
- This is the project definition file for CMake projects. There is no `.pro` file here as in Qt
Creator qmake projects.
- Upon opening the file, Qt Creator will ask some questions and generate build kits for the
project. We only enable the "Imported Kit" because that one will work and use the KDE build system
(`extra-cmake-modules` and so on). However, creating new Qt Creator defined build kits in a CMake
project will use CMake as well, so it's not bad if it works.
- It will store all that information into a XML file with user settings, called
`CMakeLists.txt.user`. That file should not be in version control as it's about your personal
settings and paths for building the project.
- Set up the build configuration in Qt Creator.
- In Qt Creator under "Tools → Options → Kits", rename "Imported Kit" to something useful like
"Desktop (KDE kit, system Qt)".
- In Qt Creator under "Project (in sidbar) → Build & Run → Desktop (KDE kit, system Qt) → Build",
add another build configuration "Release". This will already work then, avoiding to build with
debug symbols.
- In the same place, edit the build directory to be inside the `./build/` directory of the
repository, for example `./build/Desktop.KDE_kit+system_Qt.Release` and
`./build/Desktop.KDE_kit+system_Qt.Debug`.
- Try out the Debug Release build configurations by running the application from inside Qt
Creator.
- Rename the project: in file `CMakeLists.txt`, replace `project(kirigami-gallery …)` with
`project(your-project-name …)`.
- If you want to start from an empty application, delete everything in your project directory that is
not necessary for a blank Kirigami application. Only keep the following, with adaptations to account
for what you deleted:
- ```
.
├── CMakeLists.txt
├── CMakeLists.txt.user
├── org.fairdirect.foodrescue.appdata.xml
└── src/
├── android/
│ ├── AndroidManifest.xml
│ └── res/
│ ├── drawable/
│ ├── drawable-xxxhdpi/
│ └── values/
├── CMakeLists.txt
├── data/
│ └── contents/
│ └── ui/
│ ├── BaseApp.qml
│ ├── MainPage.qml
│ └── mobileApp.qml
├── main.cpp
├── metadata.desktop
├── qtquickcontrols2.conf
└── resources.qrc
```
(Generated with command `tree`.)
- If you want to start from an empty application, delete the `.git` subdirectory in your project
directory, then initialize a new Git repository and commit the current "empty app" state as the first
commit.
- How to update the project documentation from the Dynalist document?
- Keep all documentation content concentrated in a single, H1 formatted node in Dynalist (below). Because due to
the limitations of current Dynalist HTML export, only that allows to export as a HTML document with a
properly formatted title.
- Do not use the nodes' "note field" functionality for heading nodes in Dynalist. Because in the
export, these notes would be rendered as part of the title due to a bug in Dynalist.
- Keep a H1 / H2 / H3 document structure for the first three levels of nodes in Dynalist. It helps to
keep a HTML exported document more readable in the absence of list folding there.
- In Dynalist, export the Food Rescue App
Documentation node to HTML.
- Make sure you have installed HTML tidy, a pretty-printing software for HTML: `sudo apt install
tidy`.
- Pretty-print the HTML file, modifying it in place: `tidy -modify -indent -wrap 120 doc.html`.
Wrapping at 120 characters is the most that Github file preview pages can take.
- Commit the updated file to the Git repository.
-
Related Projects and Initiatives
- CodeCheck app
- Potentially based on the Open Food Facts dataset.
- https://codecheck-app.com/
- Uses a B2B business model of paid-for surveys to their user base:
https://codecheck-app.com/de/business/insights/
- Die Tafeln
- El CoCo
- Open Food Facts based app that focuses on NOVA and Nutriscore metrics, for the Spanish market.
- https://elcoco.es/
- https://play.google.com/store/apps/details?id=es.elcoco.app
- Business model: "At the beginning we started with a B2C business model with a premium app. But
unfortunatly there is no market in Spain, people don't pay for an app. So we are now B2B, we try to
help brands to improve their products. For instance we tell them what they should improve to have a
better rating. We sell also customer insights. (Brands can send survey to our users.)"
- EU Platform on Food Losses and Food Waste
- https://ec.europa.eu/food/safety/food_waste/eu_actions/eu-platform_en
- Especially relevant: "Redistribution of surplus food:Examples of practices in the Member States",
https://ec.europa.eu/food/sites/food/files/safety/docs/fw_eu-actions_food-donation_ms-practices-food-redis.pdf
- food expiration tracker apps
- Date Limite (iOS)
- A food storage management app that will warn people when products approach their best-before /
use-by dates.
- It is based on Open Food Facts data, but only regarding barcodes, product names etc.. Expiry
dates of the products at hand have to be entered by the user herself. Also, Open Food Facts does
not yet have any information about expiry period length or the like.
- This is so far the only expiration tracker app based on OFF. People can contribute product
photos and product data back to OFF using this app.
- https://apps.apple.com/fr/app/date-limite/id504520670
-
https://translate.google.com/translate?sl=fr&tl=en&u=https%3A%2F%2Fapps.apple.com%2Ffr%2Fapp%2Fdate-limite%2Fid504520670
- Vorratsübersicht (Android)
- Can fetch data and pictures from Open Food Facts, but does not contribute back there.
- https://play.google.com/store/apps/details?id=de.stryi.Vorratsuebersicht
- https://sites.google.com/site/vorratsuebersicht
- Food Expiration Track (Android)
- Fridge (Android)
- FridgeCheck (Android)
- Love Food Hate Waste (Android)
- Food Repo
- https://www.foodrepo.org/
- Basically the same idea as Open Food Facts, but with a separate database. Contains ~42 000
products in total as of 2020-03, see https://www.foodrepo.org/ . Focused on Switzerland, but also
available for French, Italian and German products.
- All content, but not the software, is CC-BY-4.0 licenced. See:
https://www.foodrepo.org/ch/terms-of-service
- food rescue initiatives and resources
- https://en.wikipedia.org/wiki/Food_rescue
- Foodsaving Worldwide
- An international equivalent of Germany's "Foodsharing" network.
- website
- https://foodsaving.world/
- software
- According to Micha, this software only provides a kind of discussion functionality. There is no
offer / marketplace function.
- "A web platform to support foodsaving groups worldwide."
- Their software is said to be more democratic compared to the more hierarchical Foodsharing
software, as per https://foodsaving.world/about/faq .
- Backend in Python, frontend in Vue.js. So more modern compared to the Foodsharing software
which is written in PHP.
- https://github.com/yunity/karrot-backend
- https://github.com/yunity/karrot-frontend
- Foodsharing
- software
- Food rescue software. Does not include a sale function.
- Written in PHP.
- Licenced AGPLv3.
- https://gitlab.com/foodsharing-dev/foodsharing/
- Made Near Me
- http://madenear.me/
- "Made Near Me: Made Near Me shows on a map where the food products you eat every day are made,
transformed and/or packaged." (https://catelin.net/off/user-guide/#post-461-_Toc469491389)
- Open Food Network
- An open source marketplace software for virtual farmers markets.
- https://about.openfoodnetwork.org.uk/
- Open Food Facts
- Product Open Data
- Similar to Open Food Facts, but not really specialized for food. Made by Open Knowledge
Foundation.
- Ingredients lists and nutrition facts are sourced from manufacturer websites and presented as a
copy of that. So pretty useless for automated evaluations etc.. See for example:
http://product-open-data.com/gtin/0857063002102
- So far, containing very little data: http://product-open-data.com/nutrition . Aroun since at least
2013 (example: http://product-open-data.com/gtin/0857063002102 ), so rather a dead project.
- https://f-droid.org/en/packages/org.okfn.pod/
- http://product-open-data.com/
- https://product.okfn.org/
- STREFOWA Reduce Food Waste Network
- An EU funded initiative from 2016-2019. Provides various materials that should help in food waste
reduction, with different materials available for the different parties involved.
- http://www.reducefoodwaste.eu/
-
Literature
-
About food rescue
- ❗USDA FoodKeeper app, https://www.foodsafety.gov/keep-food-safe/foodkeeper-app . This also includes
mobile apps, here for Android: https://play.google.com/store/apps/details?id=gov.usda.fsis.foodkeeper2
. Data harvesting may best be done from the mobile app.
- ❗https://www.ag.ndsu.edu/publications/food-nutrition/food-safety?b_start:int=40 , all CC-BY-NC
licenced
- https://www.ag.ndsu.edu/publications/food-nutrition/food-freezing-guide
-
https://www.ag.ndsu.edu/publications/food-nutrition/food-storage-guide-answers-the-question
-
https://www.ag.ndsu.edu/publications/food-nutrition/questions-and-answers-about-storing-fresh-fruits-and-vegetables
-
https://www.ag.ndsu.edu/publications/lawns-gardens-trees/from-garden-to-table-my-potatoes-turned-green-now-what
- ❗USDA Food Safety portal, https://www.foodsafety.gov/ . Among other items:
- https://www.foodsafety.gov/keep-food-safe/4-steps-to-food-safety
- https://www.foodsafety.gov/food-safety-charts/cold-food-storage-charts
- ❗Food Deterioration, U.S. Army Manual,
http://ready4itall.org/wp-content/uploads/2013/05/US-Army-cc-md0723-food-deterioration.pdf
- Compendium of the Microbiological Spoilage of Foods and Beverages
http://file.qums.ac.ir/repository/vct/nutrition/%D8%A2%D9%85%D9%88%D8%B2%D8%B4%D9%8A/%D9%83%D8%AA%D8%A8%20%D9%85%D8%B1%D8%AC%D8%B9/Compendium%20of%20the%20%20Microbiological%20Spoilage%20of%20Foods%20and%20Beverages.pdf
-
Springer "Food Microbiology and
Food Safety" series (to be evaluated)
- UNHCR Food Storage Manual,
https://cms.emergency.unhcr.org/documents/11982/45957/Food+storage+manual/c0961a89-389f-4ede-963f-7cd5caa50b20
- Fungi and Food Spoilage,
https://www.bookdepository.com/Fungi-Food-Spoilage-John-I-Pitt/9780412554605 and
https://link.springer.com/book/10.1007/978-1-4615-6391-4
- https://www.consumerreports.org/food-storage/how-to-extend-food-expiration-dates/ (some useful tips
inside)
- https://hickersonbrothers.com/ways-to-prevent-food-from-spoiling/ (some useful tips inside)
- StillTasty, https://www.stilltasty.com/
- Identification and characterization of Specific Spoilage Organisms (SSOs) in different food
matrices, https://air.unimi.it/retrieve/handle/2434/230015/299627/phd_unimi_R09151.pdf
- Less Food Waste More Profit, https://www.foodwaste.ie/web-images/Food-Waste-Prevention-Guide.pdf
(some useful tips inside)
- Handbook of Food Preservation, 1088 pp.,
http://www.cold.org.gr/library/downloads/Docs/Handbook%20of%20Food%20Preservation.PDF
- How to Determine the Shelf Life of Food, https://www.mpi.govt.nz/dmsdocument/12540/direct
- New Zealand Food Safety Information, https://www.mpi.govt.nz/food-safety
- Pathogen Data Sheets,
https://www.mpi.govt.nz/food-safety/food-safety-and-suitability-research/food-risk-assessment/hazard-data-sheets/data-sheets/
- Is it safe to eat?,
https://www.mpi.govt.nz/food-safety/food-safety-for-consumers/is-it-safe-to-eat/
- NUTRITION TRAINING MANUAL: Module3–Food Safety, Storage & Preservation,
https://www.ethicalteapartnership.org/wp-content/uploads/Food-Safety-Module-3-1.pdf
- Food Safety is Everybody’s Business,
https://www.doh.wa.gov/Portals/1/Documents/Pubs/332-036.pdf
- Safe Food Storage at Home,
https://www.eufic.org/en/food-safety/article/safe-food-storage-at-home
- The safety of bottled water,
https://www.eufic.org/en/food-safety/article/the-safety-of-bottled-water
- A Guide to Food Hygiene,
https://www.melbourne.vic.gov.au/SiteCollectionDocuments/guide-to-food-hygiene.pdf
- Handbook of Food Products Manufacturing, https://books.google.de/books?id=mnh6aoI8iF8C
- Manuals of Food Quality Control – 4. Microbiological Analysis,
http://www.fao.org/3/T0610E/T0610E.pdf
- Food Spoilage and Safety Predictor (FSSP), a software for Windows, http://fssp.food.dtu.dk/
- Handbook of Food Spoilage Yeasts,
https://epdf.pub/handbook-of-food-spoilage-yeasts-second-edition-contemporary-food-science.html
- Microbial Contamination & Food Degradation, chp. 5. Food Degradation and Foodborne Diseases: A
Microbial Approach, https://www.researchgate.net/publication/320244516
- Food Spoilage and Preservation – A learning element for staff of consumer cooperatives,
https://www.ilo.org/wcmsp5/groups/public/---ed_emp/---emp_ent/---coop/documents/instructionalmaterial/wcms_628571.pdf
- Northeast Vegetable and Strawberry Pest Identification Guide,
https://nevegetable.org/sites/nevegetable.org/files/Pest_ID_2018_no%20cover%20date.pdf and indexed on
https://nevegetable.org/about-guide/ordering-and-downloads
- Restaurant Food Waste Action Guide
- https://www.refed.com/downloads/Restaurant_Guide_Web.pdf
- The Food Safety Information Handbook
- https://books.google.de/books?id=G2QL_dyS5YAC
- REDUCEFOODWASTE Handbook
- http://www.reducefoodwaste.eu/strefowa-handbook.html
- Does not provide any detailed tips to judge the edibility of food items, though.
- Welt: "Verschimmelt, verfärbt, aufgewärmt – Ist das noch essbar?"
- https://www.welt.de/gesundheit/plus189849987
-
Mint, Chilli & More: How to Grow Organic Veggies From
Kitchen Scraps
-
11
Plants That You Can Always Regrow From Kitchen Scraps
-
Haryana Man Grows Mini Food Forest In 100 sq m Using
Zero Chemicals!
- "Vipesh also prepares bio enzymes from fruit and vegetable waste. “I ferment kitchen fruit
peels for over 60-90 days and then add jaggery and water. Every month I prepare around 10 litres of
BE which is sprayed in my garden every 15 days,” he says."
-
How To Cure and Store Winter
Squash and Pumpkins
-
100+ Canning Recipes
-
Natural Citrus Seed Pectin for Canning
-
About the food waste situation
-
Food Waste Generation at Household
Level: Results of a Survey among Employees of Two European Research Centers in Italy and Germany
- "All available studies consistently come to the conclusion that one of the largest savings
potential in Europe is at the household level. Using various national data sources, the BCFN study
specifies the amount of food wasted in households per capita and year for different European
countries as follows: 110 kg in Great Britain, 108 kg in Italy, 99 kg in France, 82 kg in Germany,
and 72 kg in Sweden. These figures illustrate that any effective strategy to combat food wastage
needs to focus on the final consumer. "
- "BMEL Ernährungsreport 2019"
- This document is referenced in https://www.welt.de/wirtschaft/article200208000 as the source of
interesting facts about food waste.
- "Noch immer verfallen die Deutschen der
MHD-Panik"
-
ReFED Food Waste Solutions
- A great overview of what can be done against food waste. In the United States, consumer
education campaigns and standardizing expiration date labelling together are said to have the
highest financial benefits of all food waste interventions (see).
- "Das zeigen neue Berechnungen der Universität Stuttgart, die sich auf das Jahr 2015 beziehen.
Inklusive der Abfallmengen von Landwirten, Lebensmittelverarbeitern, Handel und Gastronomie komme man
auf insgesamt 12,7 Millionen Tonnen verschwendete Lebensmittel im Jahr.
Mehr als die Hälfte der Abfälle stammt aus Haushalten: Hier fallen rund sieben Millionen Tonnen an.
Rund 40 Prozent davon wären laut den Forschern vermeidbar. Verbraucherinnen und Verbraucher könnten
37,3 Kilo einsparen, wenn sie weniger einkaufen, etwa Obst, Gemüse und Brot richtig lagern und Reste
nicht bedenkenlos wegwerfen. 2,2 Millionen Tonnen stammen aus der Verarbeitung, 1,7 Millionen Tonnen
aus der Gastronomie. Von der Gesamtmenge der Lebensmittelabfälle seien knapp 6 bis zu 8,2 Millionen
Tonnen theoretisch vermeidbar." (source)