In [1]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
In [2]:
from vizgrimoire.metrics.query_builder import SCRQuery
from vizgrimoire.metrics.metrics_filter import MetricFilters
import vizgrimoire.metrics.scr_metrics as scr
In [3]:
#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 [4]:
period = MetricFilters.PERIOD_MONTH
startdate = "'2013-01-01'"
enddate = "'2015-03-01'"
filters = MetricFilters(period, startdate, enddate)
In [5]:
participants = scr.Participants(dbcon, filters)
In [9]:
participants.get_agg()
Out[9]:
{'participants': 921L}
In [10]:
participants_ts = participants.get_ts()
In [11]:
from datetime import datetime
dates = []
unixtime = participants_ts["unixtime"]
for i in unixtime:
    dates.append(datetime.fromtimestamp(float(i)))
In [13]:
fig = plt.figure()
plot(dates, ts["participants"])
fig.autofmt_xdate()
In [14]:
list_participants = participants.get_list()
SELECT u.identifier , count(*) as events FROM people_upeople pup , ((SELECT comments.submitted_on as submitted_on , comments.submitted_by as submitted_by FROM comments WHERE comments.submitted_on>='2013-01-01' AND comments.submitted_on<'2015-03-01') union (SELECT ch.changed_by as submitted_by , ch.changed_on as submitted_on FROM changes ch WHERE ch.changed_on>='2013-01-01' AND ch.changed_on<'2015-03-01') union (SELECT i.submitted_on as submitted_on , i.submitted_by as submitted_by FROM issues i WHERE i.submitted_on>='2013-01-01' AND i.submitted_on<'2015-03-01')) t , wikimedia_git_20150224.upeople u WHERE t.submitted_on>='2013-01-01' AND t.submitted_on<'2015-03-01' AND pup.upeople_id = u.id and t.submitted_by = pup.people_id group by u.identifier  order by count(*) desc 
In [15]:
#Adding companies affiliation
query = """
SELECT u.identifier , c.name as company, count(*) as events 
FROM ((SELECT comments.submitted_on as submitted_on , comments.submitted_by as submitted_by 
       FROM comments 
       WHERE comments.submitted_on>='2015-01-24' AND comments.submitted_on<'2015-02-24') union 
      (SELECT ch.changed_by as submitted_by , ch.changed_on as submitted_on 
       FROM changes ch 
       WHERE ch.changed_on>='2015-01-24' AND ch.changed_on<'2015-02-24') union 
      (SELECT i.submitted_on as submitted_on , i.submitted_by as submitted_by 
       FROM issues i 
       WHERE i.submitted_on>='2015-01-24' AND i.submitted_on<'2015-02-24')) t , 
      people_upeople pup , wikimedia_git_20150224.upeople u,
      wikimedia_git_20150224.upeople_companies upc, wikimedia_git_20150224.companies c
WHERE t.submitted_on>='2015-01-24' AND t.submitted_on<'2015-02-24' AND pup.upeople_id = u.id and 
      t.submitted_by = pup.people_id and u.id = upc.upeople_id and upc.company_id = c.id
GROUP by u.identifier      
ORDER by count(*) desc 
"""
list_affs = participants.db.ExecuteQuery(query)
In [16]:
for i in range(0,len(list_affs["identifier"])):
    identifier = list_affs["identifier"][i]
    company = list_affs["company"][i]
    events = list_affs["events"][i]
    print identifier.split('@')[0] + "," + company + "," + str(events)
