wger icon indicating copy to clipboard operation
wger copied to clipboard

Improve OFF import

Open rolandgeider opened this issue 1 year ago • 2 comments

At the moment, when importing a current OFF dump with a threshold of 0.7 completeness, around 230 000 products can't be imported because the extract_info_from_off function can't extract the necessary information.

Most products fail because some of these fields are missing

  • energy-kcal_100g
  • proteins_100g
  • carbohydrates_100g
  • sugars_100g
  • fat_100g
  • saturated-fat_100g

Possible solutions

~~Convert the energy, when the energy is only available in kj per 100g and not in kcal (energy-kj_100g), the conversion is easy~~

~~Ignore less important ones (sugars_100g and saturated-fat_100g) and just set their values to 0~~

Calculate the rest if the infos are available, read serving_quantity and e.g. carbohydrates_serving and convert this to a per-100g value. This probably has some tricky edge cases and we should take a look at what other fields / flags we have access to in the dump

rolandgeider avatar Nov 26 '23 13:11 rolandgeider