diff --git a/README.md b/README.md index 95fe459..53240c8 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,12 @@ docker build -t flask-web-app . docker run -it -p 5000:5000 -v $(pwd)/src/:/src -v /home/jerome/Perso/freqtradeDocker/user_data/:/mnt/external flask-web-app bash puis : python3 app.py + +## librairies + + ### Génération d'un rapport sur le dataframe +ydata-profiling : https://github.com/ydataai/ydata-profiling + + profile = ProfileReport(dataframe, tsmode=True, sortby="date", title="Time-Series EDA") + + profile.to_file("report_timeseries.html") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 615cb11..7669346 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ Werkzeug==2.2.3 joblib==1.4.2 pyarrow pandas-ta +ydata-profiling \ No newline at end of file diff --git a/src/app.py b/src/app.py index 9089614..80bff17 100644 --- a/src/app.py +++ b/src/app.py @@ -6,7 +6,7 @@ import os import pickle import joblib from io import TextIOWrapper - +from ydata_profiling import ProfileReport app = Flask(__name__) FREQTRADE_USERDATA_DIR = '/mnt/external' @@ -126,6 +126,26 @@ def read_feather(filename): print(e) return jsonify({"error": str(e)}), 500 +@app.route('/generate_report') +def generate_report(): + filename = request.args.get('filename', '') + path = os.path.join(FREQTRADE_USERDATA_DIR + "/data/binance/", filename) + print(path) + indicators = request.args.get('indicators', '').split(',') + print(indicators) + + try: + dataframe = pd.read_feather(path) + print(dataframe.columns) + df = dataframe[indicators] + profile = ProfileReport(df.loc[1:100], tsmode=True, sortby="date", title="Time-Series EDA") + + profile.to_file(FREQTRADE_USERDATA_DIR + "/reports/report_timeseries.html") + return dataframe.to_json(orient="records") + except Exception as e: + print(e) + return jsonify({"error": str(e)}), 500 + @app.route('/get_chart_data') def get_chart_data(): filename = request.args.get('filename', '') diff --git a/src/static/js/functions.js b/src/static/js/functions.js index 30d6ff4..474fa70 100644 --- a/src/static/js/functions.js +++ b/src/static/js/functions.js @@ -497,10 +497,36 @@ function loadFeather(filename) { element.value = filename fetch(`/read_feather/${filename}`) .then(response => response.json()) - .then(data => renderChart(data, filename, true) ); + .then(data => { + renderChart(data, filename, true) + initReport(data) + }) +} + +function initReport(data) { + string = "