r94910 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94909‎ | r94910 | r94911 >
Date:17:07, 18 August 2011
Author:giovanni
Status:deferred
Tags:
Comment:
created folder contribution_inequality and added query files
Modified paths:
  • /trunk/tools/wsor/contribution_inequality (added) (history)
  • /trunk/tools/wsor/contribution_inequality/create.sql (added) (history)
  • /trunk/tools/wsor/contribution_inequality/query.py (added) (history)
  • /trunk/tools/wsor/contribution_inequality/queryall.sh (added) (history)

Diff [purge]

Index: trunk/tools/wsor/contribution_inequality/create.sql
@@ -0,0 +1,133 @@
 2+drop table if exists giovanni.policy_contributors;
 3+
 4+create table giovanni.policy_contributors select
 5+ page_title as title,
 6+ page_namespace as namespace,
 7+ rev_user as user_id,
 8+ rev_user_text user_name,
 9+ year(rev_timestamp) as year,
 10+ count(*) as editcount
 11+from revision join page
 12+on rev_page = page_id
 13+where page_title in (
 14+ "Notability",
 15+ "Verifiability",
 16+ "No_original_research",
 17+ "Neutral_point_of_view",
 18+ "Article_titles",
 19+ "What_Wikipedia_is_not",
 20+ "Wikipedia_is_not_a_dictionary",
 21+ "Biographies_of_living_persons",
 22+ "Consensus",
 23+ "Ignore_all_rules",
 24+ "Deletion_policy",
 25+ "Criteria_for_speedy_deletion",
 26+ "Proposed_deletion",
 27+ "Editing_policy",
 28+ "Citing_sources",
 29+ "Disambiguation",
 30+ "Edit_warring",
 31+ "Civility",
 32+ "No_legal_threats",
 33+ "No_personal_attacks",
 34+ "Ownership_of_articles",
 35+ "Sock_puppetry",
 36+ "Conflict_of_interest",
 37+ "Do_not_disrupt_Wikipedia_to_illustrate_a_point",
 38+ "Etiquette",
 39+ "Gaming_the_system",
 40+ "Manual_of_Style",
 41+ "Manual_of_Style_(abbreviations)",
 42+ "Manual_of_Style_(accessibility)",
 43+ "Manual_of_Style_(article_message_boxes)",
 44+ "Manual_of_Style_(biographies)",
 45+ "Manual_of_Style_(capital_letters)",
 46+ "Manual_of_Style_(captions)",
 47+ "Manual_of_Style_(dates_and_numbers)",
 48+ "Manual_of_Style_(disambiguation_pages)",
 49+ "Manual_of_Style_(embedded_lists)",
 50+ "Manual_of_Style_(footnotes)",
 51+ "Manual_of_Style_(icons)",
 52+ "Manual_of_Style_(infoboxes)",
 53+ "Manual_of_Style_(layout)",
 54+ "Manual_of_Style_(lead_section)",
 55+ "Manual_of_Style_(linking)",
 56+ "Manual_of_Style_(lists)",
 57+ "Manual_of_Style_(lists_of_works)",
 58+ "Manual_of_Style_(pronunciation)",
 59+ "Manual_of_Style_(proper_names)",
 60+ "Manual_of_Style_(self-references_to_avoid)",
 61+ "Manual_of_Style_(spelling)",
 62+ "Manual_of_Style_(summary_style)",
 63+ "Manual_of_Style_(tables)",
 64+ "Manual_of_Style_(text_formatting)",
 65+ "Manual_of_Style_(titles)",
 66+ "Manual_of_Style_(trademarks)",
 67+ "Manual_of_Style_(trivia_sections)",
 68+ "Manual_of_Style_(words_to_watch)",
 69+ "Help_desk",
 70+ "Reference_desk/Computing",
 71+ "Reference_desk/Entertainment",
 72+ "Reference_desk/Humanities",
 73+ "Reference_desk/Language",
 74+ "Reference_desk/Mathematics",
 75+ "Reference_desk/Science",
 76+ "Reference_desk/Miscellaneous",
 77+ "Editor%27s_index_to_Wikipedia",
 78+ "Copyright_problems",
 79+ "Contributor_copyright_investigations",
 80+ "External_links/Noticeboard",
 81+ "Fringe_theories/Noticeboard",
 82+ "Neutral_point_of_view/Noticeboard",
 83+ "Reliable_sources/Noticeboard",
 84+ "Administrator_intervention_against_vandalism",
 85+ "Arbitration_Committee/Noticeboard",
 86+ "Arbitration/Requests/Enforcement",
 87+ "Arbitration/Requests",
 88+ "Editor_review",
 89+ "Dispute_resolution_noticeboard",
 90+ "Wikiquette_assistance",
 91+ "Requests_for_mediation",
 92+ "Notability_(academics)",
 93+ "Notability_(books)",
 94+ "Notability_(events)",
 95+ "Notability_(films)",
 96+ "Notability_(music)",
 97+ "Notability_(numbers)",
 98+ "Notability_(people)",
 99+ "Notability_(sports)",
 100+ "Notability_(web)",
 101+ "Notability_(organizations_and_companies)",
 102+ "No_original_research/Noticeboard",
 103+ "Fiction/Noticeboard",
 104+ "Content_forking",
 105+ "Autobiography",
 106+ "Non-free_content_review",
 107+ "Bureaucrats%27_noticeboard",
 108+ "External_links",
 109+ "Fringe_theories",
 110+ "No_disclaimers_in_articles",
 111+ "Offensive_material",
 112+ "Patent_nonsense",
 113+ "Plagiarism",
 114+ "Spam",
 115+ "Wikipedia_is_not_for_things_made_up_one_day",
 116+ "Sexual_content",
 117+ "Vandalism",
 118+ "Please_do_not_bite_the_newcomers",
 119+ "Arbitration/Policy",
 120+ "Banning_policy",
 121+ "Blocking_policy",
 122+ "Administrators",
 123+ "Bot_policy",
 124+ "Copyright_violations",
 125+ "Image_use_policy",
 126+ "Non-free_content_criteria",
 127+ "Be_bold",
 128+ "Categorization/Ethnicity,_gender,_religion_and_sexuality",
 129+ "Categorization_of_people",
 130+ "Categorization",
 131+ "Citing_sources"
 132+)
 133+and page_namespace in (4,5)
 134+group by rev_user_text, year(rev_timestamp), title, namespace
