haganbt / PYLON-exporter

Utility for exporting data from a PYLON index
4 stars 2 forks source link

Output as CSV #8

Closed haganbt closed 9 years ago

samaybar commented 9 years ago

Don't know whether you intended this, but it would be nice to create an option to output data for one of then then type to a single CSV ready for network graph. (i.e. each primary request could get its own csv rather than one csv of all the results.)

Passing in child results, might run something like: var csv = ''; if (typeof (data) !== 'object' || !data.analysis.results) return; for (var i = 1; i < data.analysis.results.length; i++) { csv +=data.analysis.results[i].key + ";" + data.analysis.results[0].key + ";" + data.analysis.results[i].interactions + ";" + data.analysis.results[i].unique_authors+ "\n"; } return csv;

(i may have the key-value pair backwards, per our earlier conversation)

haganbt commented 9 years ago

@samaybar funny you mention this, im just starting to write down the use cases for this here:: https://github.com/haganbt/PYLON-exporter/issues/10 I have a design mapped out but want to make sure I capture all of the possible options to confirm its correct.

The key thing here is that the "merge" of the different data sets has to be done higher up the stack (rather than at the CSV layer which is the very final step) as each request is independent and asynchronous and hence we have no idea which will return when, and which ones need to be merged.

samaybar commented 9 years ago

@haganbt good point. it worked for me to do it the way i did only because i was running just that one query with the children (so you know you get the big one back first and the order of the little ones doesn't matter).

haganbt commented 9 years ago

Complete 9ab3e1f33e823d2744cf7dbc0479c8dc0b1c73cc