From 9c98e5bc50971e91def3b4490deff727c72caa23 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Mon, 25 Mar 2019 15:49:18 +0000 Subject: Start work on annotation view --- app/main/datasets.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/main/datasets.py (limited to 'app/main/datasets.py') diff --git a/app/main/datasets.py b/app/main/datasets.py new file mode 100644 index 0000000..c06b4bf --- /dev/null +++ b/app/main/datasets.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import os +import json + +from flask import current_app + + +def load_data_for_chart(name): + dataset_dir = os.path.join( + current_app.instance_path, current_app.config["DATASET_DIR"] + ) + target_filename = os.path.join(dataset_dir, name + ".json") + with open(target_filename, 'rb') as fid: + data = json.load(fid) + chart_data = [{"value": x} for x in data['series']['V1']['raw']] + return {"chart_data": chart_data} + + -- cgit v1.2.3