mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-15 23:45:54 +00:00
Add excel to report datasets
This commit is contained in:
@@ -299,11 +299,11 @@ class ReportDatasets:
|
|||||||
color2 = "#FDE9D9"
|
color2 = "#FDE9D9"
|
||||||
color3 = "#B1A0C7"
|
color3 = "#B1A0C7"
|
||||||
|
|
||||||
def __init__(self, excel=False, book=None):
|
def __init__(self, excel=False, book=None, output=True):
|
||||||
self.excel = excel
|
self.excel = excel
|
||||||
self.env = EnvData().load()
|
self.env = EnvData().load()
|
||||||
self.close = False
|
self.close = False
|
||||||
self.output = True
|
self.output = output
|
||||||
self.header_text = f"Datasets used in benchmark ver. {__version__}"
|
self.header_text = f"Datasets used in benchmark ver. {__version__}"
|
||||||
if excel:
|
if excel:
|
||||||
self.max_length = 0
|
self.max_length = 0
|
||||||
|
@@ -6,7 +6,7 @@ import xlsxwriter
|
|||||||
from benchmark.Utils import Files, Folders
|
from benchmark.Utils import Files, Folders
|
||||||
from benchmark.Arguments import EnvData
|
from benchmark.Arguments import EnvData
|
||||||
from benchmark.ResultsBase import StubReport
|
from benchmark.ResultsBase import StubReport
|
||||||
from benchmark.ResultsFiles import Excel
|
from benchmark.ResultsFiles import Excel, ReportDatasets
|
||||||
from benchmark.Datasets import Datasets
|
from benchmark.Datasets import Datasets
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask import render_template, request, redirect, url_for
|
from flask import render_template, request, redirect, url_for
|
||||||
@@ -121,7 +121,11 @@ def excel():
|
|||||||
book = None
|
book = None
|
||||||
if selected_files[0] == "datasets":
|
if selected_files[0] == "datasets":
|
||||||
# Create a list of datasets
|
# Create a list of datasets
|
||||||
return AjaxResponse(True, "datasets").to_string()
|
report = ReportDatasets(excel=True, output=False)
|
||||||
|
report.report()
|
||||||
|
excel_name = os.path.join(Folders.excel, Files.datasets_report_excel)
|
||||||
|
Files.open(excel_name, test=app.config[TEST])
|
||||||
|
return AjaxResponse(True, Files.datasets_report_excel).to_string()
|
||||||
try:
|
try:
|
||||||
for file_name in selected_files:
|
for file_name in selected_files:
|
||||||
file_name_result = os.path.join(Folders.results, file_name)
|
file_name_result = os.path.join(Folders.results, file_name)
|
||||||
|
@@ -6,7 +6,8 @@
|
|||||||
{% set table_class = "table table-striped table-hover table-bordered" %}
|
{% set table_class = "table table-striped table-hover table-bordered" %}
|
||||||
{% set head_class = "bg-primary text-white" %}
|
{% set head_class = "bg-primary text-white" %}
|
||||||
{% set text_right = "text-end" %}
|
{% set text_right = "text-end" %}
|
||||||
{% set container = "container-fluid" %}
|
{% set container = "container" %}
|
||||||
|
{% set selected = "selected" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set close_button = '<button class="delete is-large" onclick="location.href = \'/index/' ~ compare ~ '\'"></button>' %}
|
{% set close_button = '<button class="delete is-large" onclick="location.href = \'/index/' ~ compare ~ '\'"></button>' %}
|
||||||
{% set button_class = "button is-primary is-small" %}
|
{% set button_class = "button is-primary is-small" %}
|
||||||
@@ -14,17 +15,35 @@
|
|||||||
{% set table_class = "table is-striped is-hoverable cell-border is-bordered" %}
|
{% set table_class = "table is-striped is-hoverable cell-border is-bordered" %}
|
||||||
{% set head_class = "is-selected" %}
|
{% set head_class = "is-selected" %}
|
||||||
{% set text_right = "has-text-right" %}
|
{% set text_right = "has-text-right" %}
|
||||||
{% set container = "container is-fluid" %}
|
{% set container = "container" %}
|
||||||
|
{% set selected = "is-selected" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="{{ container }}">
|
<div class="{{ container }}">
|
||||||
<h1 class="{{ h1_class }}">{{ close_button|safe }} Datasets Report</h1>
|
<h1 class="{{ h1_class }}">{{ close_button|safe }} Benchmark Datasets Report</h1>
|
||||||
<button class="{{ button }}" onclick="excelFiles(['datasets'], false)"><i class="mdi mdi-file-excel"></i> Excel</button>
|
<button class="{{ button_class }}" onclick="excelFiles(['datasets'], false)"><i class="mdi mdi-file-excel"></i> Excel</button>
|
||||||
{% include "partials/datasets_table.html" %}
|
{% include "partials/datasets_table.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block jscript %}
|
{% block jscript %}
|
||||||
<script>
|
<script>
|
||||||
{% include "partials/excelFiles.js" %}
|
{% include "partials/excelFiles.js" %}
|
||||||
|
$(document).ready(function () {
|
||||||
|
$(document).ajaxStart(function(){
|
||||||
|
$("body").addClass('ajaxLoading');
|
||||||
|
});
|
||||||
|
$(document).ajaxStop(function(){
|
||||||
|
$("body").removeClass('ajaxLoading');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// Check if row is selected
|
||||||
|
$('#file-table tbody').on('click', 'tr', function () {
|
||||||
|
if ($(this).hasClass('{{ selected }}')) {
|
||||||
|
$(this).removeClass('{{ selected }}');
|
||||||
|
} else {
|
||||||
|
$('#file-table tbody tr.{{ selected }}').removeClass("{{ selected }}")
|
||||||
|
$(this).addClass('{{ selected }}');
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@@ -1,6 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<table class="{{ table_class }}">
|
<table id="file-table" class="{{ table_class }}">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="{{ head_class }}">
|
<tr class="{{ head_class }}">
|
||||||
<th class="{{ text_center }}">Dataset</th>
|
<th class="{{ text_center }}">Dataset</th>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<td class="{{ text_right }}">{{ dataset.cont_features }}</td>
|
<td class="{{ text_right }}">{{ dataset.cont_features }}</td>
|
||||||
<td class="{{ text_right }}">{{ dataset.classes }}</td>
|
<td class="{{ text_right }}">{{ dataset.classes }}</td>
|
||||||
<td>{{ dataset.balance }}</td>
|
<td>{{ dataset.balance }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Reference in New Issue
Block a user