cidgoh / DataHarmonizer

A standardized browser-based spreadsheet editor and validator that can be run offline and locally, and which includes templates for SARS-CoV-2 and Monkeypox sampling data. This project, created by the Centre for Infectious Disease Genomics and One Health (CIDGOH), at Simon Fraser University, is now an open-source collaboration with contributions from the National Microbiome Data Collaborative (NMDC), the LinkML development team, and others.
MIT License
91 stars 25 forks source link

DH require at least two columns in section? #253

Closed turbomam closed 2 years ago

turbomam commented 2 years ago

It appears that DH won't tolerate a section that has only one column, even though it says "section with no columns'

See https://github.com/microbiomedata/DataHarmonizer/issues/79

We will elaborate today or tomorrow

sujaypatil96 commented 2 years ago

Thank you for the quick reasoning as to why the original error message was showing up @turbomam.

If you look within main.js, specifically at L#246, i.e., the line that computes min_cols is what's causing the makes the #unmapped-headers-list div to become visible incorrectly.

You can add this statement on the next line:

console.log(min_cols)

And if you open the console section on your browser's Developer Tools, you'll see that the app stops logging after 0, meaning it's taking the sections with one column in them, subtracting 1, making it zero, and hence executing the logic which makes the #unmapped-headers-list div visible.

Fix

Change L#246 to:

let min_cols = parent.children.length;

cc: @turbomam @ddooley

ddooley commented 2 years ago

Yes I think that's right, although line 260 then needs an adjustment to pad remainder of first row columns with empty values. I've added that and its now on master (but not in release yet). If you could test in your error triggering situations that would be appreciated. I tested it and it seems to work ok with 1 section, 1 field scenario. Also I improved display of template vs. imported file fields.

sujaypatil96 commented 2 years ago

Thank you the fixes @ddooley. I checked, and the file now gets loaded into the system without any parsing problems. This issue is ready to be closed @turbomam.

turbomam commented 2 years ago

This issue is ready to be closed @turbomam.

Thanks guys, you're the best.

I merged your fix into our master branch and have pushed a new build of the NMDC DataHarmonizer, which appears to be visible at https://microbiomedata.github.io/DataHarmonizer/main.html?template=dev already.

Sample data file: https://raw.githubusercontent.com/microbiomedata/DataHarmonizer/master/docs/template/dev/exampleInput/valid_jgi_gen_emsl.tsv