How do I get my app to search for the best before dates of certain items?

I'm try to find a way to search for the best before dates of food items scanned with ocr from receipts and then display the dates beside the items. I need a way to for the app to get this information from the internet or using ai. Does anyone know any way I could do this? Thanks in advance!

  1. After OCR gets the item names, use a small built-in database in your app (maybe just a CSV or TinyDB) that stores common food items & their average shelf lives. For example, "Milk – 7 days", "Yogurt – 14 days" etc.

  2. You could try calling an external API or AI model to predict or fetch typical "best before" durations. There is not a universal “expiration date” API yet, but you can use something like:

  • ChatGPT or other LLMs (via OpenAI API) to get estimated shelf life from product names.
  • Or train your own lightweight model based on food categories.
  1. You could even let users scan a barcode or type the item name manually, and then search a food database like Open Food Facts to pull average shelf life.

If you store the purchase date, you could auto-calculate & display the best before date by just adding the shelf life duration to the purchase date.

1 Like