jenkins-bot,Unknown,15505
Translation updater bot,Unknown,2459
legoktm,Independent,588
Krinkle,Wikimedia Foundation,499
jforrester,Unknown,481
jayvdb,Unknown,462
Bartosz Dziewoński,Independent,437
ori,Unknown,405
paladox,Unknown,396
Fabian Neundorf,Unknown,383
hashar,Unknown,368
Catrope,Wikimedia Foundation,359
dzahn,Unknown,352
hoo,Unknown,342
yuvipanda,Unknown,285
florianschmidtwelzow,Unknown,260
thiemowmde,Wikimedia Deutschland,259
Ed S,Unknown,256
Matthew Flaschen,Wikimedia Foundation,255
ricordisamoa,Unknown,231
Umherirrender,Unknown,228
Adrian Lang,Unknown,217
Bryan Davis,Wikimedia Foundation,216
bblack,Unknown,214
otto,Unknown,211
Niklas Laxström,Wikimedia Foundation,204
KartikMistry,Unknown,196
nemobis,Independent,195
Sam Reed,Wikimedia Foundation,194
Andrew,Unknown,194
Alexandros Kosiaris,Wikimedia Foundation,194
Anomie,Wikimedia Foundation,194
amire80,Wikimedia Foundation,192
Henning Snater,Unknown,181
ssastry,Unknown,179
Giuseppe Lavagetto,Unknown,176
Adam Roses Wight,Wikimedia Foundation,175
bmansurov,Unknown,173
Santhosh Thottingal,Wikimedia Foundation,170
ebernhardson,Unknown,169
Arlolra,Wikimedia Foundation,168
Jon Robson,Wikimedia Foundation,167
Mooeypoo,Unknown,162
Yaron Koren,WikiWorks,155
MaxSem,Wikimedia Foundation,154
krenair,Unknown,153
filippo,Unknown,151
xqt,Independent,150
Moritz Schubotz,Unknown,148
Gergo Tisza,Unknown,145
Phuedx,Unknown,143
Christopher Johnson,Unknown,142
jhernandez,Unknown,134
mlitn,Wikimedia Foundation,133
Aaron Schulz,Wikimedia Foundation,131
jsahleen,Unknown,129
siebrand,Unknown,126
Chad,Wikimedia Foundation,124
mhurd,Unknown,122
springle,Unknown,121
RobH,Unknown,118
Mpaa,Unknown,112
Gilles Dubuc,Wikimedia Foundation,112
fomafix,Unknown,108
kaldari,Wikimedia Foundation,108
daniel,Unknown,102
Trevor Parscal,Wikimedia Foundation,99
rmoen,Unknown,96
[[mw:User:Valhallasw]],Unknown,96
Chris McMahon,Wikimedia Foundation,93
dbrant,Unknown,91
cscott,Unknown,89
aude,Unknown,88
MarkTraceur,Wikimedia Foundation,87
Robert Vogel,Unknown,87
nuria,Unknown,86
Mjbmr,Unknown,86
Gabriel Wicke,Wikimedia Foundation,85
yurik,Unknown,85
Merlijn van Deen,Independent,82
Christian Aistleitner,Independent,80
Brion Vibber,Wikimedia Foundation,80
ariel,Unknown,78
bsitzmann,Unknown,77
bgerstle,Unknown,74
cfloyd,Unknown,74
TTO,Unknown,73
marcoil,Unknown,72
rush,Unknown,71
zfilipin,Unknown,64
JanZerebecki,Unknown,64
Dan Duvall,Unknown,63
Andrew Green,Wikimedia Foundation,62
jeroendedauw,Wikimedia Deutschland,61
Ejegg,Unknown,61
dr0ptp4kt,Unknown,58
Glaisher,Unknown,57
Tim Starling,Wikimedia Foundation,52
prtksxna,Unknown,51
Faidon,Wikimedia Foundation,50
tonythomas01,Unknown,50
Sn1per,Unknown,43
John F. Lewis,Unknown,42
pastakhov,Unknown,41
Jackmcbarn,Unknown,40
ebrahim,Unknown,36
Vivek Ghaisas,Unknown,34
asthana.sumit23,Unknown,34
ladsgroup,Unknown,33
isarra,Unknown,33
Deskana,Unknown,32
David Chan,Unknown,32
kmenger,Unknown,32
addshore,Independent,31
milimetric,Unknown,31
Cenarium,Unknown,30
Phoenix303,Unknown,30
PleaseStand,Unknown,30
cmjohnson,Unknown,30
Andrew Garrett,Wikimedia Foundation,30
edokter,Unknown,28
ryasmeen,Unknown,28
Marielle Volz,Unknown,27
rillke,Unknown,27
Tyler Anthony Romeo,Independent,27
DavisNT,Unknown,27
Marc A. Pelletier,Unknown,26
priyankajayaswal025,Unknown,26
Mukunda Modell,Unknown,25
Tweichart,Unknown,24
hartman,Unknown,24
ayush.ce13,Unknown,24
matanya,Unknown,23
se4598,Unknown,23
tpt,Independent,23
Raimond Spekking,Independent,23
csteipp,Unknown,21
mgrabovsky,Unknown,20
Malvineous,Unknown,20
steinsplitter,Unknown,19
llbraughler,Unknown,19
JuneHyeon Bae,Unknown,19
Renoir Boulanger,Unknown,19
ecotg,Unknown,17
MZMcBride,Unknown,17
Mobrovac,Unknown,17
wirth,Unknown,16
Tobias Gritschacher,Unknown,16
Manybubbles,Wikimedia Foundation,16
gage,Unknown,15
wctaiwan,Unknown,14
Gerrit Code Review,Wikimedia Foundation,14
Tim Landscheidt,Unknown,14
jagori,Unknown,13
Lewis Cawte,Unknown,13
gerardduenas,Unknown,12
spage,Unknown,12
welterkj,Unknown,11
mpalmer,Unknown,11
Marcel Ruiz Forns,Unknown,11
dan-nl,Unknown,11
jgreen,Unknown,10
qgil,Unknown,10
Jack Phoenix,Unknown,10
jhobs,Unknown,10
tosfos,Unknown,10
he7d3r,Unknown,9
mah,Unknown,9
Greg Grossmeier,Unknown,8
mikael,Unknown,8
Unicodesnowman,Unknown,7
eikes,Unknown,7
gnosygnu,Unknown,7
pginer,Unknown,7
notconfusing,Unknown,7
Mgooley,Unknown,7
lydia.pintscher,Unknown,6
Foxtrott,Unknown,6
mark,Unknown,6
Alexia E. Smith,Unknown,6
RAN1,Unknown,6
kji,Unknown,6
VcamX,Unknown,6
tamaraslosarek,Unknown,6
UltrasonicNXT,Unknown,5
Vikassy,Unknown,5
Felipe Schenone,Unknown,5
raheem,Unknown,5
Calak,Unknown,5
cicalese,Unknown,5
aklapper,Unknown,5
martineznovo,Unknown,5
mwjames,Unknown,4
gvaibhavraj2,Unknown,4
pandiculation,Unknown,4
kunalgrover05,Unknown,4
Daniel Friesen,Unknown,4
public,Unknown,4
chiefwei1989,Unknown,3
george.orwell.iii,Unknown,3
Niharika Kohli,Unknown,3
o0lilu0o1980,Unknown,3
tcipriani,Unknown,3
lucie,Unknown,3
murnatty,Unknown,3
mglaser,Unknown,3
Dschwen,Unknown,2
soeren.oldag,Unknown,2
Linedwell,Unknown,2
Pigpen,Unknown,2
pratikbsp,Unknown,2
Hypergrove,Unknown,2
Southparkfan,Unknown,2
Jarrettmunton,Unknown,2
suchetag,Wikimedia Foundation,2
Katie Horn,Wikimedia Foundation,2
dennerlein,Unknown,2
sjoerddebruin,Unknown,2
jonas.keutel,Unknown,2
pcoombe,Unknown,2
goettlich,Unknown,2
Karsten Hoffmeyer,Unknown,2
541329866,Unknown,2
JoelKP,Unknown,2
Brian Wolff,Independent,2
jkatz,Unknown,2
Kenrick95,Unknown,1
wsklutz,Unknown,1
russblau,Unknown,1
ffs,Unknown,1
bmp2558,Unknown,1
Etonkovidova,Unknown,1
cas222222221,Unknown,1
skizzerz,Unknown,1
mcintire.evan,Unknown,1
rtnpro,Unknown,1
npangarkar,Unknown,1
matx-1997,Unknown,1
Whaterss,Unknown,1
truchiranga,Unknown,1
jarry1250,Unknown,1
Wieland Hoffmann,Unknown,1
Huji,Unknown,1
Jackson Isaac,Unknown,1
Keegan,Unknown,1
dragan.espenschied,Unknown,1
Oliver Keyes,Unknown,1
maverick,Unknown,1
jdouglas,Unknown,1
Jalexander,Wikimedia Foundation,1
dale,Unknown,1
Technical_13,Unknown,1
master.skywalker.88,Unknown,1
Alex S.H. Lin,Unknown,1
Tuxilina,Unknown,1
kahlil.wallace,Unknown,1
namit.ohri,Unknown,1
Harmageddon,Unknown,1
liangent,Unknown,1
Adrián Chaves Fernández (Gallaecio),Unknown,1
Sputniza,Unknown,1
psg.1992,Unknown,1
Sherah Smith,Wikimedia Foundation,1
Petrb,Unknown,1
In [ ]: