diff --git a/create-evaluation-files.py b/create-evaluation-files.py index 528539146d70097f7eeb71654d46adf0e0175fd2..62b9df0060d4395c74d1c8f1fb113e703d35bb58 100644 --- a/create-evaluation-files.py +++ b/create-evaluation-files.py @@ -3,8 +3,8 @@ # in current directory. Creates evaluation.html and reviews/ # # cd Selection -# usage: python ../create-evaluation-files.py \ -# ../RegistrantsList.csv ../evaluation-results.csv +# usage: python ../create-evaluation-files-multi.py \ +# ../registrations.csv ../submissions-638.csv # # Some --- columns needs to be renamed in evaluation-results.csv # First column --- to -o- @@ -20,6 +20,10 @@ from datetime import datetime from collections import Counter import glob + +# enter SoHPC year +SoHPC_year = "2020" + # # Basic skeleton of html file (header, footer and content in the middle (parameter 3) # Also include place holders for file title (0) and date (1) @@ -131,7 +135,7 @@ Content: [<a href="#projects">Project list</a>] [<a href="#registrant <td>Country</td> <td>Gender</td> <td>Age</td> - <td>E-mail</td> + <td>E-mail</td> <td colspan="2">Evaluation<br>details</td> </tr> {{PROJECT_LIST_AND_SELECTED_PARTICIPANTS}} @@ -175,7 +179,7 @@ Content: [<a href="#projects">Project list</a>] [<a href="#registrant # layout of project in TOC project_selected_participant_row = """ <tr> - <td><a href="#project_{{PROJECT_ID}}">{{PROJECT_ID}} - {{PROJECT_NAME}}</td> + <td rowspan="{{PROJECT_ROW_SPAN}}"><a href="#project_{{PROJECT_ID}}">{{PROJECT_ID}} - {{PROJECT_NAME}}</td> <td>{{PARTICIPANTS_LIST}}</td> </tr> """ @@ -400,17 +404,17 @@ def read_csv_file(filename): # 0 if not defined. Values are written as %d Points. # def get_points_from_evaluation(value): - point = 0; + point = 0 if value: # check #print(value) - tmp_point = value.split(" ")[0].strip(); + tmp_point = value.split(" ")[0].strip() if tmp_point: point = int(tmp_point) - return point; + return point #=========================================================== @@ -431,14 +435,14 @@ for row in tmp_user_data['rows']: dic=dict(zip(tmp_user_data['header'], row)) #[print(key) for key in dic.keys()] if dic['ID'] == '': - dic['ID'] = 0; + dic['ID'] = 0 - id = int(dic['ID']); + id = int(dic['ID']) link = glob.glob('../Application_Form/*_%d' % id) if len(link) == 0: print('Missing Application form for id %d' % id) link = link[0] - dic.update({'link_application': "%s/index.html" % link}); + dic.update({'link_application': "%s/index.html" % link}) user_data.update({id:dic}) @@ -452,7 +456,7 @@ if not os.path.exists("reviews"): print("Creating HTML files: ") # read registrant content template -f = open("../evaluation-detail-format.html", "r"); +f = open("../evaluation-detail-format.html", "r") evaluation_content = f.read() f.close() @@ -460,9 +464,9 @@ n = datetime.now() generation_date = "{0}. {1}. {2} @ {3}:{4}".format(n.day, n.month, n.year, n.hour, n.minute) # data about projects and registrants sorted with project first, then all rgistrant data and scores... -project_data = {}; -student_data = {}; -country_data = {}; +project_data = {} +student_data = {} +country_data = {} for id in user_data: # prepare array for student evaluation data @@ -475,17 +479,17 @@ for id in user_data: 'reviewer': ['', ''], 'overall_comment': ['', ''], 'preference': [[['',''], ['',''], ['','']], [['',''], ['',''], ['','']]]} - }); + }) # store countries into separate array ctryName = user_data[id]['Country'] if not ctryName in country_data: # add country to array - country_data.update({ctryName : {'all': 0, 'selected': 0, 'percent': 0.0 }}); + country_data.update({ctryName : {'all': 0, 'selected': 0, 'percent': 0.0 }}) # add another student - country_data[ctryName]['all'] += 1; + country_data[ctryName]['all'] += 1 #print(student_data) #print(eval_data) @@ -495,26 +499,26 @@ for row in eval_data['rows']: dic=dict(zip(eval_data['header'], row)) # print(dic) - userID=int(dic["Applicant number"]); - reviewerName=dic["Signature"].replace(" ","_"); + userID=int(dic["Applicant number"]) + reviewerName=dic["Signature"].replace(" ","_") filename = "reviews/{0:03}_{1}.html".format(userID,reviewerName) #print("{0}: {1}".format(userID, user_data[userID]['Name'])) # print(" - evaluation defined") # store points form evaluation - sum = 0; - numReviewer = student_data[userID]['num_reviewers_done']; + sum = 0 + numReviewer = student_data[userID]['num_reviewers_done'] if numReviewer < 2: - student_data[userID]['evaluation_detail_file'][numReviewer] = filename; - student_data[userID]['reviewer'][numReviewer] = dic["Signature"]; - student_data[userID]['overall_comment'][numReviewer] = dic["Overall recommendation and comment"]; + student_data[userID]['evaluation_detail_file'][numReviewer] = filename + student_data[userID]['reviewer'][numReviewer] = dic["Signature"] + student_data[userID]['overall_comment'][numReviewer] = dic["Overall recommendation and comment"] else: print("{0}: {1}".format(userID, user_data[userID]['Name'])) print(" -->> ERROR: too many reviewers!! -- {0}; only first 2 reviewers used.".format(numReviewer+1)) - continue; + continue # 2019 remapping remap = { @@ -525,27 +529,27 @@ for row in eval_data['rows']: for part in ['motivation', 'ambasador', 'technical']: # parse all fields, store the points and compute the average - point = get_points_from_evaluation(dic[remap[part]]); + point = get_points_from_evaluation(dic[remap[part]]) #print(" - {0}: {1} -> {2} (reviever num: {3})".format(part, dic[remap[part]], point, numReviewer)) #print(dic[remap[part] + " comment"]) if numReviewer < 2: - student_data[userID][part]['p'][numReviewer] = point; - student_data[userID][part]['comment'][numReviewer] = dic[remap[part] + " comment"]; + student_data[userID][part]['p'][numReviewer] = point + student_data[userID][part]['comment'][numReviewer] = dic[remap[part] + " comment"] if numReviewer == 0: # average is current values - student_data[userID][part]['avg'] = student_data[userID][part]['p'][0]; - sum += student_data[userID][part]['avg']; + student_data[userID][part]['avg'] = student_data[userID][part]['p'][0] + sum += student_data[userID][part]['avg'] else: # compute average from both marks - student_data[userID][part]['avg'] = 0.5*(student_data[userID][part]['p'][0]+student_data[userID][part]['p'][1]); - sum += student_data[userID][part]['avg']; + student_data[userID][part]['avg'] = 0.5*(student_data[userID][part]['p'][0]+student_data[userID][part]['p'][1]) + sum += student_data[userID][part]['avg'] # compute the average - student_data[userID]['average'] = sum/3.; - student_data[userID]['num_reviewers_done'] += 1; + student_data[userID]['average'] = sum/3. + student_data[userID]['num_reviewers_done'] += 1 # print(" - avg: {0:.2f}".format(student_data[userID]['average']);) # @@ -553,7 +557,7 @@ for row in eval_data['rows']: # content = evaluation_content # current preference - currentPreference = ''; + currentPreference = '' for i in range(0,len(eval_data['header'])): # loop over header to preserve key order @@ -561,7 +565,7 @@ for row in eval_data['rows']: value = row[i].strip() #print(key, "|" + value + "|") # replace value for all keys in row - html_fld = key.replace(" ", "_").upper(); + html_fld = key.replace(" ", "_").upper() #print("key: {0}".format(html_fld)) @@ -648,147 +652,174 @@ for row in eval_data['rows']: content = content.replace("{{PREFERENCE_" + currentPreference +"_DESIRABLE}}", student_data[userID]['preference'][numReviewer][currPrefIndex][1]) # add content into skeleton and write to file - save_content(filename, skeleton, "Summer of HPC 2019 - Registrant data", generation_date, content) + save_content(filename, skeleton, "Summer of HPC {0} - Registrant data".format(SoHPC_year), generation_date, content) # for fldName in ['First Choice', 'Second Choice', 'Third Choice']: #for fldName in ['1', '2', '3']: for fldName in ['Choice 1', 'Choice 2', 'Choice 3']: - # get all three projects and first add all user's first choise, then second and then third choice + # get all three projects and first add all user's first choice, then second and then third choice for id in user_data: # loop over all users and extract projects and prepare arrays if user_data[id][fldName].strip(): # project is defined - proj = user_data[id][fldName].split(" ", 1); + proj = user_data[id][fldName].split(" ", 1) # print(proj) - projID = int(proj[0].strip()); - projName = proj[1].strip(); + projID = int(proj[0].strip()) + projName = proj[1].strip() if not projID in project_data: # project does not exist; add an empty array for later addinf the data - initData = {'name': projName, 'students': [], 'selected_student': []}; + initData = {'name': projName, 'students': [], 'selected_student': {}} project_data.update({projID: initData}) - project_data[projID]['students'].append({'id': id, 'choice': fldName.split(" ")[1]}); + project_data[projID]['students'].append({'id': id, 'choice': fldName.split(" ")[0]}) for id in user_data: # loop over usr data and save selected students/registrants for each projct if user_data[id]['selected'].strip(): - projID = int(user_data[id]['selected'].strip()); - project_data[projID]['selected_student'].append(id); + # get project ID and order from selected number: 2001.1 (project ID.order of selection) + _tmp = [el.strip() for el in user_data[id]['selected'].split(".")] + projID = int(_tmp[0]) + projOrder = 0 + + if len(_tmp) == 2: + # get order from second part of 'selected' column + if len(_tmp[1]) > 0: + projOrder = int(_tmp[1]) + + project_data[projID]['selected_student'][projOrder] = id # get student country and change country stat data - ctryName = user_data[id]['Country']; - country_data[ctryName]['selected'] += 1; + ctryName = user_data[id]['Country'] + country_data[ctryName]['selected'] += 1 - # now display project and student data into evaluation.html file -content_projects = ""; -content_registrants = registrant_list; +content_projects = "" +content_registrants = registrant_list # sort projects by projectID -project_ids = sorted(project_data); +project_ids = sorted(project_data) # # layout project data + registrants for each project -proj_rows = ""; -proj_select = ""; +# +proj_rows = "" +proj_select = "" for projID in project_ids: - # loop over all projets - proj_row = project_html_data; - proj_row = proj_row.replace("{{PROJECT_NAME}}", project_data[projID]['name']); - proj_row = proj_row.replace("{{PROJECT_ID}}", "{0}".format(projID)); - - tmp_row = project_selected_participant_row.replace("{{PROJECT_ID}}", "{0}".format(projID)); - tmp_row = tmp_row.replace("{{PROJECT_NAME}}", project_data[projID]['name']); + # loop over all projects + proj_row = project_html_data + proj_row = proj_row.replace("{{PROJECT_NAME}}", project_data[projID]['name']) + proj_row = proj_row.replace("{{PROJECT_ID}}", "{0}".format(projID)) + + tmp_row = project_selected_participant_row.replace("{{PROJECT_ID}}", "{0}".format(projID)) + tmp_row = tmp_row.replace("{{PROJECT_NAME}}", project_data[projID]['name']) + tmp_row = tmp_row.replace("{{PROJECT_ROW_SPAN}}", str(max(1, len(project_data[projID]['selected_student'])))) if project_data[projID]['selected_student']: - tmp_row = tmp_row.replace("{{PARTICIPANTS_LIST}}", - "<br>".join("<a href='{0}'>{1}</a> ({7})</td><td>{2}</td><td>{3}</td><td>{4}</td><td align='center'><a href='{5}'>[1]</a></td><td align='center'><a href='{6}'>[2]</a></td><td>{8}</td>" - .format(user_data[x]['link_application'], user_data[x]['Name'], - user_data[x]['Country'], user_data[x]['Gender'], - user_data[x]['Age (years)'], - student_data[x]['evaluation_detail_file'][0], - student_data[x]['evaluation_detail_file'][1], - user_data[x]['ID'], - user_data[x]['Email']) - for x in project_data[projID]['selected_student'])); + # add selected students in order defined in dict + _cur_proj_students = "" + _cur_proj_sep = "" + + for ordNum in sorted(project_data[projID]['selected_student'].keys()): + # print students according to the order + x = project_data[projID]['selected_student'][ordNum] + _cur_proj_students += _cur_proj_sep+\ + "<a href='{0}'>{1}</a> ({7})</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{8}</td><td align='center'><a href='{5}'>[1]</a></td><td align='center'><a href='{6}'>[2]</a></td>"\ + .format(user_data[x]['link_application'], user_data[x]['Name'], + user_data[x]['Country'], user_data[x]['Gender'], + user_data[x]['Age (years)'], + student_data[x]['evaluation_detail_file'][0], + student_data[x]['evaluation_detail_file'][1], + user_data[x]['ID'], + user_data[x]['Email']) + _cur_proj_sep = "</tr><tr><td>" + tmp_row = tmp_row.replace("{{PARTICIPANTS_LIST}}", _cur_proj_students) else: - tmp_row = tmp_row.replace("{{PARTICIPANTS_LIST}}", ""); + tmp_row = tmp_row.replace("{{PARTICIPANTS_LIST}}", "") proj_select += tmp_row # proj_select += project_toc_row.format(projID, projID, project_data[projID]['name']); - user_rows = ""; - no = 1; - - for student_row in sorted(project_data[projID]['students'], key=lambda student_row: (student_row['choice'], -student_data[student_row['id']]['average'], student_row['id'])): - # create list of students in current project - id = student_row['id']; - row = project_user_row; - row = row.replace("{{I}}", "{0}".format(no)); - row = row.replace("{{NAME}}", user_data[id]['Name']); - row = row.replace("{{ID}}", user_data[id]['ID']); - row = row.replace("{{COUNTRY}}", user_data[id]['Country']); - row = row.replace("{{GENDER}}", user_data[id]['Gender']); - row = row.replace("{{AGE}}", user_data[id]['Age (years)']); - row = row.replace("{{CHOICE}}", student_row['choice']); - row = row.replace("{{OVERALL}}", student_row['choice']); - row = row.replace("{{HTML_FILENAME}}", user_data[id]['link_application']); - row = row.replace("{{EVALUATION_HTML_LINK_1}}", student_data[id]['evaluation_detail_file'][0]); - row = row.replace("{{EVALUATION_HTML_LINK_2}}", student_data[id]['evaluation_detail_file'][1]); - row = row.replace("{{REVIEWER_1}}", student_data[id]['reviewer'][0]); - row = row.replace("{{REVIEWER_2}}", student_data[id]['reviewer'][1]); - row = row.replace("{{OVERALL_COMMENT_1}}", student_data[id]['overall_comment'][0]); - row = row.replace("{{OVERALL_COMMENT_2}}", student_data[id]['overall_comment'][1]); + user_rows = "" + no = 1 + + # sort students by average value, not ID + tmp_avg_list = [] + + for student_row in project_data[projID]['students']: + # create list of student IDs with their average value + tmp_avg_list.append([max(0, student_data[student_row['id']]['average']), student_row['id'], student_row]) + + for curr_row in sorted(tmp_avg_list, reverse=True): + # display students according to their average value + _, id, student_row = curr_row + row = project_user_row + row = row.replace("{{I}}", "{0}".format(no)) + row = row.replace("{{NAME}}", user_data[id]['Name']) + row = row.replace("{{ID}}", user_data[id]['ID']) + row = row.replace("{{COUNTRY}}", user_data[id]['Country']) + row = row.replace("{{GENDER}}", user_data[id]['Gender']) + row = row.replace("{{AGE}}", user_data[id]['Age (years)']) + row = row.replace("{{CHOICE}}", student_row['choice']) + row = row.replace("{{OVERALL}}", student_row['choice']) + row = row.replace("{{HTML_FILENAME}}", user_data[id]['link_application']) + row = row.replace("{{EVALUATION_HTML_LINK_1}}", student_data[id]['evaluation_detail_file'][0]) + row = row.replace("{{EVALUATION_HTML_LINK_2}}", student_data[id]['evaluation_detail_file'][1]) + row = row.replace("{{REVIEWER_1}}", student_data[id]['reviewer'][0]) + row = row.replace("{{REVIEWER_2}}", student_data[id]['reviewer'][1]) + row = row.replace("{{OVERALL_COMMENT_1}}", student_data[id]['overall_comment'][0]) + row = row.replace("{{OVERALL_COMMENT_2}}", student_data[id]['overall_comment'][1]) if user_data[id]['selected']: # current student is selected for project; display it in special way - row = row.replace("{{REGISTRANT_SELECTED}}", "registrant_selected"); + row = row.replace("{{REGISTRANT_SELECTED}}", "registrant_selected") else: # ordinary row - row = row.replace("{{REGISTRANT_SELECTED}}", ""); + row = row.replace("{{REGISTRANT_SELECTED}}", "") for part in ['motivation','ambasador','technical']: # add all parts - html_fld = part.upper(); + html_fld = part.upper() #print(student_data[id].keys()) #print(part in student_data[id]) - row = row.replace("{{"+ html_fld +"_P1}}", "{0}".format(student_data[id][part]['p'][0])); - row = row.replace("{{"+ html_fld +"_P2}}", "{0}".format(student_data[id][part]['p'][1])); - row = row.replace("{{"+ html_fld +"_COMMENT_P1}}", "{0}".format(student_data[id][part]['comment'][0])); - row = row.replace("{{"+ html_fld +"_COMMENT_P2}}", "{0}".format(student_data[id][part]['comment'][1])); + row = row.replace("{{"+ html_fld +"_P1}}", "{0}".format(student_data[id][part]['p'][0])) + row = row.replace("{{"+ html_fld +"_P2}}", "{0}".format(student_data[id][part]['p'][1])) + row = row.replace("{{"+ html_fld +"_COMMENT_P1}}", "{0}".format(student_data[id][part]['comment'][0])) + row = row.replace("{{"+ html_fld +"_COMMENT_P2}}", "{0}".format(student_data[id][part]['comment'][1])) if student_data[id][part]['avg'] > 0: - row = row.replace("{{"+ html_fld +"_AVG}}", "{0:.2f}".format(student_data[id][part]['avg'])); + row = row.replace("{{"+ html_fld +"_AVG}}", "{0:.2f}".format(student_data[id][part]['avg'])) else: - row = row.replace("{{"+ html_fld +"_AVG}}", ""); + row = row.replace("{{"+ html_fld +"_AVG}}", "") if student_data[id]['average'] > 0: - row = row.replace("{{AVERAGE_P}}", "{0:.2f}".format(student_data[id]['average'])); + row = row.replace("{{AVERAGE_P}}", "{0:.2f}".format(student_data[id]['average'])) else: - row = row.replace("{{AVERAGE_P}}", ""); + row = row.replace("{{AVERAGE_P}}", "") for prefNo in range(1,4): # display all preferences row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_SHORT_COMPULSORY}}", - "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][0], student_data[id]['preference'][1][prefNo-1][0])); + "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][0], student_data[id]['preference'][1][prefNo-1][0])) row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_SHORT_DESIRABLE}}", - "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][1], student_data[id]['preference'][1][prefNo-1][1])); + "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][1], student_data[id]['preference'][1][prefNo-1][1])) row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_COMPULSORY}}", "{0}: {1}\n{2}: {3}".format(student_data[id]['reviewer'][0], student_data[id]['preference'][0][prefNo-1][0], - student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][0])); + student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][0])) row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_DESIRABLE}}", "{0}: {1}\n{2}: {3}".format(student_data[id]['reviewer'][0], student_data[id]['preference'][0][prefNo-1][1], - student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][1])); + student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][1])) - user_rows += row; - no += 1; + user_rows += row + no += 1 - proj_row = proj_row.replace("{{REGISTRANT_DATA}}", user_rows); - proj_rows += proj_row; - + proj_row = proj_row.replace("{{REGISTRANT_DATA}}", user_rows) + proj_rows += proj_row + +#print(project_data) #print(proj_select) +#print(proj_rows) index_data = index_data.replace("{{PROJECT_LIST_AND_SELECTED_PARTICIPANTS}}", proj_select) content_projects = proj_rows @@ -806,98 +837,98 @@ for ctryName in country_list_sorted: country_rows += "<tr><td>{0}</td><td class='id'>{1}</td><td class='id'>{2}</td><td class='id'>{3:.1f}</td></tr>".format( ctryName, country_data[ctryName]['all'], country_data[ctryName]['selected'], perc) -index_data = index_data.replace("{{COUNTRY_PARTICIPANTS_LIST}}", country_rows); +index_data = index_data.replace("{{COUNTRY_PARTICIPANTS_LIST}}", country_rows) # layout of registrant data + scores of evaluation + average scores -user_avg = {}; +user_avg = {} for id in user_data: # loop over usr data and create {key: avg} for sorting - user_avg.update({id: student_data[id]['average']}); + user_avg.update({id: student_data[id]['average']}) # now sort it user_sorted = Counter(user_avg) rows = "" -no = 1; +no = 1 for cell in user_sorted.most_common(): # loop over usr data and create registrant data - id = cell[0]; - row = person_row; - row = row.replace("{{I}}", "{0}".format(no)); - row = row.replace("{{REGISTRANT_NAME}}", user_data[id]['Name']); - row = row.replace("{{COUNTRY}}", user_data[id]['Country']); - row = row.replace("{{GENDER}}", user_data[id]['Gender']); - row = row.replace("{{AGE}}", user_data[id]['Age (years)']); - row = row.replace("{{REGISTRANT_ID}}", user_data[id]['ID']); - row = row.replace("{{HTML_FILENAME}}", user_data[id]['link_application']); - row = row.replace("{{REVIEWER_1}}", student_data[id]['reviewer'][0]); - row = row.replace("{{REVIEWER_2}}", student_data[id]['reviewer'][1]); - row = row.replace("{{OVERALL_COMMENT_1}}", student_data[id]['overall_comment'][0]); - row = row.replace("{{OVERALL_COMMENT_2}}", student_data[id]['overall_comment'][1]); - project_list_tmp = ""; - sep = ""; + id = cell[0] + row = person_row + row = row.replace("{{I}}", "{0}".format(no)) + row = row.replace("{{REGISTRANT_NAME}}", user_data[id]['Name']) + row = row.replace("{{COUNTRY}}", user_data[id]['Country']) + row = row.replace("{{GENDER}}", user_data[id]['Gender']) + row = row.replace("{{AGE}}", user_data[id]['Age (years)']) + row = row.replace("{{REGISTRANT_ID}}", user_data[id]['ID']) + row = row.replace("{{HTML_FILENAME}}", user_data[id]['link_application']) + row = row.replace("{{REVIEWER_1}}", student_data[id]['reviewer'][0]) + row = row.replace("{{REVIEWER_2}}", student_data[id]['reviewer'][1]) + row = row.replace("{{OVERALL_COMMENT_1}}", student_data[id]['overall_comment'][0]) + row = row.replace("{{OVERALL_COMMENT_2}}", student_data[id]['overall_comment'][1]) + project_list_tmp = "" + sep = "" if user_data[id]['selected']: # current student is selected for project; display it in special way - row = row.replace("{{REGISTRANT_SELECTED}}", "registrant_selected"); + row = row.replace("{{REGISTRANT_SELECTED}}", "registrant_selected") else: # ordinary row - row = row.replace("{{REGISTRANT_SELECTED}}", ""); + row = row.replace("{{REGISTRANT_SELECTED}}", "") # for fldName in ['1', '2', '3']: for fldName in ['Choice 1', 'Choice 2', 'Choice 3']: # get all three projects and first add all user's first choise, then second and then third choice if user_data[id][fldName].strip(): # project is defined - proj = user_data[id][fldName].split(" ", 1); - projID = int(proj[0].strip()); + proj = user_data[id][fldName].split(" ", 1) + projID = int(proj[0].strip()) project_list_tmp += "{0} <a href='#project_{1}'>{2}</a>".format(sep,projID,projID) sep = ", " - row = row.replace("{{PROJECT_ID_LIST}}", project_list_tmp); + row = row.replace("{{PROJECT_ID_LIST}}", project_list_tmp) for part in ['motivation','ambasador','technical']: # add all parts - html_fld = part.upper(); - row = row.replace("{{"+ html_fld +"_P1}}", "{0}".format(student_data[id][part]['p'][0])); - row = row.replace("{{"+ html_fld +"_P2}}", "{0}".format(student_data[id][part]['p'][1])); - row = row.replace("{{"+ html_fld +"_COMMENT_P1}}", "{0}".format(student_data[id][part]['comment'][0])); - row = row.replace("{{"+ html_fld +"_COMMENT_P2}}", "{0}".format(student_data[id][part]['comment'][1])); + html_fld = part.upper() + row = row.replace("{{"+ html_fld +"_P1}}", "{0}".format(student_data[id][part]['p'][0])) + row = row.replace("{{"+ html_fld +"_P2}}", "{0}".format(student_data[id][part]['p'][1])) + row = row.replace("{{"+ html_fld +"_COMMENT_P1}}", "{0}".format(student_data[id][part]['comment'][0])) + row = row.replace("{{"+ html_fld +"_COMMENT_P2}}", "{0}".format(student_data[id][part]['comment'][1])) if student_data[id][part]['avg'] > 0: - row = row.replace("{{"+ html_fld +"_AVG}}", "{0:.2f}".format(student_data[id][part]['avg'])); + row = row.replace("{{"+ html_fld +"_AVG}}", "{0:.2f}".format(student_data[id][part]['avg'])) else: - row = row.replace("{{"+ html_fld +"_AVG}}", ""); + row = row.replace("{{"+ html_fld +"_AVG}}", "") if student_data[id]['average'] > 0: - row = row.replace("{{AVERAGE_P}}", "{0:.2f}".format(student_data[id]['average'])); + row = row.replace("{{AVERAGE_P}}", "{0:.2f}".format(student_data[id]['average'])) else: - row = row.replace("{{AVERAGE_P}}", ""); + row = row.replace("{{AVERAGE_P}}", "") for prefNo in range(1,4): # display all preferences row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_SHORT_COMPULSORY}}", - "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][0], student_data[id]['preference'][1][prefNo-1][0])); + "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][0], student_data[id]['preference'][1][prefNo-1][0])) row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_SHORT_DESIRABLE}}", - "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][1], student_data[id]['preference'][1][prefNo-1][1])); + "{0}<br>{1}".format(student_data[id]['preference'][0][prefNo-1][1], student_data[id]['preference'][1][prefNo-1][1])) row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_COMPULSORY}}", "{0}: {1}\n{2}: {3}".format(student_data[id]['reviewer'][0], student_data[id]['preference'][0][prefNo-1][0], - student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][0])); + student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][0])) row = row.replace("{{PREFERENCE_" + "{0}".format(prefNo) +"_DESIRABLE}}", "{0}: {1}\n{2}: {3}".format(student_data[id]['reviewer'][0], student_data[id]['preference'][0][prefNo-1][1], - student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][1])); + student_data[id]['reviewer'][1], student_data[id]['preference'][1][prefNo-1][1])) - rows += row; - no += 1; + rows += row + no += 1 -content_registrants = registrant_list.format(rows); +content_registrants = registrant_list.format(rows) # add persons list into "index" file content content = index_data content = content.replace("{{CONTENT_PROJECTS}}", content_projects) content = content.replace("{{CONTENT_REGISTRANTS}}", content_registrants) -save_content("evaluation.html", skeleton, "Summer of HPC 2018 - Project evaluation results", generation_date, content) +save_content("evaluation.html", skeleton, "Summer of HPC {0} - Project evaluation results".format(SoHPC_year), generation_date, content) print("All done!") diff --git a/evaluation-detail-format.html b/evaluation-detail-format.html new file mode 100644 index 0000000000000000000000000000000000000000..51344010674f9973d3c4a35904f3952711ec7241 --- /dev/null +++ b/evaluation-detail-format.html @@ -0,0 +1,158 @@ +<table width="100%"> +<tr> + <td> + <div class="groupTitleNoBorder title" style="color: #B14300; margin: 0; padding: 0"> + {{REGISTRANT_NAME}} + </div> + </td> + <td align="right"> + Go back to: <a href="../index.html">Project list + scores</a> + </td> +</tr> +</table> +<table class="list" width="100%" align="left" border="0"> +<tr> + <td class="dataCaptionTD"><span class="dataCaptionFormat">Registrant ID</span></td> + <td bgcolor="white">{{APPLICANT_NUMBER}}</td> +</tr> +<tr> + <td class="dataCaptionTD"><span class="dataCaptionFormat">Submittion date</span></td> + <td class="blacktext">{{SUBMISSION_DATE}}</td> +</tr> +<tr> + <td colspan="2" class="horizontalLine"> </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat"></span> + </td> + <td class="blacktext" valign="top"> + <table width="75%"> + <tr> + <td align="left" class="dataSubCaptionTD" valign="top"><b>Mark</b></td> + <td align="left" valign="top">Description</td> + </tr> + </table> + </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat">1. Motivation</span> + </td> + <td class="blacktext" valign="top"> + <table width="75%"> + <tr> + <td align="left" class="dataSubCaptionTD" valign="top">{{MOTIVATION}}</td> + <td align="left" valign="top">{{MOTIVATION-COMMENT}}</td> + </tr> + </table> + </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat">2. Ambasador</span> + </td> + <td class="blacktext" valign="top"> + <table width="75%"> + <tr> + <td align="left" class="dataSubCaptionTD" valign="top">{{AMBASADOR}}</td> + <td align="left" valign="top">{{AMBASADOR-COMMENT}}</td> + </tr> + </table> + </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat">3. Technical</span> + </td> + <td class="blacktext" valign="top"> + <table width="75%"> + <tr> + <td align="left" class="dataSubCaptionTD" valign="top">{{TECHNICAL}}</td> + <td align="left" valign="top">{{TECHNICAL-COMMENT}}</td> + </tr> + </table> + </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat">Preference 1</span> + </td> + <td class="blacktext" valign="top"> + <table width="75%" class="no_bg_coloring"> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_1_COMPULSORY}}</td> + <td align="left" valign="top">Student meet compulsory preferences</td> + </tr> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_1_DESIRABLE}}</td> + <td align="left" valign="top">Student meet desirable prerequisites</td> + </tr> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_1_DOESNOTFIT}}</td> + <td align="left" valign="top">Student does not fit requirements</td> + </tr> + </table> + </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat">Preference 2</span> + </td> + <td class="blacktext" valign="top"> + <table width="75%" class="no_bg_coloring"> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_2_COMPULSORY}}</td> + <td align="left" valign="top">Student meet compulsory preferences</td> + </tr> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_2_DESIRABLE}}</td> + <td align="left" valign="top">Student meet desirable prerequisites</td> + </tr> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_2_DOESNOTFIT}}</td> + <td align="left" valign="top">Student does not fit requirements</td> + </tr> + </table> + </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat">Preference 3</span> + </td> + <td class="blacktext" valign="top"> + <table width="75%" class="no_bg_coloring"> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_3_COMPULSORY}}</td> + <td align="left" valign="top">Student meet compulsory preferences</td> + </tr> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_3_DESIRABLE}}</td> + <td align="left" valign="top">Student meet desirable prerequisites</td> + </tr> + <tr> + <td align="center" valign="top" width="30px">{{PREFERENCE_3_DOESNOTFIT}}</td> + <td align="left" valign="top">Student does not fit requirements</td> + </tr> + </table> + </td> +</tr> +<tr> + <td colspan="2" class="horizontalLine"> </td> +</tr> +<tr> + <td class="dataCaptionTD" valign="top"> + <span class="dataCaptionFormat">Overall</span> + </td> + <td class="blacktext" valign="top"> + {{OVERALL}} + </td> +</tr> +<tr> + <td colspan="2" class="horizontalLine"> </td> +</tr> +<tr> + <td class="dataCaptionTD">Signature</td> + <td class="blacktext">{{SIGNATURE}}</td> +</tr> +</table> diff --git a/prepare-selection.sh b/prepare-selection.sh index 7afec23f4f6969fe0d19435754e3ab0633f5bfcf..1f666444b801b41bb0e79767782fa34748c161a4 100755 --- a/prepare-selection.sh +++ b/prepare-selection.sh @@ -9,7 +9,7 @@ slots=1 perl sohpc-assign.pl slots-$slots.csv weights-pref.csv students.csv project-preferences.csv > select-by-pref.txt perl sohpc-assign.pl slots-$slots.csv weights-score.csv students.csv project-preferences.csv > select-by-score.txt mkdir Selection/scripts -cp sohpc-assign.pl html2csv.pl submissions-638.csv registrations.csv create-evaluation-files.py Selection/scripts +cp sohpc-assign.pl html2csv.pl submissions-638.csv registrations.csv create-evaluation-files.py evaluation-detail-format.html Selection/scripts cp prepare-selection.sh weights-*.csv students.csv project-preferences.csv select-by-*.txt Selection/scripts echo zip -r Selection Selection # submissions-638.csv: David Henty's #24 renamed to #34, Duplicate #15 on line 151 removed