Template talk:WPBannerMeta

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Council
WikiProject icon This template relates to the WikiProject Council, a collaborative effort regarding WikiProjects in general. If you would like to participate, please visit the project discussion page.
 

Adding PageAssessments parser function[edit]

The WMF Community Tech team just finished developing a small new extension called PageAssessments whose purpose is to store page assessment metadata in a database table and make that data available via an API. We would like to enable this functionality for English Wikipedia by adding the #assessment parser function into the {{WPBannerMeta}} template. This will not change anything about the output of the template and will be a completely invisible change to end users. All it will do is cause the 'project', 'class', and 'importance' parameters for each project assessment to be recorded in a database table for each page that includes this template (or subtemplates). This will improve the efficiency of pretty much any query or report that is WikiProject-related and make it easier to build WikiProject-related tools (like WikiProject X). The change would basically be adding something like {{#assessment:{{{PROJECT|}}}|{{{class|}}}|{{{importance|}}}}} to the template code. Are you guys OK with this change to the template? Do you have any questions or concerns about it? Ryan Kaldari (WMF) (talk) 00:15, 8 September 2016 (UTC)

@MSGJ, WOSlinker, Happy-melon, Harej, and Isarra: Pinging some folks who might be interested. Ryan Kaldari (WMF) (talk) 00:23, 8 September 2016 (UTC)
I strongly support this. Currently the reports bot maintains its index of WikiProjects and articles through a database table it generates anew every 24 hours. This process takes over an hour and is very inefficient because it has to do a complicated database query that accounts for all the different category names WikiProjects use. This new database table makes this process much more efficient. If you're a bot or gadget developer you will find this useful. And there are no changes to the interface in the process. Harej (talk) 02:49, 8 September 2016 (UTC)
I can't see any reason not to do this. Would you mind sandboxing the code so we can see exactly where this will be inserted? — Martin (MSGJ · talk) 08:06, 8 September 2016 (UTC)
Don't forget there's also some banner templates that don't use WPBannerMeta. A list is at Template:WPBannerMeta/Conversion. -- WOSlinker (talk) 12:43, 8 September 2016 (UTC)
Thanks for the tips. I will definitely sandbox the code first and let people take a look at it. I'm not sure exactly when we will be ready to move forward with this, but probably sometime in the next few weeks. It's already deployed on some other wikis, but there is concern about it flooding the database connections on enwiki since this template is included on so many pages. I'll let you know when we're ready to push ahead. Ryan Kaldari (WMF) (talk) 17:40, 8 September 2016 (UTC)

