File size: 1,135 Bytes
7709e14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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