Skip to content
Snippets Groups Projects
Commit d9cca530 authored by Aleksandra Dimitrova's avatar Aleksandra Dimitrova
Browse files

working version

parent 2e2664d6
Branches
No related tags found
No related merge requests found
......@@ -51,10 +51,14 @@ def upload_file():
if uploaded_file.filename != '':
#file is saved in the 'upload' directory.
uploaded_file.save(os.path.join(app.config['UPLOAD_FOLDER'],uploaded_file.filename))
if not elog.format_check(uploaded_file.filename):
flash('Event log does not match the expected business process!')
return redirect(url_for('index'))
elif uploaded_file.filename == '':
#if no file has been selected, flashes a warning
flash('No files selected! Please select a file!')
return redirect(url_for('index'))
return redirect(url_for('case_id', filename = uploaded_file.filename))
"""
......@@ -64,17 +68,29 @@ Currently it just sends a preexisting file. Meaning the generated file will have
"""
@app.route('/download/', methods=['GET'])
def download():
filetype = time = ''
filetype = request.args.get("selectType")
# time = request.form.get("downloadType")
time = 100
if time != None:
print(int(time))
elog.generate_event_log(time)
if filetype == 'csv':
path = os.path.join(app.config['STATIC_FOLDER'], 'fish.jpg')
path = os.path.join(app.config['STATIC_FOLDER'], 'elog.csv')
#flash the confirmation that file is succesfully downloaded
flash('Generated a event log in csv. Please check your attachments!')
return send_file(path, as_attachment=True)
elif filetype == 'xes':
path = os.path.join(app.config['STATIC_FOLDER'], 'fish.jpg')
path = os.path.join(app.config['STATIC_FOLDER'], 'elog.xes')
#flash the confirmation that file is succesfully downloaded
flash('Generated a event log in xes. Please check your attachments!')
return send_file(path, as_attachment=True)
else:
path = os.path.join(app.config['STATIC_FOLDER'], 'fish.jpg')
#flash the confirmation that file is succesfully downloaded
flash('Else')
return send_file(path, as_attachment=True)
"""
Route for displaying possible case IDs. It is a dropdown menu that displays the list from the python script in the dropdown menu.
......@@ -96,15 +112,11 @@ def case_id(filename):
state = elog.get_state(result, filename)
rec = dqn.deploy(state)
rec = int(rec)
print(rec)
# print(rec)
petrinet.decorate_petri_net(result, filename)
# preview = os.path.join(app.config['STATIC_FOLDER'], 'preview_net.png')
# print(preview)
else:
print("else")
# preview = "../static/fish.jpg"
return render_template('case.html', selection=selection, filename=filename)
......@@ -129,9 +141,9 @@ def recommendation(result, filename):
rec = dqn.deploy(state)
rec = int(rec)
petrinet.decorate_petri_net_with_rec(result, rec, filename)
name = petrinet.decorate_petri_net_with_rec(result, rec, filename)
return render_template('result.html')
return render_template('result.html', name = name)
"""
Loading page. Has yet to be used.
......
CaseID,Activity,StartTimestamp,EndTimestamp
0,place order,0.0,2.0
1,place order,2.0,4.0
2,place order,4.0,6.0
0,arrange custom order,6.0,35.0
1,arrange custom order,6.0,26.0
2,arrange standard order,6.0,20.0
3,place order,10.0,12.0
3,arrange custom order,12.0,34.0
4,place order,20.0,22.0
2,pick from stock A,22.0,50.0
4,arrange standard order,22.0,37.0
1,manufacture A,26.0,
5,place order,30.0,32.0
5,arrange custom order,32.0,53.0
3,manufacture A,34.0,
0,manufacture B,35.0,
4,pick from stock C,37.0,
6,place order,40.0,42.0
6,arrange custom order,42.0,68.0
7,place order,50.0,52.0
2,pack C,52.0,82.0
7,arrange custom order,52.0,79.0
5,manufacture B,53.0,
8,place order,60.0,62.0
8,arrange custom order,62.0,91.0
6,manufacture A,68.0,
9,place order,70.0,72.0
9,arrange custom order,72.0,
7,manufacture A,79.0,
10,place order,80.0,82.0
2,attempt delivery B,82.0,
10,arrange standard order,82.0,97.0
11,place order,90.0,92.0
8,manufacture B,92.0,
11,arrange standard order,92.0,
10,pick from stock C,97.0,
<?xml version="1.0" encoding="utf-8" ?>
<log xes.version="1849-2016" xes.features="nested-attributes" xmlns="http://www.xes-standard.org/">
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="0.0" />
<int key="EndTimestamp" value="2" />
<int key="CaseID" value="0" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="2.0" />
<int key="EndTimestamp" value="4" />
<int key="CaseID" value="1" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="4.0" />
<int key="EndTimestamp" value="6" />
<int key="CaseID" value="2" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="6.0" />
<int key="EndTimestamp" value="35" />
<int key="CaseID" value="0" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="6.0" />
<int key="EndTimestamp" value="26" />
<int key="CaseID" value="1" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange standard order" />
<float key="StartTimestamp" value="6.0" />
<int key="EndTimestamp" value="20" />
<int key="CaseID" value="2" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="10.0" />
<int key="EndTimestamp" value="12" />
<int key="CaseID" value="3" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="12.0" />
<int key="EndTimestamp" value="34" />
<int key="CaseID" value="3" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="20.0" />
<int key="EndTimestamp" value="22" />
<int key="CaseID" value="4" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="pick from stock A" />
<float key="StartTimestamp" value="22.0" />
<int key="EndTimestamp" value="50" />
<int key="CaseID" value="2" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange standard order" />
<float key="StartTimestamp" value="22.0" />
<int key="EndTimestamp" value="37" />
<int key="CaseID" value="4" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="manufacture A" />
<float key="StartTimestamp" value="26.0" />
<int key="CaseID" value="1" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="30.0" />
<int key="EndTimestamp" value="32" />
<int key="CaseID" value="5" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="32.0" />
<int key="EndTimestamp" value="53" />
<int key="CaseID" value="5" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="manufacture A" />
<float key="StartTimestamp" value="34.0" />
<int key="CaseID" value="3" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="manufacture B" />
<float key="StartTimestamp" value="35.0" />
<int key="CaseID" value="0" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="pick from stock C" />
<float key="StartTimestamp" value="37.0" />
<int key="CaseID" value="4" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="40.0" />
<int key="EndTimestamp" value="42" />
<int key="CaseID" value="6" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="42.0" />
<int key="EndTimestamp" value="68" />
<int key="CaseID" value="6" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="50.0" />
<int key="EndTimestamp" value="52" />
<int key="CaseID" value="7" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="pack C" />
<float key="StartTimestamp" value="52.0" />
<int key="EndTimestamp" value="82" />
<int key="CaseID" value="2" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="52.0" />
<int key="EndTimestamp" value="79" />
<int key="CaseID" value="7" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="manufacture B" />
<float key="StartTimestamp" value="53.0" />
<int key="CaseID" value="5" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="60.0" />
<int key="EndTimestamp" value="62" />
<int key="CaseID" value="8" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="62.0" />
<int key="EndTimestamp" value="91" />
<int key="CaseID" value="8" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="manufacture A" />
<float key="StartTimestamp" value="68.0" />
<int key="CaseID" value="6" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="70.0" />
<int key="EndTimestamp" value="72" />
<int key="CaseID" value="9" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange custom order" />
<float key="StartTimestamp" value="72.0" />
<int key="CaseID" value="9" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="manufacture A" />
<float key="StartTimestamp" value="79.0" />
<int key="CaseID" value="7" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="80.0" />
<int key="EndTimestamp" value="82" />
<int key="CaseID" value="10" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="attempt delivery B" />
<float key="StartTimestamp" value="82.0" />
<int key="CaseID" value="2" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange standard order" />
<float key="StartTimestamp" value="82.0" />
<int key="EndTimestamp" value="97" />
<int key="CaseID" value="10" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="place order" />
<float key="StartTimestamp" value="90.0" />
<int key="EndTimestamp" value="92" />
<int key="CaseID" value="11" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="manufacture B" />
<float key="StartTimestamp" value="92.0" />
<int key="CaseID" value="8" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="arrange standard order" />
<float key="StartTimestamp" value="92.0" />
<int key="CaseID" value="11" />
</event>
</trace>
<trace>
<event>
<string key="Activity" value="pick from stock C" />
<float key="StartTimestamp" value="97.0" />
<int key="CaseID" value="10" />
</event>
</trace>
</log>
Frontend/static/net.png

