How do we convert the `handsontable` sample table representation to a PEP-compatible sample table representation?
@sanghoonio is already working on this.
Since Aug 27, 2024.
- Dominant language
- TypeScript
- Stars
- 22
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Overview
Probably the most bug-prone step in the sample-table of the PEPhub UI is the conversion of the data-representation used by handsontable to the data-representation used in our database. Specifically, we need to convert an array-of-arrays, into an array-of-objects. You can view the current function deployed now.
Essentially the function must convert this:
[
['col1', 'col2', 'col3'],
['s1_col1', 's1_col2', 's1_col3'],
['s2_col1', 's2_col2', 's2_col3'],
]
Into this:
[
{ col1: 's1_col1', col2: 's1_col2', col3: 's1_col3' },
{ col1: 's2_col1', col2: 's2_col2', col3: 's2_col3' },
]
Things that make it tricky
There are problems with this conversion; moreover questions that need to be answered:
- What happens if a user has duplicate column names? This will lead to data-loss as attributes are overwritten
- What if a user has an empty column? This leads to objects with
nullas an attribute (which feels wrong) - What if the user skips a row? Should it be blank or smart enough to know that they don't want that as a sample?
The conversion seems to be lossy by nature. In the interest of trying to balance out not doing magic behind the scenes but also promptly warning the user about potential errors, it becomes quite difficult to write the function, and I am looking for assistance.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.