feat: cohort scripts
CI / dependency-pin-check-typescript (pull_request) Failing after 4s
CI / typescript (pull_request) Has been skipped
CI / dependency-pin-check-python (pull_request) Failing after 4s
CI / python (pull_request) Has been skipped
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m23s

This commit is contained in:
2026-01-23 18:26:39 -08:00
parent c0ad74367a
commit 6184801fed
7 changed files with 736 additions and 0 deletions
+216
View File
@@ -0,0 +1,216 @@
import json
BLOCK_EMOJIS = {
'mornings': '🌅',
'afternoons': '☀️',
'evenings': '🌆',
'nights': '🌙'
}
def load_all_data():
"""Load all evaluation data files"""
with open('discord_verification.json', 'r') as f:
verification = json.load(f)
with open('proficiency_evaluations.json', 'r') as f:
proficiency = json.load(f)
with open('availability_analysis.json', 'r') as f:
availability = json.load(f)
with open('leadership_candidates.json', 'r') as f:
candidates = json.load(f)
with open('leadership_evaluations.json', 'r') as f:
leadership = json.load(f)
return verification, proficiency, availability, candidates, leadership
def build_lookup_dicts(verification, proficiency, availability, leadership):
"""Build lookup dictionaries by discord_id"""
verified_usernames = {v[0]: v[1] for v in verification['verified']}
prof_by_id = {p['discord_id']: p for p in proficiency}
avail_by_id = {a['discord_id']: a for a in availability}
lead_by_id = {l['discord_id']: l for l in leadership}
return verified_usernames, prof_by_id, avail_by_id, lead_by_id
def format_availability_blocks(blocks):
"""Format availability blocks with emojis"""
if not blocks:
return "No consistent availability"
formatted = []
for block in ['mornings', 'afternoons', 'evenings', 'nights']:
if block in blocks:
formatted.append(f"{BLOCK_EMOJIS[block]} {block.capitalize()}")
return ", ".join(formatted)
def format_tech_stack(tech_stack):
"""Format tech stack list"""
if not tech_stack:
return "Not specified"
return ", ".join(sorted(tech_stack))
def generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, avail_by_id):
"""Generate participants.md for non-leaders"""
lines = [
"# Cohort Participants",
"",
f"**Total Participants**: {len(non_leader_ids)}",
"",
"---",
""
]
beginner_count = 0
intermediate_count = 0
advanced_count = 0
for discord_id in sorted(non_leader_ids):
if discord_id not in verified_usernames:
continue
username = verified_usernames.get(discord_id, "Unknown")
prof = prof_by_id.get(discord_id, {})
avail = avail_by_id.get(discord_id, {})
proficiency = prof.get('final_proficiency', 'unknown')
tech_stack = prof.get('tech_stack', [])
blocks = avail.get('available_blocks', [])
notes = prof.get('notes', [])
if proficiency == 'beginner':
beginner_count += 1
elif proficiency == 'intermediate':
intermediate_count += 1
elif proficiency == 'advanced':
advanced_count += 1
lines.append(f"## {discord_id}")
lines.append(f"**Username**: @{username}")
lines.append(f"**Technical Proficiency**: {proficiency.capitalize()}")
lines.append(f"**Tech Stack**: {format_tech_stack(tech_stack)}")
lines.append(f"**Availability**: {format_availability_blocks(blocks)}")
if notes:
lines.append(f"**Notes**: {', '.join(notes)}")
lines.append("")
summary = [
"# Cohort Participants",
"",
f"**Total Participants**: {len([id for id in non_leader_ids if id in verified_usernames])}",
"",
"### Proficiency Breakdown",
f"- Beginner: {beginner_count}",
f"- Intermediate: {intermediate_count}",
f"- Advanced: {advanced_count}",
"",
"---",
""
]
return "\n".join(summary + lines[6:])
def leadership_fit_label(score):
"""Convert leadership score to label"""
if score >= 6:
return "Excellent"
elif score >= 4:
return "Good"
elif score >= 2:
return "Adequate"
else:
return "Needs Review"
def generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id, lead_by_id):
"""Generate leaders.md for leadership candidates"""
verified_leaders = [id for id in leader_ids if id in verified_usernames]
lines = [
"# Cohort Leaders",
"",
f"**Total Leaders**: {len(verified_leaders)}",
"",
"---",
""
]
sorted_leaders = sorted(verified_leaders, key=lambda x: lead_by_id.get(x, {}).get('leadership_score', 0), reverse=True)
for discord_id in sorted_leaders:
username = verified_usernames.get(discord_id, "Unknown")
prof = prof_by_id.get(discord_id, {})
avail = avail_by_id.get(discord_id, {})
lead = lead_by_id.get(discord_id, {})
proficiency = prof.get('final_proficiency', 'unknown')
tech_stack = prof.get('tech_stack', [])
blocks = avail.get('available_blocks', [])
leadership_score = lead.get('leadership_score', 0)
leadership_fit = lead.get('leadership_fit', 'unknown')
leadership_notes = lead.get('notes', [])
prof_notes = prof.get('notes', [])
lines.append(f"## {discord_id}")
lines.append(f"**Username**: @{username}")
lines.append(f"**Leadership Fit**: {leadership_fit.capitalize()} (Score: {leadership_score})")
lines.append(f"**Technical Proficiency**: {proficiency.capitalize()}")
lines.append(f"**Tech Stack**: {format_tech_stack(tech_stack)}")
lines.append(f"**Availability**: {format_availability_blocks(blocks)}")
if leadership_notes:
lines.append(f"**Leadership Notes**: {', '.join(leadership_notes)}")
if prof_notes:
lines.append(f"**Technical Notes**: {', '.join(prof_notes)}")
lines.append("")
excellent = sum(1 for id in verified_leaders if lead_by_id.get(id, {}).get('leadership_fit') == 'excellent')
good = sum(1 for id in verified_leaders if lead_by_id.get(id, {}).get('leadership_fit') == 'good')
adequate = sum(1 for id in verified_leaders if lead_by_id.get(id, {}).get('leadership_fit') == 'adequate')
summary = [
"# Cohort Leaders",
"",
f"**Total Leaders**: {len(verified_leaders)}",
"",
"### Leadership Fit Breakdown",
f"- Excellent: {excellent}",
f"- Good: {good}",
f"- Adequate: {adequate}",
"",
"---",
""
]
return "\n".join(summary + lines[6:])
def main():
verification, proficiency, availability, candidates, leadership = load_all_data()
verified_usernames, prof_by_id, avail_by_id, lead_by_id = build_lookup_dicts(
verification, proficiency, availability, leadership
)
leader_ids = set(candidates['leaders'])
non_leader_ids = set(candidates['non_leaders'])
verified_ids = set(verified_usernames.keys())
leader_ids = leader_ids & verified_ids
non_leader_ids = non_leader_ids & verified_ids
participants_md = generate_participants_md(non_leader_ids, verified_usernames, prof_by_id, avail_by_id)
with open('participants.md', 'w') as f:
f.write(participants_md)
print(f"Generated participants.md with {len(non_leader_ids)} participants")
leaders_md = generate_leaders_md(leader_ids, verified_usernames, prof_by_id, avail_by_id, lead_by_id)
with open('leaders.md', 'w') as f:
f.write(leaders_md)
print(f"Generated leaders.md with {len(leader_ids)} leaders")
if __name__ == "__main__":
main()