Page MenuHomePhabricator

Add leaderboard based on user's edits using Commons Android app
Closed, ResolvedPublic

Description

About

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons. Commons is not only the image repository for Wikipedia, but an independent project that seeks to document the world with photos, videos and recordings.

Project

Github link: https://github.com/commons-app/apps-android-commons/issues/2074

Commons Android App Repo (for UI): https://github.com/commons-app/apps-android-commons/
Commons Misc Repo(for APIs): https://github.com/commons-app/commonsmisc

The project is about adding a leaderboard based on user's edits using Commons. The feature will include only edits made with the mobile app, and users who have shown interest in this activity.

Project schedule:

  1. Update UI of achievements activity to display level (current activity) in first tab and Leaderboard in second tab (based on uploads).
  2. Designing and implementing the APIs for calculating and displaying ranks of the User (all time, monthly, weekly). These would be Python APIs in commons-misc repo.
  3. Display user's Avatar and rank on Leaderboard screen fetched from API.
  4. Designing and implementing the APIs for displaying leaderborad (user list) based on 2 parameters - duration (all time, monthly, weekly), type (uploads, nearby, images used).
  5. Use the APIs to fetch leaderboard (user list) based on uploads via mobile app (all time) and display it in Leaderboard screen.
  6. Add pagination in the leaderboard screen to load more users on scrolling down.
  7. Add duration filters in leaderboard screen and show results based on selected filter (weekly, monthly, yearly, all time). Change the UI to show and select filter.
  8. Change the UI to show 3 different results (based on uploads, nearby, used). - add 2 more tabs
  9. Tapping the name of a user in the leaderboard should open the gallery of that user's pictures, probably as a browser URL for now.
  10. Write unit tests , documentation, fix bugs and Release (at least in alpha) - (2 weeks)
  11. If time permits, Add option for users to change Avatar, Store user's Avatar in cache for a month.

Idea

The score could reuse some numbers from achievements, but should only count edits done with the mobile app, because otherwise Vicuna/etc users will dominate the top of the leaderboard even if they don't use the mobile app.

Actually, I suggest listing in the leaderboard only the users who have ever opened the achievements activity. We must keep track of that information server-side. So the leaderboard would only list app users who have an interest in this kind of game.

Tapping the name of a user in the leaderboard should open the gallery of that user's pictures, probably as a browser URL for now. Knowing they are being watched by their peers will probably reduce the temptation to "cheat" (for instance by uploading 1000 pictures of the same spoon)

The user's name should be highligthed. Random idea: The length of the leaderboard could be dynamic, for instance if I am 3rd it could be 10 people, but if I am 13rd it could be 20 people. Or just make more people appear when scrolling down.

There could be weekly (last 30 days) rankings, yearly (last 365 days) rankings, all-time rankings.

To make it more visually attractive, I suggest using as a kind of avatar the user's most successful picture (the one which is used the most in the wikipedias/etc, or a random one if the user's pictures are not used yet anywhere). Random idea: Users like to personalize their avatar, so we could also offer the option to select one of the user's uploads as an avatar picture, but that may lead to more selfies, so this option could be an privilege to unlock (only users who are above level 5 for instance).

There is a lot of data to show, so we have to think the UI carefully. Here is just an idea:

53636749-94104080-3c64-11e9-90f1-f399dc8ff83f.png (877×904 px, 34 KB)

The vegetable is a placeholder for the user's avatar.
I forgot to write the position number (1, 2, 3, etc). It is important because I want to know whether I climbed from 37th to 36th, and counting is boring.

UI Mocks

58955017-66cdb400-87b8-11e9-8e3d-6bc79f7c3445.png (2×1 px, 164 KB)

58759956-8e6e1380-854f-11e9-95ca-5f3a69795ced.png (2×1 px, 90 KB)

Implementation

The leaderboard lists should probably be calculated on the server where we currently perform achievement calculations, and cached (re-serve the same results if less old than 1 hour). The user will probably upload a few more pictures in 5 minutes and come see the leaderboard again. So we could recalculate only that user's new scores (and let the other people's scores the same until the next hour comes). In other words, only the users who keep looking at the leaderboard would have their score grow at smaller intervals than 1 hour. That 1-user-only recalculation itself should be cached something like 1 minute because a picture can not be neatly uploaded in less time, and to avoid useless server load.

The avatar miniatures (generated by mediawiki) should be cached by the app for like a month.

How should the user start showing up in the leaderboard?

Automatically when the user performs one of the actions. We can automatically add the user in the leaderboard, once he performs any of these actions

  • login
  • or upload
  • or nearby upload

In our backend, we are planning to have:

  • a list of users(with option 1 or 2) for whom we need to calculate statistics
  • periodically fetch the statistics (every 1 or 4 hours). Update the statistics in our tools forge DB
  • When the Commons app does an API call to get leaderboard info, serve the statistics using tools forge DB instead of calculating real-time.

Skills required

  • Android SDK
  • Android UI design
  • Understanding of RxJava
  • Basic knowledge of Wikimedia APIs
  • Familiarity with Python
  • Unit testing for Android

Nice to have skills

  • Familiarity with Kotlin
  • Retrofit

Mentor(s)

@maskaravivek and @Nicolas_Raoul

Get started

Event Timeline

@maskaravivek , @Nicolas_Raoul I think the project is good. I wish to contribute in the best way possible by co-mentoring the project. Thank you

Some possible micro-contributions: https://github.com/commons-app/apps-android-commons/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner+friendly%22

The link in the description redirects to a label that doesn't have any issues at all. Maybe it could lead to a different label like good first issue instead?

@maskaravivek @Nicolas_Raoul I am willing to participate in GSOC 2020 and would like to contribute to this project. I have some past experience in the Android Commons app and researching about this enhancement.

@maskaravivek Sir, My name is Abhishek Garain, BTech 3rd year student from IIIT Gwalior. I am willing to work on this project during GSoC'20. The project mainly revolves around building an UI and an API for contributions calculation which populates the leaderboard. To get a better understanding of building the API, I would like to know about the db schema which is used for wikimedia commons. I have also applied for toolforge tools membership.

Welcome everyone and thanks for showing interest in this app.

@Agarain99 We are planning to host a new DB on toolsforge and the schema isn't decided yet. Designing and implementing the schema is part of the GSoC task.

Sir , My name is Nishant and I am student of JNU.
Here is my linkedIn Profile .https://www.linkedin.com/in/nishant-sharma-46b655165/?originalSubdomain=in
.I found this project interested and i want to contribute to this project during GSOC 2020 and I have all the required skills.
Thanks you.

Sir, My name is Amitoz Singh, BTech 3rd year student from Bpit. I am willing to work on this project during GSoC'20. and I have all the required skills I have worked with java,kotlin and rxjava. Here is my Linkedin Profile. https://www.linkedin.com/in/amitoz-singh/
Thank you.

Greetings everyone,
I added a subtask but it is not showing up here, perhaps i am doing something wrong.
Here's the link to the subtask:
T249027: (GSoC 2020 proposal) Implement Leaderboards

Greetings everyone,
I added a subtask but it is not showing up here, perhaps i am doing something wrong.

Did you try this?
Click "Edit Related Tasks… 🡒 Edit Parent Tasks" and add the task of the project idea ("T244197").

@318anushka yes i did that and then it got reflected in the task graph but not in the comments, thanks anyways :)

Is everything in this project task planned for Google-Summer-of-Code (2020) completed? If yes, please consider closing this task as resolved. If bits and pieces are remaining, you could consider creating a new task and moving them there.