In [14]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
WARNING: pylab import has clobbered these variables: ['datetime']
`%pylab --no-import-all` prevents importing * from pylab and numpy
In [15]:
from vizgrimoire.metrics.query_builder import SCRQuery
from vizgrimoire.metrics.metrics_filter import MetricFilters
import vizgrimoire.metrics.scr_metrics as scr
In [16]:
#database object
user="root"
password=""
scr_db = "wikimedia_gerrit_20150224"
identities_db ="wikimedia_git_20150224"
people_out = ["Translation updater bot", "", "", ""]
dbcon=SCRQuery(user, password, scr_db, identities_db)
In [17]:
#metrics filter object
period = MetricFilters.PERIOD_MONTH
startdate="'2013-01-01'"
enddate="'2015-03-01'"

filters = MetricFilters(period, startdate, enddate, ["autoreviews", "fake"])
In [18]:
reviewers = scr.ActiveCoreReviewers(dbcon, filters)
In [19]:
reviewers.get_agg()
#get query: reviewers._get_sql(False)
Out[19]:
{'core_reviewers': 295L}
In [20]:
from datetime import datetime
dates = []
unixtime = reviewers.get_ts()["unixtime"]
for i in unixtime:
    dates.append(datetime.fromtimestamp(float(i)))
ts = reviewers.get_ts()
In [21]:
fig = plt.figure()
plot(dates, ts["core_reviewers"])
fig.autofmt_xdate()
In [22]:
period = MetricFilters.PERIOD_MONTH
startdate="'2015-01-24'"
enddate="'2015-02-24'"

filters = MetricFilters(period, startdate, enddate, ["autoreviews", "fake"])
reviewers = scr.ActiveCoreReviewers(dbcon, filters)

    
In [23]:
list_reviewers = reviewers.get_list()
select up.id as id , up.identifier as identifier , count(distinct(ch.id)) as reviews from issues_ext_gerrit ieg , issues i , changes ch , wikimedia_git_20150224.upeople up , people_upeople pup where field = 'Code-Review' and changed_on < '2015-02-24' and ieg.issue_id = i.id and changed_on >= '2015-01-24' and ch.issue_id = i.id and pup.upeople_id = up.id and (ch.new_value = -2 or ch.new_value = 2) and ch.changed_by  = pup.people_id and ieg.branch like '%master%' and i.id not in
                       (select distinct(i.id) as issue_id
                       from issues i,
                            changes ch
                       where i.submitted_by = ch.changed_by and
                             i.id = ch.issue_id and
                             ch.field = 'status' and
                             ch.new_value = 'MERGED')
                     group by up.id, up.identifier order by count(distinct(ch.id)) desc 
In [24]:
#Now adding to the query the affiliation
query = """select up.id as id , up.identifier as identifier , c.name as company, count(distinct(ch.id)) as reviews
           from issues_ext_gerrit ieg , issues i , changes ch , 
                wikimedia_git_20150224.upeople up , people_upeople pup, 
                wikimedia_git_20150224.upeople_companies upc, wikimedia_git_20150224.companies c
           where field = 'Code-Review' and changed_on < '2015-02-24' and ieg.issue_id = i.id and changed_on >= '2015-01-24' and 
                 ch.issue_id = i.id and pup.upeople_id = up.id and (ch.new_value = -2 or ch.new_value = 2) and 
                 ch.changed_by  = pup.people_id and ieg.branch like '%master%' and 
                 up.id = upc.upeople_id and upc.company_id = c.id and
                 i.id not in
                       (select distinct(i.id) as issue_id
                       from issues i,
                            changes ch
                       where i.submitted_by = ch.changed_by and
                             i.id = ch.issue_id and
                             ch.field = 'status' and
                             ch.new_value = 'MERGED')
                     group by up.id, up.identifier order by count(distinct(ch.id)) desc 
        """
list_affs = reviewers.db.ExecuteQuery(query)
In [25]:
for i in range(0,len(list_affs["id"])):
    identifier = list_affs["identifier"][i]
    company = list_affs["company"][i]
    reviews = list_affs["reviews"][i]
    print identifier.split('@')[0] + "," + company + "," + str(reviews)
