From 7b4c908bddca5ace2bed2196e4435af17e480256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maik=20Fr=C3=B6be?= Date: Sun, 1 Dec 2024 21:47:59 +0100 Subject: [PATCH] allow for multiple ir-datasets for a single tira dataset --- .../src/tira_app/endpoints/v1/_datasets.py | 7 +++++++ .../0006_dataset_ir_datasets_id_2.py | 18 ++++++++++++++++ application/src/tira_app/model.py | 1 + frontend/src/ClaimSubmission.vue | 12 +++++++++-- frontend/src/Datasets.vue | 8 ++++--- frontend/src/utils.ts | 21 +++++++++++++++---- 6 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 application/src/tira_app/migrations/0006_dataset_ir_datasets_id_2.py diff --git a/application/src/tira_app/endpoints/v1/_datasets.py b/application/src/tira_app/endpoints/v1/_datasets.py index 48ec9f89..ef105c95 100644 --- a/application/src/tira_app/endpoints/v1/_datasets.py +++ b/application/src/tira_app/endpoints/v1/_datasets.py @@ -17,6 +17,7 @@ class DatasetSerializer(ModelSerializer): id = CharField(source="dataset_id") mirrors = SerializerMethodField() default_task_name = SerializerMethodField() + ir_datasets_id = SerializerMethodField() class Meta: model = modeldb.Dataset @@ -39,6 +40,12 @@ def get_mirrors(self, obj): def get_default_task_name(self, obj): return obj.default_task.task_name if obj.default_task else None + def get_ir_datasets_id(self, obj): + if obj.ir_datasets_id and obj.ir_datasets_id_2: + return [obj.ir_datasets_id, obj.ir_datasets_id_2] + else: + return obj.ir_datasets_id + class _DatasetView(ModelViewSet): queryset = modeldb.Dataset.objects.all() diff --git a/application/src/tira_app/migrations/0006_dataset_ir_datasets_id_2.py b/application/src/tira_app/migrations/0006_dataset_ir_datasets_id_2.py new file mode 100644 index 00000000..b0a618c1 --- /dev/null +++ b/application/src/tira_app/migrations/0006_dataset_ir_datasets_id_2.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.9 on 2024-12-01 20:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("tira", "0005_datasethasmirroredresource_resource_type"), + ] + + operations = [ + migrations.AddField( + model_name="dataset", + name="ir_datasets_id_2", + field=models.CharField(default=None, max_length=100, null=True), + ), + ] diff --git a/application/src/tira_app/model.py b/application/src/tira_app/model.py index 433e2347..5af666dd 100644 --- a/application/src/tira_app/model.py +++ b/application/src/tira_app/model.py @@ -157,6 +157,7 @@ class Dataset(models.Model): format = models.CharField(max_length=50, null=True, default=None) chatnoir_id = models.CharField(max_length=100, null=True, default=None) ir_datasets_id = models.CharField(max_length=100, null=True, default=None) + ir_datasets_id_2 = models.CharField(max_length=100, null=True, default=None) class TaskHasDataset(models.Model): diff --git a/frontend/src/ClaimSubmission.vue b/frontend/src/ClaimSubmission.vue index 782c1aed..5f8337c4 100644 --- a/frontend/src/ClaimSubmission.vue +++ b/frontend/src/ClaimSubmission.vue @@ -59,7 +59,7 @@