@WOSlinker, MSGJ, and Harej: I've added the new code to the sandbox template. Please let me know if that looks correct or if anything needs to be changed, as I'm hoping to only do this once (since it's a huge load on the servers). Kaldari (talk) 08:42, 31 October 2016 (UTC)

No not really. You seem to be imposing FQS on every project when not every project uses the full scale. A lot now have their own bespoke quality scales. It would make more sense to put your code into /core where the class and importance have already been normalised. I can have a tinker if you wish. Regards — Martin (MSGJ · talk) 08:48, 31 October 2016 (UTC)
@MSGJ: Sure, any help would be great. Ideally we want the data in PageAssessments to match what is output by the template. Kaldari (talk) 16:22, 31 October 2016 (UTC)
I assume you mean tinkering with /core/sandbox rather than /core itself. Just want to make sure we aren't making any unnecessary edits to the main templates. Kaldari (talk) 17:04, 31 October 2016 (UTC)
I assume that if a project does not use assessments then the whole tag will be omitted? What if a project uses class but not importance? Can the tag be used with just the class? What if assessments are used but class and/or importance are unassessed? Should this be passed as a blank parameter to the tag or should "Unassessed" be used? — Martin (MSGJ · talk) 21:41, 1 November 2016 (UTC)
@MSGJ: If a project doesn't use assessments, but still tags articles, we would still want to capture that information, i.e. that the WikiProject has "claimed" an article, so {{#assessment:WikiProject NoAssessments||}}. If no class or importance are given, those should just be passed as blank parameters, e.g. {{#assessment:WikiProject NoAssessments|FA|}} or {{#assessment:WikiProject NoAssessments||Low}}. Kaldari (talk) 22:46, 3 November 2016 (UTC)
Is there any distinction between an "unassessed rating" by a project that uses assessments and a "claim" by a project that doesn't use assessments? (You didn't answer the question above on whether "unassessed" or "unknown" was allowed as a class/importance rating.) — Martin (MSGJ · talk) 08:57, 4 November 2016 (UTC)
There is a distinction: some projects consciously do not have ratings, see for example Template talk:WikiProject Women#Importance. --Redrose64 (talk) 12:24, 4 November 2016 (UTC)
Indeed. My question was whether there is any distinction in the PageAssessments database. — Martin (MSGJ · talk) 12:51, 4 November 2016 (UTC)
@MSGJ: "unassessed" or "unknown" (or any value) is allowed as a class/importance rating in PageAssessments. I don't, however, see any value in an assessment of "unassessed". I would prefer that any unknown or unassessed ratings just be passed as empty parameters to PageAssessments (unless that makes things substantially more difficult). It will make things much easier to query if anything besides an actual assessment rating is recorded as null. As far as PageAssessments is concerned, there is no distinction between an empty assessment from a project that doesn't do assessments and an empty assessment from a project that does. Basically all assessment data is treated as optional for all projects. Kaldari (talk) 01:24, 6 November 2016 (UTC)
The present setup is that if a project banner is set up to recognise class and importance parameters, but in a given usage those are not set (whether the param is absent or present but blank is immaterial), then it's passed through from {{WPBannerMeta}} to {{WPBannerMeta/core}} and subtemplates as a null value - an empty string, if you like; so the page gets categorised in e.g. Category:Unassessed Computing articles or Category:Unknown-importance Computing articles. However, if a project banner is set up to not recognise class and/or importance params, then there is nothing to pass through, and the special character "¬" is used as a placeholder by {{WPBannerMeta}}. This is not interpreted as either "unknown" or "unassessed", but instead it denotes "meaningless" - as in "this concept has no meaning", like zero divided by itself is meaningless. So there is no class/importance processing, and no categorisation since there is no meaningful category in which to place the page. --Redrose64 (talk) 14:44, 6 November 2016 (UTC)
That makes sense. In the case of the assessment class being "¬" (or absent), it would be best to pass a blank parameter to PageAssessments. Perhaps in the future we could have it handle those cases differently, but right now there is no practical way to handle such a distinction in the PageAssessments data. Kaldari (talk) 20:41, 8 November 2016 (UTC)

PageAssessments: code ready[edit]

Okay I have put the code in Template:WPBannerMeta/core/sandbox and there are some tests on Template talk:WPBannerMeta/testcases. (Obviously the lower box is just for testing and will not appear on the deployed version!) A couple more questions:

  • I assume you are interested in all the extended class ratings used by various projects such as Template-class, Redirect-class and NA-class?
  • If a project has subprojects or task forces, do you want to record each task force's interest in the article as well? For example should we be calling {{#assessment:Crime task force|B|High}}?

— Martin (MSGJ · talk) 09:39, 7 November 2016 (UTC)

@MSGJ: Thanks! Yes, definitely interested in the extended class ratings. Adding assessment data for subprojects and task forces would be great, but I'm also OK with leaving these out if its too complicated. The format you suggest, {{#assessment:Crime task force|B|High}}, would be correct. Kaldari (talk) 20:34, 8 November 2016 (UTC)
Code for setting task force assessments is in Template:WPBannerMeta/taskforce/sandbox. However it can only work if the TF_n_NAME parameter is defined. (You will see that in the first example the military task force does not currently use this parameter so the assessments will not be set.) It would be possible to go through the templates filling in these missing parameters if necessary. I could even add a tracking category for it. — Martin (MSGJ · talk) 09:35, 9 November 2016 (UTC)
@MSGJ: That looks great! A tracking category for the missing parameter would also be helpful. Do you think it would be possible to put this into place in the main template late Friday night or Saturday (so that it can populate the database over the weekend). It would be good to avoid adding this during peak hours (16:00 to 04:00 UTC) since it's going to create a huge number of database queries (although they will all be low-priority in the job queue). Also, will it require editing more than 1 subtemplate? Kaldari (talk) 22:05, 10 November 2016 (UTC)
Probably won't be available Saturday but can make the change on Sunday. Yes the two affected subtemplates are /core and /taskforce. — Martin (MSGJ · talk) 22:35, 10 November 2016 (UTC)
@MSGJ: We may want to stagger the two changes to give the databases and job queue some time to breathe. Like maybe doing the /core change Sunday and the /taskforce change next weekend. At this point I'm assuming that you would prefer to make the changes yourself, but if not, let me know. Kaldari (talk) 02:07, 12 November 2016 (UTC)

