OCS comment rating machine readability
Closed, ResolvedPublic

Description

At the moment, the store considers comments a review, and because of this there is a rating included in the root comments' text in the OCS exported data. This is either a + or -, or an integer number from 0 through 10, which is then immediately followed by a description of the rating (though not always), and then the text of the comment following a newline.

What this means in practice is that it is somewhat awkward to interpret on the client side, and currently the result is that the comment is simply shown verbatim (that is, not interpreted in any way as a review score). That is to say, thiis is the case in Discover, but as KNewStuff currently doesn't support comments the issue is not shown there.

What Discover does attempt to do is interpret the score value of the root comments as a review score (and it ignores any subcomments, though of course due to T11126 it currently never gets any anyway). The score at the moment is always 0, which makes the reviews look kind of sad in Discover's KNS support.

So, proposals for resolving the various issues above in one go:

  • Don't export the review values in the comment text (which will make it look less strange).
  • Export - and + ratings as a score of 1 and 100 respectively
  • Export 0 through 10 ratings as 1 through 100 (that is, multiply the rating by ten, so it is the correct scale as suggested by the OCS spec)
  • Export the description of the rating as the comment subject(1)
  • Only export the comment's text in the text field (even if the field is then empty)
  • Interpret a score of 0 as "unrated" so clients can handle this in some sensible manner(2)
  • Do nothing in Discover, which already expects the above situation (which will result in already released versions suddenly looking as it is supposed to)
  • Implement the same interpretation in the new comments support in KNewStuff

(1) Preferably this would be title case, rather than all lower case. Also, please run a spell checker, "bery good" isn't really a thing ;)
(2) If handled explicitly, it then be possible to do adjustments to the UI in some way (for example in KNewStuff we might want to hide a ratings display if there is no rating on a specific comment, for example a child comment), and if unhandled (such as in Discover) it will simply be interpreted as a rating of 0 without any adaptation (such as would be required if some number like -1 were to be considered the unrated number).

nb: For completion, arguably it might have made sense to add a new field for review scores to comments, but the description in the OCS specification is vague on this topic and simply calls it a score, with no further descripton of what kind of score it is supposed to be. If we want to add in some kind of helpfulness score later (like on e.g. Steam, Amazon, and other places), then it would make sense for that to be the addition, rather than the review score which we need now, and which software already expects to exist.

leinir created this task.Jun 24 2019, 12:40 PM
leinir updated the task description. (Show Details)Jun 25 2019, 9:15 AM

Playing around some more, it seems to me that the exported data is structured as...

"some rating, either +, - or a number" "a space" "optionally a short text description of the rating"
"the optional text of the review itself"

It seems to me what should happen here is that the short description of the rating should go into the comment subject (which is currently unpopulated). I will update the task description with this in mind.

leinir updated the task description. (Show Details)Jun 26 2019, 10:02 AM
ronaldv moved this task from To Do to Work in Progress on the KDE Store board.Jun 28 2019, 10:08 AM

How's this coming along? :) (i can't finish up the work i'm doing in D21721 without this and T11173 being done)

Just a quick poke, because i kind of need this to happen... how's it coming along? Thanks in advance! I realise you've been ooo for a little bit :)

ronaldv added a comment.EditedAug 23 2019, 12:41 PM

Please take a look at my changes.

Example output now:

<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message/>
  </meta>
  <data>
    <comment>
      <id>1477913</id>
      <subject>the best</subject>
      <text>10 Thanks for sharing with the open community!</text>
      <childcount>0</childcount>
      <user>y27x</user>
      <date>2019-07-23T16:59:55+00:00</date>
      <score>100</score>
    </comment>
  </data>
  <data>
    <comment>
      <id>1473313</id>
      <subject>the best</subject>
      <text/>
      <childcount>0</childcount>
      <user>testmanifest</user>
      <date>2019-05-25T13:40:32+00:00</date>
      <score>100</score>
    </comment>
  </data>
  <data>
    <comment>
      <id>1472480</id>
      <subject>excellent</subject>
      <text/>
      <childcount>1</childcount>
      <user>jenspen</user>
      <date>2019-05-17T06:37:59+00:00</date>
      <score>90</score>
      <children>
        <comment>
          <id>1472576</id>
          <subject/>
          <text>thanks jenspen ;)</text>
          <childcount>0</childcount>
          <user>antechdesigns</user>
          <date>2019-05-18T10:11:45+00:00</date>
          <score>0</score>
        </comment>
      </children>
    </comment>
  </data>
...

That is so much better, thank you :D Works an absolute treat! Witness the now much nicer looking (though of course as yet somewhat unpolished) comments display in the shiny, new KNewStuffQuick components :)

Is there anything else to do from the server side?

leinir added a comment.Nov 6 2019, 9:52 AM

I think we have a discrepancy between the comments being sent out via this call, and the number of comments reported in the content call. As an example, see below:

The comments shown in the dialog (ignore the Discover window) are those sent back by the server, but the number of comments the content call suggests is 28 (which incidentally is the correct number of /comments/, which is different to the reviews which we get here).

The comments call there is https://api.kde-look.org/ocs/v1/comments/data/1/1309269 - basically we'll want to ensure that the data returned by that call and the number suggested by content/data call https://api.kde-look.org/ocs/v1/content/data/1309269 match (so given where we're heading with reviews and whatnot, i'd say we'd want to simply have the number be the amount likely to be returned by comments/data, rather than changing what comments/data returns). Having the commentspage the way it is is fine, though, incidentally :)

Apart from that detail, though, it's good :)

Oh, I see. With /comment/data only comments with ratings are displayed at the moment. In /content/data however the number of all comments is displayed.
I will change the number of ratings/comments in the /content/data response.

Is that ok for you?

Hmm... In that case, if it's more like a filter, it might actually make sense to send all the comments out - how much trouble would it be to make it do so? (if it's a huge amount of work, then it's probably not really worth it, but i think it might well be good; it'd allow us to perhaps add some more interesting filtering and sorting options on the client side)

Well, so I'll return all comments in /comment/data in the future, even if not all of them contain a rating. You then have to ensure that the number of ratings is calculated correctly and displayed in the dialog. In your example, that would be 3 ratings/reviews for a total of 28 comments.

Great, i can work with that! :)

You should get now all comments.

Confirmed, thank you :) Need to do a bit of jiggery-pokery to the various consumers of the data, but it's already much more consistent now - always had a kind of "...what in the world?" feel when the numbers didn't match, and having this works well i think :) Thanks! Think we can call this one all done (if it turns out to need further work, we'd probably want to open a different ticket to track what and why for that, rather than this one)

justinzobel closed this task as Resolved.Jun 19 2021, 9:01 AM
justinzobel moved this task from Needs Review to Done on the KDE Store board.
justinzobel added a subscriber: justinzobel.

@leinir confirmed this is all done.