|
15 | 15 | # Define reviewers |
16 | 16 | reviewers = [f"Reviewer {i}" for i in range(1, 8)] |
17 | 17 |
|
18 | | -# Updated full rubric |
| 18 | +# Updated rubric including all categories from the latest file |
19 | 19 | rubric = [ |
20 | 20 | ("Technical Expertise", "Proficiency with the PyTorch Ecosystem", "Demonstrated knowledge and practical experience with PyTorch, including model building, traininga and deployment?"), |
21 | 21 | ("Technical Expertise", "Proficiency with the PyTorch Ecosystem", "Familiarity with foundation-hosted projects, vLLM, DeepSpeed?"), |
|
46 | 46 | ("Credibility", "Community References", "References from other known community members?") |
47 | 47 | ] |
48 | 48 |
|
49 | | -# All categories in correct order |
50 | | -categories = list(dict.fromkeys([cat for cat, _, _ in rubric])) |
| 49 | +# Dynamically detect unique rubric categories in order |
| 50 | +summary_categories = [] |
| 51 | +for cat, _, _ in rubric: |
| 52 | + if cat not in summary_categories: |
| 53 | + summary_categories.append(cat) |
51 | 54 |
|
52 | | -# Output folder |
| 55 | +# Output directory |
53 | 56 | output_folder = "ambassador/reviewer_sheets_excel" |
54 | 57 | os.makedirs(output_folder, exist_ok=True) |
55 | 58 |
|
56 | | -# Assign reviewers |
| 59 | +# Assign reviewers evenly |
57 | 60 | assignments = [] |
58 | 61 | reviewer_counts = defaultdict(int) |
59 | 62 | for submission in submissions: |
|
62 | 65 | reviewer_counts[reviewer] += 1 |
63 | 66 | assignments.append((submission, reviewer)) |
64 | 67 |
|
65 | | -# Generate reviewer workbooks |
| 68 | +# Generate Excel files per reviewer |
66 | 69 | for reviewer in reviewers: |
67 | 70 | wb = Workbook() |
68 | 71 | ws = wb.active |
69 | 72 | ws.title = "Review Sheet" |
70 | 73 | summary_ws = wb.create_sheet("Score Summary") |
71 | 74 |
|
72 | | - # Headers |
73 | | - ws.append(["Submission ID", "First Name", "Last Name", "Submission Summary", "Reviewer's Comment", "Category", "Subcategory", "Question", "Score"]) |
74 | | - for cell in ws[1]: cell.font = Font(bold=True) |
| 75 | + # Review Sheet headers |
| 76 | + headers = [ |
| 77 | + "Submission ID", "First Name", "Last Name", "Submission Summary", |
| 78 | + "Reviewer's Comment", "Category", "Subcategory", "Question", "Score" |
| 79 | + ] |
| 80 | + ws.append(headers) |
| 81 | + for col in range(1, len(headers)+1): |
| 82 | + ws.cell(row=1, column=col).font = Font(bold=True) |
75 | 83 |
|
| 84 | + # Add dropdown |
76 | 85 | dv = DataValidation(type="list", formula1='"Yes,No,N/A"', allow_blank=True) |
77 | 86 | ws.add_data_validation(dv) |
78 | 87 |
|
|
100 | 109 | end = row_idx - 1 |
101 | 110 | candidate_ranges.append((sid, fname, lname, start, end)) |
102 | 111 |
|
| 112 | + # Merge ID/name cells |
103 | 113 | for col in [1, 2, 3, 4]: |
104 | 114 | ws.merge_cells(start_row=start, end_row=end, start_column=col, end_column=col) |
105 | | - ws.cell(row=start, column=col).alignment = Alignment(vertical="top", wrap_text=True) |
| 115 | + cell = ws.cell(row=start, column=col) |
| 116 | + cell.alignment = Alignment(vertical="top", wrap_text=True) |
| 117 | + |
106 | 118 | for r in range(start, end + 1): |
107 | 119 | dv.add(ws[f"I{r}"]) |
108 | 120 |
|
109 | | - # Auto column width |
| 121 | + # Autofit columns |
110 | 122 | for col in ws.columns: |
111 | 123 | max_len = max((len(str(cell.value)) if cell.value else 0) for cell in col) |
112 | 124 | ws.column_dimensions[get_column_letter(col[0].column)].width = min(max_len + 5, 50) |
113 | 125 |
|
114 | | - # Score Summary Sheet |
115 | | - summary_ws.append(["Submission ID", "First Name", "Last Name"] + categories + ["Final Score"]) |
116 | | - for cell in summary_ws[1]: cell.font = Font(bold=True) |
| 126 | + # Score Summary header |
| 127 | + summary_ws.append(["Submission ID", "First Name", "Last Name"] + summary_categories + ["Final Score"]) |
| 128 | + for col in range(1, summary_ws.max_column + 1): |
| 129 | + summary_ws.cell(row=1, column=col).font = Font(bold=True) |
117 | 130 |
|
| 131 | + # Fill score summary |
118 | 132 | for sid, fname, lname, start, end in candidate_ranges: |
119 | | - cat_formulas = [] |
120 | | - for cat in categories: |
121 | | - rows = [r for r in range(start, end + 1) if ws.cell(row=r, column=6).value == cat] |
122 | | - if rows: |
123 | | - cat_range = f"Review Sheet!I{rows[0]}:I{rows[-1]}" |
124 | | - cat_formulas.append(f"=SUMPRODUCT(--({cat_range}=\"Yes\"))") |
| 133 | + category_rows = defaultdict(list) |
| 134 | + for r in range(start, end + 1): |
| 135 | + cat = ws.cell(row=r, column=6).value |
| 136 | + category_rows[cat].append(r) |
| 137 | + |
| 138 | + formulas = [] |
| 139 | + for cat in summary_categories: |
| 140 | + if cat in category_rows: |
| 141 | + rows = category_rows[cat] |
| 142 | + formulas.append(f'=SUMPRODUCT(--(\'Review Sheet\'!I{rows[0]}:I{rows[-1]}="Yes"))') |
125 | 143 | else: |
126 | | - cat_formulas.append("=0") |
127 | | - total_formula = f"=SUM({','.join([get_column_letter(i + 4) + str(summary_ws.max_row + 1) for i in range(len(categories))])})" |
128 | | - summary_ws.append([sid, fname, lname] + cat_formulas + [total_formula]) |
| 144 | + formulas.append("0") |
| 145 | + |
| 146 | + row_number = summary_ws.max_row + 1 |
| 147 | + total_formula = f"=SUM({','.join([f'{get_column_letter(i+4)}{row_number}' for i in range(len(formulas))])})" |
| 148 | + summary_ws.append([sid, fname, lname] + formulas + [total_formula]) |
129 | 149 |
|
130 | | - # Save workbook |
131 | | - wb.save(os.path.join(output_folder, f"{reviewer.replace(' ', '_').lower()}_sheet.xlsx")) |
| 150 | + # Save |
| 151 | + filename = os.path.join(output_folder, f"{reviewer.replace(' ', '_').lower()}_sheet.xlsx") |
| 152 | + wb.save(filename) |
132 | 153 |
|
133 | | -print("✅ Reviewer sheets generated with aligned rubric and score summary.") |
| 154 | +print("✅ Reviewer sheets generated with updated rubric and corrected score summary.") |
0 commit comments