50.7 KiB | W: | H:

Frontend/static/net.png

46.5 KiB | W: | H:

Frontend/static/net.png
Frontend/static/net.png
Frontend/static/net.png
Frontend/static/net.png
  • 2-up
  • Swipe
  • Onion skin
Frontend/static/preview_net.png

50.7 KiB | W: | H:

Frontend/static/preview_net.png

51.3 KiB | W: | H:

Frontend/static/preview_net.png
Frontend/static/preview_net.png
Frontend/static/preview_net.png
Frontend/static/preview_net.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
<link rel="icon" href="{{url_for('static',filename='dino.ico')}}">
<link rel="icon" href="{{url_for('static',filename='favicon.ico')}}">
<link rel="stylesheet" href="{{url_for('static',filename='styles.css')}}">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
......@@ -15,7 +15,6 @@
name="description"
content="The web app for OPTIS"
/>
<link rel="manifest" href="../manifest.json" />
{% block head %}
{% endblock %}
......@@ -51,4 +50,4 @@
</body>
</html>
\ No newline at end of file
</html>
......@@ -9,6 +9,8 @@
{%block body%}
<div style="text-align: center;" class="custom-select">
Choose which case you want to optimize:
<!--This is the form for directly sending case ID to be processed by the agent.-->
<form id="selectcaseid" method="post" name="selectresult">
<select name="selectresult" id="selectcaseid" method="get" form="selectcaseid" >
......@@ -34,16 +36,16 @@
{% endfor %}
</select>
<div style = "text-align: center;">
<!--The preview image-->
<img src="\static\preview_net.png" alt="Placeholder"> <br>
</div>
<div style = "text-align: center;">
<!--The preview button-->
<button type="submit" class="button" form="previewCase" value="casevalue"> Preview this case! </button>
</div>
<div style = "text-align: center;">
<!--The preview image-->
<img src="\static\preview_net.png" alt="Placeholder" style="max-width: 80%; border: solid 20px rgb(230,241,250)" > <br>
</div>
</form>
</div>
{%endblock%}\
......
......@@ -26,7 +26,7 @@
<p><input type="file" name="file" accept=".xes,.csv"></p>
<p><input type="submit" value="submit" class="button"></p>
</form>
<h2 style="font-size: 14px">please input only .xes and .csv files. please!</h2>
<h2 style="font-size: 14px">Please input only .xes and .csv files!</h2>
</div>
<div style="text-align: center;">
......@@ -38,9 +38,14 @@
<option value= "{{type}}"> export as .{{type}} </option>
{% endfor %}
</select>
<div>
<h2>Please input the desired simulation length:</h2>
<input type="text" value="elogTime"></input>
</div>
<div style = "text-align: center;">
<button type="submit" class="button" form="downloadType" value="exportType"> Generate an event log! </button>
<button type="submit" class="button" form="downloadType" value="exportType"> Generate an event log! </button>
</div>
</form>
</div>
......
......@@ -11,10 +11,10 @@
{%block body%}
<div style="text-align: center;">
<h1>Here are the results of the optimization!</h1>
<h2>We recommend you to do the following activity for this specific case:</h2>
<h2>We recommend you to do the following activity for this specific case: {{name}}</h2>
<!--res is the result-->
<!-- currently a placeholder image to display result-->
<img src="/static/net.png" alt="Placeholder"> <br>
<img src="/static/net.png" alt="Placeholder" style="max-width: 80%; border: solid 20px rgb(230,241,250)"> <br>
<!--button to go back to home page-->
<button onclick="window.location.href='/'" class="button"> Optimize your next case NOW!</button>
</div>
......
CaseID,Activity,StartTimestamp,EndTimestamp
0,place order,0.0,2.0
1,place order,2.0,4.0
2,place order,4.0,6.0
0,arrange custom order,6.0,35.0
1,arrange custom order,6.0,26.0
2,arrange standard order,6.0,20.0
3,place order,10.0,12.0
3,arrange custom order,12.0,34.0
4,place order,20.0,22.0
2,pick from stock A,22.0,50.0
4,arrange standard order,22.0,37.0
1,manufacture A,26.0,
5,place order,30.0,32.0
5,arrange custom order,32.0,53.0
3,manufacture A,34.0,
0,manufacture B,35.0,
4,pick from stock C,37.0,
6,place order,40.0,42.0
6,arrange custom order,42.0,68.0
7,place order,50.0,52.0
2,pack C,52.0,82.0
7,arrange custom order,52.0,79.0
5,manufacture B,53.0,
8,place order,60.0,62.0
8,arrange custom order,62.0,91.0
6,manufacture A,68.0,
9,place order,70.0,72.0
9,arrange custom order,72.0,
7,manufacture A,79.0,
10,place order,80.0,82.0
2,attempt delivery B,82.0,
10,arrange standard order,82.0,97.0
11,place order,90.0,92.0
8,manufacture B,92.0,
11,arrange standard order,92.0,
10,pick from stock C,97.0,
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment