Skip to content

Commit

Permalink
Re-using ApiClientAnswer in result log
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaro committed Jan 19, 2024
1 parent 4f42eb2 commit 57decb9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions backend/src/main/kotlin/dev/dres/data/model/log/ParticipantLog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonSetter
import com.fasterxml.jackson.annotation.Nulls
import dev.dres.api.rest.types.evaluation.submission.ApiClientAnswer
import io.javalin.openapi.OpenApiIgnore
import kotlinx.serialization.Serializable

enum class QueryEventCategory {
TEXT, IMAGE, SKETCH, FILTER, BROWSING, COOPERATION, OTHER
}

@JsonIgnoreProperties(ignoreUnknown = true)
@Serializable
data class QueryEvent(
val timestamp: Long = -1,
val category: QueryEventCategory = QueryEventCategory.OTHER,
Expand All @@ -19,36 +22,38 @@ data class QueryEvent(
)

@JsonIgnoreProperties(ignoreUnknown = true)
@Serializable
data class QueryEventLog internal constructor(
val timestamp: Long = -1,
@field:JsonSetter(contentNulls = Nulls.FAIL)
val events: List<QueryEvent> = emptyList(),
@field:JsonIgnore
@get:JsonIgnore
@get:OpenApiIgnore
@kotlinx.serialization.Transient
internal val serverTimeStamp: Long = System.currentTimeMillis()
)

@JsonIgnoreProperties(ignoreUnknown = true)
data class QueryResult(
val item: String = "",
val segment: Int? = null,
val frame: Int? = null,
val score: Double? = null,
@Serializable
data class RankedAnswer(
val answer: ApiClientAnswer,
val rank: Int? = null
)

@JsonIgnoreProperties(ignoreUnknown = true)
@Serializable
data class QueryResultLog internal constructor(
val timestamp: Long = -1,
val sortType: String = "",
val resultSetAvailability: String = "",
@field:JsonSetter(contentNulls = Nulls.FAIL)
val results: List<QueryResult> = emptyList(),
val results: List<RankedAnswer> = emptyList(),
@field:JsonSetter(contentNulls = Nulls.FAIL)
val events: List<QueryEvent> = emptyList(),
@field:JsonIgnore
@get:JsonIgnore
@get:OpenApiIgnore
@kotlinx.serialization.Transient
internal val serverTimeStamp: Long = System.currentTimeMillis()
)

0 comments on commit 57decb9

Please sign in to comment.