-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdf_func.py
More file actions
56 lines (48 loc) · 1.85 KB
/
Copy pathpdf_func.py
File metadata and controls
56 lines (48 loc) · 1.85 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image, PageBreak
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from datetime import datetime
def add_title_page(story, uploaded_file=None, project_name=None):
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
"TitleStyle",
parent=styles["Title"],
fontSize=28,
alignment=1, # center
spaceAfter=30
)
subtitle_style = ParagraphStyle(
"SubTitleStyle",
parent=styles["Normal"],
fontSize=14,
alignment=1,
spaceAfter=20
)
section_style = ParagraphStyle(
"SectionStyle",
parent=styles["Normal"],
fontSize=12,
leading=16,
alignment=1
)
# Decide dataset/project name
dataset_name = project_name if project_name else (uploaded_file.name if uploaded_file else "Dataset")
# Report date
report_date = datetime.now().strftime("%B %d, %Y")
# Build title page
story.append(Paragraph("Exploratory Data Analysis Report", title_style))
story.append(Spacer(1, 20))
story.append(Paragraph(f"<b>Dataset:</b> {dataset_name}", subtitle_style))
story.append(Paragraph(f"<b>Generated on:</b> {report_date}", subtitle_style))
story.append(Paragraph(f"<b>Prepared by:</b> DataForge", subtitle_style))
story.append(Spacer(1, 40))
story.append(Paragraph("Auto-generated EDA report with plot-wise explanations", styles["Heading2"]))
story.append(Spacer(1, 12))
story.append(Paragraph(
"This report provides an automated exploratory data analysis "
"including data quality checks, structured insights, and "
"visualizations with professional interpretations.",
section_style
))
story.append(PageBreak())