Add flatten parameter

There is a requirement from Spotlight for data from Backdrop to come in
a flattened format so that graphs can be rendered quicker and .csv
files can be downloaded.

This should replace equivalent JavaScript code that currently runs on
the client.

[Delivers #76044558]