Page MenuHomePhabricator

Disambiguation for Wikidata search from tags terms in wordpress
Closed, ResolvedPublic

Description

  1. To add a list of the tags of the blog in the plugin setup page
  2. Add a form to each tag in that setup page in which the user can add manually a wikidata ID
  3. Develop a javascript function to automatically search for the tag term in wikidata and return a list of wikidata items (and their related wikidata ID) to let the user choose the most accurate to the tag he is using.
  4. Save all in Wordpress setup

Working on this right now =)

https://github.com/zeko3991/Wikidata-references

Event Timeline

Zeko created this task.Oct 18 2017, 8:04 AM
Zeko added a comment.Oct 18 2017, 12:17 PM

Created a setup page and added a list with a tag list (please ignore the tag names), in each one its possible to add a wiki id manually (won't be saved yet) or just press the "search" button that later on will call a javascript function that will open a dialog with a list of results to select.

Zeko added a comment.EditedOct 23 2017, 10:53 AM

Hello!

Now its possible to associate tags with wikidata ids and save that assoc to plugin setup.
As said before, now in plugin setup page there is a list of the tags used in the blog:

As we discussed, I added an ajax modal window that shows the wikidata results of the tag term search:

In that modal window, there is some info about the id, and a link to the wikidata item, if we click on a list elem, the wikidata id will be added to the related input field:

If no items found:

And of course, user can add manually an id.

when options are saved, configuration is added to plugin setup.

Design is questionable and I will be happy to hear new ideas about how to display the list elems in the modal box or to add other wikidata item properties to each list elem =)

As always, code is updated at https://github.com/zeko3991/Wikidata-references

Tell me what you think about it or how to improve it.

Thank you! =)

Pigsonthewing added a comment.EditedOct 23 2017, 11:17 AM

As said before, now in plugin setup page there is a list of the tags used in the blog:

That all looks good. Maybe in your first image, you could display the Wikidata label & description, at least as a tool-tip?

Zeko added a comment.EditedOct 23 2017, 11:32 AM

That all looks good. Maybe in your first image, you could display the Wikidata label & description, at least as a tool-tip?

Sure, and I find it better to show it like that (as a tooltip) so that there is not too much info displayed together

Zeko added a comment.Oct 26 2017, 11:59 AM

As said before, now in plugin setup page there is a list of the tags used in the blog:

That all looks good. Maybe in your first image, you could display the Wikidata label & description, at least as a tool-tip?

Now, when mouse is over the input:

I also added links to tag pages in the tag names.

thiemowmde triaged this task as Normal priority.Oct 27 2017, 12:12 PM
thiemowmde added a project: patch-welcome.
Zeko closed this task as Resolved.Nov 7 2017, 12:07 PM

Hi! Apologies that it's taken a while for me to revisit this and provide thoughts and feedback. Thanks for working on this, I love that this is coming together!

Some thoughts/feedback then:

  • The set up page feels unnecessary for a number of reasons;
    • Using the term meta API to add fields to the term edit screen is the correct way to add this kind of feature in WordPress
    • The setup screen really just duplicates that functionality, with no real benefit when the user can easily use the term edit screen instead
    • That setup page will quickly get out of hand. Any site with more than a small number of terms will find that page either incredibly slow to load, or it will completely break under the weight of terms
    • It's adding a huge amount of bloat by including Bootstrap and not following core WordPress design principles
  • In https://phabricator.wikimedia.org/T138371 you mentioned that "Of course, if option is not activated, plugin will delete all data it added." - I'm not entirely sure of the meaning but I would encourage any deletion of data to be explicitly chosen by the user with a double confirmation to avoid accidentally wiping out all the effort of adding Wikidata IDs
  • Looks like you've used a template to create the initial plugin framework - those often add lots of unnecessary files so I'd encourage you to do a cleanup when you're nearing completion to remove anything that isn't strictly necessary and also to ensure the comments are all relevant :)

Give me a shout when you're nearing completion and I'll do a full code review too. Looks like there's still a bunch of debugging going on in there so I'll leave you to that :)

One thing that might work instead of the options page to help folks is a "suggestion" screen where the plugin shows one tag at a time and returns a list of wikidata items that might be relevant. The user could choose to associate one of them, or skip to the next tag.

This would be a nice way to work through each tag but at a comfortable pace over time and in a way that will scale well.

Zeko reopened this task as Open.Nov 7 2017, 10:30 PM
  • The set up page feels unnecessary for a number of reasons;
    • Using the term meta API to add fields to the term edit screen is the correct way to add this kind of feature in WordPress
    • The setup screen really just duplicates that functionality, with no real benefit when the user can easily use the term edit screen instead

I think that is what I really needed to know, it really helps, thank you.

  • That setup page will quickly get out of hand. Any site with more than a small number of terms will find that page either incredibly slow to load, or it will completely break under the weight of terms
  • It's adding a huge amount of bloat by including Bootstrap and not following core WordPress design principles

Shame on me

  • In https://phabricator.wikimedia.org/T138371 you mentioned that "Of course, if option is not activated, plugin will delete all data it added." - I'm not entirely sure of the meaning but I would encourage any deletion of data to be explicitly chosen by the user with a double confirmation to avoid accidentally wiping out all the effort of adding Wikidata IDs

Not sure of that! for the moment, I store that as plugin options, -what I now see it's a terrible Idea- so it just deleted them from the database as metadata associated to each term. So if option was unchecked, it simply deleted the metadata the plugin added.

  • Looks like you've used a template to create the initial plugin framework - those often add lots of unnecessary files so I'd encourage you to do a cleanup when you're nearing completion to remove anything that isn't strictly necessary and also to ensure the comments are all relevant :)

As I have been developing for wordpress I've been realizing that =/ I will clean that mess up, I promise!

Give me a shout when you're nearing completion and I'll do a full code review too. Looks like there's still a bunch of debugging going on in there so I'll leave you to that :)

Sure! =)

One thing that might work instead of the options page to help folks is a "suggestion" screen where the plugin shows one tag at a time and returns a list of wikidata items that might be relevant. The user could choose to associate one of them, or skip to the next tag.

This would be a nice way to work through each tag but at a comfortable pace over time and in a way that will scale well.

Don't really how to do this, but I will try to.

That really helped, thank you! =)

Zeko added a comment.Nov 8 2017, 8:09 AM

Hello again!

Working now on that, adding our plugin options to tag/category edit screen:

To update wikidata value I think we can add a "button" to the row actions:

For the moment, I display the tag name, but wikidata id will go there! =)

Zeko added a comment.Nov 8 2017, 10:59 AM

Well, some things working, look at this:

Tag edit screen: added field for wikidata id, also disambiguation will follow the same process

when clicking on the search button:


--->

now time to save it at options and to update term metadata =)

Zeko added a comment.Nov 10 2017, 9:19 AM

Hello! Its working now and I'm cleaning up all the code

Now, the association will be made at the edit taxonomy screen, as I made it work for both tags and categories, also I changed the code added to <head>

tag list edit screen -> (also I added a field so its possible to associate taxonomy term with wikidata Id while creating it)

Code added to head:

As well, I'd like to know if you want me to leave that "common" metadata to be added at html head / post_meta or not, so I can definitely remove the plugin settings page.

Zeko closed this task as Resolved.Nov 17 2017, 12:33 PM
This comment was removed by Pigsonthewing.
Pigsonthewing reopened this task as Open.Mar 16 2018, 1:36 PM
Pigsonthewing closed this task as Resolved.