Skip to content

Commit 10094b5

Browse files
committed
fist commit
1 parent e4b3af2 commit 10094b5

16 files changed

+624
-0
lines changed

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: uvicorn main:app --host=0.0.0.0 --port=${PORT:-5000}

cert.pem

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDGzCCAgMCFBbRRA9rkoD5vBc860ahBJF/A9roMA0GCSqGSIb3DQEBCwUAMEox
3+
CzAJBgNVBAYTAmdyMQswCQYDVQQIDAJncjELMAkGA1UEBwwCZ3IxITAfBgNVBAoM
4+
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMjA1MTAxNTU5MzlaFw00OTA5
5+
MjQxNTU5MzlaMEoxCzAJBgNVBAYTAmdyMQswCQYDVQQIDAJncjELMAkGA1UEBwwC
6+
Z3IxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZI
7+
hvcNAQEBBQADggEPADCCAQoCggEBAMqJMax8wr8Qwb8+nLTAV7FfBw1EdxMIvN9g
8+
hVA9hyfUQt5LmEOqcUfs8DfEelSLTENIQrthPgcN6VEEhDRxX9WOwNe6CU9Zc1gN
9+
Z2W3o01eYLLc/0IpPSoju2e2/k+hLbCGFnP/xd5aAWkTdHRpdrYi3RwNrB3wv2zM
10+
9JSl1Z+D4xmPjXI8K9JRXfOzXmdR1/9Jiy/yeY9dc1ZBdgzg4xGYLu3w866kWxRG
11+
yFwRTKCbMaNF/8g4l3HRd6vr+nNnyKUZ+1q6v5y/Z2avRLaDF97WvcHC6AdC3Vsb
12+
JwxKNKPHW6gYSQICd5kYBOwPybNFMnbd5+3w91QmbA1pKqAipo8CAwEAATANBgkq
13+
hkiG9w0BAQsFAAOCAQEAwjtMYaNoAySS0jBGneW7y2SwhVq24nRO7VpPKcuWtMi/
14+
nJfNDMIyw2SaR2r1iwaLdOyHsOW/Dzhhdx9VR1dtiwhWl/YZ3e/BGItCv9L1jDXp
15+
1ZVstfV+USFrDp/F/fpm4/RZtWJaQ5WPrB4eNr488TTDVod2n2fGHBV3we4LFLaf
16+
fUYXCLrl+7O8qhaQJa60cigcxfVlLIaiDtJwY7lrwV2kQ27DOYWFpBUAAdPJfn23
17+
ikL5OZo2AOqeGYFd1wtOPiXqtACAVxhpzwz/CoM+VigWu+RsrMrclbzOFAzVh8O5
18+
DXpPOSOAYyqzNiMbBgkChgD+ZHRZzQvs36rabX5zQA==
19+
-----END CERTIFICATE-----

