From 4f9ecbbd9caaea8a7d1f9500d7eec70585b59656 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Wed, 11 Dec 2024 11:24:56 +0100 Subject: [PATCH] fix(management): add override for wrongly labeled tasks --- .../management/commands/importannotations.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apis_instance_nsvis/management/commands/importannotations.py b/apis_instance_nsvis/management/commands/importannotations.py index 173981a..b77dc3a 100644 --- a/apis_instance_nsvis/management/commands/importannotations.py +++ b/apis_instance_nsvis/management/commands/importannotations.py @@ -10,6 +10,14 @@ labelstudio_token = os.getenv("LABELSTUDIO_TOKEN", None) +def override(project, attribute): + match project: + case 69: + if attribute == "issue": + return "Wiener Illustrierte vom 23.11.1944" + return None + + class Command(BaseCommand): help = "Import data from LabelStudio Export" @@ -42,7 +50,7 @@ def handle(self, *args, **options): ann_ids.append(annotation.id) annotation.data = annotations[ann] annotation.image = task["data"]["image"] - annotation.issue = task["data"]["issue"] + annotation.issue = override(project, "issue") or task["data"]["issue"] annotation.save() Annotation.objects.exclude(id__in=ann_ids).delete() for ann in Annotation.objects.all():