Skip to content

Commit 84dcd9e

Browse files
committed
Fix trivial issues, add TODOs
1 parent f2723dd commit 84dcd9e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

paramgenerator/generateparamsbi.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from timeparameters import *
1414
from calendar import timegm
1515

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")
1818

1919
def format_date(date):
2020
return int(time.mktime(date.timetuple())*1000)
@@ -127,23 +127,23 @@ def serializes_q1(outdir, post_weeks):
127127
for week, count in post_weeks:
128128
writer.append([str(week)], [count])
129129

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"])
132132
random.seed(1988+2)
133133
for country_set, count_country in country_sets:
134134
for day_range, count_post in post_day_ranges:
135135
if random.randint(0,len(country_sets) + len(post_day_ranges)) == 0:
136136
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])
137137

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"])
140140
for ix in range(0,len(post_months)):
141141
week_range_a, count_a = post_months[ix]
142142
for week_range_b, count_b in post_months[ix+1:]:
143143
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])
144144

145145
def serializes_q4(outdir, tagclasses, countries):
146-
writer = ParamsWriter(outdir, "q4", ["tagClass","country"])
146+
writer = ParamsWriter(outdir, "q4", ["tagClass", "country"])
147147
for tag, count_a in tagclasses:
148148
for country, count_b in countries:
149149
writer.append([tag,country], [count_a,count_b])
@@ -176,7 +176,7 @@ def serializes_q9(outdir, tagclasses):
176176
for tag_class_b, count_b in tagclasses[ix+1:]:
177177
writer.append([tag_class_a, tag_class_b, str(200)], [count_a, count_b])
178178

179-
def serializes_q10(outdir, tags):
179+
def serializes_q10(outdir, tags): # TODO date
180180
writer = ParamsWriter(outdir, "q10", ["tag"])
181181
for tag, count in tags:
182182
writer.append([tag], [count])
@@ -201,7 +201,7 @@ def serializes_q11(outdir, countries, bad_words):
201201
writer.append([country,";".join(blacklist)], [count])
202202

203203
def serializes_q12(outdir, post_weeks):
204-
writer = ParamsWriter(outdir, "q12", ["creationDate", "likeCount"])
204+
writer = ParamsWriter(outdir, "q12", ["creationDate", "likeThreshold"])
205205
for week, count in post_weeks:
206206
writer.append([str(week),str(400)], [count])
207207

@@ -211,7 +211,7 @@ def serializes_q13(outdir, countries):
211211
writer.append([country], [count])
212212

213213
def serializes_q14(outdir, creationdates):
214-
writer = ParamsWriter(outdir, "q14", ["begin","end"])
214+
writer = ParamsWriter(outdir, "q14", ["begin", "end"])
215215
for creation, count in creationdates:
216216
writer.append([str(creation[0]),str(creation[1])], [count])
217217

@@ -221,7 +221,7 @@ def serializes_q15(outdir, countries):
221221
writer.append([country], [count])
222222

223223
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
225225
random.seed(1988+2)
226226
for tag, count_a in tagclasses:
227227
for country, count_b in countries:
@@ -233,30 +233,30 @@ def serializes_q17(outdir, countries):
233233
writer.append([country], [count])
234234

235235
def serializes_q18(outdir, post_weeks):
236-
writer = ParamsWriter(outdir, "q18", ["creationDate"])
236+
writer = ParamsWriter(outdir, "q18", ["date"]) # TODO lengthThreshold and languages are missing
237237
for week, count in post_weeks:
238238
writer.append([str(week)], [count])
239239

240240
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"])
243243
for ix in range(0,len(tagclasses)):
244244
tag_class_a, count_a = tagclasses[ix]
245245
for tag_class_b, count_b in tagclasses[ix+1:]:
246246
writer.append([str(format_date(PERS_DATE)),tag_class_a, tag_class_b], [count_a, count_b])
247247

248248
def serializes_q20(outdir, tagclasses):
249-
writer = ParamsWriter(outdir, "q20", ["tagclass"])
249+
writer = ParamsWriter(outdir, "q20", ["tagclass"]) # TODO tagclasses
250250
for tagclass, count in tagclasses:
251251
writer.append([tagclass], [count])
252252

253253
def serializes_q21(outdir, countries):
254-
writer = ParamsWriter(outdir, "q21", ["country","endDate"])
254+
writer = ParamsWriter(outdir, "q21", ["country", "endDate"])
255255
for country, count in countries:
256256
writer.append([country,str(format_date(END_DATE))], [count])
257257

258258
def serializes_q22(outdir, countries):
259-
writer = ParamsWriter(outdir, "q22", ["country1","country2"])
259+
writer = ParamsWriter(outdir, "q22", ["country1", "country2"])
260260
for ix in range(0,len(countries)):
261261
country_a, count_a = countries[ix]
262262
for country_b, count_b in countries[ix+1:]:

0 commit comments

Comments
 (0)