From 1cb31ae33033cd07b1c7756bc6dc1b839142a307 Mon Sep 17 00:00:00 2001 From: Jacob Clark Date: Fri, 1 Dec 2023 12:59:20 -0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20impvoed=20subject=20structu?= =?UTF-8?q?re=20import=20flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/guided.css | 6 + scripts/guided-mode/guided-curate-dataset.js | 48 ++-- .../guided_mode/guided_curate_dataset.html | 215 +++++++++++------- 3 files changed, 154 insertions(+), 115 deletions(-) diff --git a/assets/css/guided.css b/assets/css/guided.css index 4b2b9be4a..19fc9668c 100644 --- a/assets/css/guided.css +++ b/assets/css/guided.css @@ -771,6 +771,12 @@ padding: 0px 3px; } +.flex-center { + display: flex; + justify-content: center; + align-items: center; +} + .guided--container-footer-buttons.flex-start { justify-content: flex-start; } diff --git a/scripts/guided-mode/guided-curate-dataset.js b/scripts/guided-mode/guided-curate-dataset.js index 38d668f95..b4228a2fe 100644 --- a/scripts/guided-mode/guided-curate-dataset.js +++ b/scripts/guided-mode/guided-curate-dataset.js @@ -1361,7 +1361,7 @@ const savePageChanges = async (pageBeingLeftID) => { You indicated that you would like to import your subject structure from a spreadsheet, however, you have not added any subjects.

- Please fill out and import the spreadsheet or select the option to add your subject structure manually. + Please fill out and import the spreadsheet or select that you would not like to add your subject structure via a spreadsheet. `, }); throw errorArray; @@ -7821,6 +7821,11 @@ const patchPreviousGuidedModeVersions = async () => { sodaJSONObj["cuartion-mode"] = "guided"; } + // Skip the subject spreadsheet importatin page if subjects have already been imported + if (getExistingSubjectNames().length > 0) { + guidedSkipPage("guided-subject-structure-spreadsheet-importation-tab"); + } + // If no other conditions are met, return the page the user was last on return sodaJSONObj["page-before-exit"]; }; @@ -11387,7 +11392,7 @@ const validateDatasetStructureSpreadsheet = async (sheetData) => { if (sheetData.length === 0) { await swalShowError( - "Empty dataset structure", + "Empty subject spreadsheet structure", "Please add data to the spreadsheet and try again" ); return false; @@ -11540,18 +11545,10 @@ document return; } - // Get the count of existing subjects, pools, and samples to compare after the import is done - const preImportSubjectCount = getExistingSubjectNames().length; - const preImportPoolCount = getExistingPoolNames().length; - const preImportSampleCount = getExistingSampleNames().length; - for (const row of sheetData) { const subjectName = lowercaseFirstLetter(row["Subject ID"]); const subjectsPool = lowercaseFirstLetter(row["Pool ID"]); const sampleName = lowercaseFirstLetter(row["Sample ID"]); - console.log("SUBJECT NAME", subjectName); - console.log("SUBJECTS POOL", subjectsPool); - console.log("SAMPLE NAME", sampleName); // Check to see if the subject already exists const subjectAlreadyExists = getExistingSubjectNames().includes(subjectName); @@ -11574,31 +11571,14 @@ document } } - // Get the count of existing subjects, pools, and samples to compare after the import is done - const postImportSubjectCount = getExistingSubjectNames().length; - const postImportPoolCount = getExistingPoolNames().length; - const postImportSampleCount = getExistingSampleNames().length; - - const subjectsAdded = postImportSubjectCount - preImportSubjectCount; - const poolsAdded = postImportPoolCount - preImportPoolCount; - const samplesAdded = postImportSampleCount - preImportSampleCount; - - let successfulImportString = ""; - if (subjectsAdded > 0) { - successfulImportString += `

${subjectsAdded} subjects added

`; - } - if (poolsAdded > 0) { - successfulImportString += `

${poolsAdded} pools added

`; - } - if (samplesAdded > 0) { - successfulImportString += `

${samplesAdded} samples added

`; - } - await swalShowInfo( - "Dataset structure successfully imported", - `${successfulImportString} -
- You will now be taken to the next step where you can review/edit the imported data.` + "Subject structure successfully imported", + ` + You will now be taken to the next step where you can review/edit the imported data. +
+
+ Note: You will not be able to return to this step once you proceed. + ` ); $("#guided-next-button").click(); }); diff --git a/sections/guided_mode/guided_curate_dataset.html b/sections/guided_mode/guided_curate_dataset.html index da8095cd2..6d3e7cdd6 100644 --- a/sections/guided_mode/guided_curate_dataset.html +++ b/sections/guided_mode/guided_curate_dataset.html @@ -1203,10 +1203,16 @@

Subject spreadsheet importation

The SDS requires a unique ID for each subject in your dataset. SODA provides a feature - that allows you to create a list of your subjects in an external spreadsheet, and then - import the list into SODA, saving you from manually typing out each subject in the - SODA UI. + that allows you to create a list of your subjects in an external spreadsheet and then + import the list into SODA, saving you from having to type out each subject in the SODA + UI.

+
-
-
-

How do I

- -
-
- -

- Subject ID column: Type each subject's name here, starting with 'sub-'. - Avoid using special characters or spaces. -

-
-
-
- -

- Subject ID column: Type each subject's name here, starting with 'sub-'. - Avoid using special characters or spaces. -

-

- Pool ID column: Type the name of the pool that subject belongs to here, - starting with 'pool-'. Avoid using special characters or spaces. -

-
-
- -

- Subject ID column: Type each subject's name here, starting with 'sub-'. - Avoid using special characters or spaces. -

-

- Sample ID column: Type each sample's name here, starting with 'sam-'. All - sample names must be unique. Avoid using special characters or spaces. -

-

- Note: If a subject has more than one sample, repeat the subject's name in - the 'Subject ID' column for each sample. -

-
-
- -

- Subject ID column: Type each subject's name here, starting with 'sub-'. - Avoid using special characters or spaces. -

-

- Pool ID column: Type the name of the pool that subject belongs to here, - starting with 'pool-'. Avoid using special characters or spaces. -

-

- Sample ID column: Type each sample's name here, starting with 'sam-'. All - sample names must be unique. Avoid using special characters or spaces. -

-

- Note: If a pooled subject has more than one sample, repeat the subject's - name in the 'Subject ID' column, the subject's pool's name in the 'Pool ID' - column, and the sample's name in the 'Sample ID' column for each sample. -

-

spreadsheet creation @@ -1433,9 +1364,131 @@

Open the spreadsheet -

- Step 2. Once you have filled out the spreadsheet, click the button below to - import it into SODA. +

+ Step 2. Add your + IDS to the + spreadsheet and save it. +

+
+
+
+

+ How do I fill out the + spreadsheet? +

+ +
+
+
+ +
+

+ Subject ID column: Type each subject's name here, starting with + 'sub-'. Avoid using special characters or spaces. +

+
+
+
+
+

+ How do I fill out the + spreadsheet? +

+ +
+
+
+ +
+

+ Subject ID column: Type each subject's name here, starting with + 'sub-'. Avoid using special characters or spaces. +

+

+ Pool ID column: Type the name of the pool that subject belongs to + here, starting with 'pool-'. Avoid using special characters or spaces. +

+
+
+
+
+

+ How do I fill out the + spreadsheet? +

+ +
+
+
+ +
+

+ Subject ID column: Type each subject's name here, starting with + 'sub-'. Avoid using special characters or spaces. +

+

+ Sample ID column: Type each sample's name here, starting with 'sam-'. + All sample names must be unique. Avoid using special characters or spaces. +

+

+ Note: If a subject has more than one sample, repeat the subject's name + in the 'Subject ID' column for each sample. +

+
+
+
+
+

+ How do I fill out the + spreadsheet? +

+ +
+
+
+ +
+

+ Subject ID column: Type each subject's name here, starting with + 'sub-'. Avoid using special characters or spaces. +

+

+ Pool ID column: Type the name of the pool that subject belongs to + here, starting with 'pool-'. Avoid using special characters or spaces. +

+

+ Sample ID column: Type each sample's name here, starting with 'sam-'. + All sample names must be unique. Avoid using special characters or spaces. +

+

+ Note: If a pooled subject has more than one sample, repeat the + subject's name in the 'Subject ID' column, the subject's pool's name in the + 'Pool ID' column, and the sample's name in the 'Sample ID' column for each + sample. +

+
+
+
+

+ Step 3. Once you have filled out the + spreadsheet, click + the button below to import it into SODA.