13
13
from timeparameters import *
14
14
from calendar import timegm
15
15
16
- START_DATE = datetime .strptime ("2010-01-01" ,"%Y-%m-%d" )
17
- END_DATE = datetime .strptime ("2013-01-01" ,"%Y-%m-%d" )
16
+ START_DATE = datetime .strptime ("2010-01-01" , "%Y-%m-%d" )
17
+ END_DATE = datetime .strptime ("2013-01-01" , "%Y-%m-%d" )
18
18
19
19
def format_date (date ):
20
20
return int (time .mktime (date .timetuple ())* 1000 )
@@ -127,23 +127,23 @@ def serializes_q1(outdir, post_weeks):
127
127
for week , count in post_weeks :
128
128
writer .append ([str (week )], [count ])
129
129
130
- def serializes_q2 (outdir , country_sets , post_day_ranges ):
131
- writer = ParamsWriter (outdir , "q2" , ["date1" ,"date2" ,"countries" ,"endDate" ,"messageThreshold" ])
130
+ def serializes_q2 (outdir , country_sets , post_day_ranges ): # TODO country1, country2
131
+ writer = ParamsWriter (outdir , "q2" , ["date1" , "date2" , "countries" , "endDate" , "messageThreshold" ])
132
132
random .seed (1988 + 2 )
133
133
for country_set , count_country in country_sets :
134
134
for day_range , count_post in post_day_ranges :
135
135
if random .randint (0 ,len (country_sets ) + len (post_day_ranges )) == 0 :
136
136
writer .append ([str (day_range [0 ]), str (day_range [1 ]), ";" .join (country_set ), str (format_date (END_DATE )),str (20 )], [count_post ,count_post ,count_country ,333 ])
137
137
138
- def serializes_q3 (outdir , post_months ):
139
- writer = ParamsWriter (outdir , "q3" , ["range1Start" ,"range1End" ,"range2Start" ,"range2End" ])
138
+ def serializes_q3 (outdir , post_months ): # TODO year, month
139
+ writer = ParamsWriter (outdir , "q3" , ["range1Start" , "range1End" , "range2Start" , "range2End" ])
140
140
for ix in range (0 ,len (post_months )):
141
141
week_range_a , count_a = post_months [ix ]
142
142
for week_range_b , count_b in post_months [ix + 1 :]:
143
143
writer .append ([str (week_range_a [0 ]),str (week_range_a [1 ]),str (week_range_b [0 ]),str (week_range_b [1 ])], [count_a ,count_b ])
144
144
145
145
def serializes_q4 (outdir , tagclasses , countries ):
146
- writer = ParamsWriter (outdir , "q4" , ["tagClass" ,"country" ])
146
+ writer = ParamsWriter (outdir , "q4" , ["tagClass" , "country" ])
147
147
for tag , count_a in tagclasses :
148
148
for country , count_b in countries :
149
149
writer .append ([tag ,country ], [count_a ,count_b ])
@@ -176,7 +176,7 @@ def serializes_q9(outdir, tagclasses):
176
176
for tag_class_b , count_b in tagclasses [ix + 1 :]:
177
177
writer .append ([tag_class_a , tag_class_b , str (200 )], [count_a , count_b ])
178
178
179
- def serializes_q10 (outdir , tags ):
179
+ def serializes_q10 (outdir , tags ): # TODO date
180
180
writer = ParamsWriter (outdir , "q10" , ["tag" ])
181
181
for tag , count in tags :
182
182
writer .append ([tag ], [count ])
@@ -201,7 +201,7 @@ def serializes_q11(outdir, countries, bad_words):
201
201
writer .append ([country ,";" .join (blacklist )], [count ])
202
202
203
203
def serializes_q12 (outdir , post_weeks ):
204
- writer = ParamsWriter (outdir , "q12" , ["creationDate" , "likeCount " ])
204
+ writer = ParamsWriter (outdir , "q12" , ["creationDate" , "likeThreshold " ])
205
205
for week , count in post_weeks :
206
206
writer .append ([str (week ),str (400 )], [count ])
207
207
@@ -211,7 +211,7 @@ def serializes_q13(outdir, countries):
211
211
writer .append ([country ], [count ])
212
212
213
213
def serializes_q14 (outdir , creationdates ):
214
- writer = ParamsWriter (outdir , "q14" , ["begin" ,"end" ])
214
+ writer = ParamsWriter (outdir , "q14" , ["begin" , "end" ])
215
215
for creation , count in creationdates :
216
216
writer .append ([str (creation [0 ]),str (creation [1 ])], [count ])
217
217
@@ -221,7 +221,7 @@ def serializes_q15(outdir, countries):
221
221
writer .append ([country ], [count ])
222
222
223
223
def serializes_q16 (outdir , persons , tagclasses , countries ):
224
- writer = ParamsWriter (outdir , "q16" , ["person" ,"tag" ,"country" ])
224
+ writer = ParamsWriter (outdir , "q16" , ["person" , "tag" , "country" ]) # TODO minPathDistance and maxPathDistance are missing
225
225
random .seed (1988 + 2 )
226
226
for tag , count_a in tagclasses :
227
227
for country , count_b in countries :
@@ -233,30 +233,30 @@ def serializes_q17(outdir, countries):
233
233
writer .append ([country ], [count ])
234
234
235
235
def serializes_q18 (outdir , post_weeks ):
236
- writer = ParamsWriter (outdir , "q18" , ["creationDate " ])
236
+ writer = ParamsWriter (outdir , "q18" , ["date " ]) # TODO lengthThreshold and languages are missing
237
237
for week , count in post_weeks :
238
238
writer .append ([str (week )], [count ])
239
239
240
240
def serializes_q19 (outdir , tagclasses ):
241
- PERS_DATE = datetime .strptime ("1989-1-1" ,"%Y-%m-%d" )
242
- writer = ParamsWriter (outdir , "q19" , ["date" ,"tagClass1" ,"tagClass2" ])
241
+ PERS_DATE = datetime .strptime ("1989-1-1" , "%Y-%m-%d" )
242
+ writer = ParamsWriter (outdir , "q19" , ["date" , "tagClass1" , "tagClass2" ])
243
243
for ix in range (0 ,len (tagclasses )):
244
244
tag_class_a , count_a = tagclasses [ix ]
245
245
for tag_class_b , count_b in tagclasses [ix + 1 :]:
246
246
writer .append ([str (format_date (PERS_DATE )),tag_class_a , tag_class_b ], [count_a , count_b ])
247
247
248
248
def serializes_q20 (outdir , tagclasses ):
249
- writer = ParamsWriter (outdir , "q20" , ["tagclass" ])
249
+ writer = ParamsWriter (outdir , "q20" , ["tagclass" ]) # TODO tagclasses
250
250
for tagclass , count in tagclasses :
251
251
writer .append ([tagclass ], [count ])
252
252
253
253
def serializes_q21 (outdir , countries ):
254
- writer = ParamsWriter (outdir , "q21" , ["country" ,"endDate" ])
254
+ writer = ParamsWriter (outdir , "q21" , ["country" , "endDate" ])
255
255
for country , count in countries :
256
256
writer .append ([country ,str (format_date (END_DATE ))], [count ])
257
257
258
258
def serializes_q22 (outdir , countries ):
259
- writer = ParamsWriter (outdir , "q22" , ["country1" ,"country2" ])
259
+ writer = ParamsWriter (outdir , "q22" , ["country1" , "country2" ])
260
260
for ix in range (0 ,len (countries )):
261
261
country_a , count_a = countries [ix ]
262
262
for country_b , count_b in countries [ix + 1 :]:
0 commit comments