Skip to content

Commit 5377202

Browse files
committed
Done with basic design, leaving touchups as of now
1 parent e20571c commit 5377202

File tree

9 files changed

+312
-49
lines changed

9 files changed

+312
-49
lines changed

backend/api/api.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@
55

66

77
#Globals
8+
UPLOAD_FOLDER = "./attachments"
9+
ALLOWED_EXTENSIONS = {'docx'}
10+
811
app = Flask(__name__)
12+
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
913
CORS(app)
1014

15+
#Extension_Check
16+
def allowed_file(filename):
17+
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
18+
19+
1120
@app.route("/", methods=['GET'])
1221
def test():
1322
return "Hello World!"
1423

24+
1525
@app.route("/analyzetext", methods=['POST'])
1626
def analyze_text():
1727
data = request.get_json()
@@ -42,6 +52,25 @@ def analyze_text():
4252

4353
return jsonify(Output)
4454

45-
# @app.route("/analyzeattachment", methods=['POST'])
46-
# def analyze_attachment():
55+
56+
@app.route("/analyzeattachment", methods=['POST'])
57+
def analyze_attachment():
58+
59+
if 'file' not in request.files:
60+
print("No File")
61+
abort(400, description="Resource not found")
62+
63+
file = request.files['file']
64+
if file.filename == '':
65+
print("No File Name")
66+
abort(400, description="Resource not found")
67+
68+
if file and allowed_file(file.filename):
69+
filename = secure_filename(file.filename)
70+
file.filename = filename
71+
# file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) #Enable this to save in attachments folder
72+
data = file.read() #This is the data you need to process my friend
73+
return jsonify("Issue") #Send Better Outputs
74+
75+
abort(400, description="Resource not found")
4776

backend/api/requirements.txt

1.03 KB
Binary file not shown.

backend/api/test_api.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
from werkzeug.utils import secure_filename
44
import time
55
import numpy
6+
#import os
67

78
UPLOAD_FOLDER = "./attachments"
8-
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
9+
ALLOWED_EXTENSIONS = {'docx'}
910

1011
app = Flask(__name__)
1112
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
@@ -15,10 +16,12 @@
1516
def allowed_file(filename):
1617
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
1718

19+
1820
@app.route("/", methods=['GET'])
1921
def test():
2022
return "Hello World!"
2123

24+
2225
@app.route("/analyzetext", methods=['POST'])
2326
def analyze_text():
2427
data = request.get_json()
@@ -35,26 +38,35 @@ def analyze_text():
3538

3639
reply = [
3740
{
38-
"message":"Private Info",
41+
"message":"Violation of Privacy Policy",
3942
"indices": [index1, index2]
4043
},
4144
{
42-
"message":"Confidentiality Issue",
45+
"message":"Breach of Confidentiality",
4346
"indices": [index3, index4]
4447
}
4548
]
4649

4750
return jsonify(reply)
4851

52+
4953
@app.route("/analyzeattachment", methods=['POST'])
5054
def analyze_attachment():
55+
5156
if 'file' not in request.files:
52-
abort(400, description="Resource not found")
57+
print("No File")
58+
abort(400, description="Resource not found")
59+
5360
file = request.files['file']
54-
# if user does not select file, browser also submit an empty part without filename
5561
if file.filename == '':
62+
print("No File Name")
5663
abort(400, description="Resource not found")
64+
5765
if file and allowed_file(file.filename):
5866
filename = secure_filename(file.filename)
5967
file.filename = filename
60-
return jsonify(file)
68+
# file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
69+
data = file.read()
70+
return jsonify("issue")
71+
72+
abort(400, description="Resource not found")

frontend/src/App.css

Lines changed: 158 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
background-color: white;
7171
width : 50vw;
7272
height : 80vh;
73-
min-width: 515px;
73+
min-width: 540px;
7474
min-height: 540px;
7575
margin : auto;
7676
border-radius: 10px;
@@ -132,6 +132,9 @@
132132
box-shadow: none;
133133
border-radius: 0px;
134134
border-bottom: 1px solid black;
135+
padding: 6px 12px;
136+
font-weight: 500;
137+
color: black;
135138
}
136139

137140
.MyTextBox{
@@ -159,8 +162,8 @@
159162
position: relative;
160163
top: 0;
161164
right: 0;
162-
height: 50px;
163-
width: 50px;
165+
height: 40px;
166+
width: 40px;
164167
margin: 2px;
165168
padding: 0;
166169
float: right;
@@ -170,17 +173,19 @@
170173
background-color: white;
171174
color:black;
172175
text-align: left;
173-
font-family: 'Times New Roman', Times, serif;
174-
font-size: medium;
176+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
177+
font-weight: lighter;
178+
font-size: 16px;
175179
border: none;
176180
padding: 2px;
177181
outline: none;
178182
}
179183

180184
textarea, textarea:hover, textarea:focus{
181185
color: black;
182-
font-size: medium;
183-
font-family: 'Times New Roman', Times, serif;
186+
font-size: 16px;
187+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
188+
font-weight: lighter;
184189
outline: none;
185190
border: none;
186191
text-align: left;
@@ -189,39 +194,40 @@ textarea, textarea:hover, textarea:focus{
189194
}
190195

191196
.highlight{
192-
background-color: cyan;
193-
color: black;
194-
font-family: 'Times New Roman', Times, serif;
195-
font-size: medium;
197+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
198+
font-weight: lighter;
199+
font-size: 16px;
196200
}
197201

198-
.highlight:hover{
199-
background-color: red;
200-
color: black;
202+
.highlight1{
203+
background-color: rgb(255,165,0);
204+
}
205+
206+
.highlight2{
207+
background-color: rgb(255,100,100);
201208
}
202209

203210
.newDiv, .newDiv:focus, .newDiv:hover{
204211
background-color: transparent;
205-
color:transparent;
212+
color:black;
206213
text-align: left;
207-
font-family: 'Times New Roman', Times, serif;
208-
font-size: medium;
214+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
215+
font-weight: lighter;
216+
font-size: 16px;
209217
border: none;
210218
padding: 2px;
211219
outline: none;
212220
}
213221

214-
.highlight .tooltiptext {
222+
/* .highlight .tooltiptext {
215223
visibility: hidden;
216224
width: 120px;
217-
background-color: darkgrey;
218-
color: #fff;
225+
background-color: rgb(255,100,100);
226+
color: black;
219227
text-align: center;
220228
border-radius: 6px;
221229
padding: 5px;
222230
font-size: small;
223-
224-
/* Position the tooltip */
225231
position: absolute;
226232
z-index: 1;
227233
}
@@ -230,9 +236,81 @@ textarea, textarea:hover, textarea:focus{
230236
visibility: visible;
231237
}
232238
239+
.highlight .tooltiptext::after {
240+
content: " ";
241+
position: absolute;
242+
top: 50%;
243+
right: 100%;
244+
margin-top: -5px;
245+
border-width: 5px;
246+
border-style: solid;
247+
border-color: transparent rgb(255,100,100) transparent transparent;
248+
} */
249+
250+
.highlight1 .tooltiptext {
251+
visibility: hidden;
252+
width: 120px;
253+
background-color: rgb(255,165,0);
254+
color: black;
255+
font-weight: bold;
256+
text-align: center;
257+
border-radius: 6px;
258+
border: 1px solid black;
259+
padding: 5px;
260+
font-size: small;
261+
position: absolute;
262+
z-index: 1;
263+
}
264+
265+
.highlight1:hover .tooltiptext {
266+
visibility: visible;
267+
}
268+
269+
.highlight1 .tooltiptext::after {
270+
content: " ";
271+
position: absolute;
272+
top: 50%;
273+
right: 100%;
274+
margin-top: -5px;
275+
border-width: 5px;
276+
border-style: solid;
277+
border-color: transparent black transparent transparent;
278+
}
279+
280+
.highlight2 .tooltiptext {
281+
visibility: hidden;
282+
width: 120px;
283+
background-color: rgb(255,100,100);
284+
color: black;
285+
font-weight: bold;
286+
text-align: center;
287+
border-radius: 6px;
288+
border: 1px solid black;
289+
padding: 5px;
290+
font-size: small;
291+
position: absolute;
292+
z-index: 1;
293+
}
294+
295+
.highlight2:hover .tooltiptext {
296+
visibility: visible;
297+
}
298+
299+
.highlight2 .tooltiptext::after {
300+
content: " ";
301+
position: absolute;
302+
top: 50%;
303+
right: 100%;
304+
margin-top: -5px;
305+
border-width: 5px;
306+
border-style: solid;
307+
border-color: transparent black transparent transparent;
308+
}
309+
233310
.BottomRow{
234311
display: flex;
235312
flex-direction: row;
313+
align-items: center;
236314
padding: 0% 5%;
237315
border-left: solid rgb(0, 114, 198) 10px;
238316
border-right: solid rgb(0, 114, 198) 10px;
@@ -256,7 +334,62 @@ textarea, textarea:hover, textarea:focus{
256334
}
257335

258336
.AttachmentIcon{
259-
height: 40px;
260-
width: 40px;
261-
margin: 5px 10px;
337+
height: 38px;
338+
width: 38px;
339+
margin: 10px 10px 10px 10px;
340+
}
341+
342+
.AttachmentsSection{
343+
padding-left: 10px;
344+
overflow-x: auto;
345+
overflow-y: hidden;
346+
/* max-width: 250px; */
347+
white-space:nowrap;
348+
}
349+
350+
.AttachmentCard{
351+
display: flex;
352+
align-items: center;
353+
border: 1px solid grey;
354+
border-radius: 5px;
355+
background-color: rgb(218, 217, 220);
356+
margin: auto 5px;
357+
}
358+
359+
.AttachmentCardIssue{
360+
display: flex;
361+
align-items: center;
362+
border: 1px solid grey;
363+
border-radius: 5px;
364+
background-color: rgb(255,100,100);
365+
margin: auto 5px;
366+
}
367+
368+
.DocxIcon{
369+
float: left;
370+
height: 35px;
371+
width : 35px;
372+
padding: 5px;
373+
}
374+
375+
.AttachmentName{
376+
float: left;
377+
color: blue;
378+
align-items: center;
379+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
380+
font-size: 15px;
381+
font-weight: bolder;
382+
vertical-align: middle;
383+
}
384+
385+
.DelIcon{
386+
float: right;
387+
right: 0;
388+
height: 25px;
389+
width : 25px;
390+
padding: 5px;
391+
}
392+
393+
.DelIcon:hover{
394+
cursor: pointer;
262395
}

0 commit comments

Comments
 (0)