Page MenuHomePhabricator

[Categorization of files at upload] Category suggestion framework
Open, MediumPublicFeature

Description

Full context in W526 by @Prototyperspective

This ticket covers one key part: Dynamic category suggestions based on file metadata (e.g. title or EXIF data if available), prior categories set by users, etc. We have some other ideas that we are still scoping, and might have more spinoff tickets depending on effort required.

Event Timeline

Some specific questions from @Mimurawil and maybe @JSengupta-WMF has feedback too:

Is the suggestion more like "auto-add" or "offer-to-add"? This could imply UI changes

Let's start with offer-to-add. If it later proves to be very successful with a high acceptance rate, then we can consider auto-add or ask the user to confirm their preference.

Should we rank the suggestions when multiple sources agree? ie: category found in both geo and history appears first in the list

Absolutely when possible, so that we may see higher acceptance rates.

Another question is about the platform scope - should we degrade gracefully where extensions are absent? For instance, should full-text search depend on CirrusSearch, and geosearch depend on GeoData?

I think it's important to degrade gracefully, so that we don't create friction or confusion.

mikez-WMF renamed this task from [Categorization of files at upload] Dynamic category suggestions to [Categorization of files at upload] Category suggestion framework.Jun 3 2026, 2:28 PM
mikez-WMF triaged this task as Medium priority.

Change #1297776 had a related patch set uploaded (by Mimurawil; author: Mimurawil):

[mediawiki/extensions/UploadWizard@master] [WIP] Categories: Add dynamic category suggestion framework

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

@mikez-WMF, there's a comment on my patch that raises a good point. I created a config to enable/disable this feature, but I only set it in UploadWizard.config.php. The comment asked whether it's better to have this override on the client side, as it could help folks test/provide feedback.

It's a very visible user feature, so it's important to make testing and providing feedback easier, but what about the potential security and data implications?
Would it be possible to still validate data server-side upon submission?

It's a very visible user feature, so it's important to make testing and providing feedback easier, but what about the potential security and data implications?
Would it be possible to still validate data server-side upon submission?

My understanding of how UploadWizard works is that the data will continue to be correctly "validated" on the server side, regardless of whether category suggestions are enabled on the client side. Category-related (and Upload-side) validation, if any, happens inside core MediaWiki.

Thank you! Should we double-check this with someone else? Maybe a quick ping to the folks in the Unsupported Tools Working Group who recommended prioritizing uploads?

Sure, I don't have a problem with you reaching out to the Unsupported Tools Working Group to discuss this more broadly if you have concerns about community support. It's probably worth noting that "Sohom Datta" on the Unsupported Tools Working Group, I, and the commenter on Gerrit are the same person. If you have implementation concerns, we could potentially just ping @Cparle, who is more familiar with the extension internals than I am.

Right, I know you're Sohom. :) I just asked if we should double-check with others about how the validation works server-side (since I don't know). If you're confident with your understanding of how it works, then we can move forward with your suggestion.

Quick update that I made the changes in the patch by adding this "per-user" preference :)

I kept the "master switch" (UploadWizard.config.php) so that administrators have more control over the feature in their entire site, and then each user can opt-in/out (default off) on this category suggestion. This gives a more independent model, but it's an easy change if we prefer a more override-based model. Let me know and I can adjust.

Change #1297776 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@master] Categories: Add dynamic category suggestion framework

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

Wanted to copy over the following feedback:

The current implementation makes it look like a green link, not sure if that is the intention? (We typically have links in blue if they are supposed to be represent that), though I feel like framed buttons or chips with links might be more preferable in this context

I feel like the UI might benefit from feedback from the community once it is more fleshed out. I'm not the biggest fan of the current design, but am willing to be convinced otherwise either way

The green is intentional to keep it consistent with other suggested items (e.g. suggested username). I do agree that it should be tested and I am happy to take any feedback into consideration and adjust the design accordingly. Can it be released as an opt in feature so users can test it out?

Patches have been submitted for all of the proposed suggestion providers in the subtasks. Some tweaking to the scoring weights and behavior might be needed, but those changes should be easy to make. Be warned, all combined it is a lot of code to review.

@Soda How do you think we should go about testing these patches? We need real data to test these effectively. I know the beta cluster exists, but I'm not familiar with it yet.

I've got a demo with all patches deployed to patchdemo: https://e30a7a20e6.catalyst.wmcloud.org/wiki/Special:UploadWizard

There are a couple of hacks in this Patchdemo build needed to make it testable there. I replaced the Wikidata depictions input with a regular OOUI TextInputWidget.This is due to Patchdemo not having the necessary dependencies to get the needed Wikidata components working with UploadWizard. You can manually enter a Q-id like Q243 and it should update the suggestions, even if it's not exactly like the real form. Otherwise, the only other changes are configuration overrides and the providers being made to point to Commons and wikidata.org.

If you need test images then the picture of the day category from Commons has plenty. Just make sure the necessary metadata is present. Here is one image I used for testing the GPS provider: https://commons.wikimedia.org/wiki/File:Haltern_am_See,_Westruper_Heide_--_2025_--_8721.jpg