# utils.py import matplotlib.pyplot as plt import uuid import os def plot_engagement_graph(score): days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] values = [randomize(score) for _ in days] plt.figure(figsize=(5, 3)) plt.plot(days, values, marker='o') plt.title("Engagement Score Trend") plt.ylim(50, 100) plt.xlabel("Day") plt.ylabel("Score") path = f"engagement_{uuid.uuid4().hex}.png" plt.savefig(path) plt.close() return path def randomize(base): import random return round(base + random.uniform(-5, 5), 2) def generate_pdf_summary(role, project_id): from fpdf import FPDF file_path = f"summary_{uuid.uuid4().hex}.pdf" pdf = FPDF() pdf.add_page() pdf.set_font("Arial", size=12) pdf.cell(200, 10, txt="Weekly Summary Report", ln=True, align="C") pdf.ln(10) pdf.cell(200, 10, txt=f"Supervisor Role: {role}", ln=True) pdf.cell(200, 10, txt=f"Project ID: {project_id}", ln=True) pdf.ln(10) pdf.multi_cell(0, 10, txt="Engagement and coaching logs for the week will appear here.") pdf.output(file_path) return file_path