text: # Generated by Django 3.0.9 on 2020-08-24 08:08
  
  import uuid
  from decimal import Decimal
  
  import django.contrib.postgres.fields.jsonb
  import django.db.models.deletion
  import social_django.fields
  from django.conf import settings
  from django.db import migrations, models
  
  import grandchallenge.components.models
  import grandchallenge.core.storage
  import grandchallenge.core.validators
  import grandchallenge.evaluation.models
  
  
  class Migration(migrations.Migration):
      initial = True
  
      dependencies = [
          ("algorithms", "0027_delete_result"),
          ("components", "0001_initial"),
          ("challenges", "0001_initial"),
          migrations.swappable_dependency(settings.AUTH_USER_MODEL),
      ]
  
      operations = [
          migrations.CreateModel(
              name="Job",
              fields=[
                  (
                      "id",
                      models.UUIDField(
                          default=uuid.uuid4,
                          editable=False,
                          primary_key=True,
                          serialize=False,
                      ),
                  ),
                  ("created", models.DateTimeField(auto_now_add=True)),
                  ("modified", models.DateTimeField(auto_now=True)),
                  (
                      "status",
                      models.PositiveSmallIntegerField(
                          choices=[
                              (0, "The task is waiting for execution"),
                              (1, "The task has been started"),
                              (
                                  2,
                                  "The task is to be retried, possibly because of failure",
                              ),
                              (
                                  3,
                                  "The task raised an exception, or has exceeded the retry limit",
                              ),
                              (4, "The task executed successfully"),
                              (5, "The task was cancelled"),
                          ],
                          default=0,
                      ),
                  ),
                  (
                      "status_history",
                      social_django.fields.JSONField(default=dict),
                  ),
                  ("output", models.TextField()),
                  (
                      "challenge",
                      models.ForeignKey(
                          on_delete=django.db.models.deletion.CASCADE,
                          to="challenges.Challenge",
                      ),
                  ),
              ],
              options={"abstract": False},
          ),
          migrations.CreateModel(
              name="Method",
              fields=[
                  (
                      "id",
                      models.UUIDField(
                          default=uuid.uuid4,
                          editable=False,
                          primary_key=True,
                          serialize=False,
                      ),
                  ),
                  ("created", models.DateTimeField(auto_now_add=True)),
                  ("modified", models.DateTimeField(auto_now=True)),
                  (
                      "ready",
                      models.BooleanField(
                          default=False,
                          editable=False,
                          help_text="Is this image ready to be used?",
                      ),
                  ),
                  ("status", models.TextField(editable=False)),
                  (
                      "image",
                      models.FileField(
                          help_text="Tar archive of the container image produced from the command `docker save IMAGE > IMAGE.tar`. See https://docs.docker.com/engine/reference/commandline/save/",
                          upload_to=grandchallenge.components.models.docker_image_path,
                          validators=[
                              grandchallenge.core.validators.ExtensionValidator(
                                  allowed_extensions=(".tar",)
                              )
                          ],
                      ),
                  ),
                  (
                      "image_sha256",
                      models.CharField(editable=False, max_length=71),
                  ),
                  (
                      "challenge",
                      models.ForeignKey(
                          on_delete=django.db.models.deletion.CASCADE,
                          to="challenges.Challenge",
                      ),
                  ),
                  (
                      "creator",
                      models.ForeignKey(
                          null=True,
                          on_delete=django.db.models.deletion.SET_NULL,
                          to=settings.AUTH_USER_MODEL,
                      ),
                  ),
              ],
              options={"abstract": False},
          ),
          migrations.CreateModel(
              name="Result",
              fields=[
                  (
                      "id",
                      models.UUIDField(
                          default=uuid.uuid4,
                          editable=False,
                          primary_key=True,
                          serialize=False,
                      ),
                  ),
                  ("created", models.DateTimeField(auto_now_add=True)),
                  ("modified", models.DateTimeField(auto_now=True)),
                  (
                      "metrics",
                      django.contrib.postgres.fields.jsonb.JSONField(
                          default=dict
                      ),
                  ),
                  ("public", models.BooleanField(default=True)),
                  (
                      "rank",
                      models.PositiveIntegerField(
                          default=0,
                          help_text="The position of this result on the leaderboard. If the value is zero, then the result is unranked.",
                      ),
                  ),
                  ("absolute_url", models.TextField(blank=True, editable=False)),
                  (
                      "challenge",
                      models.ForeignKey(
                          on_delete=django.db.models.deletion.CASCADE,
                          to="challenges.Challenge",
                      ),
                  ),
                  (
                      "job",
                      models.OneToOneField(
                          null=True,
                          on_delete=django.db.models.deletion.CASCADE,
                          to="evaluation.Job",
                      ),
                  ),
              ],
              options={"abstract": False},
          ),
          migrations.CreateModel(
              name="Submission",
              fields=[
                  (
                      "id",
                      models.UUIDField(
                          default=uuid.uuid4,
                          editable=False,
                          primary_key=True,
                          serialize=False,
                      ),
                  ),
                  ("created", models.DateTimeField(auto_now_add=True)),
                  ("modified", models.DateTimeField(auto_now=True)),
                  (
                      "file",
                      models.FileField(
                          upload_to=grandchallenge.evaluation.models.submission_file_path,
                          validators=[
                              grandchallenge.core.validators.MimeTypeValidator(
                                  allowed_types=("application/zip", "text/plain")
                              ),
                              grandchallenge.core.validators.ExtensionValidator(
                                  allowed_extensions=(".zip", ".csv")
                              ),
                          ],
                      ),
                  ),
                  (
                      "supplementary_file",
                      models.FileField(
                          blank=True,
                          upload_to=grandchallenge.evaluation.models.submission_supplementary_file_path,
                          validators=[
                              grandchallenge.core.validators.MimeTypeValidator(
                                  allowed_types=("text/plain", "application/pdf")
                              )
                          ],
                      ),
                  ),
                  (
                      "comment",
                      models.CharField(
                          blank=True,
                          default="",
                          help_text="You can add a comment here to help you keep track of your submissions.",
                          max_length=128,
                      ),
                  ),
                  (
                      "challenge",
                      models.ForeignKey(
                          on_delete=django.db.models.deletion.CASCADE,
                          to="challenges.Challenge",
                      ),
                  ),
                  (
                      "creator",
                      models.ForeignKey(
                          null=True,
                          on_delete=django.db.models.deletion.SET_NULL,
                          to=settings.AUTH_USER_MODEL,
                      ),
                  ),
                  (
                      "publication_url",
                      models.URLField(
                          blank=True,
                          help_text="A URL for the publication associated with this submission.",
                      ),
                  ),
              ],
              options={"abstract": False},
          ),
          migrations.AddField(
              model_name="job",
              name="method",
              field=models.ForeignKey(
                  on_delete=django.db.models.deletion.CASCADE,
                  to="evaluation.Method",
              ),
          ),
          migrations.AddField(
              model_name="job",
              name="submission",
              field=models.ForeignKey(
                  on_delete=django.db.models.deletion.CASCADE,
                  to="evaluation.Submission",
              ),
          ),
          migrations.RemoveField(model_name="job", name="status_history",),
          migrations.CreateModel(
              name="Config",
              fields=[
                  (
                      "id",
                      models.UUIDField(
                          default=uuid.uuid4,
                          editable=False,
                          primary_key=True,
                          serialize=False,
                      ),
                  ),
                  ("created", models.DateTimeField(auto_now_add=True)),
                  ("modified", models.DateTimeField(auto_now=True)),
                  (
                      "use_teams",
                      models.BooleanField(
                          default=False,
                          help_text="If true, users are able to form teams together to participate in challenges.",
                      ),
                  ),
                  (
                      "score_jsonpath",
                      models.CharField(
                          blank=True,
                          help_text="The jsonpath of the field in metrics.json that will be used for the overall scores on the results page. See http://goessner.net/articles/JsonPath/ for syntax. For example:\n\ndice.mean",
                          max_length=255,
                      ),
                  ),
                  (
                      "score_title",
                      models.CharField(
                          default="Score",
                          help_text="The name that will be displayed for the scores column, for instance:\n\nScore (log-loss)",
                          max_length=32,
                      ),
                  ),
                  (
                      "score_default_sort",
                      models.CharField(
                          choices=[("asc", "Ascending"), ("desc", "Descending")],
                          default="desc",
                          help_text="The default sorting to use for the scores on the results page.",
                          max_length=4,
                      ),
                  ),
                  (
                      "extra_results_columns",
                      django.contrib.postgres.fields.jsonb.JSONField(
                          blank=True,
                          default=dict,
                          help_text='A JSON object that contains the extra columns from metrics.json that will be displayed on the results page. Where the KEYS contain the titles of the columns, and the VALUES contain the JsonPath to the corresponding metric in metrics.json. For example:\n\n{"Accuracy": "aggregates.acc","Dice": "dice.mean"}',
                      ),
                  ),
                  (
                      "allow_submission_comments",
                      models.BooleanField(
                          default=False,
                          help_text="Allow users to submit comments as part of their submission.",
                      ),
                  ),
                  (
                      "allow_supplementary_file",
                      models.BooleanField(
                          default=False,
                          help_text="Show a supplementary file field on the submissions page so that users can upload an additional file along with their predictions file as part of their submission (eg, include a pdf description of their method).",
                      ),
                  ),
                  (
                      "require_supplementary_file",
                      models.BooleanField(
                          default=False,
                          help_text="Force users to upload a supplementary file with their predictions file.",
                      ),
                  ),
                  (
                      "supplementary_file_label",
                      models.CharField(
                          blank=True,
                          default="Supplementary File",
                          help_text="The label that will be used on the submission and results page for the supplementary file. For example: Algorithm Description.",
                          max_length=32,
                      ),
                  ),
                  (
                      "supplementary_file_help_text",
                      models.CharField(
                          blank=True,
                          default="",
                          help_text='The help text to include on the submissions page to describe the submissions file. Eg: "A PDF description of the method.".',
                          max_length=128,
                      ),
                  ),
                  (
                      "show_supplementary_file_link",
                      models.BooleanField(
                          default=False,
                          help_text="Show a link to download the supplementary file on the results page.",
                      ),
                  ),
                  (
                      "daily_submission_limit",
                      models.PositiveIntegerField(
                          default=10,
                          help_text="The limit on the number of times that a user can make a submission in a 24 hour period.",
                      ),
                  ),
                  (
                      "challenge",
                      models.OneToOneField(
                          editable=False,
                          on_delete=django.db.models.deletion.CASCADE,
                          related_name="evaluation_config",
                          to="challenges.Challenge",
                      ),
                  ),
                  (
                      "submission_page_html",
                      models.TextField(
                          blank=True,
                          help_text="HTML to include on the submission page for this challenge.",
                      ),
                  ),
                  (
                      "new_results_are_public",
                      models.BooleanField(
                          default=True,
                          help_text="If true, new results are automatically made public. If false, the challenge administrator must manually publish each new result.",
                      ),
                  ),
                  (
                      "display_submission_comments",
                      models.BooleanField(
                          default=False,
                          help_text="If true, submission comments are shown on the results page.",
                      ),
                  ),
                  (
                      "submission_join_key",
                      models.CharField(
                          blank=True,
                          default="",
                          help_text="If predictions are submitted as csv files, which column should be used to join the data? eg. case_id",
                          max_length=32,
                      ),
                  ),
                  (
                      "publication_url_choice",
                      models.CharField(
                          choices=[
                              ("off", "Off"),
                              ("opt", "Optional"),
                              ("req", "Required"),
                          ],
                          default="off",
                          help_text="Show a publication url field on the submission page so that users can submit a link to a publication that corresponds to their submission. Off turns this feature off, Optional means that including the url is optional for the user, Required means that the user must provide an url.",
                          max_length=3,
                      ),
                  ),
                  (
                      "score_decimal_places",
                      models.PositiveSmallIntegerField(
                          default=4,
                          help_text="The number of decimal places to display for the score",
                      ),
                  ),
                  (
                      "show_publication_url",
                      models.BooleanField(
                          default=False,
                          help_text="Show a link to the publication on the results page",
                      ),
                  ),
                  (
                      "supplementary_file_choice",
                      models.CharField(
                          choices=[
                              ("off", "Off"),
                              ("opt", "Optional"),
                              ("req", "Required"),
                          ],
                          default="off",
                          help_text="Show a supplementary file field on the submissions page so that users can upload an additional file along with their predictions file as part of their submission (eg, include a pdf description of their method). Off turns this feature off, Optional means that including the file is optional for the user, Required means that the user must upload a supplementary file.",
                          max_length=3,
                      ),
                  ),
              ],
              options={"abstract": False},
          ),
          migrations.RemoveField(
              model_name="config", name="allow_supplementary_file",
          ),
          migrations.RemoveField(
              model_name="config", name="require_supplementary_file",
          ),
          migrations.RenameField(
              model_name="config",
              old_name="new_results_are_public",
              new_name="auto_publish_new_results",
          ),
          migrations.RenameField(
              model_name="result", old_name="public", new_name="published",
          ),
          migrations.AddField(
              model_name="config",
              name="result_display_choice",
              field=models.CharField(
                  choices=[
                      ("all", "Display all results"),
                      ("rec", "Only display each users most recent result"),
                      ("bst", "Only display each users best result"),
                  ],
                  default="all",
                  help_text="Which results should be displayed on the leaderboard?",
                  max_length=3,
              ),
          ),
          migrations.AlterField(
              model_name="job",
              name="status",
              field=models.PositiveSmallIntegerField(
                  choices=[
                      (0, "Queued"),
                      (1, "Started"),
                      (2, "Re-Queued"),
                      (3, "Failed"),
                      (4, "Succeeded"),
                      (5, "Cancelled"),
                  ],
                  default=0,
              ),
          ),
          migrations.AddField(
              model_name="method",
              name="staged_image_uuid",
              field=models.UUIDField(blank=True, editable=False, null=True),
          ),
          migrations.AlterField(
              model_name="method",
              name="image",
              field=models.FileField(
                  blank=True,
                  help_text="Tar archive of the container image produced from the command `docker save IMAGE > IMAGE.tar`. See https://docs.docker.com/engine/reference/commandline/save/",
                  upload_to=grandchallenge.components.models.docker_image_path,
                  validators=[
                      grandchallenge.core.validators.ExtensionValidator(
                          allowed_extensions=(".tar",)
                      )
                  ],
              ),
          ),
          migrations.AlterField(
              model_name="config",
              name="extra_results_columns",
              field=django.contrib.postgres.fields.jsonb.JSONField(
                  blank=True,
                  default=list,
                  help_text="A JSON object that contains the extra columns from metrics.json that will be displayed on the results page. ",
              ),
          ),
          migrations.AddField(
              model_name="config",
              name="score_error_jsonpath",
              field=models.CharField(
                  blank=True,
                  help_text="The jsonpath for the field in metrics.json that contains the error of the score, eg: dice.std",
                  max_length=255,
              ),
          ),
          migrations.AlterField(
              model_name="config",
              name="extra_results_columns",
              field=django.contrib.postgres.fields.jsonb.JSONField(
                  blank=True,
                  default=list,
                  help_text="A JSON object that contains the extra columns from metrics.json that will be displayed on the results page. ",
                  validators=[
                      grandchallenge.core.validators.JSONSchemaValidator(
                          schema={
                              "$id": "http://json-schema.org/draft-06/schema#",
                              "$schema": "http://json-schema.org/draft-06/schema#",
                              "definitions": {},
                              "items": {
                                  "$id": "#/items",
                                  "properties": {
                                      "error_path": {
                                          "$id": "#/items/properties/error_path",
                                          "default": "",
                                          "examples": ["aggregates.dice.std"],
                                          "pattern": "^(.*)$",
                                          "title": "The Error Path Schema",
                                          "type": "string",
                                      },
                                      "path": {
                                          "$id": "#/items/properties/path",
                                          "default": "",
                                          "examples": ["aggregates.dice.mean"],
                                          "pattern": "^(.*)$",
                                          "title": "The Path Schema",
                                          "type": "string",
                                      },
                                      "title": {
                                          "$id": "#/items/properties/title",
                                          "default": "",
                                          "examples": ["Mean Dice"],
                                          "pattern": "^(.*)$",
                                          "title": "The Title Schema",
                                          "type": "string",
                                      },
                                  },
                                  "required": ["title", "path"],
                                  "title": "The Items Schema",
                                  "type": "object",
                              },
                              "title": "The Extra Results Columns Schema",
                              "type": "array",
                          }
                      )
                  ],
              ),
          ),
          migrations.AlterField(
              model_name="config",
              name="score_jsonpath",
              field=models.CharField(
                  blank=True,
                  help_text="The jsonpath of the field in metrics.json that will be used for the overall scores on the results page. See http://goessner.net/articles/JsonPath/ for syntax. For example: dice.mean",
                  max_length=255,
              ),
          ),
          migrations.AlterField(
              model_name="config",
              name="score_title",
              field=models.CharField(
                  default="Score",
                  help_text="The name that will be displayed for the scores column, for instance: Score (log-loss)",
                  max_length=32,
              ),
          ),
          migrations.RemoveField(model_name="result", name="absolute_url",),
          migrations.AddField(
              model_name="config",
              name="scoring_method_choice",
              field=models.CharField(
                  choices=[
                      ("abs", "Use the absolute value of the score column"),
                      (
                          "avg",
                          "Use the mean of the relative ranks of the score and extra result columns",
                      ),
                      (
                          "med",
                          "Use the median of the relative ranks of the score and extra result columns",
                      ),
                  ],
                  default="abs",
                  help_text="How should the rank of each result be calculated?",
                  max_length=3,
              ),
          ),
          migrations.AddField(
              model_name="result",
              name="rank_per_metric",
              field=django.contrib.postgres.fields.jsonb.JSONField(default=dict),
          ),
          migrations.AddField(
              model_name="result",
              name="rank_score",
              field=models.FloatField(default=0.0),
          ),
          migrations.AlterField(
              model_name="config",
              name="extra_results_columns",
              field=django.contrib.postgres.fields.jsonb.JSONField(
                  blank=True,
                  default=list,
                  help_text="A JSON object that contains the extra columns from metrics.json that will be displayed on the results page. ",
                  validators=[
                      grandchallenge.core.validators.JSONSchemaValidator(
                          schema={
                              "$schema": "http://json-schema.org/draft-06/schema#",
                              "definitions": {},
                              "items": {
                                  "$id": "#/items",
                                  "additionalProperties": False,
                                  "properties": {
                                      "error_path": {
                                          "$id": "#/items/properties/error_path",
                                          "default": "",
                                          "examples": ["aggregates.dice.std"],
                                          "pattern": "^(.*)$",
                                          "title": "The Error Path Schema",
                                          "type": "string",
                                      },
                                      "order": {
                                          "$id": "#/items/properties/order",
                                          "default": "",
                                          "enum": ["asc", "desc"],
                                          "examples": ["asc"],
                                          "pattern": "^(asc|desc)$",
                                          "title": "The Order Schema",
                                          "type": "string",
                                      },
                                      "path": {
                                          "$id": "#/items/properties/path",
                                          "default": "",
                                          "examples": ["aggregates.dice.mean"],
                                          "pattern": "^(.*)$",
                                          "title": "The Path Schema",
                                          "type": "string",
                                      },
                                      "title": {
                                          "$id": "#/items/properties/title",
                                          "default": "",
                                          "examples": ["Mean Dice"],
                                          "pattern": "^(.*)$",
                                          "title": "The Title Schema",
                                          "type": "string",
                                      },
                                  },
                                  "required": ["title", "path", "order"],
                                  "title": "The Items Schema",
                                  "type": "object",
                              },
                              "title": "The Extra Results Columns Schema",
                              "type": "array",
                          }
                      )
                  ],
              ),
          ),
          migrations.AddField(
              model_name="method",
              name="requires_cpu_cores",
              field=models.DecimalField(
                  decimal_places=2, default=Decimal("1.0"), max_digits=4
              ),
          ),
          migrations.AddField(
              model_name="method",
              name="requires_gpu",
              field=models.BooleanField(default=False),
          ),
          migrations.AddField(
              model_name="method",
              name="requires_gpu_memory_gb",
              field=models.PositiveIntegerField(default=4),
          ),
          migrations.AddField(
              model_name="method",
              name="requires_memory_gb",
              field=models.PositiveIntegerField(default=4),
          ),
          migrations.AlterField(
              model_name="method",
              name="image",
              field=models.FileField(
                  blank=True,
                  help_text=".tar.gz archive of the container image produced from the command 'docker save IMAGE | gzip -c > IMAGE.tar.gz'. See https://docs.docker.com/engine/reference/commandline/save/",
                  upload_to=grandchallenge.components.models.docker_image_path,
                  validators=[
                      grandchallenge.core.validators.ExtensionValidator(
                          allowed_extensions=(".tar", ".tar.gz")
                      )
                  ],
              ),
          ),
          migrations.AlterField(
              model_name="method",
              name="image",
              field=models.FileField(
                  blank=True,
                  help_text=".tar.gz archive of the container image produced from the command 'docker save IMAGE | gzip -c > IMAGE.tar.gz'. See https://docs.docker.com/engine/reference/commandline/save/",
                  storage=grandchallenge.core.storage.PrivateS3Storage(),
                  upload_to=grandchallenge.components.models.docker_image_path,
                  validators=[
                      grandchallenge.core.validators.ExtensionValidator(
                          allowed_extensions=(".tar", ".tar.gz")
                      )
                  ],
              ),
          ),
          migrations.RenameField(
              model_name="submission",
              old_name="file",
              new_name="predictions_file",
          ),
          migrations.AlterField(
              model_name="submission",
              name="predictions_file",
              field=models.FileField(
                  storage=grandchallenge.core.storage.PrivateS3Storage(),
                  upload_to=grandchallenge.evaluation.models.submission_file_path,
                  validators=[
                      grandchallenge.core.validators.MimeTypeValidator(
                          allowed_types=("application/zip", "text/plain")
                      ),
                      grandchallenge.core.validators.ExtensionValidator(
                          allowed_extensions=(".zip", ".csv")
                      ),
                  ],
              ),
          ),
          migrations.AlterField(
              model_name="submission",
              name="predictions_file",
              field=models.FileField(
                  storage=grandchallenge.core.storage.ProtectedS3Storage(),
                  upload_to=grandchallenge.evaluation.models.submission_file_path,
                  validators=[
                      grandchallenge.core.validators.MimeTypeValidator(
                          allowed_types=("application/zip", "text/plain")
                      ),
                      grandchallenge.core.validators.ExtensionValidator(
                          allowed_extensions=(".zip", ".csv")
                      ),
                  ],
              ),
          ),
          migrations.RemoveField(model_name="job", name="challenge",),
          migrations.RemoveField(model_name="result", name="challenge",),
          migrations.AddField(
              model_name="config",
              name="display_all_metrics",
              field=models.BooleanField(
                  default=True,
                  help_text="Should all of the metrics be displayed on the Result detail page?",
              ),
          ),
          migrations.AlterField(
              model_name="submission",
              name="supplementary_file",
              field=models.FileField(
                  blank=True,
                  storage=grandchallenge.core.storage.PublicS3Storage(),
                  upload_to=grandchallenge.evaluation.models.submission_supplementary_file_path,
                  validators=[
                      grandchallenge.core.validators.MimeTypeValidator(
                          allowed_types=("text/plain", "application/pdf")
                      )
                  ],
              ),
          ),
          migrations.AddField(
              model_name="job",
              name="completed_at",
              field=models.DateTimeField(null=True),
          ),
          migrations.AddField(
              model_name="job",
              name="started_at",
              field=models.DateTimeField(null=True),
          ),
          migrations.AddField(
              model_name="config",
              name="inputs",
              field=models.ManyToManyField(
                  related_name="evaluation_inputs",
                  to="components.ComponentInterface",
              ),
          ),
          migrations.AddField(
              model_name="config",
              name="outputs",
              field=models.ManyToManyField(
                  related_name="evaluation_outputs",
                  to="components.ComponentInterface",
              ),
          ),
          migrations.AddField(
              model_name="job",
              name="inputs",
              field=models.ManyToManyField(
                  related_name="evaluation_jobs_as_input",
                  to="components.ComponentInterfaceValue",
              ),
          ),
          migrations.AddField(
              model_name="job",
              name="outputs",
              field=models.ManyToManyField(
                  related_name="evaluation_jobs_as_output",
                  to="components.ComponentInterfaceValue",
              ),
          ),
          migrations.AddField(
              model_name="job",
              name="published",
              field=models.BooleanField(default=True),
          ),
          migrations.AddField(
              model_name="job",
              name="rank",
              field=models.PositiveIntegerField(
                  default=0,
                  help_text="The position of this result on the leaderboard. If the value is zero, then the result is unranked.",
              ),
          ),
          migrations.AddField(
              model_name="job",
              name="rank_per_metric",
              field=django.contrib.postgres.fields.jsonb.JSONField(default=dict),
          ),
          migrations.AddField(
              model_name="job",
              name="rank_score",
              field=models.FloatField(default=0.0),
          ),
          migrations.DeleteModel(name="Result",),
          migrations.RenameModel(old_name="Job", new_name="Evaluation",),
          migrations.AlterField(
              model_name="evaluation",
              name="inputs",
              field=models.ManyToManyField(
                  related_name="evaluation_evaluations_as_input",
                  to="components.ComponentInterfaceValue",
              ),
          ),
          migrations.AlterField(
              model_name="evaluation",
              name="outputs",
              field=models.ManyToManyField(
                  related_name="evaluation_evaluations_as_output",
                  to="components.ComponentInterfaceValue",
              ),
          ),
          migrations.AlterField(
              model_name="submission",
              name="predictions_file",
              field=models.FileField(
                  blank=True,
                  storage=grandchallenge.core.storage.ProtectedS3Storage(),
                  upload_to=grandchallenge.evaluation.models.submission_file_path,
                  validators=[
                      grandchallenge.core.validators.MimeTypeValidator(
                          allowed_types=("application/zip", "text/plain")
                      ),
                      grandchallenge.core.validators.ExtensionValidator(
                          allowed_extensions=(".zip", ".csv")
                      ),
                  ],
              ),
          ),
          migrations.AddField(
              model_name="config",
              name="submission_kind",
              field=models.PositiveSmallIntegerField(
                  choices=[(1, "CSV"), (2, "ZIP"), (3, "Algorithm")],
                  default=1,
                  help_text="Should participants submit a .csv/.zip file of predictions, or an algorithm?",
              ),
          ),
          migrations.AddField(
              model_name="submission",
              name="algorithm_image",
              field=models.ForeignKey(
                  null=True,
                  on_delete=django.db.models.deletion.SET_NULL,
                  to="algorithms.AlgorithmImage",
              ),
          ),
          migrations.CreateModel(
              name="AlgorithmEvaluation",
              fields=[
                  (
                      "status",
                      models.PositiveSmallIntegerField(
                          choices=[
                              (0, "Queued"),
                              (1, "Started"),
                              (2, "Re-Queued"),
                              (3, "Failed"),
                              (4, "Succeeded"),
                              (5, "Cancelled"),
                          ],
                          default=0,
                      ),
                  ),
                  ("output", models.TextField()),
                  ("started_at", models.DateTimeField(null=True)),
                  ("completed_at", models.DateTimeField(null=True)),
                  ("id", models.BigAutoField(primary_key=True, serialize=False)),
                  ("created", models.DateTimeField(auto_now_add=True)),
                  ("modified", models.DateTimeField(auto_now=True)),
                  (
                      "inputs",
                      models.ManyToManyField(
                          related_name="evaluation_algorithmevaluations_as_input",
                          to="components.ComponentInterfaceValue",
                      ),
                  ),
                  (
                      "outputs",
                      models.ManyToManyField(
                          related_name="evaluation_algorithmevaluations_as_output",
                          to="components.ComponentInterfaceValue",
                      ),
                  ),
                  (
                      "submission",
                      models.ForeignKey(
                          on_delete=django.db.models.deletion.CASCADE,
                          to="evaluation.Submission",
                      ),
                  ),
              ],
              options={"abstract": False},
          ),
          migrations.AlterUniqueTogether(
              name="submission",
              unique_together={
                  ("challenge", "predictions_file", "algorithm_image")
              },
          ),
      ]
  