Beispiel #1
0
 def get_linked_task(self, *, validated_data):
     if "algorithm" in validated_data:
         return create_algorithm_jobs_for_session.signature(
             kwargs={
                 "algorithm_image_pk":
                 validated_data["algorithm"].latest_ready_image.pk
             },
             immutable=True,
         )
     elif "archive" in validated_data:
         return add_images_to_archive.signature(
             kwargs={"archive_pk": validated_data["archive"].pk},
             immutable=True,
         )
     elif "reader_study" in validated_data:
         return add_images_to_reader_study.signature(
             kwargs={"reader_study_pk": validated_data["reader_study"].pk},
             immutable=True,
         )
     elif "answer" in validated_data:
         return add_image_to_answer.signature(
             kwargs={"answer_pk": validated_data["answer"].pk},
             immutable=True,
         )
     else:
         raise RuntimeError(
             "Algorithm image, archive or reader study must be set")
Beispiel #2
0
def _get_linked_task(*, targets, interface):
    if "archive" in targets:
        kwargs = {"archive_pk": targets["archive"].pk}
        if interface:
            kwargs["interface_pk"] = interface.pk
        return add_images_to_archive.signature(kwargs=kwargs, immutable=True)
    elif "archive_item" in targets:
        return add_images_to_archive_item.signature(
            kwargs={
                "archive_item_pk": targets["archive_item"].pk,
                "interface_pk": interface.pk,
            },
            immutable=True,
        )
    elif "reader_study" in targets:
        return add_images_to_reader_study.signature(
            kwargs={"reader_study_pk": targets["reader_study"].pk},
            immutable=True,
        )
    elif "display_set" in targets:
        return add_image_to_display_set.signature(
            kwargs={
                "display_set_pk": targets["display_set"].pk,
                "interface_pk": interface.pk,
            },
            immutable=True,
        )
    elif "answer" in targets:
        return add_image_to_answer.signature(
            kwargs={"answer_pk": targets["answer"].pk}, immutable=True
        )
    else:
        raise RuntimeError(f"Unknown target {targets=}")
Beispiel #3
0
 def get_form_kwargs(self):
     kwargs = super().get_form_kwargs()
     kwargs.update({
         "linked_task":
         add_images_to_archive.signature(
             kwargs={"archive_pk": self.archive.pk}, immutable=True)
     })
     return kwargs
def _get_linked_task(*, targets):
    if "archive" in targets:
        return add_images_to_archive.signature(
            kwargs={"archive_pk": targets["archive"].pk},
            immutable=True,
        )
    elif "reader_study" in targets:
        return add_images_to_reader_study.signature(
            kwargs={"reader_study_pk": targets["reader_study"].pk},
            immutable=True,
        )
    elif "answer" in targets:
        return add_image_to_answer.signature(
            kwargs={"answer_pk": targets["answer"].pk},
            immutable=True,
        )
    else:
        raise RuntimeError(f"Unknown target {targets=}")