interview_agent / utils /evaluator.py
Jekyll2000's picture
Create utils/evaluator.py
6c961d1 verified
raw
history blame
585 Bytes
def evaluate_answers(answers):
"""Calculate final score from all answers"""
if not answers:
return {"score": 0, "band": "N/A"}
total = sum(a["evaluation"]["score"] for a in answers)
avg_score = total / len(answers)
bands = [
(9, "Excellent"),
(7, "Good"),
(5, "Average"),
(3, "Below Average"),
(0, "Poor")
]
band = next((b[1] for b in bands if avg_score >= b[0]), "N/A")
return {
"score": round(avg_score, 1),
"band": band,
"total_questions": len(answers)
}