From 16b1512cf04691a417ebb0c60373ec3ffbc0d80a Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Wed, 10 Jan 2024 14:55:35 -0500 Subject: [PATCH 01/13] Column label updates for batch and QC tables --- src/content/dataSubmissions/DataSubmission.tsx | 2 +- src/content/dataSubmissions/QualityControl.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/dataSubmissions/DataSubmission.tsx b/src/content/dataSubmissions/DataSubmission.tsx index 76e79757..0523961b 100644 --- a/src/content/dataSubmissions/DataSubmission.tsx +++ b/src/content/dataSubmissions/DataSubmission.tsx @@ -259,7 +259,7 @@ const columns: Column[] = [ } }, { - label: "Errors", + label: "Upload Errors", renderValue: (data) => ( {({ handleOpenErrorDialog }) => { diff --git a/src/content/dataSubmissions/QualityControl.tsx b/src/content/dataSubmissions/QualityControl.tsx index 60455c49..2455266b 100644 --- a/src/content/dataSubmissions/QualityControl.tsx +++ b/src/content/dataSubmissions/QualityControl.tsx @@ -44,7 +44,7 @@ const StyledBreakAll = styled(Box)({ const columns: Column[] = [ { - label: "Type", + label: "Node Type", renderValue: (data) => {data?.nodeType}, field: "nodeType", }, @@ -75,7 +75,7 @@ const columns: Column[] = [ default: true }, { - label: "Reasons", + label: "Validation Issues", renderValue: (data) => data?.description?.length > 0 && ( {({ handleOpenErrorDialog }) => ( From 9ea5661e981ead26295396af239ce9edf3035dfc Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Wed, 10 Jan 2024 16:34:17 -0500 Subject: [PATCH 02/13] Refreshed batch table after batch record created --- src/components/DataSubmissions/DataSubmissionUpload.tsx | 4 +++- src/content/dataSubmissions/DataSubmission.tsx | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/DataSubmissions/DataSubmissionUpload.tsx b/src/components/DataSubmissions/DataSubmissionUpload.tsx index 75e34c5b..dfedbdb5 100644 --- a/src/components/DataSubmissions/DataSubmissionUpload.tsx +++ b/src/components/DataSubmissions/DataSubmissionUpload.tsx @@ -114,10 +114,11 @@ const UploadRoles: User["role"][] = ["Organization Owner"]; // and submission ow type Props = { submitterID: string; readOnly?: boolean; + onCreateBatch: () => void; onUpload: (message: string, severity: AlertColor) => void; }; -const DataSubmissionUpload = ({ submitterID, readOnly, onUpload }: Props) => { +const DataSubmissionUpload = ({ submitterID, readOnly, onCreateBatch, onUpload }: Props) => { const { submissionId } = useParams(); const { user } = useAuthContext(); @@ -228,6 +229,7 @@ const DataSubmissionUpload = ({ submitterID, readOnly, onUpload }: Props) => { if (!newBatch) { return; } + onCreateBatch(); const uploadResult: UploadResult[] = []; diff --git a/src/content/dataSubmissions/DataSubmission.tsx b/src/content/dataSubmissions/DataSubmission.tsx index 0523961b..49d666c8 100644 --- a/src/content/dataSubmissions/DataSubmission.tsx +++ b/src/content/dataSubmissions/DataSubmission.tsx @@ -499,6 +499,7 @@ const DataSubmission = () => { Date: Fri, 19 Jan 2024 12:29:48 -0500 Subject: [PATCH 03/13] Rename quality control to validation results --- src/content/dataSubmissions/DataSubmission.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/content/dataSubmissions/DataSubmission.tsx b/src/content/dataSubmissions/DataSubmission.tsx index 0ad5b2f2..b770cdd5 100644 --- a/src/content/dataSubmissions/DataSubmission.tsx +++ b/src/content/dataSubmissions/DataSubmission.tsx @@ -322,7 +322,7 @@ const columns: Column[] = [ const URLTabs = { DATA_UPLOAD: "data-upload", - QUALITY_CONTROL: "quality-control" + VALIDATION_RESULTS: "validation-results" }; const submissionLockedStatuses: SubmissionStatus[] = ["Submitted", "Released", "Completed", "Canceled", "Archived"]; @@ -531,10 +531,10 @@ const DataSubmission = () => { selected={tab === URLTabs.DATA_UPLOAD} /> From cbf453fbd437b195a272662aa653e9c5064e2feb Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Fri, 19 Jan 2024 12:30:31 -0500 Subject: [PATCH 04/13] Updated submissionQCResults API and types --- src/graphql/submissionQCResults.ts | 8 +++++++- src/types/Submissions.d.ts | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/graphql/submissionQCResults.ts b/src/graphql/submissionQCResults.ts index 4b0ac281..6ec05ff0 100644 --- a/src/graphql/submissionQCResults.ts +++ b/src/graphql/submissionQCResults.ts @@ -25,13 +25,19 @@ export const query = gql` results { submissionID nodeType + validationType batchID displayID nodeID CRDC_ID severity uploadedDate - description { + validatedDate + errors { + title + description + } + warnings { title description } diff --git a/src/types/Submissions.d.ts b/src/types/Submissions.d.ts index ed0f3092..bcf14f37 100644 --- a/src/types/Submissions.d.ts +++ b/src/types/Submissions.d.ts @@ -170,13 +170,16 @@ type QCResults = { type QCResult = { submissionID: string; nodeType: string; + validationType: "metadata" | "file"; // [metadata, file] batchID: string; displayID: number; nodeID: string; CRDC_ID: string; severity: "Error" | "Warning"; // [Error, Warning] - uploadedDate: string // batch.updatedAt - description: ErrorMessage[]; + uploadedDate: string; // batch.updatedAt + validatedDate: string; + errors: ErrorMessage[]; + warnings: ErrorMessage[]; }; type ErrorMessage = { From 69868df25e426f537ea626f83f35aeaa5b83a122 Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Fri, 19 Jan 2024 12:31:12 -0500 Subject: [PATCH 05/13] Updated ErrorDialog for Data Upload tab issues column --- src/content/dataSubmissions/ErrorDialog.tsx | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/content/dataSubmissions/ErrorDialog.tsx b/src/content/dataSubmissions/ErrorDialog.tsx index 6a083b6d..7543001d 100644 --- a/src/content/dataSubmissions/ErrorDialog.tsx +++ b/src/content/dataSubmissions/ErrorDialog.tsx @@ -69,6 +69,7 @@ const StyledTitle = styled(Typography)({ fontStyle: "normal", fontWeight: "900", lineHeight: "30px", + paddingBottom: "8px" }); const StyledUploadedDate = styled(Typography)({ @@ -78,8 +79,6 @@ const StyledUploadedDate = styled(Typography)({ fontStyle: "normal", fontWeight: 400, lineHeight: "19.6px", - marginTop: "8px", - marginBottom: "35px" }); const StyledSubtitle = styled(Typography)({ @@ -91,6 +90,7 @@ const StyledSubtitle = styled(Typography)({ lineHeight: "20px", letterSpacing: "0.14px", textTransform: "uppercase", + marginTop: "35px" }); const StyledErrorItem = styled(Typography)({ @@ -113,7 +113,8 @@ type Props = { title?: string; closeText?: string; errors: string[]; - uploadedDate: string; + errorCount?: string; + uploadedDate?: string; onClose?: () => void; } & Omit; @@ -122,6 +123,7 @@ const ErrorDialog = ({ title, closeText = "Close", errors, + errorCount, uploadedDate, onClose, open, @@ -144,14 +146,16 @@ const ErrorDialog = ({ {title} - - Uploaded on - {" "} - {FormatDate(uploadedDate, "M/D/YYYY", "N/A")} - + {uploadedDate && ( + + Uploaded on + {" "} + {FormatDate(uploadedDate, "M/D/YYYY", "N/A")} + + )} - {`${errors?.length || 0} ${errors?.length === 1 ? "ERROR" : "ERRORS"}`} + {errorCount || `${errors?.length || 0} ${errors?.length === 1 ? "ERROR" : "ERRORS"}`} {errors?.map((error: string, idx: number) => ( From 3187c09e29e2340725145e50464d9fd9bb3023eb Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Fri, 19 Jan 2024 12:31:48 -0500 Subject: [PATCH 06/13] Updated QC columns and data passed to error dialog --- .../dataSubmissions/QualityControl.tsx | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/content/dataSubmissions/QualityControl.tsx b/src/content/dataSubmissions/QualityControl.tsx index 78b9a868..4e29c56e 100644 --- a/src/content/dataSubmissions/QualityControl.tsx +++ b/src/content/dataSubmissions/QualityControl.tsx @@ -107,10 +107,16 @@ const columns: Column[] = [ renderValue: (data) => {data?.nodeType}, field: "nodeType", }, + { + label: "Validation Type", + renderValue: (data) => {data?.validationType}, + field: "validationType", + }, { label: "Batch ID", renderValue: (data) => {data?.displayID}, field: "displayID", + default: true }, { label: "Node ID", @@ -128,18 +134,17 @@ const columns: Column[] = [ field: "severity", }, { - label: "Uploaded Date", - renderValue: (data) => (data?.uploadedDate ? `${FormatDate(data.uploadedDate, "MM-DD-YYYY [at] hh:mm A")}` : ""), - field: "uploadedDate", - default: true + label: "Validated Date", + renderValue: (data) => (data?.validatedDate ? `${FormatDate(data?.validatedDate, "MM-DD-YYYY [at] hh:mm A")}` : ""), + field: "validatedDate", }, { - label: "Validation Issues", - renderValue: (data) => data?.description?.length > 0 && ( + label: "Issues", + renderValue: (data) => (data?.errors?.length > 0 || data?.warnings?.length > 0) && ( {({ handleOpenErrorDialog }) => ( <> - {data.description[0]?.title} + {data.errors?.length > 0 ? data.errors[0].title : data.warnings[0]?.title } {" "} handleOpenErrorDialog && handleOpenErrorDialog(data)} @@ -154,7 +159,6 @@ const columns: Column[] = [ )} ), - field: "description", sortDisabled: true, }, ]; @@ -173,6 +177,10 @@ const QualityControl: FC = () => { const [selectedRow, setSelectedRow] = useState(null); const tableRef = useRef(null); + const errorDescriptions = selectedRow?.errors?.map((error) => `(Error) ${error.description}`) ?? []; + const warningDescriptions = selectedRow?.warnings?.map((warning) => `(Warning) ${warning.description}`) ?? []; + const allDescriptions = [...errorDescriptions, ...warningDescriptions]; + const [submissionQCResults] = useLazyQuery(SUBMISSION_QC_RESULTS, { variables: { id: submissionId }, context: { clientName: 'backend' }, @@ -332,6 +340,7 @@ const QualityControl: FC = () => { total={totalData || 0} loading={loading} defaultRowsPerPage={20} + defaultOrder="desc" setItemKey={(item, idx) => `${idx}_${item.batchID}_${item.nodeID}`} onFetchData={handleFetchQCResults} /> @@ -340,9 +349,9 @@ const QualityControl: FC = () => { open={openErrorDialog} onClose={() => setOpenErrorDialog(false)} header="Data Submission" - title="Reasons" - errors={selectedRow?.description?.map((error) => error.description)} - uploadedDate={selectedRow?.uploadedDate} + title={`Validation Issues for ${selectedRow?.nodeType} Node ID ${selectedRow?.nodeID}.`} + errors={allDescriptions} + errorCount={`${allDescriptions?.length || 0} ${allDescriptions?.length === 1 ? "ISSUE" : "ISSUES"}`} /> ); From e12889a94e11ffcfc9e9e147655e353e7249826a Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Fri, 19 Jan 2024 14:59:16 -0500 Subject: [PATCH 07/13] Added capitalizeFirstLetter utility function --- src/utils/stringUtils.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/stringUtils.ts b/src/utils/stringUtils.ts index 095049df..a7907840 100644 --- a/src/utils/stringUtils.ts +++ b/src/utils/stringUtils.ts @@ -1,3 +1,12 @@ +/** + * Capitalizes the first letter of a given string. + * If the input string is empty, it returns an empty string. + * + * @param {string} str - The string to capitalize. + * @returns {string} - The capitalized string or an empty string if the input is empty. + */ +export const capitalizeFirstLetter = (str: string): string => (str ? str[0].toUpperCase() + str.slice(1) : ""); + /** * Function to add a space between a number and a letter in a string. * @param input - The input string to be processed. It should be a string where a number is directly followed by a letter. From f615844ee4f9c4346f71b9b352c95aa547629419 Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Fri, 19 Jan 2024 14:59:41 -0500 Subject: [PATCH 08/13] capitalized first letter of nodeType in dialog title --- src/content/dataSubmissions/QualityControl.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/dataSubmissions/QualityControl.tsx b/src/content/dataSubmissions/QualityControl.tsx index 4e29c56e..196d2a00 100644 --- a/src/content/dataSubmissions/QualityControl.tsx +++ b/src/content/dataSubmissions/QualityControl.tsx @@ -6,7 +6,7 @@ import { Box, Button, FormControl, MenuItem, Select, styled } from "@mui/materia import { Controller, useForm } from 'react-hook-form'; import { LIST_BATCHES, LIST_NODE_TYPES, ListBatchesResp, ListNodeTypesResp, SUBMISSION_QC_RESULTS, SubmissionQCResultsResp } from "../../graphql"; import GenericTable, { Column, FetchListing, TableMethods } from "../../components/DataSubmissions/GenericTable"; -import { FormatDate } from "../../utils"; +import { FormatDate, capitalizeFirstLetter } from "../../utils"; import ErrorDialog from "./ErrorDialog"; import QCResultsContext from "./Contexts/QCResultsContext"; @@ -349,7 +349,7 @@ const QualityControl: FC = () => { open={openErrorDialog} onClose={() => setOpenErrorDialog(false)} header="Data Submission" - title={`Validation Issues for ${selectedRow?.nodeType} Node ID ${selectedRow?.nodeID}.`} + title={`Validation Issues for ${capitalizeFirstLetter(selectedRow?.nodeType)} Node ID ${selectedRow?.nodeID}.`} errors={allDescriptions} errorCount={`${allDescriptions?.length || 0} ${allDescriptions?.length === 1 ? "ISSUE" : "ISSUES"}`} /> From adf6735b9faaa3e429f4931dc0e0ab904f31f90a Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Mon, 22 Jan 2024 09:22:49 -0500 Subject: [PATCH 09/13] Removed header from QC Error dialog --- src/content/dataSubmissions/ErrorDialog.tsx | 8 +++++--- src/content/dataSubmissions/QualityControl.tsx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/content/dataSubmissions/ErrorDialog.tsx b/src/content/dataSubmissions/ErrorDialog.tsx index 7543001d..baf9b384 100644 --- a/src/content/dataSubmissions/ErrorDialog.tsx +++ b/src/content/dataSubmissions/ErrorDialog.tsx @@ -140,9 +140,11 @@ const ErrorDialog = ({ - - {header} - + {header && ( + + {header} + + )} {title} diff --git a/src/content/dataSubmissions/QualityControl.tsx b/src/content/dataSubmissions/QualityControl.tsx index 196d2a00..d9cc40fd 100644 --- a/src/content/dataSubmissions/QualityControl.tsx +++ b/src/content/dataSubmissions/QualityControl.tsx @@ -348,7 +348,7 @@ const QualityControl: FC = () => { setOpenErrorDialog(false)} - header="Data Submission" + header={null} title={`Validation Issues for ${capitalizeFirstLetter(selectedRow?.nodeType)} Node ID ${selectedRow?.nodeID}.`} errors={allDescriptions} errorCount={`${allDescriptions?.length || 0} ${allDescriptions?.length === 1 ? "ISSUE" : "ISSUES"}`} From 637fea67d319d165aa39118d29c5b63bd252b420 Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Mon, 22 Jan 2024 10:17:58 -0500 Subject: [PATCH 10/13] Added modelVersion to listSubmissions query --- src/graphql/listSubmissions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/graphql/listSubmissions.ts b/src/graphql/listSubmissions.ts index ac918e0d..38d0854d 100644 --- a/src/graphql/listSubmissions.ts +++ b/src/graphql/listSubmissions.ts @@ -15,6 +15,7 @@ export const query = gql` dataCommons studyAbbreviation dbGaPID + modelVersion status conciergeName createdAt From 0affdb9855e86dd3d3d46a769a4bde76e2987782 Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Mon, 22 Jan 2024 10:18:20 -0500 Subject: [PATCH 11/13] Added modelVersion as column in Data Submission List --- src/content/dataSubmissions/DataSubmissionsListView.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/content/dataSubmissions/DataSubmissionsListView.tsx b/src/content/dataSubmissions/DataSubmissionsListView.tsx index add0700f..04fedaa1 100644 --- a/src/content/dataSubmissions/DataSubmissionsListView.tsx +++ b/src/content/dataSubmissions/DataSubmissionsListView.tsx @@ -189,6 +189,11 @@ const columns: Column[] = [ value: (a) => a.dbGaPID, field: "dbGaPID", }, + { + label: "Data Model Versison", + value: (a) => a.modelVersion, + field: "modelVersion", + }, { label: "Status", value: (a) => a.status, From 4eb10a47fb1ee118c42385f821fae87312e9e600 Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Mon, 22 Jan 2024 11:09:28 -0500 Subject: [PATCH 12/13] Moved Batch ID column to be first --- src/content/dataSubmissions/QualityControl.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/content/dataSubmissions/QualityControl.tsx b/src/content/dataSubmissions/QualityControl.tsx index d9cc40fd..8c66811c 100644 --- a/src/content/dataSubmissions/QualityControl.tsx +++ b/src/content/dataSubmissions/QualityControl.tsx @@ -102,6 +102,12 @@ const baseTextFieldStyles = { const StyledSelect = styled(Select)(baseTextFieldStyles); const columns: Column[] = [ + { + label: "Batch ID", + renderValue: (data) => {data?.displayID}, + field: "displayID", + default: true + }, { label: "Node Type", renderValue: (data) => {data?.nodeType}, @@ -112,12 +118,6 @@ const columns: Column[] = [ renderValue: (data) => {data?.validationType}, field: "validationType", }, - { - label: "Batch ID", - renderValue: (data) => {data?.displayID}, - field: "displayID", - default: true - }, { label: "Node ID", renderValue: (data) => {data?.nodeID}, From 7c664f00d467911c47869aa326d2684eb7bef0cc Mon Sep 17 00:00:00 2001 From: Alejandro-Vega Date: Tue, 23 Jan 2024 10:53:01 -0500 Subject: [PATCH 13/13] Renamed column and changed placement --- .../dataSubmissions/DataSubmissionsListView.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/content/dataSubmissions/DataSubmissionsListView.tsx b/src/content/dataSubmissions/DataSubmissionsListView.tsx index 04fedaa1..a7425072 100644 --- a/src/content/dataSubmissions/DataSubmissionsListView.tsx +++ b/src/content/dataSubmissions/DataSubmissionsListView.tsx @@ -174,6 +174,11 @@ const columns: Column[] = [ value: (a) => a.dataCommons, field: "dataCommons", }, + { + label: "DM Versison", + value: (a) => a.modelVersion, + field: "modelVersion", + }, { label: "Organization", value: (a) => a.organization.name, @@ -189,11 +194,6 @@ const columns: Column[] = [ value: (a) => a.dbGaPID, field: "dbGaPID", }, - { - label: "Data Model Versison", - value: (a) => a.modelVersion, - field: "modelVersion", - }, { label: "Status", value: (a) => a.status,