Skip to content

Proposal 0026: rating metadata - #164

Open
dubadub wants to merge 4 commits into
mainfrom
proposal/0026-rating-metadata
Open

dubadub wants to merge 4 commits into
mainfrom
proposal/0026-rating-metadata

Conversation

@dubadub

@dubadub dubadub commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Adds one key to the canonical metadata: rating, the recipe keeper's own rating of the recipe. It is a number out of 5, or out of another scale when the author writes one: rating: 4 is 4 out of 5, rating: 3/10 is 3 out of 10.

Rendered proposal

Summary

  • The key. rating: 4, or rating: 8/10 for another scale. Higher is better. Decimals are allowed.
  • Scale. 5 unless one is written. N/M is N out of M, for any whole M of 1 or more. 4 and 4/5 are the same rating. A bare number is never read as out of 10.
  • Range. 0 to the top of the scale, both included. 0 is the lowest rating, not "not rated".
  • Not rated means a missing key, an empty or null value, or anything that is not a rating (7, 7/5, "★★★★☆", great). A linter reports the last kind.
  • Display is up to the application: stars, "⭐ 4.5/5", "8/10", a bar, as long as it is clear what the top of the scale is. Ratings on different scales compare by N divided by M.
  • Writing keeps the file's scale. Clearing a rating removes the key or leaves the value empty.
  • One key, no aliases.
  • It is the keeper's own rating. Importers do not write it, and published recipes do not present it as an average or as an aggregate rating in structured data.
  • No grammar change. It is ordinary front matter.

Motivation

The canonical metadata table has difficulty, cuisine, diet and tags, and nothing for a rating, so everyone who rates their recipes picks a key and a shape of their own (stars: 2, rating: 4.5, rating: 4/5). No application can show the rating, sort by it, or keep it when the file is opened elsewhere. Not everyone rates out of five, so a key tied to five stars leaves some people out.

Today the same value is also treated differently depending on how it is typed: with CookCLI 0.38.1 the web server shows rating: 4/5 as a plain label and shows nothing for rating: 4.

Prompted by a community question about showing rating: 4/5 as stars in cook server.

Changes since the first draft

  • The fixed 1 to 5 scale is gone. The scale defaults to 5 and any other one is written as N/M, so 8/10 is now a rating instead of an invalid value, and applications are no longer bound to stars.
  • 0 is now the lowest rating instead of meaning "not rated".
  • A value that is not a rating counts as not rated.
  • A second canonical test covers 3/10.

Things worth a reviewer's attention

  • A default scale, not a guessed one. A bare number is always out of 5. Reading a bare number above 5 as out of 10 was considered and left out, because it makes rating: 5 ambiguous.
  • No upper limit on the scale. 85/100 is a valid rating. A cap at 10 was considered; the proposal says why it was not taken.
  • N/M is not a fraction here, although elsewhere in Cooklang 4/5 is 0.8.
  • Zero is a rating.
  • Parsers that separate canonical keys from custom ones. Once rating is canonical it leaves the custom keys, so an application that lists custom keys generically has to show the rating itself in the same release; for a value that is not a rating it may show the raw text.
  • Left out on purpose: sorting and filtering by rating, setting it from an application, a rating per cook or per date, ratings by several people.

This PR contains the proposal only; the conventions.md row and the canonical tests follow once it is accepted.

- one new canonical metadata key, `rating`: the recipe keeper's own
  rating, a number from 1 to 5, decimals allowed
- a missing key, an empty value and `0` mean not rated
- `N/5` is read as the number N; any other value is shown as text and
  is not rescaled
- no aliases; importers do not write it; published recipes show it as
  the author's rating, never as an aggregate
- no grammar change; one canonical test to add with the conventions row
@davidpkj

Copy link
Copy Markdown

Hi, thanks for the detailed proposal. I generally agree with everything.

And instead of a row of stars, ratings could also be rendered like (⭐ 4.2/5). This would also be more consistent with how the server draws the other canonical pills. I have not looked into how other official apps do it though.

Also, if at some point in the future there will be a notion to allow for other scales of ratings, that will allow for easier implementation then.

I think it is a little limiting (for some people, maybe) to only allow a fixed scale. But I do agree with the arguments in the proposal. Introducing conversions may also lead to ambiguities where the float of 1.0 without a denominator (or a possible type error during conversion) could be misinterpreted as 1/5. So it probably really is best to stay with a fixed N/5 scale, at least for now.

…(0026)

- `rating: N` is N out of 5; `rating: N/M` is N out of M, for any
  whole M of 1 or more; the scale is never guessed from the value
- N runs from 0 to M, decimals allowed; `0` is the lowest rating,
  no longer "not rated"
- a missing key, empty or null value, or anything else is not rated;
  a linter reports values that are not a rating
- display is the application's choice, not bound to stars, as long
  as the scale is visible; ratings compare by N divided by M
- applications keep the file's scale when writing
- second canonical test for `3/10`; the fixed 1-5 scale and zero as
  not rated move to alternatives considered
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants