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

Git repo fix #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Binary file modified .DS_Store
Binary file not shown.
Binary file added Vm_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dogs.db
Binary file not shown.
70 changes: 34 additions & 36 deletions result_into_pdf.py
Original file line number Diff line number Diff line change
@@ -1,62 +1,60 @@
from fpdf import FPDF
from result import Result


#this is to test
def gen_pdf(data, result: Result, temp_link: str):
#this will convert json into txt, thus we use txt file to convert it into pdf format
pdf = FPDF('P', 'mm', (100, 150))


# variable pdf
pdf = FPDF(format='letter')

# Add a page
pdf.add_page()
pdf.set_font("Times", 'B', size = 15)
pdf.set_font("Helvetica", 'B', size = 17)
#this will make print the color in red
pdf.set_text_color(0, 40, 85)
pdf.ln(.15)
pdf.set_author("Dr.Reagan")
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.set_font("Times", size = 15)
# add another cell

# the user emails
#pdf.cell(200, 0, txt = "This is the user email + " , ln = 2, align = 'C')

# emails
pdf.cell(200, 10, border = 1, txt = "If you have any question or would like to make an inquiry please visit our website: ", ln = 2, align = 'C')
pdf.cell(200, 10, border = 1, txt= "https://drkrystlereagan.com/", ln= 1, align = 'C')
pdf.set_y(-40)
pdf.cell(200, 10, border = 1, txt = "(Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights reserved)", ln =1, align = 'C')
pdf.cell(200, 0, txt = "Here is the result of the Leptospirosis Machine Learning Algorithm: ",ln = 0, align = 'L')
#result moved to new location
pdf.cell(200, 20, txt = "Result: " + Result.fmt(result), ln = 0, align='C')
print(Result.fmt(result))
pdf.set_font("Helvetica", 'BI', size = 18)
pdf.set_font("Helvetica", size = 12)
pdf.set_text_color(179, 163, 105)

pdf.cell(200, 45, ln=1)
i = 1;
#how to make coulmns go side by side
for data_point in data:
pdf.cell(100, 10, border = 1, txt= str(data_point), align = 'C')
pdf.cell(100, 10, border = 1, txt= str(data[data_point][0]), ln= 1, align = 'C')
i += 1
if (i == 42):
break
elif (i >= 20):
pdf.cell(100,-50)
pdf.cell(50, -8.6, border = 0, txt= str(data_point), align = 'C')
pdf.cell(50, -8.6, border = 0, txt= str(data[data_point][0]), ln= 1, align = 'C')
i += 1
else:
pdf.cell(50, 10, border = 0, txt= str(data_point), align = 'C')
pdf.cell(50, 10, border = 0, txt= str(data[data_point][0]), ln= 1, align = 'C')
i += 1
#does not work to send this side

print(i)

pdf.set_font("Helvetica", 'BI', size = 20)
pdf.set_text_color(0, 40, 85)
pdf.cell(200, -20, ln=1)
pdf.cell(200, -1, txt = "Result: " + Result.fmt(result), ln = 0, align='C')
#pdf.cell(200, 200, border = 0, txt = "If you have any question or would like to make an inquiry please visit our website: ", ln = 1, align = 'C')

#cant print the bottom parts for some reason
pdf.cell(200, 100, border = 0, txt= "https://drkrystlereagan.com/", ln= 1, align = 'C')
#pdf.set_font("Helvetica", 'B', size = 8)
#pdf.cell(200, 146, border = 0, txt = "(Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights reserved)", ln = 1, align = 'C')
# save the pdf with name .pdf
print("Process completed")
pdf.footer()

# additional link
#pdf image fix/position needs to be fixed
#TODO: add image to repo pdf.image('vm2.png', 110, 250, 100)
#pdf.image('vm.png', 100, 150, 100)
pdf.output("./generated_pdfs/" + temp_link + ".pdf")
#return pdf.output(dest = "S").encode('latin-1')

#will change the formatting of the fpdf

# Here is the result of the Lepto-Classifier [logo of vm office]

# display the result

# credential by uc davis


7 changes: 6 additions & 1 deletion static/contact.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
z-index: 1;
color: #002855;
}
h2 {
font-size: .4rem;
z-index: 1;
color: #002855;
};
.box {
height: 3rem;
display: block;
Expand Down Expand Up @@ -59,7 +64,7 @@
margin-bottom: 5px;
}
#contact .contact-info h2 {
font-size: .8rem;
font-size: .6rem;
line-height: 1.5rem;
font-weight: 500;
}
Expand Down
Binary file added static/git.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion static/help.css
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@
.right {
font-size: .9rem;
margin-left: 0px;
margin-top: 50px;
}
hr {
margin-left: 0px;
Expand Down
2 changes: 1 addition & 1 deletion static/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
text-decoration: none;
color: white;
text-transform: uppercase;
padding: 11px;
padding: 20px;
display: block;
font-weight: 900;
}
Expand Down
2 changes: 1 addition & 1 deletion static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
text-decoration: none;
color: white;
text-transform: uppercase;
padding: 11px;
padding: 20px;
display: block;
font-weight: 900;
}
Expand Down
3 changes: 3 additions & 0 deletions static/result.css
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@
margin-left: 0px;
margin-top: 50px;
margin-bottom: 30px;
display: flex;
justify-content: center;
align-items: center;
}
hr {
margin-left: 0px;
Expand Down
15 changes: 12 additions & 3 deletions templates/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ul>
<li class="ucd"><a href="home">UC DAVIS</a></li>
<li><a href="index">Input</a></li>
<li><a onclick="alertFunction()" href="index">Lepto-classifier</a></li>
<li><a onclick="alertFunction()" href="index">Auto-Input</a></li>
<script>
function alertFunction() {
alert("Sorry the page is currently under construction, Stay tuned for the update!");
Expand Down Expand Up @@ -59,6 +59,15 @@ <h1>Address</h1>
<h2>One Shields Avenue Davis, CA 95616, 2018 Tupper Hall</h2>
</div>
</div>
<div class="contact-item">
<div class="icon">
<img src="git.png"/>
</div>
<div class="contact-info">
<h1>Git repository</h1>
<h2>https://github.com/sf-deng/lepto-classifier</h2>
</div>
</div>
</div>
</div>
</section>
Expand All @@ -71,7 +80,7 @@ <h2>One Shields Avenue Davis, CA 95616, 2018 Tupper Hall</h2>
<div class="title">UC DAVIS</div>
<hr>
<div class="vet_txt">VETERINARY MEDICINE</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved</p>
</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved
<br> Git repository: https://github.com/sf-deng/lepto-classifier</p></div>
</div>
</body>
6 changes: 3 additions & 3 deletions templates/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ul>
<li class="ucd"><a href="home">UC DAVIS</a></li>
<li><a href="index">Input</a></li>
<li><a onclick="alertFunction()" href="home">Lepto-classifier</a></li>
<li><a onclick="alertFunction()" href="home">Auto-Input</a></li>
<script>
function alertFunction() {
alert("Sorry the page is currently under construction, Stay tuned for the update!");
Expand Down Expand Up @@ -54,8 +54,8 @@
<div class="title">UC DAVIS</div>
<hr>
<div class="vet_txt">VETERINARY MEDICINE</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved</p>
</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved
<br> Git repository: https://github.com/sf-deng/lepto-classifier</p> </div>
</div>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- this will be connected to the home page -->
<li class="ucd"><a href="home">UC DAVIS</a></li>
<li><a href="index">Input</a></li>
<li><a onclick="alertFunction()" href="index">Lepto-classifier</a></li>
<li><a onclick="alertFunction()" href="index">Auto-Input</a></li>
<script>
function alertFunction() {
alert("Sorry the page is currently under construction, Stay tuned for the update!");
Expand Down Expand Up @@ -690,9 +690,6 @@
<br><br>
</div>
<div class="col3">
<label for="Urine Specific Gravity">Urine Specific Gravity</label>
<input type="text" inputmode="numeric" pattern="\d*" name="Urine Specific Gravity" placeholder="number to 3 sig digits" step=".001" onchange="setThreeDecimal" min="0" max="100">
<br><br>
<label for="ALP">ALP</label>
<input type="number" name="ALP" placeholder="IU/L" step=".01" min="0" max="100">
<br><br>
Expand All @@ -705,6 +702,9 @@
<label for="Bilirubin">Bilirubin</label>
<input type="number" name="Bilirubin" placeholder="mg/dL" step=".01" min="0" max="100">
<br><br>
<label for="Urine Specific Gravity">Urine Specific Gravity</label>
<input type="text" inputmode="numeric" pattern="\d*" name="Urine Specific Gravity" placeholder="number to 3 sig digits" step=".001" onchange="setThreeDecimal" min="0" max="100">
<br><br>
<label>Urine Protein</label><br>
<!-- <input type="number" name="Urine Protein" step="1"> -->
<div class="shrink">
Expand Down Expand Up @@ -786,8 +786,8 @@
<div class="title">UC DAVIS</div>
<hr>
<div class="vet_txt">VETERINARY MEDICINE</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved</p>
</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved
<br> Git repository: https://github.com/sf-deng/lepto-classifier</p></div>
</div>


Expand Down
5 changes: 3 additions & 2 deletions templates/lepto.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="header">
<ul>
<li class="ucd"><a href="home">UC DAVIS</a></li>
<li><a href="lepto">Lepto-classifier</a></li>
<li><a href="lepto">Auto-Input</a></li>
<li><a href="help">Help</a></li>
<li><a href="contact">Contact</a></li>
</ul>
Expand Down Expand Up @@ -55,7 +55,8 @@
<div class="title">UC DAVIS</div>
<hr>
<div class="vet_txt">VETERINARY MEDICINE</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved</p>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved
<br> Git repository: https://github.com/sf-deng/lepto-classifier</p>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ul>
<li class="ucd"><a href="home">UC DAVIS</a></li>
<li><a href="index">Input</a></li>
<li><a onclick="alertFunction()" href="home">Lepto-classifier</a></li>
<li><a onclick="alertFunction()" href="home">Auto-Input</a></li>
<script>
function alertFunction() {
alert("Sorry the page is currently under construction, Stay tuned for the update!");
Expand Down Expand Up @@ -98,7 +98,8 @@ <h3 class="htu">How to use: </h3>
<div class="title">UC DAVIS</div>
<hr>
<div class="vet_txt">VETERINARY MEDICINE</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved</p>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved
<br> Git repository: https://github.com/sf-deng/lepto-classifier/p>
</div>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions templates/result.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<ul>
<li class="ucd"><a href="home">UC DAVIS</a></li>
<li><a href="index">Input</a></li>
<li><a onclick="alertFunction()" href="result">Lepto-classifier</a></li>
<li><a onclick="alertFunction()" href="result">Auto-Input</a></li>
<script>
function alertFunction() {
alert("Sorry the page is currently under construction, Stay tuned for the update!");
Expand Down Expand Up @@ -57,7 +57,9 @@
<div class="title">UC DAVIS</div>
<hr>
<div class="vet_txt">VETERINARY MEDICINE</div>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved</p>
<p class="right">Copyright © 2022 UC DAVIS VETERINARY MEDICINE. All rights resereved
<br>Git repository: https://github.com/sf-deng/lepto-classifier
</p>
</div>
</div>
<!--
Expand Down