feat: add grouped time analysis endpoint

This commit is contained in:
2026-01-31 16:46:15 +00:00
parent 70cd4393a5
commit 657bd37cdd
2 changed files with 33 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ from flask_cors import CORS
from server.stat_gen import StatGen
import pandas as pd
import traceback
app = Flask(__name__)
@@ -102,6 +103,19 @@ def get_summary():
return jsonify({"error": f"Malformed or missing data: {str(e)}"}), 400
except Exception as e:
return jsonify({"error": f"An unexpected error occurred: {str(e)}"}), 500
@app.route("/stats/time", methods=["GET"])
def get_time_analysis():
if stat_obj is None:
return jsonify({"error": "No data uploaded"}), 400
try:
return jsonify(stat_obj.time_analysis()), 200
except ValueError as e:
return jsonify({"error": f"Malformed or missing data: {str(e)}"}), 400
except Exception as e:
print(traceback.format_exc())
return jsonify({"error": f"An unexpected error occurred: {str(e)}"}), 500
@app.route('/reset', methods=["GET"])
def reset_dataset():