Skip to content

Commit

Permalink
Add changes to work on for later
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-parker committed Jul 30, 2024
1 parent 409bb64 commit 75e3b07
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ data class AccessionsToRevokeWithComments(
)
val accessions: List<Accession>,
@Schema(
description = "Reason for revocation or other details, added as version_comments",
description = "Reason for revocation or other details, added as recovation_comments",
)
val revocationComments: String? = null,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ReleasedDataModel(
}

var metadata = rawProcessedData.processedData.metadata +
("version_comments" to TextNode(rawProcessedData.revocationComments)) +
("accession" to TextNode(rawProcessedData.accession)) +
("version" to LongNode(rawProcessedData.version)) +
(HEADER_TO_CONNECT_METADATA_AND_SEQUENCES to TextNode(rawProcessedData.submissionId)) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const val METADATA_UPLOAD_TABLE_NAME = "metadata_upload_aux_table"
object MetadataUploadAuxTable : Table(METADATA_UPLOAD_TABLE_NAME) {
val accessionColumn = varchar("accession", 255).nullable()
val versionColumn = long("version").nullable()
val versionCommentColumn = varchar("version_comment", 255).nullable()
val uploadIdColumn = varchar("upload_id", 255)
val organismColumn = varchar("organism", 255)
val submissionIdColumn = varchar("submission_id", 255)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object SequenceEntriesTable : Table(SEQUENCE_ENTRIES_TABLE_NAME) {

val accessionColumn = varchar("accession", 255)
val versionColumn = long("version")
val versionCommentColumn = varchar("version_comment", 255).nullable()
val revocationCommentsColumn = varchar("revocation_comments", 255).nullable()
val organismColumn = varchar("organism", 255)
val submissionIdColumn = varchar("submission_id", 255)
val submitterColumn = varchar("submitter", 255)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ object SequenceEntriesView : Table(SEQUENCE_ENTRIES_VIEW_NAME) {
val releasedAtTimestampColumn = datetime("released_at").nullable()
val statusColumn = varchar("status", 255)
val isRevocationColumn = bool("is_revocation").default(false)
val revocationCommentsColumn = varchar("revocation_comments", 255).nullable()
val errorsColumn = jacksonSerializableJsonb<List<PreprocessingAnnotation>>("errors").nullable()
val warningsColumn = jacksonSerializableJsonb<List<PreprocessingAnnotation>>("warnings").nullable()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ class SubmissionDatabaseService(
DataUseTermsType.fromString(it[DataUseTermsTable.dataUseTermsTypeColumn]),
it[DataUseTermsTable.restrictedUntilColumn],
),
revocationComments = it[SequenceEntriesView.revocationCommentsColumn],
)
}

Expand Down Expand Up @@ -674,7 +675,7 @@ class SubmissionDatabaseService(
accessions: List<Accession>,
authenticatedUser: AuthenticatedUser,
organism: Organism,
revocationComment: String?,
revocationComments: String?,
): List<SubmissionIdMapping> {
log.info { "revoking ${accessions.size} sequences" }

Expand All @@ -686,7 +687,7 @@ class SubmissionDatabaseService(
}

val now = Clock.System.now().toLocalDateTime(TimeZone.UTC)
val comment = revocationComment ?: ""
val comment = revocationComments ?: ""
SequenceEntriesTable.insert(
SequenceEntriesTable
.select(
Expand All @@ -707,7 +708,7 @@ class SubmissionDatabaseService(
columns = listOf(
SequenceEntriesTable.accessionColumn,
SequenceEntriesTable.versionColumn,
SequenceEntriesTable.versionCommentColumn,
SequenceEntriesTable.revocationCommentsColumn,
SequenceEntriesTable.submissionIdColumn,
SequenceEntriesTable.submitterColumn,
SequenceEntriesTable.groupIdColumn,
Expand Down Expand Up @@ -1022,6 +1023,7 @@ data class RawProcessedData(
override val accession: Accession,
override val version: Version,
val isRevocation: Boolean,
val revocationComments: String?,
val submitter: String,
val groupId: Int,
val groupName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.loculus.backend.service.submission.MetadataUploadAuxTable.submissionI
import org.loculus.backend.service.submission.MetadataUploadAuxTable.submitterColumn
import org.loculus.backend.service.submission.MetadataUploadAuxTable.uploadIdColumn
import org.loculus.backend.service.submission.MetadataUploadAuxTable.uploadedAtColumn
import org.loculus.backend.service.submission.MetadataUploadAuxTable.versionCommentColumn
import org.loculus.backend.service.submission.SequenceUploadAuxTable.compressedSequenceDataColumn
import org.loculus.backend.service.submission.SequenceUploadAuxTable.segmentNameColumn
import org.loculus.backend.service.submission.SequenceUploadAuxTable.sequenceSubmissionIdColumn
Expand Down Expand Up @@ -64,7 +63,6 @@ class UploadDatabaseService(
uploadedAt: LocalDateTime,
) {
MetadataUploadAuxTable.batchInsert(uploadedMetadataBatch) {
this[versionCommentColumn] = it.metadata["version_comment"]
this[submitterColumn] = authenticatedUser.username
this[groupIdColumn] = groupId
this[uploadedAtColumn] = uploadedAt
Expand All @@ -84,7 +82,6 @@ class UploadDatabaseService(
) {
MetadataUploadAuxTable.batchInsert(uploadedRevisedMetadataBatch) {
this[accessionColumn] = it.accession
this[versionCommentColumn] = it.metadata["version_comment"]
this[submitterColumn] = authenticatedUser.username
this[uploadedAtColumn] = uploadedAt
this[submissionIdColumn] = it.submissionId
Expand Down
1 change: 1 addition & 0 deletions backend/src/main/resources/db/migration/V1__init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ create table sequence_entries (
submitted_at timestamp not null,
released_at timestamp,
is_revocation boolean not null default false,
revocation_comment text,
original_data jsonb,
primary key (accession, version),
foreign key (group_id) references groups_table(group_id)
Expand Down

0 comments on commit 75e3b07

Please sign in to comment.