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

Adding some additional information to output

parent 7ecf02da
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -39,13 +39,17 @@ class BoxplotTask(AnalyticTask):
"non empty numerical variable.")
df = reduce(lambda l, r: l.merge(r, on='id', how='outer'), variables)
df = apply_id_filter(df=df, id_filter=id_filter)
df = apply_subsets(df=df, subsets=subsets)
variable_names = df.columns.tolist()
variable_names.remove('id')
df = apply_subsets(df=df, subsets=subsets)
df = apply_categories(df=df, categories=categories)
results = {
'data': df.to_json(orient='index'),
'statistics': {}
'statistics': {},
'variables': variable_names,
'categories': list(set(df['category'].tolist())),
'numOfBoxplots': 0,
'subsets': list(set(df['subset'].tolist()))
}
for variable in variable_names:
for subset in list(set(df['subset'].tolist())):
......@@ -60,6 +64,7 @@ class BoxplotTask(AnalyticTask):
if not results['statistics'][variable].get(category):
results['statistics'][variable][category] = {}
results['statistics'][variable][category][subset] = stats
results['numOfBoxplots'] += 1
return results
@staticmethod
......
......@@ -28,8 +28,11 @@ class TestBoxplotAnalytics:
subsets=[])
assert 'data' in results
assert 'statistics' in results
assert len(results['categories']) == 1
assert len(results['subsets']) == 1
assert len(results['variables']) == 4
assert len(json.loads(results['data'])) == 22
assert len(results['statistics']) == 5
assert len(results['statistics']) == 4
assert len(results['statistics']['A']) == 1
assert len(results['statistics']['A']['']) == 1
stats = results['statistics']['A'][''][0]
......
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