Index: trunk/tools/wsor/contribution_inequality/queryall.sh
@@ -0,0 +1,8 @@
 2+#!/bin/bash
 3+
 4+wd=`pwd`
 5+mkdir results
 6+pushd results
 7+for args in {2001..2010}' '{4..5}; do
 8+ xargs -I {} $wd/query.py {} $args < $wd/pages.txt
 9+done
Property changes on: trunk/tools/wsor/contribution_inequality/queryall.sh
___________________________________________________________________
Added: svn:executable
110 + *
Index: trunk/tools/wsor/contribution_inequality/query.py
@@ -0,0 +1,28 @@
 2+#!/usr/bin/python
 3+from argparse import ArgumentParser
 4+import os
 5+from oursql import connect
 6+
 7+parser = ArgumentParser()
 8+parser.add_argument('page')
 9+parser.add_argument('year')
 10+parser.add_argument('ns')
 11+
 12+query="""
 13+select
 14+ user_name, editcount
 15+from giovanni.policy_contributors
 16+where title = ? and year = ? and namespace = ?
 17+order by editcount desc limit 100;
 18+"""
 19+
 20+if __name__ == '__main__':
 21+ ns = parser.parse_args()
 22+ db = connect(read_default_file=os.path.expanduser('~/.my.cnf'))
 23+ cursor = db.cursor()
 24+ cursor.execute(query, (ns.page, ns.year, ns.ns))
 25+ f = open('%s-%s-%s.tsv' % (ns.page, ns.year, ns.ns), 'w')
 26+ for row in cursor:
 27+ print >> f, '%s\t%d' % row
 28+ print 'results printed to %s' % f.name
 29+
Property changes on: trunk/tools/wsor/contribution_inequality/query.py
___________________________________________________________________
Added: svn:executable
130 + *

Status & tagging log