legoktm,Independent,214
jforrester,Unknown,118
Catrope,Wikimedia Foundation,111
hoo,Unknown,80
Ed S,Unknown,74
Bartosz Dziewoński,Independent,68
Adrian Lang,Unknown,58
Trevor Parscal,Wikimedia Foundation,53
jayvdb,Unknown,45
Sam Reed,Wikimedia Foundation,43
Matthew Flaschen,Wikimedia Foundation,42
Niklas Laxström,Wikimedia Foundation,42
Phuedx,Unknown,39
ssastry,Unknown,38
Bryan Davis,Wikimedia Foundation,35
Krinkle,Wikimedia Foundation,35
zfilipin,Unknown,34
Umherirrender,Unknown,33
thiemowmde,Wikimedia Deutschland,33
Santhosh Thottingal,Wikimedia Foundation,33
bmansurov,Unknown,31
MaxSem,Wikimedia Foundation,29
mlitn,Wikimedia Foundation,28
Arlolra,Wikimedia Foundation,27
krenair,Unknown,26
siebrand,Unknown,25
Anomie,Wikimedia Foundation,25
ebernhardson,Unknown,25
jsahleen,Unknown,24
Fabian Neundorf,Unknown,23
Jon Robson,Wikimedia Foundation,22
Chad,Wikimedia Foundation,21
Gilles Dubuc,Wikimedia Foundation,21
Adam Roses Wight,Wikimedia Foundation,19
ori,Unknown,19
isarra,Unknown,19
amire80,Wikimedia Foundation,18
florianschmidtwelzow,Unknown,18
rmoen,Unknown,17
hashar,Unknown,17
jeroendedauw,Wikimedia Deutschland,17
MarkTraceur,Wikimedia Foundation,15
Aaron Schulz,Wikimedia Foundation,14
dbrant,Unknown,14
JanZerebecki,Unknown,13
xqt,Independent,13
bsitzmann,Unknown,13
mhurd,Unknown,13
aude,Unknown,13
Henning Snater,Unknown,13
dr0ptp4kt,Unknown,13
kaldari,Wikimedia Foundation,11
addshore,Independent,11
daniel,Unknown,11
jhernandez,Unknown,9
TTO,Unknown,9
marcoil,Unknown,9
KartikMistry,Unknown,8
Ejegg,Unknown,8
Chris McMahon,Wikimedia Foundation,8
Andrew Garrett,Wikimedia Foundation,8
Mooeypoo,Unknown,7
Brion Vibber,Wikimedia Foundation,7
Robert Vogel,Unknown,7
Gabriel Wicke,Wikimedia Foundation,6
Gergo Tisza,Unknown,6
Andrew Green,Wikimedia Foundation,5
yurik,Unknown,5
Jack Phoenix,Unknown,5
Merlijn van Deen,Independent,5
Tim Starling,Wikimedia Foundation,4
Dan Duvall,Unknown,4
Mpaa,Unknown,4
milimetric,Unknown,4
ryasmeen,Unknown,4
yuvipanda,Unknown,4
gnosygnu,Unknown,3
hartman,Unknown,3
Moritz Schubotz,Unknown,3
Alexandros Kosiaris,Wikimedia Foundation,3
tpt,Independent,3
Jackmcbarn,Unknown,3
Andrew,Unknown,2
Deskana,Unknown,2
ladsgroup,Unknown,2
wirth,Unknown,2
csteipp,Unknown,2
Tyler Anthony Romeo,Independent,2
tamaraslosarek,Unknown,2
Mukunda Modell,Unknown,2
nuria,Unknown,2
wctaiwan,Unknown,2
tonythomas01,Unknown,2
Yaron Koren,WikiWorks,2
Raimond Spekking,Independent,2
Katie Horn,Wikimedia Foundation,2
dzahn,Unknown,2
jonas.keutel,Unknown,1
mark,Unknown,1
Malvineous,Unknown,1
Foxtrott,Unknown,1
MZMcBride,Unknown,1
PleaseStand,Unknown,1
cicalese,Unknown,1
otto,Unknown,1
Pigpen,Unknown,1
mwjames,Unknown,1
prtksxna,Unknown,1
Manybubbles,Wikimedia Foundation,1
Marcel Ruiz Forns,Unknown,1
tosfos,Unknown,1
ricordisamoa,Unknown,1
pginer,Unknown,1
soeren.oldag,Unknown,1
Mobrovac,Unknown,1
JoelKP,Unknown,1
cscott,Unknown,1
Hypergrove,Unknown,1
rush,Unknown,1
Felipe Schenone,Unknown,1
russblau,Unknown,1
mah,Unknown,1
pcoombe,Unknown,1
o0lilu0o1980,Unknown,1
Marielle Volz,Unknown,1
Tweichart,Unknown,1
filippo,Unknown,1
Giuseppe Lavagetto,Unknown,1
In [ ]: