Open FrankApiyo opened 2 years ago
Currently, when you make a request to the charts endpoint asking to group data by another field, response looks like this
{ "data": [ { "_submitted_by": "x", "items": [ { "INTRO_DISTRICT": [ "abcd" ], "count": 1 }, { "INTRO_DISTRICT": [ "efgh" ], "count": 15 }, { "INTRO_DISTRICT": [ "Ijkl" ], "count": 14 }, { "INTRO_DISTRICT": [ "mnop" ], "count": 24 }, { "INTRO_DISTRICT": [ "qrst" ], "count": 5 } ] } ], "data_type": "categorized", "field_label": "Submission By", "field_xpath": "_submitted_by", "field_name": "_submitted_by", "field_type": "text", "grouped_by": "INTRO_DISTRICT", "xform": 2852 }
I wonder if it would be possible to modify it to look as follows
{ "data": [ { "_submitted_by": "x", "INTRO_DISTRICT": [ "abcd" ], "count": 1 }, { "_submitted_by": "x", "INTRO_DISTRICT": [ "efgh" ], "count": 15 }, { "_submitted_by": "x", "INTRO_DISTRICT": [ "Ijkl" ], "count": 14 }, { "_submitted_by": "x", "INTRO_DISTRICT": [ "mnop" ], "count": 24 }, { "_submitted_by": "x", "INTRO_DISTRICT": [ "qrst" ], "count": 5 } ], "data_type": "categorized", "field_label": "Submission By", "field_xpath": "_submitted_by", "field_name": "_submitted_by", "field_type": "text", "grouped_by": "INTRO_DISTRICT", "xform": 2852 }
we might need to rearrange the data in order to graph it properly with vega as follows https://gist.github.com/FrankApiyo/3add6159296d3fb2e36f73fb1d838269
@FrankApiyo This has a lot of duplication and i feel it can be easily achieved on the frontend.
Suggested Feature / Enhancement
Currently, when you make a request to the charts endpoint asking to group data by another field, response looks like this
I wonder if it would be possible to modify it to look as follows
Benefits of implementing the feature/enhancement
we might need to rearrange the data in order to graph it properly with vega as follows https://gist.github.com/FrankApiyo/3add6159296d3fb2e36f73fb1d838269