forked from priyanshugandhi/Med-Help
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
executable file
·122 lines (97 loc) · 3.31 KB
/
Copy pathapp.py
File metadata and controls
executable file
·122 lines (97 loc) · 3.31 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import json
import tokenGen as token
import config
from flask import Flask,render_template
from flask import request
import nearestDoctor as nd
import forDatabase as fd
import os
import api as ap
from flask import jsonify, redirect
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/dashboard')
def one():
authkey=token.getToken()
return render_template("dashboard.html",authkey=authkey)
@app.route('/patient_information')
def two():
authkey=token.getToken()
return render_template("patient_information.html",authkey=authkey)
@app.route('/disease_information')
def three():
authkey=token.getToken()
return render_template("disease_information.html",authkey=authkey)
@app.route('/login')
def four():
return render_template("login.html")
@app.route("/patient_submit", methods=['GET', 'POST'])
def five():
if request.method == 'POST':
gender=request.form['Gender']
age=request.form["Age"]
symptoms=request.form['ID']
print(symptoms,age,gender)
authkey=token.getToken()
return render_template("patient_information.html",authkey=authkey,gender=gender,age=age,symptoms=symptoms)
@app.route("/disease_submit", methods=['GET', 'POST'])
def six():
if request.method == 'POST':
issue=request.form['issue']
authkey=token.getToken()
return render_template("disease_information.html",authkey=authkey,issue=issue)
@app.route("/findDoctor")
def find_doctor():
return render_template("findMyDoctor.html")
@app.route('/api/four/result', methods=['POST'])
def apiFourResult():
data = request.get_json()
nearestDocs = nd.nearestDoctors(data["lat"], data["long"])
print(nearestDocs)
nearestDocsDict = json.dumps(nearestDocs)
return nearestDocsDict
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
@app.route('/uceverything',methods=['GET', 'POST'])
def upload_image():
target = os.path.join(APP_ROOT, 'uploads/')
print(target)
if not os.path.isdir(target):
os.mkdir(target)
else:
print("Couldn't create upload directory: {}".format(target))
print(request.files.getlist("file"))
for upload in request.files.getlist("file"):
print(upload)
print("{} is the file name".format(upload.filename))
filename = upload.filename
destination = "/".join([target, filename])
print ("Accept incoming file:", filename)
print ("Save it to:", destination)
upload.save(destination)
return ap.texttospeech(filename)
# If no valid image file was uploaded, show the file upload form:
return '''
<!doctype html>
<title>UCEverything</title>
<h1>Upload a picture!</h1>
<form method="POST" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
'''
@app.route('/treatment')
def eight():
return render_template("scrapedTreatments.html")
@app.route('/api/three/result', methods=['POST'])
def apiThreeResult():
data = request.get_json()
medicalConditions = fd.fetch(data["searchTerm"])
medicalConditionsDict = json.dumps(medicalConditions)
return medicalConditionsDict
if __name__ == '__main__':
app.run(host='127.0.0.1',port=5001)