Page MenuHomePhabricator

Embed machine readable ores scores as data on pages where ORES scores things
Closed, ResolvedPublic

Description

Problem: gadgets that read RecentChanges and other pages where changes are scored through ORES need to do a difficult job of parsing a changes table and identifying which rows have been scored. This is essentially taking advantage of an undocumented behavior and is therefor fragile.

Include data about the generated scores within a javascript variable (e.g. mw.config) or within the attributes of change rows (e.g. class="ores_scored_change" ores_score="{'damaging': ...}").

For an example of how this is done elsewhere, see mw.config.get('wbEntity') within any wikidata item page. E.g go to https://www.wikidata.org/wiki/Q42 and execute mw.config.get('wbEntity') on the javascript console to get the wikidata item JSON.

Event Timeline

Errrr, I'm confused. Can you explain the problem that needs fixing?

Halfak renamed this task from Inject ores scores to rc-data to Embed machine readable ores scores as data on pages where ORES scores things.Aug 25 2016, 2:43 PM
Halfak updated the task description. (Show Details)
Halfak subscribed.

@Legoktm, I just made some updates. Does this make the task more clear?

Halfak triaged this task as Medium priority.Aug 25 2016, 2:47 PM
Halfak moved this task from Unsorted to New development on the Machine-Learning-Team board.

Yeah, thanks. I don't think wbEntity is a good idea - there's a bug somewhere about how it needs to be killed. So I would rather use data attributes like data-ores="...". I'd rather not embed a JSON object there though...

@Legoktm, if not JSON, how would you propose we serialize the data? Is there another format that you like better?

Just multiple data attributes? data-ores-damaging, data-ores-reverted, etc.?

Okay, I looked into this. It seems hooks are not good enough to add attributes to rows. We can either modify lots of hooks on EnhancedChangesList, OldChangesList, Contribs, etc. to let extensions add attributes which take lots of time. Or we add ores data as class. Something like <li classes="foo bar ... data-ores-damaging-0.123">. jquery can select these elements with a rather "nasty" hack: http://stackoverflow.com/a/28981225 What do you think? @Halfak @Legoktm @Catrope

@Legoktm, it looks like this is going to be very painful. We're going to have to make a lot of core changes in order to add arbitrary attributes. Maybe we should consider looking at the wbEntity strategy again. What do you think?

Note, the wbEntity strategy will not require us to think hard about serialization.

Okay, I checked and it's super easy to add it but it will conflicts with Roan patches on goodfaith. I wait until he's done (and they are merged) and I start adding this.

Okay, I checked and it's super easy to add it but it will conflicts with Roan patches on goodfaith. I wait until he's done (and they are merged) and I start adding this.

Don't wait for https://gerrit.wikimedia.org/r/#/c/312166/4 , we're not sure if we want that one yet, but the other ones would be good to get in, yes. Thanks for reviewing those!

Change 314449 had a related patch set uploaded (by Ladsgroup):
Expose ores scores in js

https://gerrit.wikimedia.org/r/314449

Change 314449 merged by jenkins-bot:
Expose ores scores in js

https://gerrit.wikimedia.org/r/314449