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"
|
||||
color3 = "#B1A0C7"
|
||||
|
||||
def __init__(self, excel=False, book=None):
|
||||
def __init__(self, excel=False, book=None, output=True):
|
||||
self.excel = excel
|
||||
self.env = EnvData().load()
|
||||
self.close = False
|
||||
self.output = True
|
||||
self.output = output
|
||||
self.header_text = f"Datasets used in benchmark ver. {__version__}"
|
||||
if excel:
|
||||
self.max_length = 0
|
||||
|
@@ -6,7 +6,7 @@ import xlsxwriter
|
||||
from benchmark.Utils import Files, Folders
|
||||
from benchmark.Arguments import EnvData
|
||||
from benchmark.ResultsBase import StubReport
|
||||
from benchmark.ResultsFiles import Excel
|
||||
from benchmark.ResultsFiles import Excel, ReportDatasets
|
||||
from benchmark.Datasets import Datasets
|
||||
from flask import Flask
|
||||
from flask import render_template, request, redirect, url_for
|
||||
@@ -121,7 +121,11 @@ def excel():
|
||||
book = None
|
||||
if selected_files[0] == "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:
|
||||
for file_name in selected_files:
|
||||
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 head_class = "bg-primary text-white" %}
|
||||
{% set text_right = "text-end" %}
|
||||
{% set container = "container-fluid" %}
|
||||
{% set container = "container" %}
|
||||
{% set selected = "selected" %}
|
||||
{% else %}
|
||||
{% set close_button = '<button class="delete is-large" onclick="location.href = \'/index/' ~ compare ~ '\'"></button>' %}
|
||||
{% 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 head_class = "is-selected" %}
|
||||
{% set text_right = "has-text-right" %}
|
||||
{% set container = "container is-fluid" %}
|
||||
{% set container = "container" %}
|
||||
{% set selected = "is-selected" %}
|
||||
{% endif %}
|
||||
{% block content %}
|
||||
<div class="{{ container }}">
|
||||
<h1 class="{{ h1_class }}">{{ close_button|safe }} Datasets Report</h1>
|
||||
<button class="{{ button }}" onclick="excelFiles(['datasets'], false)"><i class="mdi mdi-file-excel"></i> Excel</button>
|
||||
<h1 class="{{ h1_class }}">{{ close_button|safe }} Benchmark Datasets Report</h1>
|
||||
<button class="{{ button_class }}" onclick="excelFiles(['datasets'], false)"><i class="mdi mdi-file-excel"></i> Excel</button>
|
||||
{% include "partials/datasets_table.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block jscript %}
|
||||
<script>
|
||||
{% 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>
|
||||
{% endblock %}
|
@@ -1,6 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<table class="{{ table_class }}">
|
||||
<table id="file-table" class="{{ table_class }}">
|
||||
<thead>
|
||||
<tr class="{{ head_class }}">
|
||||
<th class="{{ text_center }}">Dataset</th>
|
||||
@@ -20,7 +20,7 @@
|
||||
<td class="{{ text_right }}">{{ dataset.cont_features }}</td>
|
||||
<td class="{{ text_right }}">{{ dataset.classes }}</td>
|
||||
<td>{{ dataset.balance }}</td>
|
||||
<tr>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user