key.pem

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-----BEGIN RSA PRIVATE KEY-----
2+
MIIEpAIBAAKCAQEAyokxrHzCvxDBvz6ctMBXsV8HDUR3Ewi832CFUD2HJ9RC3kuY
3+
Q6pxR+zwN8R6VItMQ0hCu2E+Bw3pUQSENHFf1Y7A17oJT1lzWA1nZbejTV5gstz/
4+
Qik9KiO7Z7b+T6EtsIYWc//F3loBaRN0dGl2tiLdHA2sHfC/bMz0lKXVn4PjGY+N
5+
cjwr0lFd87NeZ1HX/0mLL/J5j11zVkF2DODjEZgu7fDzrqRbFEbIXBFMoJsxo0X/
6+
yDiXcdF3q+v6c2fIpRn7Wrq/nL9nZq9EtoMX3ta9wcLoB0LdWxsnDEo0o8dbqBhJ
7+
AgJ3mRgE7A/Js0Uydt3n7fD3VCZsDWkqoCKmjwIDAQABAoIBAG8zuplY+thLDAXE
8+
C+hWPw+8/DM1pydFQeZnqWqwDZg5u+kvmk90srPqDM6hywTGYr4CW9lj/9mBstvv
9+
3eKpaRPpSEpp85ikpWbwHRhFJp1hNzidjG04FUQg0FGWsLTp6xsj1Aomoe5+fo3B
10+
x8vu5+YC6GHxw9HAkGndcmB3WP42Qpv8qVuxghzaXlpFpwTEuoLdqgLMcAOq2TNH
11+
3YeOQ+NlMOqG52rTd3UrZNdgbtdu1NDOMrE91oN6o758KB5i7RLSAvqfHpkmF98i
12+
Pi/eR+oYu7cup8YDqLECREhVJpJU4HhkKp6rSnvfnPfv03aa/SINYjORxW+ZvF1c
13+
7Lqm/VECgYEA4+vIfm5QkiB4Ubs+hwO9saOWtZzZ4XohkibyWL0YjNsNPbSiHHFm
14+
jPv9Av12EGI1tvmNN4xJYaw74abxPx99VlhEGQmkXStQu5BrtVPg+/vQeDo4WMv4
15+
27OivsecSbjXx9o9pe6F5+0+SZYMMwhvSYvEmRI2ja1QOP5Xqa/h/IkCgYEA43zP
16+
b+In7rXHWkMAAWWdgN1AeFQ8jUvx9hJsf6UWJtVF7C6EP9+ok7dTe24020ZCndFy
17+
6/BC2Xk5Pubg+RsiiKCNBOGnHNcfI2/M7IxpxzGHL+jAME45iAyEeKuEFdJYVQ11
18+
wseE1ZHeJqdkCy9f/UXGtt9JHV4h+dYi5dw6NFcCgYEAsaIAt3C4gLqnq2NYfxeO
19+
TxUlD1Q4hz+NTH/oHvr5WEYc0rumIK7M8xIthZgO3QP9wyZJRkKiqmn2nY5jtQOQ
20+
xquyHyVhoW9x00zidQbzcNA4EIungKUvxeMB8thVWSujmNHhfCIi4LgI9Ibp6Rgo
21+
y9QPnBESzWaHAHRR1CEM6qkCgYEAl/9T5vDYN6JTwhaUUVqhA3JR2lSGZO6CjCVB
22+
Q4R9qZLE9osaKEd7rr9GU2mOfZiTeDlzLPxK3l4mBsZjOW6NA3cq4kEX1KhUEOxp
23+
owAqyUJpjnRYva32uNWMSchoJ+B0zteAgJWpRr4BDhi4OtT7sRHHNXc5thqoXvNa
24+
O/WLGl8CgYBZEcFxAlVHIaPPLjndTGOk+sl6/Q8g3TppLMYhE5qtDljsx8Uswjth
25+
OE4Iym8/Riy8Cvgzzbx4r9CszIdicFyRzK9l3TVUy6ezhPEmyJcjXlDGL9QA+9Nh
26+
a6B/gkJdprj0+3rno/IuV+CfocI5NE4LMGA0Bdpg9Rjx/Deyzi5Lnw==
27+
-----END RSA PRIVATE KEY-----

main.py

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from fastapi import __version__ as fastapi_version
2+
from typing import Optional
3+
from pydantic import BaseModel
4+
from fastapi import FastAPI, Header
5+
from fastapi.middleware.cors import CORSMiddleware
6+
import uvicorn
7+
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
8+
from fastapi.responses import HTMLResponse
9+
from fastapi.staticfiles import StaticFiles
10+
from fastapi.templating import Jinja2Templates
11+
from fastapi import Request
12+
import os
13+
14+
class patient_metrics(BaseModel):
15+
age: int
16+
BMI: float
17+
waist: float
18+
vegfruit: int
19+
protein: float
20+
templates = Jinja2Templates(directory="templates/html")
21+
print(fastapi_version)
22+
app = FastAPI()
23+
app.mount("/static", StaticFiles(directory="static"), name="static")
24+
#app.add_middleware(HTTPSRedirectMiddleware)
25+
app.add_middleware(
26+
CORSMiddleware,
27+
allow_origins = ['*'],
28+
allow_credentials=True,
29+
allow_methods=['*'],
30+
allow_headers=['*'],
31+
)
32+
33+
@app.post("/metrics/")
34+
async def func_metrics(metrics:patient_metrics, Origin:str | None=Header(default=None)):
35+
print('Origin: ', Origin)
36+
print("your age is: ", metrics.age)
37+
print("your BMI is: ", metrics.BMI)
38+
print("your waist circ is: ", metrics.waist)
39+
print("your vegfruit is: ", metrics.vegfruit)
40+
print("your protein is: ", metrics.protein)
41+
return metrics
42+
43+
@app.get("/", response_class= HTMLResponse)
44+
async def read_root(request: Request, Origin:str |None=Header(default=None)):
45+
print('Origin: ', Origin)
46+
print(fastapi_version)
47+
print({
48+
"age": 45,
49+
"BMI": 34.5,
50+
"waist_circ": 12.5,
51+
"veg_fruit": 5,
52+
"protein": 3.5,
53+
})
54+
return templates.TemplateResponse("Page2.html", {"request": request})
55+
56+
57+
@app.get("/items/{item_id}")
58+
async def read_item(item_id: int, q: Optional[str] = None):
59+
return {"item_id": item_id, "q": q}
60+
61+
#ssl_keyfile='./key.pem',
62+
## # ssl_certfile='./cert.pem',

requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fastapi==0.78.0
2+
pydantic==1.9.0
3+
uvicorn==0.17.6
4+
jinja2==3.1.2

runtime.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python-3.10.2

static/Page1.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/Page1.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
document.getElementById('iaft4').onclick = (event) => {
2+
postData('https://biomedicalede.herokuapp.com/metrics', {
3+
age: document.getElementById("i3q7j").value,
4+
BMI: document.getElementById("i9agp").value,
5+
waist: document.getElementById("ijgfa").value,
6+
vegfruit: document.getElementById("i3kjl").value,
7+
protein: document.getElementById("ip2ij").value,
8+
}
9+
)
10+
.then(data => {
11+
console.log(data);
12+
// JSON data parsed by `data.json()` call
13+
}
14+
);
15+
};
16+
async function postData(url = '', data = {
17+
}
18+
) {
19+
// Default options are marked with *
20+
const response = await fetch(url, {
21+
method: 'POST', // *GET, POST, PUT, DELETE, etc.
22+
mode: 'cors', // no-cors, *cors, same-origin
23+
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
24+
credentials: 'same-origin', // include, *same-origin, omit
25+
headers: {
26+
'Content-Type': 'application/json'
27+
// 'Content-Type': 'application/x-www-form-urlencoded',
28+
}
29+
,
30+
redirect: 'follow', // manual, *follow, error
31+
referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
32+
body: JSON.stringify(data) // body data type must match "Content-Type" header
33+
}
34+
);
35+
return response.json();
36+
// parses JSON response into native JavaScript objects
37+
}

static/Page2.css

