Commons:Bots/Requests/Pi bot 3

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Pi bot (talk · contribs)

Operator: Mike Peel (talk · contributions · Statistics · Recent activity · block log · User rights log · uploads · Global account information)

Bot's tasks for which permission is being sought: Migrate uses of {{Object photo}} to {{Art photo}}

Automatic or manually assisted: Automatic

Edit type (e.g. Continuous, daily, one time run): One (or two/three) time run

Maximum edit rate (e.g. edits per minute): 10/minute

Bot flag requested: (Y/N): Already have bot flag

Programming language(s): Python source code

Object photo has been deprecated for a while, but migrating it over is somewhat tricky, and there are around 47k photos still using it in Category:Files using deprecated object photo template. This script migrates the easy ones to use Art photo, using the Wikidata item attached to the object photo category. It will be tweaked to match other formats as needed. The remaining items will need manual intervention to migrate to Wikidata. Thanks. Mike Peel (talk) 17:57, 23 April 2022 (UTC)[reply]

Discussion

Thanks for picking this up. I recall Jarek also doing some, not sure why he stopped. Reading your code, you replace {{Object photo}} with {{Art photo}} with the parameter "object" set to some category to "wikidata" set to the Wikidata item of the category and you also do some clean up. Can you give it a spin with some test edits? Multichill (talk) 21:05, 23 April 2022 (UTC)[reply]

@Mike Peel and Multichill: , Yes I was working on it, but got distracted with something else. I did do a ton of "easy" cases where there is an item on Wikidata matching the category. Then if there is main subject (P921) or digital representation of (P6243) than simply replacing "{{Object photo" with "{{subst:Object photo/Art photo" would cleanly replace {{Object photo}} template with {{Art photo}}. At some point I fixed all the files using {{Object photo}} template that have_Wikidata item in SDC and now I can find only about 10 of them.
It seems to me that linking files in Category:Files using deprecated object photo template is the prerequisite of retiring this template. Great number of those files are photographs of graves from Père-Lachaise cemetary. I was planing to create wikidata items for them, but something else come up.
Useful DB queries:
--Jarekt (talk) 04:13, 24 April 2022 (UTC)[reply]
@Jarekt: I also got a bit distracted. Back in February we worked on this with User:Pyb and also created d:User:Multichill/Père Lachaise Cemetery. I think we used tomb of Cécile, Bordeau and Dabit (Q110825428) as a reference item. Maybe start with creating the missing grave items on Wikidata for which we already have a category to get the party started?
I do notice we seem to have a bit of a mix up between two items:
  • grave (Q173387): location where one dead person or a limited amount of people are buried: en=grave / fr=tombe / de=Grab / nl=graf
  • tomb (Q381885): burial place en=tomb / fr=tombeau / de=Grabkammer / nl=graftombe
I don't think tomb of Cécile, Bordeau and Dabit (Q110825428) is a tomb (Q381885) unless there is a room under that stone. Multichill (talk) 11:11, 30 April 2022 (UTC)[reply]

Thanks @Multichill and Jarekt. This was aimed at the easier cases, so if Jarekt has already done them then it won't catch as many as I thought it would (did I miss the bot request for that, or is this something that can be run without one?). But still worth running I think, even if it needs more iterations as we add more Wikidata items? I'm not editing SDC still, so this is only focused on sitelinks between categories and Wikidata, which may be a benefit since it's a bit orthogonal to what you've been doing? But in general, the sooner we can get this template deprecated, the better.

I've semi-automatically run through some examples using my user account, see [1], [2], [3]. I've made a few changes to the code to handle some edge cases. How does this look? I could probably run through this on a semi-automated basis if that would be preferred, given what you've said above. Thanks. Mike Peel (talk) 19:30, 6 May 2022 (UTC)[reply]

Mike Peel your edits look good. Your replacement rules seem very similar to the ones in my substitution template Template:Object photo/Art photo. We are using two very different approaches to find the files. You are looking for files in Category:Files using deprecated object photo template which transclude a category which is linked to wikidata through a sitelink. Such categories should also be in Category:Artworks with Wikidata item and in Category:Pages_using_Category_definition:_Object_template and intersection of those 2 only finds 2 categories at the moment, so I would predict that you are only going to find a handful of files to edit. My approach was much more manual: to use this query to find intersection of Category:Artworks with Wikidata item and in Category:Files_using_deprecated_object_photo_template, add main subject (P921) or digital representation of (P6243) to those files using QuickStatements or User:Magnus Manske/sdc tool.js and do a single replacement of "{{Object photo" with "{{subst:Object photo/Art photo" using AutoWikiBrowser or VisualFileChange. Your approach is probably better and I would be quite interested if my prediction that it would catch only about 65 files is correct. If so than you can make your bot more efficient if you run it on the files that are in Category:Artworks with Wikidata item and in Category:Files_using_deprecated_object_photo_template. Also you should make sure that your bot handles all allowed spellings of the input parameters ('artist' and 'Artist' for example). And we still need to create wikidata items for 12,630 categories or wrote some alternative bot to copy fields from the categories to the files. For example Category:Vesuviana_stovetop_coffee_maker list files of someone's private coffee maker, a category unlikely to be connected to the wikidata. How should we handle 51 files that transclude this category? --Jarekt (talk) 20:51, 6 May 2022 (UTC)[reply]
Fine, I'll run this semi-automatically. Then we can discuss the remaining cases. Back shortly. Thanks. Mike Peel (talk) 21:06, 6 May 2022 (UTC)[reply]
BTW, I think @Rama: is basically on board with this migration to Wikidata? Thanks. Mike Peel (talk) 21:25, 6 May 2022 (UTC)[reply]
Hello, indeed I am very much in favour of migrating information to Wikidata. Thank you for your work, much appreciated! Rama (talk) 06:55, 7 May 2022 (UTC)[reply]
Hmm, OK, first pass done. It didn't catch as many cases as I expected, I guess Jarekt got them already. Will have a think about different ways to approach this... Thanks. Mike Peel (talk) 12:12, 8 May 2022 (UTC)[reply]
Also, just to formally note, I  withdraw the bot request. Thanks. Mike Peel (talk) 12:13, 8 May 2022 (UTC)[reply]

Withdrawn. --Krd 13:21, 8 May 2022 (UTC)[reply]