Change behaviour when flattening read API output

When given this input:

    group_by: type, collect: value:sum, type: elephant

Previously the flat merge would have generated keys of the format

    elephant:value:sum: 999

But actually the output which we would find far easier to handle
is of the format

    type: elephant
    value:sum: 999

This commit removes most of the flat merge processing to give us
output from the API which is easier for clients to handle.
Include test_build_data_with_flatten inside class