Skip to content
Snippets Groups Projects
Commit fd44e144 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

make boxplot results json serializable

parent e2d01be6
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -42,17 +42,16 @@ class BoxplotTask(AnalyticTask):
df = reduce(lambda l, r: l.append(r), features)
if id_filter:
df = df[df['id'].isin(id_filter)]
feature_names = df['feature'].unique()
df = apply_subsets(df=df, subsets=subsets)
df = apply_categories(df=df, categories=categories)
results = {
'data': df.to_json(orient='records'),
'statistics': {},
'features': feature_names,
'categories': df['category'].unique(),
'subsets': df['subset'].unique()
'features': df['feature'].unique().tolist(),
'categories': df['category'].unique().tolist(),
'subsets': df['subset'].unique().tolist()
}
for feature in feature_names:
for feature in results['features']:
for subset in results['subsets']:
for category in results['categories']:
values = df[(df['subset'] == subset) &
......
......@@ -24,6 +24,7 @@ class TestBoxplotAnalytics:
categories=[],
id_filter=[],
subsets=[])
json.dumps(results) # check if result is json serializable
assert 'data' in results
assert 'statistics' in results
assert len(json.loads(results['data'])) == 8
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment