From 1a64c28e56236164ff32f4ba978c708ad135704f Mon Sep 17 00:00:00 2001 From: huuaho <32457341+huuaho@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:20:02 -0400 Subject: [PATCH 1/2] updated mapping, added append string for drs, corrected header --- src/bento/fileCentricCartWorkflowData.js | 4 +- .../exportButton/exportButton.js | 46 +++++++++---------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/bento/fileCentricCartWorkflowData.js b/src/bento/fileCentricCartWorkflowData.js index d94e7489..7203508b 100644 --- a/src/bento/fileCentricCartWorkflowData.js +++ b/src/bento/fileCentricCartWorkflowData.js @@ -112,8 +112,8 @@ export const myFilesPageData = { export const manifestData = { - keysToInclude: ['file_id', 'file_name', 'subject_id', 'md5sum', 'associated_file', 'associated_drs_uri', 'associated_md5sum', 'study_acronym', 'phs_accession', 'sample_id', 'accesses', 'file_type', 'gender', 'race', 'primary_diagnosis', 'is_tumor', 'analyte_type', 'organ_or_tissue', 'study_data_type', 'library_strategy', 'image_modality', 'experimental_strategy', 'library_layouts', 'license', 'file_size'], - header: ['drs_uri', 'name', 'Participant ID', 'Md5sum', 'Associated File', 'Associated File DRS URI', 'Associated File md5sum', 'Study Name', 'Accession', 'Sample Id', 'Study Access', 'File Type', 'Gender', 'Race', 'Primary Diagnosis', 'Sample Tumor Status', 'Analyte Type', 'Organ or Tissue', 'Study Data Type', 'Library Strategy', ' Image Modality', 'Experimental Strategy', 'Library Layout', 'License', 'File Size (in bytes)', 'User Comments'], + keysToInclude: ['file_id', 'file_name', 'subject_id', 'md5sum', 'associated_file', 'associated_drs_uri', 'associated_md5sum', 'study_acronym', 'phs_accession', 'sample_id', 'accesses', 'file_type', 'gender', 'race', 'primary_diagnoses', 'is_tumor', 'analyte_type', 'organ_or_tissue', 'study_data_type', 'library_strategy', 'image_modality', 'experimental_strategy', 'library_layouts', 'license', 'file_size'], + header: ['drs_uri', 'name', 'Participant ID', 'Md5sum', 'Associated File', 'Associated File DRS URI', 'Associated File md5sum', 'Study Name', 'Accession', 'Sample Id', 'Study Access', 'File Type', 'Gender', 'Race', 'Primary Diagnoses', 'Sample Tumor Status', 'Analyte Type', 'Organ or Tissue', 'Study Data Type', 'Library Strategy', 'Image Modality', 'Experimental Strategy', 'Library Layout', 'License', 'File Size (in bytes)', 'User Comments'], }; // --------------- GraphQL query - Retrieve selected cases info -------------- diff --git a/src/pages/cart/customComponent/exportButton/exportButton.js b/src/pages/cart/customComponent/exportButton/exportButton.js index 0b3e8449..ec9fded2 100644 --- a/src/pages/cart/customComponent/exportButton/exportButton.js +++ b/src/pages/cart/customComponent/exportButton/exportButton.js @@ -5,6 +5,7 @@ import { Paper, Popper, Button, ClickAwayListener, Grow, MenuItem, MenuList, wit import { noop } from 'lodash'; import { useQuery } from '@apollo/client'; import { MY_CART_MANIFEST_QUERY } from '../../../../bento/tableDownloadCSV' +import { manifestData } from '../../../../bento/fileCentricCartWorkflowData' import arrowDownPng from './assets/arrowDown.png'; import cgcIcon from './assets/cgc.svg'; import { getManifestData } from './util/TableService'; @@ -69,31 +70,26 @@ const ExportButtonView = (props,) => { if (!data) { return null; } - const processedStoreManifestPayload = data.filesInList.map((el) => ({ - file_name: el ? el.file_name : undefined, - file_size: el ? el.file_size : undefined, - file_id: el ? el.file_id : undefined, - file_type: el ? el.file_type : undefined, - md5sum: el ? el.md5sum : undefined, - experimental_strategy: el ? el.experimental_strategy : undefined, - study_acronym: el ? el.study_acronym : undefined, - phs_accession: el ? el.phs_accession : undefined, - study_data_type: el ? el.study_data_type : undefined, - accesses: el ? el.accesses : undefined, - image_modality: el ? el.image_modality : undefined, - organ_or_tissue: el ? el.organ_or_tissue : undefined, - license: el ? el.license : undefined, - library_layouts: el ? el.library_layouts : undefined, - library_strategy: el ? el.library_strategy : undefined, - subject_id: el ? el.subject_id : undefined, - gender: el ? el.gender : undefined, - race: el ? el.race : undefined, - primary_diagnoses: el ? el.primary_diagnoses : undefined, - sample_id: el ? el.sample_id : undefined, - analyte_type: el ? el.analyte_type : undefined, - is_tumor: el ? el.is_tumor : undefined, - })); - + const appendString = 'drs://nci-crdc.datacommons.io/' + const processedStoreManifestPayload = data.filesInList.map((el) => { + const obj = {} + // - 1 to ignore the User Comments column + for (let i = 0; i < manifestData.keysToInclude.length - 1; i++) { + if (manifestData.keysToInclude[i] === 'file_id') { + obj[manifestData.header[i]] = el && el[manifestData.keysToInclude[i]] ? + appendString + el[manifestData.keysToInclude[i]] + : + ""; + } + else { + obj[manifestData.header[i]] = el && el[manifestData.keysToInclude[i]] ? + el[manifestData.keysToInclude[i]] + : + ""; + } + } + return obj; + }); return processedStoreManifestPayload; }; From 1fee2e900f9bb7626af12a5c7f8bb7ee7157f342 Mon Sep 17 00:00:00 2001 From: huuaho <32457341+huuaho@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:37:41 -0400 Subject: [PATCH 2/2] off by 1 error --- src/pages/cart/customComponent/exportButton/exportButton.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/cart/customComponent/exportButton/exportButton.js b/src/pages/cart/customComponent/exportButton/exportButton.js index ec9fded2..acf4074f 100644 --- a/src/pages/cart/customComponent/exportButton/exportButton.js +++ b/src/pages/cart/customComponent/exportButton/exportButton.js @@ -73,8 +73,7 @@ const ExportButtonView = (props,) => { const appendString = 'drs://nci-crdc.datacommons.io/' const processedStoreManifestPayload = data.filesInList.map((el) => { const obj = {} - // - 1 to ignore the User Comments column - for (let i = 0; i < manifestData.keysToInclude.length - 1; i++) { + for (let i = 0; i < manifestData.keysToInclude.length; i++) { if (manifestData.keysToInclude[i] === 'file_id') { obj[manifestData.header[i]] = el && el[manifestData.keysToInclude[i]] ? appendString + el[manifestData.keysToInclude[i]]