LanguageValues and typesStandard typesHealth
Allergen
On this page
One of the 14 allergens a UK or EU food label must name: milk, celery and so on.
Use it to mark what's in a dish or a product. For a person's own allergy to something else, use your own type, since this list holds only those 14.
Shape
One of these 14 values:
Allergen.celery, Allergen.cereals_containing_gluten, Allergen.crustaceans, Allergen.eggs, Allergen.fish, Allergen.lupin, Allergen.milk, Allergen.molluscs, Allergen.mustard, Allergen.peanuts, Allergen.sesame, Allergen.soybeans, Allergen.sulphites, Allergen.tree_nuts.
Example
Allergen.milktext.parse(raw, as: Allergen) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as gluten, nuts or Cereals containing gluten.
Good to know
Allergen.cereals_containing_glutenis the name for gluten.text.formatshows the UK Food Standards Agency's wording.==tells you whether two are the same.<andlist.sort_bydon't take it.
In JSON
A string, in a request, a response or json.write:
"cereals_containing_gluten""milk""sulphites"
Details
Text form, storage, how it is shown, and operations
Allergen is in the group Health, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: cereals_containing_gluten, milk and sulphites.
How it is stored
It is stored in one column named for the field, of type text. milk is stored as 'milk'.
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
cereals_containing_gluten |
Cereals containing gluten |
milk |
Milk |
sulphites |
Sulphur dioxide and sulphites |
Operations
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-allergen.md.Built from Jadpo main at aee2e8f.