Skip to content

Commit 172ee52

Browse files
Update extract_submissions.py
1 parent cb0fb17 commit 172ee52

File tree

1 file changed

+32
-43
lines changed

1 file changed

+32
-43
lines changed

.github/scripts/extract_submissions.py

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Define reviewers
1616
reviewers = [f"Reviewer {i}" for i in range(1, 8)]
1717

18-
# Define rubric
18+
# Updated full rubric
1919
rubric = [
2020
("Technical Expertise", "Proficiency with the PyTorch Ecosystem", "Demonstrated knowledge and practical experience with PyTorch, including model building, traininga and deployment?"),
2121
("Technical Expertise", "Proficiency with the PyTorch Ecosystem", "Familiarity with foundation-hosted projects, vLLM, DeepSpeed?"),
@@ -38,22 +38,22 @@
3838
("Alignment and Values", "Alignment with PyTorch Foundation Values", "Commitment to open source principles, community-first development, and inclusive collaboration?"),
3939
("Alignment and Values", "Alignment with PyTorch Foundation Values", "Advocacy for responsible AI development and ethical machine learning practices?"),
4040
("Motivation and Vision", "Vision", "Clear articulation of why they want to be an Ambassador and what they hope to accomplish?"),
41-
("Motivation and Vision", "Vision", "Proposed goals or initiatives that align with the mission of the PyTorch Foundation?")
41+
("Motivation and Vision", "Vision", "Proposed goals or initiatives that align with the mission of the PyTorch Foundation?"),
42+
("Additional Bonus Criteria", "Cross-Community Collaboration", "Contributions or bridges to other relevant ecosystems (e.g., HuggingFace?)"),
43+
("Additional Bonus Criteria", "Cross-Community Collaboration", "Integration work across tools or libraries within the AI/ML infrastructure landscape?"),
44+
("Additional Bonus Criteria", "Geographic and Demographic Diversity", "Representation from underrepresented regions or groups to foster inclusivity and global outreach?"),
45+
("Additional Bonus Criteria", "Innovation and Pioneering Work", "Early adoption or novel application of PyTorch or its ecosystem tools in industry, research, or startups?"),
46+
("Credibility", "Community References", "References from other known community members?")
4247
]
4348

44-
summary_categories = [
45-
"Technical Expertise",
46-
"Open Source Contributions",
47-
"Thought Leadership and Technical Writing",
48-
"Community Engagement and Evangelism",
49-
"Online Influence and Reach",
50-
"Alignment and Values",
51-
"Motivation and Vision"
52-
]
49+
# All categories in correct order
50+
categories = list(dict.fromkeys([cat for cat, _, _ in rubric]))
5351

52+
# Output folder
5453
output_folder = "ambassador/reviewer_sheets_excel"
5554
os.makedirs(output_folder, exist_ok=True)
5655

56+
# Assign reviewers
5757
assignments = []
5858
reviewer_counts = defaultdict(int)
5959
for submission in submissions:
@@ -62,19 +62,16 @@
6262
reviewer_counts[reviewer] += 1
6363
assignments.append((submission, reviewer))
6464

65+
# Generate reviewer workbooks
6566
for reviewer in reviewers:
6667
wb = Workbook()
6768
ws = wb.active
6869
ws.title = "Review Sheet"
6970
summary_ws = wb.create_sheet("Score Summary")
7071

71-
headers = [
72-
"Submission ID", "First Name", "Last Name", "Submission Summary",
73-
"Reviewer's Comment", "Category", "Subcategory", "Question", "Score"
74-
]
75-
ws.append(headers)
76-
for col in range(1, len(headers) + 1):
77-
ws.cell(row=1, column=col).font = Font(bold=True)
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)
7875

7976
dv = DataValidation(type="list", formula1='"Yes,No,N/A"', allow_blank=True)
8077
ws.add_data_validation(dv)
@@ -105,40 +102,32 @@
105102

106103
for col in [1, 2, 3, 4]:
107104
ws.merge_cells(start_row=start, end_row=end, start_column=col, end_column=col)
108-
cell = ws.cell(row=start, column=col)
109-
cell.alignment = Alignment(vertical="top", wrap_text=True)
110-
105+
ws.cell(row=start, column=col).alignment = Alignment(vertical="top", wrap_text=True)
111106
for r in range(start, end + 1):
112107
dv.add(ws[f"I{r}"])
113108

109+
# Auto column width
114110
for col in ws.columns:
115111
max_len = max((len(str(cell.value)) if cell.value else 0) for cell in col)
116112
ws.column_dimensions[get_column_letter(col[0].column)].width = min(max_len + 5, 50)
117113

118-
summary_ws.append(["Submission ID", "First Name", "Last Name"] + summary_categories + ["Final Score"])
119-
for col in range(1, summary_ws.max_column + 1):
120-
summary_ws.cell(row=1, column=col).font = Font(bold=True)
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)
121117

122118
for sid, fname, lname, start, end in candidate_ranges:
123-
category_rows = defaultdict(list)
124-
for r in range(start, end + 1):
125-
category = ws.cell(row=r, column=6).value
126-
if category in summary_categories:
127-
category_rows[category].append(r)
128-
129-
formula_cells = []
130-
for cat in summary_categories:
131-
if cat in category_rows:
132-
rng = category_rows[cat]
133-
formula = f"=SUMPRODUCT(--('Review Sheet'!I{rng[0]}:I{rng[-1]}=\"Yes\"))"
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\"))")
134125
else:
135-
formula = "0"
136-
formula_cells.append(formula)
137-
138-
final_formula = f"=SUM({','.join([get_column_letter(i + 4) + str(summary_ws.max_row + 1) for i in range(len(formula_cells))])})"
139-
summary_ws.append([sid, fname, lname] + formula_cells + [final_formula])
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])
140129

141-
path = os.path.join(output_folder, f"{reviewer.replace(' ', '_').lower()}_sheet.xlsx")
142-
wb.save(path)
130+
# Save workbook
131+
wb.save(os.path.join(output_folder, f"{reviewer.replace(' ', '_').lower()}_sheet.xlsx"))
143132

144-
print("✅ Reviewer sheets generated with fixed formulas and matching structure.")
133+
print("✅ Reviewer sheets generated with aligned rubric and score summary.")

0 commit comments

Comments
 (0)