Coder Social home page Coder Social logo

wikimedia / analytics-geowiki Goto Github PK

View Code? Open in Web Editor NEW
1.0 8.0 0.0 166 KB

Github mirror of "analytics/geowiki" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing

Python 53.57% Shell 46.43%

analytics-geowiki's Introduction

Geo Coding module

This module can be used to generate datasets that aggregate geographical information about editors. The source of the data is the recentchanges table of the Mediawiki MySql databases. Currently two datasets are generated

  • Each row shows the number of editors of certain activity level for a given country. The files are tab seperated, there is one file per Wikipedia project (e.g. enwp).

    Country, total editors, total active editors (5+), total very active editors (100+)

  • Each row shows a country and total number of edits, followed by a list of the top ten cities and the percentage of edits made in that city. The files are tab seperated, there is one file per Wikipedia project (e.g. enwp).

    Country, total edits, [city, {0.0-10.0} weight compared to largest contributor city]

Privacy

One needs access to IP addresses to create geo coded datasets from wikipedia. Wikipedia's privacy policy states that IP addresses are only stored for a limited period of time. The datasets generated by this module do not contain information about indidual editors, all datapoints are aggregated on a city or country level.

Dependencies

Configuration

Directories

In 'process_data.py', set the following directories.

  • output : generated geo coded data files

Mysql

Configure access to the mysql databases by configuring the mysql_config.py file. The login info has to to be configured by creating the file ~/.my.cnf with the following conent:

[client]
user = USERNAME
password = PASSWORD

The data is retrieved using a server-side mySQLdb cursor. The tables queried are:

No joins are performed.

GeoIP

Point geo_coding.geoIP_fn to the GeoIP City Database.

Usage

Note: Any files that already exist in the cofingured data/output directories will be overwritten. None of the already existing files will be deleted. At the moment no date-specific information is included anywhere in the files or the file names, it is best to run the script with empty directories.

Simply run:

python process_data.py

Todo

  • Add date specific information in the data files and the file names
  • Tests!
  • Create a package

analytics-geowiki's People

Contributors

catrope avatar declerambaul avatar hashar avatar lunartwilight avatar milimetric avatar ottomata avatar paravoid avatar somechris avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.