apps-android-commons
apps-android-commons copied to clipboard
Create a map showing where we have a higher proportion of uploads than other upload tools
I believe our app results in more uploads from the global South / underrepresented countries than the web Upload Wizard, but I don't think we have a solid proof of that.
This script could be customized to check for our label, then compare. For instance it could show with a green gradient the areas where we have proportionally more than our average share of uploads :
# Quad-licensed under CC-BY-SA 3.0, GNU AGPL v3, MIT/Expat License, NCSA Open Source License
# Use and distribution are permitted as long as any one of the above licenses is satisfied.
from PIL import Image, ImageDraw
im = Image.new("L", (720, 360))
draw = ImageDraw.Draw(im)
query = """
SELECT 180-ROUND(gt_lat*2),
ROUND(gt_lon*2)+360,
ROUND(LOG2(COUNT(gt_page_id))*16)
FROM geo_tags
INNER JOIN page
ON page_id = gt_page_id
WHERE gt_globe = "earth"
AND NOT (
gt_lat = 0
AND gt_lon = 0
)
AND page_namespace = 6
GROUP BY ROUND(gt_lat*2),
ROUND(gt_lon*2)
ORDER BY COUNT(gt_page_id) DESC
;"""
import MySQLdb
connection = MySQLdb.connect(
host = "commonswiki.labsdb",
db = "commonswiki_p",
read_default_file = "~/replica.my.cnf"
)
cursor = connection.cursor()
cursor.execute(query)
for y, x, c in cursor.fetchall():
draw.point((x,y), fill=c)
im.save("File:Geolocated_images_in_Wikimedia_Commons_2014-02-21.png", "PNG")
Found at https://commons.wikimedia.org/wiki/File:Geolocated_images_in_Wikimedia_Commons_2014-02-21.png#Generator
Anyone knows whether there is a lightweight way to execute this script, in particular without setting a lab instance and downloading the database? Maybe Quarry? As usual, all volunteers welcome :-)
Great idea! I can obtain maps of active installs from the dev console, but uploads is a better metric for sure.