Skip to content

Part 2 of 7 · Allergen checker series ~5 min read

How an ingredient declares what it contains

The single most consequential decision in an allergen data model is how many states an allergen can be in, and the common answer of two is wrong in a way that is genuinely dangerous.

Key takeaways

  • Three states: contains, may contain, unknown. A blank is never a negative.
  • ’May contain’ is a manufacturer’s precautionary statement, not a maybe.
  • Compound ingredients nest; the declaration has to follow the tree down.
  • A dish rolls up to the strongest state present across its ingredients.
  • One unknown ingredient makes the dish’s statement incomplete, and it should say so.

Three states

StateWhat it meansHow it renders
ContainsThe specification declares this allergenNamed, unambiguously
May containA precautionary statement from the manufacturerNamed, distinctly from contains
UnknownNo current specification, or it does not address this allergenNamed as unknown, never blank
Does not containA current specification explicitly excludes itBlank is acceptable

The fourth row is the only one where a blank is honest, and it requires a current specification that actually addresses the allergen. An ingredient whose specification predates the current allergen labelling requirements, or which simply does not mention celery, is unknown for celery rather than free of it.

That distinction produces more unknowns than most people expect when a system is first populated, and that is the system working. A matrix that was all blanks and is now thirty per cent unknown has not got worse; it has become honest, and the unknowns are a work list.

May contain is not a maybe

“May contain nuts” is a statement by a manufacturer that their process cannot exclude cross-contamination. It is not uncertainty about the recipe and it is not something a kitchen can resolve by asking. It carries forward to any dish using that ingredient and it must be reported as what it is.

Collapsing it into either contains or does not contain loses real information in both directions: treating it as contains removes dishes unnecessarily, and treating it as absent removes a warning the manufacturer thought was necessary.

Compound ingredients

How allergen declarations roll up from ingredients to a dishA vertical chain of five steps entered by a box labelled A dish with a recipe. Step one takes each recipe line with its ingredient and quantity. Step two asks whether it is compound, such as a sauce, a base or a mix; if so it exits to Recurse into it, following its own ingredients. Step three asks whether there is a current specification, dated and recent; if not it exits to Unknown for all fourteen, not absent. Step four takes its declarations for contains and may contain. Step five rolls up to the dish, with the strongest state winning. A note says the recursion is where hand-maintained matrices break down on any real menu.AWS ACCOUNTA dishwith a recipeEach recipe lineingredient and quantityIs it compound?a sauce, a base, a mixRecurse into itits own ingredientsyesCurrent spec?dated, and recentUnknown for all 14not absentnoTake its declarationscontains, may containRoll up to the dishstrongest state winsThe recursion is where hand-maintained matrices break down on any real menu.
Fig 1. How a dish-level declaration is assembled. Compound ingredients nesting several levels deep is normal and is where manual maintenance becomes impractical.
  • Compute
  • App integration
  • Security & identity
  • Analytics
  • Front-end & mobile

How deep it goes

A dish uses a sauce; the sauce uses a stock base; the stock base uses a seasoning blend; the seasoning blend contains an anti-caking agent. Four levels is not unusual and the allergen can be at the bottom.

Maintaining that by hand across forty dishes is possible in principle and does not survive a supplier change, which is precisely the situation where accuracy matters most. The recursion is the part of this system that is genuinely hard to do without software.

The dish-level statement

One dish's allergens sorted into four declaration statesA bar chart with four bars showing the number of allergens in each state for one dish. Contains: three. May contain: two. Unknown: four. Not present: five. A note says four unknowns is a work list rather than a result, and it renders as prominently as contains.02468~3Contains~2May contain~4Unknown~5Not presentAllergens in each state for one dishFour unknowns is a work list, not a result. It renders as prominently as 'contains'.
Fig 2. One dish’s fourteen allergens sorted into four states. The unknown column is the one that drives action, and hiding it would make the other three look complete.

A dish with any unknowns has an incomplete statement, and that fact belongs at the top of it rather than in a footnote. A member of staff answering a question needs to know immediately whether they are working from complete information.

Chasing the unknowns

The unknown list is the system’s main ongoing output. Each one is a specification to request from a supplier, and requesting them is straightforward: most suppliers have the document and will send it.

Ranking by how many dishes an unknown ingredient affects makes the chasing efficient. One missing specification on a widely-used stock base can be responsible for half the unknowns on a menu, and one email resolves it.

Next: the change nobody sees.

All posts