+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
.pointer:hover{
2+
cursor:pointer;
3+
}
4+
.align-self-center{
5+
align-self:center !important;
6+
}
7+
.table-stripped2 tr:nth-child(even){
8+
background-color:#f2f2f2 !important;
9+
}
10+
.table-stripped2 td:not(:last-child){
11+
border-right:3px solid white !important;
12+
}
13+
.table-stripped2 th:not(:last-child){
14+
border-right:3px solid white !important;
15+
}
16+
.form-check .form-check-input{
17+
display:inline-block !important;
18+
margin-top:0.25vw !important;
19+
}
20+
.dropdown-menu{
21+
position:absolute !important;
22+
transform:none !important;
23+
}
24+
.flex{
25+
display:flex !important;
26+
}
27+
.w3-row-padding img{
28+
margin-bottom:12px !important;
29+
}
30+
body, h1, h2, h3, h4, h5, h6{
31+
font-family:Montserrat, sans-serif !important;
32+
}
33+
.navbar-brand.classRule-iabg-test-Page2{
34+
width:63px !important;
35+
height:63px !important;
36+
en: !important;
37+
}
38+
body{
39+
background-color:#65d083 !important;
40+
}
41+
.navbar.navbar-expand-lg.navbar-dark.bg-dark.classRule-iquj-test-Page2{
42+
border:solid #0a0a0a !important;
43+
background-color:#2d2d2d !important;
44+
opacity:0.89 !important;
45+
}
46+
.classRule-idsua-test-Page2{
47+
text-align:center !important;
48+
}
49+
.classRule-ifcqv-test-Page2{
50+
height:11px !important;
51+
color:#000000 !important;
52+
font-size:0 !important;
53+
}
54+
.gjs-row{
55+
display:table;
56+
padding-top:10px;
57+
padding-right:10px;
58+
padding-bottom:10px;
59+
padding-left:10px;
60+
width:100%;
61+
}
62+
.gjs-cell{
63+
width:8%;
64+
display:table-cell;
65+
height:75px;
66+
}
67+
.pointer.classRule-igdj9-test-Page2{
68+
width:164px !important;
69+
height:164px !important;
70+
en: !important;
71+
}
72+
.pointer.classRule-i07sf-test-Page2{
73+
width:138px !important;
74+
height:138px !important;
75+
en: !important;
76+
}
77+
.form-group.flex.classRule-i2b04-test-Page2{
78+
justify-content:center !important;
79+
}
80+
.form-group.flex.classRule-i04ap-test-Page2{
81+
label-parent-flex:0 !important;
82+
justify-content:center !important;
83+
}
84+
.classRule-inx81-test-Page2{
85+
text-align:center !important;
86+
}
87+
.classRule-iypp1-test-Page2{
88+
text-align:center !important;
89+
}
90+
.pointer.classRule-id93z-test-Page2{
91+
width:123px !important;
92+
height:135px !important;
93+
en: !important;
94+
}
95+
.pointer.classRule-iuh6z-test-Page2{
96+
width:125px !important;
97+
height:123px !important;
98+
en: !important;
99+
}
100+
.classRule-iadsd-test-Page2{
101+
justify-content:center !important;
102+
margin:17px 0 30px 0 !important;
103+
}
104+
.classRule-ioj7r-test-Page2{
105+
justify-content:center !important;
106+
}
107+
#i7gnc{
108+
min-height:30px !important;
109+
width:auto !important;
110+
}
111+
.form-group.flex.classRule-i7gnc-test-Page2{
112+
justify-content:center !important;
113+
}
114+
#i8pfp{
115+
min-height:30px !important;
116+
width:auto !important;
117+
}
118+
#id4q1{
119+
color:black !important;
120+
}
121+
.pointer.classRule-id4q1-test-Page2{
122+
width:120px !important;
123+
height:132px !important;
124+
en: !important;
125+
}
126+
.form-group.flex.classRule-i8pfp-test-Page2{
127+
justify-content:center !important;
128+
}
129+
#icl9l{
130+
color:black !important;
131+
}
132+
.pointer.classRule-icl9l-test-Page2{
133+
width:102px !important;
134+
height:100px !important;
135+
en: !important;
136+
}
137+
.pointer.classRule-id4q1-test-Page2:hover{
138+
transform: rotate(360deg);
139+
transition:transform 2s linear !important;
140+
}
141+
.form-group.flex.classRule-i7gnc-test-Page2:hover{
142+
border:0 solid rgb(0, 0, 0) !important;
143+
}
144+
.pointer.classRule-icl9l-test-Page2:hover{
145+
transform: rotate(360deg) ;
146+
transition:transform 2s linear !important;
147+
}
148+
@media fadeEffect{
149+
0%{
150+
opacity:0;
151+
}
152+
100%{
153+
opacity:1;
154+
}
155+
}
156+
@media (max-width: 992px){
157+
.navbar-brand.classRule-iabg-test-Page2{
158+
width:77px !important;
159+
height:77px !important;
160+
en: !important;
161+
}
162+
.classRule-iypp1-test-Page2{
163+
margin:10px 0 12px 0 !important;
164+
padding:16px 0 0 0 !important;
165+
}
166+
.form-group.flex.classRule-i7gnc-test-Page2{
167+
margin:10px 0 1px 0 !important;
168+
}
169+
}
170+
@media (max-width: 768px){
171+
.gjs-cell{
172+
width:100%;
173+
display:block;
174+
}
175+
}
176+
@media (max-width: 480px){
177+
.navbar-brand.classRule-iabg-test-Page2{
178+
width:77px !important;
179+
height:77px !important;
180+
en: !important;
181+
}
182+
.classRule-iypp1-test-Page2{
183+
padding:10px 0 0 0 !important;
184+
}
185+
.classRule-iadsd-test-Page2{
186+
margin:17px 0 47px 0 !important;
187+
}
188+
}
189+

templates/css/Page1.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)