Skip to content

Expiration dates from 2026 onwards are silently dropped (hardcoded year window) #1914

Description

@uditjainstjis

Describe the bug

The expiration-date OCR extractor (robotoff/prediction/ocr/expiration_date.py) filters out any detected date whose year falls outside a hardcoded window:

if date.year > 2025 or date.year < 2015:
    continue

The upper bound (2025) is now in the past. As a result, every valid expiration / best-before date from 2026 onwards - which is the normal case for products currently on shelves - is silently discarded and no expiration_date prediction is produced.

To reproduce

from robotoff.prediction.ocr.expiration_date import find_expiration_date
find_expiration_date("À consommer de préférence avant 14.06.2026")  # -> [] (expected: one prediction)

Suggested fix

Compute the plausibility window relative to the current date instead of hardcoding the bounds, so it filters OCR noise without going stale as years pass. PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions