diff --git a/.gitignore b/.gitignore index 8bc348e68bc9a9ad44b0cbe1f39f04660966b818..6f6b0c69f7a7b59bfb163805c2d9dab451c28817 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ venv/ -__pycache__ \ No newline at end of file +__pycache__ +.vscode/ \ No newline at end of file diff --git a/front_end/dpath.py b/front_end/dpath.py index 3c55fb95822a326c4363d1aade0b6d7b70d99301..f71227d1f2f66f8f207e6340c3bcac16cb96d3b4 100644 --- a/front_end/dpath.py +++ b/front_end/dpath.py @@ -1,5 +1,4 @@ from flask import Flask, render_template, url_for, flash, redirect -from flask import jsonify from flask import request import requests import urllib.request @@ -9,7 +8,9 @@ from werkzeug.utils import secure_filename app = Flask(__name__) + UPLOAD_FOLDER = 'static/uploads/' +REPORTS_SERVICE_URL = 'http://127.0.0.1:5000' app.secret_key = "secret key" app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER @@ -24,6 +25,11 @@ def allowed_file(filename): def home(): return render_template('home.html') +@app.route('/term2') +def term2(): + reports = requests.get(f'{REPORTS_SERVICE_URL}/dpath/report').json() + return render_template('2ndTerm.html', reports=reports) + @app.route('/', methods=['GET', "POST"]) def upload_image(): if 'file' not in request.files: @@ -46,4 +52,7 @@ def upload_image(): @app.route('/display/<filename>') def display_image(filename): #print('display_image filename: ' + filename) - return redirect(url_for('static', filename='uploads/' + filename), code=301) \ No newline at end of file + return redirect(url_for('static', filename='uploads/' + filename), code=301) + +if __name__ == "__main__": + app.run(debug=True) \ No newline at end of file diff --git a/front_end/templates/2ndTerm.html b/front_end/templates/2ndTerm.html index a84c5e75919a9ee933021ffb113234eda6e8f67d..1ce7d087cdc5da2840bc9686d90c3ff3f815067e 100644 --- a/front_end/templates/2ndTerm.html +++ b/front_end/templates/2ndTerm.html @@ -1,27 +1,41 @@ +<!DOCTYPE html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Slide Analyzer</title> + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" + integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous"> +</head> + +<div class="list-group"> + {% include 'includes/reports.html' %} +</div> <div class="progress w-50"> - <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div> + <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" + aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"> </div> +</div> - {% if filename %} - <div> - <img src="{{ url_for('display_image', filename=filename) }}"> - </div> - {% endif %} +{% if filename %} +<div> + <img src="{{ url_for('display_image', filename=filename) }}"> +</div> +{% endif %} - <h2> - Sample id: c1471950-71a5-11ed-9ddb-1267f16e00ed - </h2> - <h2> - Time of completion: 01/12/2022 18:27:04 - </h2> - <h2> - Diagnosis: Severe - </h2> - <h2> - Chip Predictions: - Mild: 806 - Severe: 846 - </h2> \ No newline at end of file +<h2> + Sample id: c1471950-71a5-11ed-9ddb-1267f16e00ed +</h2> +<h2> + Time of completion: 01/12/2022 18:27:04 +</h2> +<h2> + Diagnosis: Severe +</h2> +<h2> + Chip Predictions: + Mild: 806 + Severe: 846 +</h2> \ No newline at end of file diff --git a/front_end/templates/includes/reports.html b/front_end/templates/includes/reports.html new file mode 100644 index 0000000000000000000000000000000000000000..29b1eda1442b015f22efaf23bca6b6e25d3f88e7 --- /dev/null +++ b/front_end/templates/includes/reports.html @@ -0,0 +1,10 @@ +{% block content %} +<h1>{% block title %} Reports {% endblock %}</h1> +<div class="list-group-item report"> + {% for report in reports %} + <div class="d-flex w-100 justify-content-between"> + <h5 class="mb-1">{{ report.id }}</h5> + <small>{{ report.report.runDate }}</small> + </div> + {% endfor %} +{% endblock %} \ No newline at end of file