Use-cases wanted! Adding dietary requirements to Schema.org/Person
I want Schema.org to add dietary requirements to the Person
specification. And I need your help!
Background
Schema.org is a metadata standard. You can include it on webpages to create structured, machine-readable data.
Here's a sample way of representing a Person:
JSON{
"@context": "https://schema.org/",
"@type": "Person",
"name": "Albert Einstein",
"hasOccupation": [
{
"@type": "Occupation",
"name": "Professor of Physics",
"occupationLocation": {
"@type": "Country",
"name": "USA",
"sameAs": "https://www.wikidata.org/wiki/Q30"
}
}
]
}
Hopefully easy to follow. This is a Person
, they have a name
and an occupation
. That occupation
has a name
and is located in a country
. That country
has some linked data.
There are all sorts of properties we can associate with a Person
- birth and death dates, memberships, nationality, credentials, tax ID, and even weight! See Schema.org/Person for a full list.
One which I think would be useful is a person's diet.
Diet
Schema already has the concept of a RestrictedDiet
type. It lists things like Vegetarian, Halal, Kosher, Low Salt etc.
But it only applies to MenuItem
and Recipe
types. That is, I can mark up a restaurant's menu and say that this dish is Gluten Free, and that dish is Vegan friendly.
JSON{
"@context": "http://schema.org",
"@type":"MenuItem",
"name":"Potato Skins",
"description":"Small serving of baked potato skins.",
"offers":{
"@type":"Offer",
"price":"4.49",
"priceCurrency":"GBP"
},
"suitableForDiet":[
{
"@type": "GlutenFreeDiet"
},
{
"@type": "VeganDiet"
}
]
}
My Use Cases
I maintain a personal contact site. I tell people my name, address, occupation, etc. I also want to inform other people that I am vegetarian.
- On a social network, it might be nice to have an (optional) feature where people give their dietary preferences.
- My Jewish and Muslim friends might want to automatically filter out the pork casserole recipes people post.
- My address book might suggest a restaurant which caters for my guests' preferences.
- An encyclopædia can show dietary restrictions of famous people.
- An airline could - with permission - read your social profile to select your meal for a flight.
Sample
Here's how I think it could work:
JSON{
"@context": "https://schema.org/",
"@type": "Person",
"name": "Terence Eden",
"restrictedDiet": "http://schema.org/VegetarianDiet"
}
That is, just add restrictedDiet
as a valid property of Person
. I suppose it could be hasDiet
or dietaryPreference
or similar.
Your Use Cases
If you want to add your own use cases, or just think this is a good idea, please leave a comment on GitHub.com/schemaorg/schemaorg/issues/1996
Neil says:
Should it be an array of restrictedDiets, so I can be a gluten-free vegetarian?
@edent says:
Yes.
Difficult Guest says:
What about allergies? They can be life or death. Are they “diet-modifiers”? How would you express “I eat everything except wheat, eggs, and white fish”? E.g. my partner gets a rash from eating raw tomatoes (heat-treated ones are fine). That’s weirdly specific, I know, but it does highlight how difficult these things can be.
Someone who’s diabetic can eat sugary and carb-rich things. It’s not an allergy and they like it as much as anyone else. However, they’ll have a strong dietary preference for meals where sugar and carbs aren’t the main ingredients. Labeling them a “SugarFree” would be old-fashioned. The term “LowCarb” is a somewhat-related-but-different health fad. “I prefer a smaller amount of carb-rich sides like potatoes and rice. Give me one instead of three potatoes, and add some filler-greens instead. I’d like one scoop of ice-cream for desert instead of three as listed on the menu.
@edent says:
There is a discussion about allergies at https://github.com/schemaorg/schemaorg/issues/1411
Guest says:
Maybe your diet is restricted for a limited time. For example, if you’re training for a sporting event, or taking special dietary measures for a limited time for health reasons?
Robin says:
That should be fine. Many person attributes change over time, including "name" - although the frequency of that would hopefully be lower to avoid confusion.