Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow marking an item as prominent #14

Open
waldyrious opened this issue Feb 3, 2022 · 7 comments
Open

Allow marking an item as prominent #14

waldyrious opened this issue Feb 3, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@waldyrious
Copy link
Contributor

There could be a checkbox for "mark as prominent", or alternatively two green buttons: one for "Yes (prominent)" and one for "Yes (not prominent)". The second one could perhaps use a lighter shade of green.

The second approach would perhaps be more convenient to use because it would only require a single click per image.

@addshore
Copy link
Owner

I wonder if this should be implemented in the same question (with an extra button for prominent)
Or only as a separate task?

Oer perhaps both?

@waldyrious
Copy link
Contributor Author

As a user of the tool, I would expect them to be the same task, since the kind of judgment applied to reach the decision is very similar (i.e., I am already at times having to decide whether an image "clearly" depicts an item, because sometimes it is arguably present but in a very obscure manner).

@addshore
Copy link
Owner

addshore commented Apr 2, 2022

Maybe options of

  • Prominent
  • Yes
  • No
  • Skip

Might work?

@addshore addshore added the enhancement New feature or request label Apr 2, 2022
@waldyrious
Copy link
Contributor Author

Oh, that makes sense, yeah, since we don't really add a "prominent=no" qualifier when the item is not prominent in the image.

My only concern is whether it is not clear that "prominent" is a superset of "yes". Perhaps if they have the same color (e.g. different shades of green) it would be more evident. Or alternatively, my original suggestion of two green buttons labeled "Yes (prominent)" and "Yes (not prominent)" could also work.

@addshore
Copy link
Owner

addshore commented Apr 4, 2022

my original suggestion of two green buttons labelled "Yes (prominent)" and "Yes (not prominent)" could also work.

Yeah, perhaps this is best!
Would you want to give this a go?

@waldyrious
Copy link
Contributor Author

Hmm, I'm not sure how I'd go about adding a qualifier to a statement using this codebase. I'd be happy to give it a go if you gave me some pointers.

@addshore
Copy link
Owner

addshore commented Apr 4, 2022

First question, have you managed to get a local copy of the codebase running?
If not I can also help you with that :)

And don't get overwhelmed by how much test I wrote here, any questions, just ask!

The code that currently adds the depicts statement is structured as a laravel job
https://github.com/addshore/wikicrowd/blob/main/app/Jobs/AddDepicts.php

Specifically, here you can see (after a bunch of other logic) a statement gets created, with the depicts value, on the $mid
https://github.com/addshore/wikicrowd/blob/main/app/Jobs/AddDepicts.php#L117-L132

Inside the addwiki library this currently makes use of the wbcreateclaim wikibase API module which unfortunately doesn't allow you to set the rank of a statement, (which is needed to make it as prominent)
https://github.com/addwiki/addwiki/blob/main/packages/wikibase-api/src/Service/StatementCreator.php#L36-L59

We would need to use wbsetclaim https://www.wikidata.org/w/api.php?action=help&modules=wbsetclaim
Which in the addwiki libraries can be accessed using the StatementSetter https://github.com/addwiki/addwiki/blob/bf50df609580ce99505533ff1efa567077035257/packages/wikibase-api/src/Service/StatementSetter.php#L25-L42

With this service, you need to create a Statement object, setting the mainsnak (we already have the mainsnak in the existing code) and also setting the rank to preffered.
You can find the statement code here https://github.com/wmde/WikibaseDataModel/blob/master/src/Statement/Statement.php
And here you can find the set rank method https://github.com/wmde/WikibaseDataModel/blob/master/src/Statement/Statement.php#L189-L206

So in summary

  • Convert from the addwiki StatementCreator to the StatementSetter service
  • In code construct a whole Statement object rather than just the mainsnak (as currently done)
  • Set the rank on the Statement object that you made

In order to create new GUIDS (which is needed for this method) you may find it useful to include the WikibaseDataModelService php library https://github.com/wmde/WikibaseDataModelServices/blob/master/src/Statement/GuidGenerator.php via composer
(Perhaps I could abstract this away in the addwiki libraries... I'll add it to my list, hah!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants