Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tomgp opened this issue Feb 12, 2021 · 1 comment
Labels

Comments

@tomgp
Copy link
Contributor

tomgp commented Feb 12, 2021

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?)

@tomgp tomgp changed the title "key by": Process a sheet into a "dictionary" instead of an array of objects "key by": Process a sheet into a keyed set of objects instead of straightforward array Feb 12, 2021
@tomgp tomgp mentioned this issue Mar 8, 2021
@github-actions
Copy link

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

@github-actions github-actions bot added the stale label Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant