diff --git a/backend/docs/plantuml/statusChange.svg b/backend/docs/plantuml/statusChange.svg index f9f110acf..e202af1a2 100644 --- a/backend/docs/plantuml/statusChange.svg +++ b/backend/docs/plantuml/statusChange.svg @@ -1 +1 @@ -initial datanew unprocessed datarevision dataalready existing sequencewith status RELEASED+ new unprocessed datarevocation dataalready existing sequencewith status RELEASEDRECEIVEDIN_PROCESSINGPROCESSEDRELEASEDentry with new accessionwill be createdentry with existing accessionand incremented version numberwill be createdentry with existing accession,incremented version number,and is_revocation=true will be createdentry will be deletedinitial submissionuser initiates revisionuser initiates revocationpreprocessing startspreprocessing done,might contain errors that need editing.user edits datauser approvesif sequence does not have errorsuser rejects \ No newline at end of file +initial datanew unprocessed datarevision dataalready existing sequencewith status RELEASED+ new unprocessed datarevocation dataalready existing sequencewith status RELEASEDRECEIVEDIN_PROCESSINGPROCESSEDRELEASEDentry with new accessionwill be createdentry with existing accessionand incremented version numberwill be createdentry with existing accession,incremented version number,and is_revocation=true will be createdentry will be deletedinitial submissionuser initiates revisionuser initiates revocationpreprocessing startspreprocessing done,might contain errors that need editing.user edits datauser approvesif sequence does not have errorsuser rejects diff --git a/backend/src/main/kotlin/org/loculus/backend/api/SubmissionTypes.kt b/backend/src/main/kotlin/org/loculus/backend/api/SubmissionTypes.kt index cfa26c22d..99cf39072 100644 --- a/backend/src/main/kotlin/org/loculus/backend/api/SubmissionTypes.kt +++ b/backend/src/main/kotlin/org/loculus/backend/api/SubmissionTypes.kt @@ -229,6 +229,15 @@ data class SequenceEntryStatus( val isRevocation: Boolean = false, val submissionId: String, val dataUseTerms: DataUseTerms, + val processedData: ProcessedData?, + val originalData: OriginalData?, + @Schema(description = "The preprocessing will be considered failed if this is not empty") + val errors: List? = null, + @Schema( + description = + "Issues where data is not necessarily wrong, but there are warning messages from the pipeline that the user might want to look into.", + ) + val warnings: List? = null, ) : AccessionVersionInterface data class EditedSequenceEntryData( diff --git a/backend/src/main/kotlin/org/loculus/backend/service/submission/CompressionService.kt b/backend/src/main/kotlin/org/loculus/backend/service/submission/CompressionService.kt index 0afbf1f09..0b006ff28 100644 --- a/backend/src/main/kotlin/org/loculus/backend/service/submission/CompressionService.kt +++ b/backend/src/main/kotlin/org/loculus/backend/service/submission/CompressionService.kt @@ -61,6 +61,9 @@ class CompressionService(private val backendConfig: BackendConfig) { getDictionaryForAminoAcidSequence(gene, organism), ) + fun maybeDecompressSequencesInOriginalData(originalData: OriginalData?, organism: Organism) = + if (originalData != null) decompressSequencesInOriginalData(originalData, organism) else null + fun decompressSequencesInOriginalData(originalData: OriginalData, organism: Organism) = OriginalData( originalData.metadata, @@ -84,6 +87,9 @@ class CompressionService(private val backendConfig: BackendConfig) { }, ) + fun maybeDecompressSequencesInProcessedData(processedData: ProcessedData?, organism: Organism) = + if (processedData != null) decompressSequencesInProcessedData(processedData, organism) else null + fun decompressSequencesInProcessedData(processedData: ProcessedData, organism: Organism) = ProcessedData( processedData.metadata, diff --git a/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt b/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt index e44eecef8..0256c6a63 100644 --- a/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt +++ b/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt @@ -655,6 +655,7 @@ class SubmissionDatabaseService( SequenceEntriesView.versionColumn, SequenceEntriesView.submissionIdColumn, SequenceEntriesView.statusColumn, + SequenceEntriesView.processingResultColumn, SequenceEntriesView.isRevocationColumn, SequenceEntriesView.groupIdColumn, SequenceEntriesView.submitterColumn, @@ -662,7 +663,8 @@ class SubmissionDatabaseService( SequenceEntriesView.submittedAtTimestampColumn, SequenceEntriesView.errorsColumn, SequenceEntriesView.warningsColumn, - SequenceEntriesView.processingResultColumn, + SequenceEntriesView.processedDataColumn, + SequenceEntriesView.originalDataColumn, DataUseTermsTable.dataUseTermsTypeColumn, DataUseTermsTable.restrictedUntilColumn, ) @@ -710,6 +712,16 @@ class SubmissionDatabaseService( DataUseTermsType.fromString(row[DataUseTermsTable.dataUseTermsTypeColumn]), row[DataUseTermsTable.restrictedUntilColumn], ), + processedData = compressionService.maybeDecompressSequencesInProcessedData( + row[SequenceEntriesView.processedDataColumn], + organism, + ), + originalData = compressionService.maybeDecompressSequencesInOriginalData( + row[SequenceEntriesView.originalDataColumn], + organism, + ), + errors = row[SequenceEntriesView.errorsColumn], + warnings = row[SequenceEntriesView.warningsColumn], ) } diff --git a/website/src/components/ReviewPage/ReviewCard.tsx b/website/src/components/ReviewPage/ReviewCard.tsx index 526a45788..fbc7bf996 100644 --- a/website/src/components/ReviewPage/ReviewCard.tsx +++ b/website/src/components/ReviewPage/ReviewCard.tsx @@ -1,7 +1,6 @@ import { type FC } from 'react'; import { Tooltip } from 'react-tooltip'; -import { backendClientHooks } from '../../services/serviceHooks.ts'; import { type DataUseTerms, processedStatus, @@ -11,12 +10,9 @@ import { restrictedDataUseTermsType, type SequenceEntryStatus, type SequenceEntryStatusNames, - type SequenceEntryToEdit, errorsProcessingResult, warningsProcessingResult, } from '../../types/backend.ts'; -import type { ClientConfig } from '../../types/runtimeConfig.ts'; -import { createAuthorizationHeader } from '../../utils/createAuthorizationHeader.ts'; import { displayMetadataField } from '../../utils/displayMetadataField.ts'; import { getAccessionVersionString } from '../../utils/extractAccessionVersion.ts'; import BiTrash from '~icons/bi/trash'; @@ -34,9 +30,6 @@ type ReviewCardProps = { deleteAccessionVersion: () => void; approveAccessionVersion: () => void; editAccessionVersion: () => void; - clientConfig: ClientConfig; - organism: string; - accessToken: string; }; export const ReviewCard: FC = ({ @@ -44,11 +37,7 @@ export const ReviewCard: FC = ({ approveAccessionVersion, deleteAccessionVersion, editAccessionVersion, - clientConfig, - organism, - accessToken, }) => { - const { isLoading, data } = useGetMetadataAndAnnotations(organism, clientConfig, accessToken, sequenceEntryStatus); return (
@@ -65,7 +54,7 @@ export const ReviewCard: FC = ({ keyName={getAccessionVersionString(sequenceEntryStatus)} value={sequenceEntryStatus.submissionId} /> - {data !== undefined && } + {sequenceEntryStatus.isRevocation && ( = ({ />
- {data?.errors?.length !== undefined && data.errors.length > 0 && ( - + {sequenceEntryStatus.errors?.length !== undefined && sequenceEntryStatus.errors.length > 0 && ( + )} - {data?.warnings?.length !== undefined && data.warnings.length > 0 && ( - + {sequenceEntryStatus.warnings?.length !== undefined && sequenceEntryStatus.warnings.length > 0 && ( + )}
); @@ -171,15 +160,14 @@ const ButtonBar: FC = ({ }; type MetadataListProps = { - data: SequenceEntryToEdit; - isLoading: boolean; + data: SequenceEntryStatus; }; const isAnnotationPresent = (metadataField: string) => (item: ProcessingAnnotation) => item.source[0].name === metadataField; -const MetadataList: FC = ({ data, isLoading }) => - !isLoading && +const MetadataList: FC = ({ data }) => + data.processedData !== null && Object.entries(data.processedData.metadata).map(([metadataName, value], index) => value === null ? null : ( = ({ clientConfig, organism, group, a editAccessionVersion={() => { window.location.href = routes.editPage(organism, sequence); }} - clientConfig={clientConfig} - organism={organism} - accessToken={accessToken} /> ); diff --git a/website/src/types/backend.ts b/website/src/types/backend.ts index c7bcaabce..6be9dc409 100644 --- a/website/src/types/backend.ts +++ b/website/src/types/backend.ts @@ -133,6 +133,24 @@ export const sequenceEntryStatus = accessionVersion.merge( dataUseTerms, groupId: z.number(), submitter: z.string(), + errors: z.array(processingAnnotation).nullable(), + warnings: z.array(processingAnnotation).nullable(), + originalData: z + .object({ + metadata: unprocessedMetadataRecord, + unalignedNucleotideSequences: z.record(z.string()), + }) + .nullable(), + processedData: z + .object({ + metadata: metadataRecord, + unalignedNucleotideSequences: z.record(z.string().nullable()), + alignedNucleotideSequences: z.record(z.string().nullable()), + nucleotideInsertions: z.record(z.array(z.string())), + alignedAminoAcidSequences: z.record(z.string().nullable()), + aminoAcidInsertions: z.record(z.array(z.string())), + }) + .nullable(), }), );