I can hardly believe it – the project is complete and Outreachy is nearly over! When I started, I was plagued with doubts about whether or not I could do it – I didn’t have a clue on how to do many of the things that we’d planned. But it all worked out in the end, and in fact turned out better than I expected. Perhaps it’s okay to not know how you’re going to do something, perhaps it’s a normal part of a developer’s life? That’s one of the more important lessons I’ll be taking away from this, at least.
But enough of my rambling, here’s the final summary of the Upload to Commons Android app project. The main goal of the project was to improve the image categorization functionality of the app by offering relevant category suggestions based on geolocation, and making category search more flexible. Download the latest version of the app here, or check out its source code here!
Category suggestions based on geolocation
If a picture with geolocation is uploaded, nearby category suggestions are offered based on the categories of other nearby Commons images. We query the Commons MediaWiki API for the Commons categories of pictures with geolocation within a radius of 10km of the uploaded pic’s geolocation. The categories found are also cached using the quadtree library, so that if another picture with similar geolocation is uploaded, the cached categories are displayed and the API is not queried. This is done to reduce the load on the API, as people often upload several pics with similar locations.
Example: Uploading an image of the Hamilton Gardens with geolocation:
Entering the title and description:
Category suggestions obtained:
If a picture with no geolocation is uploaded, nearby category suggestions can be offered based on the user’s current location. This is useful if someone doesn’t want to geotag their pictures, and uploads them while still in the same area. The feature is optional and only works if enabled in Settings (disabled by default for privacy).
Enabling the ‘use current location’ settings:
More flexible category search
Category search (when typing in the search field) has been made more flexible. Prior to this, category search was done solely by prefix search. E.g. if you searched for ‘latte’, you would only get categories that start with ‘latte’, which excludes many potentially relevant categories (i.e. ‘iced latte’). Prefix search is useful when you are certain of what the exact name of the category you want is, but not so useful if you are unsure. So we wanted to retain prefix search, but also provide additional suggestions for relevant categories that do not share that prefix.
We query the Commons MediaWiki API for pages of type “Category” (srnamespace=14), maximum 10 results (srlimit=10). These results are aggregated with the prefix search results and the duplicate suggestions are eliminated before they are displayed.
Example: Searching for ‘latte’ categories: