OpenDataServices / flatten-tool

Tools for generating CSV and other flat versions of the structured data
http://flatten-tool.readthedocs.io/en/latest/
MIT License
103 stars 15 forks source link

Add support for arrays of strings / plain lists #354

Open duncandewhurst opened 4 years ago

duncandewhurst commented 4 years ago

As noted in the docs, arrays of strings (plain lists) are not supported.

Adding support for these would be useful for collecting OCDS data in a spreadsheet, in particular for populating parties/roles field from multiple sheets.

Example: Tenderer details entered in one sheet and suppliers details in another

Tenderers sheet parties/0/id parties/0/roles/0
123456 tenderer
Suppliers sheet parties/0/id parties/0/roles/0
123456 supplier

Desired output

"parties": [
  {
    "id": "123456",
    "roles": ["tenderer","supplier"]
  }
]

Would it be possible add this functionality?

Bjwebb commented 4 years ago

This should be possible. But, without properly getting my head stuck back into the code, its hard for me to estimate how much work this would be.

Bjwebb commented 4 years ago

Add support for arrays of strings / plain lists

yolile commented 4 years ago

@duncandewhurst actually, I think that this is already supported, you should use ";" as separator and the --schema argument

duncandewhurst commented 4 years ago

Does that work for merging cells from separate sheets into the same string array?

Bjwebb commented 4 years ago

@duncandewhurst No, I don't think so.

jpmckinney commented 4 years ago

@duncandewhurst As a workaround, could you have a parties sheet, and then the other sheets have a dropdown from which users can select one of the parties? This is probably better anyway, to avoid conflicting data across sheets.

Bjwebb commented 4 years ago

I've taken a look into this, and I think it could be done in 2-3 days of my time.

duncandewhurst commented 4 years ago

Thanks for the estimate @Bjwebb

@duncandewhurst As a workaround, could you have a parties sheet, and then the other sheets have a dropdown from which users can select one of the parties? This is probably better anyway, to avoid conflicting data across sheets.

Yes, but this was in the context of minimizing the number of sheets required to enter data to keep the template simple to understand and use.