@@ -37,6 +37,9 @@ def get_review_scores(pretalx_slug, previous_slugs):
37
37
38
38
reviews_url = f'https://pretalx.com/api/events/{ pretalx_slug } /reviews'
39
39
reviews = load_pretalx_resource (reviews_url , http_headers )
40
+ speaker_names = get_speaker_names (pretalx_slug , http_headers )
41
+ submission_types = get_submission_types (pretalx_slug , http_headers )
42
+ tags = get_tags (pretalx_slug , http_headers )
40
43
41
44
for review in reviews :
42
45
try :
@@ -48,26 +51,27 @@ def get_review_scores(pretalx_slug, previous_slugs):
48
51
49
52
with open (output_file , 'w' ) as f :
50
53
csvwriter = csv .writer (f )
51
- csvwriter .writerow (["Mean" , "Median" , "Pvar" , "Title" , "Speaker" , "Tags" , "Previous submissions" , "URL" ])
54
+ csvwriter .writerow (["Mean" , "Median" , "Pvar" , "Type" , " Title" , "Speaker" , "Tags" , "Previous submissions" , "URL" ])
52
55
for code , submission in submissions .items ():
53
56
previous_for_speaker = {}
54
- for speaker in submission ['speakers' ]:
55
- previous_for_speaker .update (previous_submissions .get (speaker [ 'code' ] , {}))
57
+ for speaker_slug in submission ['speakers' ]:
58
+ previous_for_speaker .update (previous_submissions .get (speaker_slug , {}))
56
59
previous_for_speaker_str = '; ' .join ([
57
60
f'{ state .title ()} : { ", " .join (sorted (events ))} '
58
61
for state , events in
59
62
sorted (previous_for_speaker .items ())
60
63
])
61
- speakers = ', ' .join ([speaker ['name' ] for speaker in submission ['speakers' ]])
62
64
url = f"https://pretalx.com/orga/event/{ pretalx_slug } /submissions/{ code } /reviews/"
63
65
scores = submission .get ('scores' , [])
66
+ speakers = ', ' .join (speaker_names [speaker ] for speaker in submission ['speakers' ])
64
67
csvwriter .writerow ([
65
68
"%.1f" % statistics .mean (scores ) if scores else '-' ,
66
69
"%.1f" % statistics .median (scores ) if scores else '-' ,
67
70
"%.1f" % statistics .pvariance (scores ) if scores else '-' ,
71
+ submission_types [submission ['submission_type' ]][0 ],
68
72
submission ['title' ],
69
73
speakers ,
70
- ', ' .join (submission ['tags' ]),
74
+ ', ' .join ([ tags [ t ] for t in submission ['tags' ] ]),
71
75
previous_for_speaker_str ,
72
76
url ,
73
77
])
@@ -94,17 +98,41 @@ def get_previous_submissions(pretalx_slugs, http_headers):
94
98
for speaker in submission ['speakers' ]:
95
99
event_name = event ['name' ]['en' ].replace ('Write the Docs' , '' ).strip ()
96
100
state = submission ['state' ]
97
- speakers_submissions .setdefault (speaker [ 'code' ] , {}).setdefault (state , set ()).add (event_name )
101
+ speakers_submissions .setdefault (speaker , {}).setdefault (state , set ()).add (event_name )
98
102
99
103
return speakers_submissions
100
104
101
105
102
- # Might be reusable in other pretalx interfaces
106
+ def get_speaker_names (pretalx_slug , http_headers ):
107
+ url = f'https://pretalx.com/api/events/{ pretalx_slug } /speakers/'
108
+ print (f'Loading speaker names from { url } ...' )
109
+ speaker_info = load_pretalx_resource (url , http_headers )
110
+ return {
111
+ s ['code' ]: s ['name' ] for s in speaker_info
112
+ }
113
+
114
+ def get_submission_types (pretalx_slug , http_headers ):
115
+ url = f'https://pretalx.com/api/events/{ pretalx_slug } /submission-types/'
116
+ print (f'Loading submission types names from { url } ...' )
117
+ submission_types = load_pretalx_resource (url , http_headers )
118
+ return {
119
+ s ['id' ]: s ['name' ]['en' ] for s in submission_types
120
+ }
121
+
122
+ def get_tags (pretalx_slug , http_headers ):
123
+ url = f'https://pretalx.com/api/events/{ pretalx_slug } /tags/'
124
+ print (f'Loading tag names from { url } ...' )
125
+ tags = load_pretalx_resource (url , http_headers )
126
+ return {
127
+ s ['id' ]: s ['tag' ] for s in tags
128
+ }
129
+
103
130
def load_pretalx_resource (url , http_headers ):
104
131
results = []
105
132
while url :
106
133
response = requests .get (url , headers = http_headers )
107
- if response .status_code != 200 :
134
+ # 403 may occur as a pretalx bug
135
+ if response .status_code not in [200 , 403 ]:
108
136
print (f'Error: request failed: { response .status_code } : { response .text } ' )
109
137
return
110
138
@@ -119,7 +147,7 @@ def load_pretalx_resource(url, http_headers):
119
147
120
148
if __name__ == '__main__' :
121
149
get_review_scores (
122
- pretalx_slug = 'wtd-portland -2025' ,
150
+ pretalx_slug = 'wtd-berlin -2025' ,
123
151
previous_slugs = [
124
152
'wtd-portland-2020' ,
125
153
'wtd-prague-2020' ,
@@ -135,5 +163,6 @@ def load_pretalx_resource(url, http_headers):
135
163
'wtd-portland-2024' ,
136
164
'wtd-atlantic-2024' ,
137
165
'wtd-australia-2024' ,
166
+ 'wtd-portland-2025' ,
138
167
],
139
168
)
0 commit comments