I've deployed to /core and tested on a few articles by making a null edit to the talk page and then checking the API output. Seems to be working well at the moment. — Martin (MSGJ · talk) 07:45, 13 November 2016 (UTC)

The code in Template:WPBannerMeta/taskforce/sandbox is ready to deploy when needed, and there is now Category:WikiProject banners with missing task force name to track the templates which are missing the TF_n_NAME parameter. — Martin (MSGJ · talk) 09:59, 18 November 2016 (UTC)
@MSGJ: Actually, let's hold off on adding the taskforce code for now. I think I want to add a way for PageAssessments to differentiate between WikiProjects and taskforces/subprojects before we add the taskforce assessments. I'll let you know when it's ready to move forward. Thanks again for all your help with this! It's been extreme valuable. Kaldari (talk) 23:04, 19 November 2016 (UTC)
No problem — Martin (MSGJ · talk) 11:46, 20 November 2016 (UTC)
For what it's worth, the auto-updating WikiProject Directory does not distinguish between WikiProjects and task forces. Harej (talk) 21:14, 8 December 2016 (UTC)
@MSGJ: Since some project templates use PROJECT_NAME instead of PROJECT, PageAssessments is recording the project name as {{{PROJECT}}} for those. Since none of these non-WikiProject projects actually use assessments, can we just change the code to {{{PROJECT|}}} in the core {{#assessment}} code? (PageAssessments will ignore any records with blank project names.) IMO, it seems like non-WikiProject projects should use their own templates rather than piggybacking on the WikiProject meta template, but I suppose that's a separate issue. Kaldari (talk) 16:41, 6 December 2016 (UTC)
PROJECT is a required parameter so those templates should really be fixed up. Could you give me some examples so I can see if there is a sensible way of defining that parameter for those templates? — Martin (MSGJ · talk) 17:15, 6 December 2016 (UTC)
@MSGJ: It looks like the main offender is {{WikiTown banner core}}, which is a meta template for other templates such as {{Freopedia}} and {{Toodyaypedia}}. Kaldari (talk) 23:27, 6 December 2016 (UTC)
Okay I'll take a look. In the meantime there is certainly no harm in putting the pipe in — Martin (MSGJ · talk) 09:11, 7 December 2016 (UTC)
I have added the PROJECT parameter for the WikiTown projects, so these should now be recorded as Freopedia and Toodyaypedia in your database. I have also added a pipe to prevent the error happening in future, and I have added a check for this which will populate a tracking category. Any progress with the task forces? — Martin (MSGJ · talk) 09:38, 7 December 2016 (UTC)
@MSGJ: Still working on it: T154216. Kaldari (talk) 06:14, 28 December 2016 (UTC)

Subprojects[edit]

@MSGJ: OK, we are finally ready for subprojects. The format that the subproject data needs to be in is: {{#assessment:Medicine/Neurology task force|GA|low}}, in other words: {{#assessment:{{{PROJECT}}}/{{{NAME}}}|class|importance}}. This is slightly different than the sandbox code that you wrote up earlier. Kaldari (talk) 01:37, 10 February 2017 (UTC)

Will need to rewrite some of the code - currently PROJECT is not passed to the taskforce template. Will also require the same update to any project template using taskforce hooks. — Martin (MSGJ · talk) 09:50, 10 February 2017 (UTC)

I've made a few tweaks to the code and the page assessments should be filtering through. There's a lot of work to do at Category:WikiProject banners with missing task force name though. Basically every taskforce hook needs (a) PROJECT parameter and (b) TF_n_NAME parameters to be defined. — Martin (MSGJ · talk) 15:21, 13 February 2017 (UTC)
@MSGJ: Thanks! I'll see what I can do to get the parameters added. Kaldari (talk) 17:58, 13 February 2017 (UTC)
@MSGJ: Do we need to update {{WPBannerMeta/hooks/tfnested}} as well? I'm not sure I understand what that template is for. Kaldari (talk) 18:45, 13 February 2017 (UTC)
No, that code is just for producing the label which appears when the banner is collapsed inside a banner shell. No impact from this change. — Martin (MSGJ · talk) 13:17, 14 February 2017 (UTC)
@MSGJ: Seems to be working. One problem that I've noticed is that about half of the task force names are of the form "the something task force" and the other half are just "something task force". "Something task force" works a lot better for my purposes, but it causes the grammar in the template to be a bit awkward: "This page is supported by Beekeeping task force." And unfortunately we can't just hard-code "the" into the template since a lot of task forces are actually WikiProjects, which would yield: "This page is supported by the WikiProject Beekeeping." It's unfortunate that setting up WikiProjects as task force parameters has become a normal practice as it leads to lots of inconsistencies in PageAssessments. Anyway, do you have any suggestions for how to handle the "the" situation? I could add some code in PageAssessments to explicitly strip it out, but that seems a bit hacky (and English specific). Kaldari (talk) 20:51, 14 February 2017 (UTC)
If it's always the case that a preceding "the" should be removed, then I think it should be fairly easy to use a template to do that. Shall I look into it? — Martin (MSGJ · talk) 21:46, 14 February 2017 (UTC)
@MSGJ: Yes, a preceding "the " should always be removed from the assessment record. That would be great if it could be removed by a template. Kaldari (talk) 17:59, 15 February 2017 (UTC)
Something like the code below should do it, but I am worried about any valid projects that start with "the" (e.g. theology) as I'm not sure how the template will handle the space. Will do some proper testing shortly. — Martin (MSGJ · talk) 18:12, 15 February 2017 (UTC)
{{#ifeq:{{ Str left | {{{NAME}}} | 3 }} |the|{{str right|{{{NAME}}}|4}}|{{{NAME}}}}}
@MSGJ: Unless we can detect for the space, I think it will be safer for me to chop it off on the PageAssessments side. I can also filter out bold markup while I'm at it (which a lot of NAME parameters use for some reason). Kaldari (talk) 18:28, 15 February 2017 (UTC)
New code for cleaning up project titles at https://gerrit.wikimedia.org/r/#/c/337963/. Kaldari (talk) 21:54, 15 February 2017 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── As you prefer. It's an ugly hack wherever the code goes ;) We're basically using a parameter for a purpose it was never designed for. If building this from scratch we probably would have taken a different approach, such as |TASKFORCE_NAME=beekeeping from which the name "the beekeeping taskforce" could be automatically used, and |SUBPROJECT_NAME=Beekeeping could give "WikiProject Beekeeping". — Martin (MSGJ · talk) 09:03, 16 February 2017 (UTC)

And old idea, revisited[edit]

Way back in 2009, I had an idea for displaying the importance on the banner, which lead to a couple of redesign. There was a couple of other possible features suggested, but some weren't possible at the time for either technical reasons, code-messiness, or whatever.

I decided to update my sandbox (User:Headbomb/Sandbox/Banner) to illustrate a few more idea. I'm not saying we need to implement them all, but I think a few of them are interesting enough to at least consider implementing. In particular, the collapsed banner could display, the importance, vitality (current icon/general design is a mockup), and the various 'issues flagged' icons of the article.Headbomb {talk / contribs / physics / books} 14:10, 12 February 2017 (UTC)

👍 Like a lot — Martin (MSGJ · talk) 13:55, 13 February 2017 (UTC)
MSGJ (talk · contribs) What would be required to make that happen, technically? Can/could {{WPBS}} inherit things from its nested templates somehow? Headbomb {talk / contribs / physics / books} 14:59, 14 February 2017 (UTC)
There are some things I like and some things I don't like... First impression, it seems like information overload. Having both vitality and importance is going to be confusing. Also I don't think it's a good idea to rely so heavily on icons, as few people are going to know what they actually signify. I would favor simplifying the template. My favorite implementation is at French Wikipedia which uses:
{{Wikiproject
 | Project1 | importance1
 | Project2 | importance2
 | class = FA
}}
So clean and simple. My first suggestion would be to remove the "attention required", "needs infobox", and "needs image" parameters entirely, as there's no point having them set per WikiProject in the first place. Those should just be separate templates that have nothing to do with WikiProjects. I do like having the most common class percolate to the collapsed view. I also think the over-all layout and design is an improvement in Headbomb's version. Can we move in that direction but keep it a bit simpler? Kaldari (talk) 21:25, 14 February 2017 (UTC)
I agree that the infobox needed/etc don't really need to be set at the project level, I put it there mostly because of backwards compatibility. The best implementation would probably be to set it once, and have it trickle down to all projects. Concerning vitality/importance, it's already kinda done, although not in that specific way. There's a distinct banner for it. It could be retained as a distinct banner, but my way gets rid of that banner and frees up space, and having a more efficient use of space was one of my goals. I made a second mockup, which might be more to your liking. Headbomb {talk / contribs / physics / books} 22:05, 14 February 2017 (UTC)
We could also make it so that the project icons are only displayed if the project is expanded. Headbomb {talk / contribs / physics / books} 22:44, 14 February 2017 (UTC)
@Kaldari and MSGJ:. How do you feel about the second mockup? Headbomb {talk / contribs / physics / books} 18:24, 15 February 2017 (UTC)
@Headbomb: I like the second one a lot better. Kaldari (talk) 18:25, 15 February 2017 (UTC)
  • Great idea and I think it can be even further simplified. Working from Mockup 2, I'd remove the individual class ratings from each row (having it set and displayed only once, at the top). Our banners have been quite bulky with whitespace. I wonder how each line would work with the height of, say, the "WikiProject Australia" line in the current example. We might even begin to list the taskforces in rows of two, which would save even more space... Food for thought czar 17:39, 19 February 2017 (UTC)
Different projects can and will rate articles differently, so we need a per-project rating. Headbomb {talk / contribs / physics / books} 20:04, 19 February 2017 (UTC)
Projects can rate importance differently, but I don't recall ever seeing an article with projects that disagreed on class rating. I think that's what Kaldari was alluding to with the frwp template code example above. czar 21:45, 19 February 2017 (UTC)
Maths may want a word with you :P —  HELLKNOWZ  ▎TALK 21:48, 19 February 2017 (UTC)
As does WP:CHEM, who doesn't recognized FA/GA, many projects who have A-class like WP:MILHIST that other projects don't recognize, and projects with custom classes like B+, AL, BL, etc... Headbomb {talk / contribs / physics / books} 00:27, 20 February 2017 (UTC)
If WP:CHEM doesn't recognise FA/GA, why are these explicitly listed in the documentation of Template:WikiProject Chemistry and also in the template's custom class mask? --Redrose64 🌹 (talk) 00:31, 21 February 2017 (UTC)
Must be new. I knew a while ago they systematically purged all FA/GA because they didn't recognized those processes as legit. Headbomb {talk / contribs / physics / books} 00:37, 21 February 2017 (UTC)

role="presentation"[edit]

@Matt Fitzpatrick: you had some stuff going on in the sandbox including adding role="presentation". I've just removed these so I can work on some code for PageAssessments, but did you intend to formally propose these changes? — Martin (MSGJ · talk) 14:08, 13 February 2017 (UTC)

Oops, I totally forgot about that. I'd still like to propose that edit, but I don't remember if I saw errors in the testcases. Matt Fitzpatrick (talk) 14:29, 13 February 2017 (UTC)

Automatic assessment parameters[edit]

What parameters need to be set such that a new project (new WPBannerMeta instance) will automatically categorize categories and redirects based on the namespace & article space content? czar 16:45, 19 February 2017 (UTC)

For posterity, the answer appears to be setting |QUALITY_SCALE=subpage and creating a separate /class subpage (see example) to add automatic redirect classification support. czar 21:46, 19 February 2017 (UTC)