signal-noise / datasupply

Data Supply is an opinionated data processing, provision and presentation library of components for Javascript
MIT License
0 stars 0 forks source link

"key by": Process a sheet into a keyed set of objects instead of straightforward array #25

Open tomgp opened 3 years ago

tomgp commented 3 years ago

At the moment running the supply command converts spreadsheets in the form of dsv files to json files. The spreadsheet data becomes and array of object, one pre row with the object keys being the cells in first line of the spreadsheet.

Another common representation we might want is that of an object where each row is a value keyed by a given column name, (a dictionary in python terms)

eg

name,lat,lon
Los Angeles,34°03′N,118°15′W
New York City,40°42′46″N,74°00′21″W
Paris,48°51′24″N,2°21′03″E

could become

{
"Los Angeles":{
  "name":"Los Angeles", "lat":"34°03′N", "lon":"118°15′W"
}
 "New York City":{ }
 "Paris":{ }
}

Something like lodash's keyBy function I envisage this would be secondary process after the initial parsing so once you have your standard json representation that's then converted to a keyed json representation (the means to do so possibly encoded in the metadata file?)

github-actions[bot] commented 3 years ago

This issue is being marked as stale due to inactivity. To avoid it being closed please update it.