Skip to content

Commit

Permalink
prepare form to claim submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
mam10eks committed Nov 30, 2024
1 parent 9ffeec5 commit 66b2189
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 6 deletions.
2 changes: 2 additions & 0 deletions application/src/tira_app/endpoints/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.urls import include, path

from ._anonymous import endpoints as anonymous_endpoints
from ._datasets import endpoints as dataset_endpoints
from ._evaluations import endpoints as evaluation_endpoints
from ._organizers import endpoints as organizer_endpoints
Expand All @@ -9,6 +10,7 @@
from ._user import endpoints as user_endpoints

endpoints = [
path("anonymous/", include(anonymous_endpoints)),
path("datasets/", include(dataset_endpoints)),
path("systems/", include(system_endpoints)),
path("evaluations/", include(evaluation_endpoints)),
Expand Down
25 changes: 25 additions & 0 deletions application/src/tira_app/endpoints/v1/_anonymous.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from django.urls import path
from rest_framework.decorators import api_view
from rest_framework.request import Request
from rest_framework.response import Response


@api_view(["GET"])
def read_anonymous_submission(request: Request, submission_uuid: str) -> Response:
"""Read information about an anonymous submission identified by the ownership uuid.
Args:
request (Request): The request that triggered the REST API call.
submission_uuid (str): The ownership uuid of the anonymous submission
Returns:
Response: The information about the anonymous submission
"""
return Response(
{"uuid": submission_uuid, "dataset_id": "clueweb09-en-trec-web-2009-20230107-training", "created": "fooo"}
)


endpoints = [
path("<str:submission_uuid>", read_anonymous_submission),
]
1 change: 1 addition & 0 deletions application/src/tira_app/endpoints/v1/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ class _DatasetView(ModelViewSet):
endpoints = [
path("", _DatasetView.as_view({"get": "list"})),
path("all", _DatasetView.as_view({"get": "list"})),
path("view/<str:dataset_id>", _DatasetView.as_view({"get": "retrieve"})),
]
102 changes: 102 additions & 0 deletions frontend/src/ClaimSubmission.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<template>
<tira-breadcrumb />

<v-container>
<h3 class="text-h3 py-5">Claim Ownership</h3>
<p>By entering the ownership UUID of a submission you can become registered as the owner of a submission. Being the owner of a submission allows you to submit it to a shared task.</p>


<div class="py-2"></div>
<v-text-field label="Ownership UUID" v-model="uuid" append-inner-icon="mdi-send" @click:append-inner="loadData" class="px-10"></v-text-field>
<div class="py-2"></div>
</v-container>

<v-container>
<v-divider/>

<h3>Details</h3>
<div class="py-2"></div>
<v-skeleton-loader type="card" v-if="dataset === undefined || submissionToClaim === undefined"/>
<div v-if="dataset !== undefined && submissionToClaim !== undefined">
<p>
The run was submitted on {{ submissionToClaim.created }} to the dataset <a :href="'/datasets?query=' + dataset.dataset_id">{{ dataset.display_name }}</a>
<span v-if="link_chatnoir !== undefined && link_ir_datasets !== undefined">
(browse in <a :href="link_chatnoir" target="_blank">ChatNoir</a> or <a :href="link_ir_datasets" target="_blank">ir_datasets</a>)
</span>
<span v-if="link_chatnoir !== undefined && link_ir_datasets === undefined">
(browse in <a :href="link_chatnoir" target="_blank">ChatNoir</a>)
</span>
<span v-if="link_chatnoir === undefined && link_ir_datasets !== undefined">
(browse in <a :href="link_ir_datasets" target="_blank">ir_datasets</a>)
</span>
for task <a :href="'/task-overview/' + dataset.default_task">{{ dataset.default_task }}</a>.
</p>

<div class="py-2"></div>

<p v-if="userinfo.role === 'guest'">
Please <a href='/login'>login</a> to claim ownership.
</p>
<div v-if="userinfo.role !== 'guest'">
<v-divider/>
<h3 class="my-1">Public Access to the Data and Submissions</h3>
<p>You can make the data public so that users can download the data and submissions, e.g., after the shared task is finished or for participants to verify their software.</p>

<v-radio-group v-model="new_software">
<v-radio label="This dataset is public (users can access the data and published submissions)" value="false"></v-radio>
<v-radio label="This dataset is confidential (only organizers can access the data and submissions)" value="true"></v-radio>
</v-radio-group>
<v-btn>Claim Ownersip</v-btn>
<div class="py-2"></div>
<v-divider/>
</div>
</div>
</v-container>
</template>

<script lang="ts">
import { inject } from 'vue'
import { get, chatNoirUrl, irDatasetsUrl, type UserInfo, type DatasetInfo, type ClaimSubmissionInfo } from './utils';
import { Loading, TiraBreadcrumb } from './components'
export default {
name: "claim-submission",
components: { Loading, TiraBreadcrumb },
data() {
return {
userinfo: inject('userinfo') as UserInfo,
uuid: '' as string,
dataset: undefined as DatasetInfo | undefined,
submissionToClaim: undefined as ClaimSubmissionInfo | undefined,
rest_url: inject("REST base URL"),
new_software: false,
}
},
methods: {
loadData() {
this.dataset = undefined
this.submissionToClaim = undefined
this.$router.push({ path: '/claim-submission/' + this.uuid})
get(this.rest_url + '/v1/anonymous/' + this.uuid)
.then((i) => {this.submissionToClaim = i as ClaimSubmissionInfo})
.then(() => {
if (this.submissionToClaim && this.submissionToClaim.dataset_id) {
get(this.rest_url + '/v1/datasets/view/' + this.submissionToClaim.dataset_id).then((i) => this.dataset = i as DatasetInfo)
}
})
},
},
computed: {
link_chatnoir() { return chatNoirUrl(this.dataset) },
link_ir_datasets() { return irDatasetsUrl(this.dataset) },
},
beforeMount() {
this.uuid = this.$route.params.uuid as string
this.loadData()
}
}
</script>

11 changes: 5 additions & 6 deletions frontend/src/Datasets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<span v-if="!item.default_task"> No Task </span>
</template>
<template #item.ir_datasets_id="{ item }">
<a v-if="item.ir_datasets_id" :href="'https://ir-datasets.com/' + item.ir_datasets_id.split('/')[0] + '.html#' + item.ir_datasets_id" style="text-decoration: none !important;" target="_blank">{{item.ir_datasets_id}}</a>
<a v-if="ir_datasets_url(item)" :href="ir_datasets_url(item)" style="text-decoration: none !important;" target="_blank">{{item.ir_datasets_id}}</a>
</template>
<template #item.search="{ item }">
<a v-if="item.chatnoir_id" :href="'https://chatnoir.web.webis.de/?index=' + item.chatnoir_id" style="text-decoration: none !important;" target="_blank">ChatNoir</a>
<a v-if="chatnoir_url(item)" :href="chatnoir_url(item)" style="text-decoration: none !important;" target="_blank">ChatNoir</a>
</template>
<template #item.type="{ item }">
Public Training
Expand All @@ -42,7 +42,7 @@
<script lang="ts">
import { inject } from 'vue'
import { get, reportError, type UserInfo, type DatasetInfo } from './utils';
import { get, reportError, chatNoirUrl, irDatasetsUrl, type UserInfo, type DatasetInfo } from './utils';
import { Loading, TiraBreadcrumb } from './components'
export default {
Expand All @@ -65,9 +65,8 @@
}
},
methods: {
logData(toLog: any) {
console.log(toLog)
}
chatnoir_url(dataset: DatasetInfo) { return chatNoirUrl(dataset)},
ir_datasets_url(dataset: DatasetInfo) { return irDatasetsUrl(dataset)},
},
beforeMount() {
this.query = this.$route.query.query as string|undefined
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import IrComponents from './IrComponents.vue'
import Home from './Home.vue'
import Tasks from './Tasks.vue'
import Tirex from './Tirex.vue'
import ClaimSubmission from './ClaimSubmission.vue'
import Datasets from './Datasets.vue'
import Systems from './Systems.vue'
import SystemDetails from './SystemDetails.vue'
import TaskOverview from './TaskOverview.vue'
import RunUpload from './RunUpload.vue'
import tiraConf from './tira.conf'
import { fetchWellKnownAPIs, fetchUserInfo, fetchServerInfo } from './utils';
import { useDisplay } from 'vuetify'

export function is_mobile() {
const { mobile } = useDisplay()
return mobile.value
}

// Composables
import { createApp } from 'vue'
Expand All @@ -37,6 +44,7 @@ export default function register_app() {
{ path: '/', component: Home },
{ path: '/tasks', component: Tasks },
{ path: '/datasets', component: Datasets },
{ path: '/claim-submission/:uuid', component: ClaimSubmission },
{ path: '/systems', component: Systems },
{ path: '/systems/:team?', component: Systems },
{ path: '/systems/:team/:system', component: SystemDetails },
Expand Down
25 changes: 25 additions & 0 deletions frontend/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export interface DatasetInfo {
default_task: TaskInfo | undefined;
}

export interface ClaimSubmissionInfo {
uuid: string;
dataset_id: string;
created: string;
}

export interface UserContext {
user_id: string;
}
Expand Down Expand Up @@ -50,6 +56,25 @@ export interface WellKnownAPI {
disraptorURL: string;
}

export function irDatasetsUrl(dataset: DatasetInfo | undefined) {
if (!dataset || !dataset.ir_datasets_id) {
return undefined
} else {
return 'https://ir-datasets.com/' + dataset.ir_datasets_id.split('/')[0] + '.html#' + dataset.ir_datasets_id
}
}

export function chatNoirUrl(dataset: DatasetInfo | undefined, document_id: string | undefined = undefined) {
if (!dataset || !dataset.chatnoir_id) {
return undefined
} else if (document_id) {
return 'https://chatnoir-webcontent.web.webis.de/?index=' + dataset.chatnoir_id + '&trec-id=' + document_id
}
else {
return 'https://chatnoir.web.webis.de/?index=' + dataset.chatnoir_id
}
}

export function extractTaskFromCurrentUrl() {
let loc = ref(window.location).value.href.split('#')[0].split('?')[0]

Expand Down

0 comments on commit 66b2189

Please sign in to comment.