pepkit / pepkit/pephub

How do we convert the `handsontable` sample table representation to a PEP-compatible sample table representation?

Open
#376 3 comments 0 reactions 1 assignee View on GitHub

@sanghoonio is already working on this.

Since Aug 27, 2024.

likely solved
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:

  1. What happens if a user has duplicate column names? This will lead to data-loss as attributes are overwritten
  2. What if a user has an empty column? This leads to objects with null as an attribute (which feels wrong)
  3. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.