Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timestamp and description to pdf output #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion result_into_pdf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from fpdf import FPDF
from result import Result
import arrow


#this is to test
Expand All @@ -21,7 +22,20 @@ def gen_pdf(data, result: Result, temp_link: str):
pdf.cell(200, 0, txt = "Here is the result of the Leptospirosis Machine Learning Algorithm: ",ln = 1, align = 'L')

pdf.set_font("Times", 'BI', size = 30)
pdf.cell(200, 100, txt = "Result: " + Result.fmt(result), ln = 1, align='C')
pdf.ln(50)
pdf.cell(200, 10, txt = "Result: " + Result.fmt(result), ln = 1, align='C')
pdf.set_font("Times", 'B', size = 10)
if result == Result.POSITIVE:
pdf.cell(200, 10, txt = "The prediction tool determined that the dog has leptospirosis", ln = 1, align='C')
elif result == Result.NEGATIVE:
pdf.cell(200, 10, txt = "The prediction tool determined that the dog does not have leptospirosis", ln = 1, align='C')
elif result == Result.INVALID:
pdf.cell(200, 10, txt = "Your input was missing important data or the algorithm could not predict your specific dog", align='C')
else:
pdf.cell(200, 10, txt = "Something went wrong with running the algorithm", ln = 1, align='C')

pdf.ln(50)
pdf.cell(200, 10, txt = "This pdf was generated at " + str(arrow.utcnow().to("US/Pacific").format('YYYY-MM-DD HH:mm:ss ZZZ')), ln = 1, align='C')
pdf.set_font("Times", size = 15)
# add another cell

Expand Down