Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional indexes for accessions #980

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Generated by Django 5.1.1 on 2024-10-05 00:51

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("ingest", "0006_accession_valid_diagnosis_accession_valid_legacy_dx"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AddIndex(
model_name="accession",
index=models.Index(
fields=["fitzpatrick_skin_type"], name="ingest_acce_fitzpat_15c454_idx"
),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(
condition=models.Q(
(
"anatom_site_general__in",
["palms/soles", "lateral torso", "oral/genital"],
)
),
fields=["anatom_site_general"],
name="accession_anatom_site_general",
),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(
condition=models.Q(("benign_malignant", "benign"), _negated=True),
fields=["benign_malignant"],
name="accession_benign_malignant",
),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(
condition=models.Q(("diagnosis__in", [None, "", "Benign"]), _negated=True),
fields=["diagnosis"],
name="accession_diagnosis",
),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(fields=["legacy_dx"], name="ingest_acce_legacy__33310d_idx"),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(fields=["mel_class"], name="ingest_acce_mel_cla_716507_idx"),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(fields=["mel_mitotic_index"], name="ingest_acce_mel_mit_261415_idx"),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(fields=["mel_type"], name="ingest_acce_mel_typ_5d54e1_idx"),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(fields=["mel_ulcer"], name="ingest_acce_mel_ulc_d11b54_idx"),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(fields=["nevus_type"], name="ingest_acce_nevus_t_8c8b30_idx"),
),
migrations.AddIndex(
model_name="accession",
index=models.Index(
condition=models.Q(
("image_type__in", ["TBP tile: close-up", "dermoscopic"]),
_negated=True,
),
fields=["image_type"],
name="accession_image_type",
),
),
]
30 changes: 30 additions & 0 deletions isic/ingest/models/accession.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,36 @@ class Meta(CreationSortedTimeStampedModel.Meta):
# metadata selection does WHERE original_blob_name IN (...) queries
models.Index(fields=["original_blob_name"]),
models.Index(fields=["girder_id"]),
# metadata fields
models.Index(fields=["fitzpatrick_skin_type"]),
models.Index(
name="accession_anatom_site_general",
fields=["anatom_site_general"],
condition=Q(
anatom_site_general__in=["palms/soles", "lateral torso", "oral/genital"]
),
),
models.Index(
name="accession_benign_malignant",
fields=["benign_malignant"],
condition=~Q(benign_malignant="benign"),
),
models.Index(
name="accession_diagnosis",
fields=["diagnosis"],
condition=~Q(diagnosis__in=[None, "", "Benign"]),
),
models.Index(fields=["legacy_dx"]),
models.Index(fields=["mel_class"]),
models.Index(fields=["mel_mitotic_index"]),
models.Index(fields=["mel_type"]),
models.Index(fields=["mel_ulcer"]),
models.Index(fields=["nevus_type"]),
models.Index(
name="accession_image_type",
fields=["image_type"],
condition=~Q(image_type__in=["TBP tile: close-up", "dermoscopic"]),
),
]

def __str__(self) -> str:
Expand Down
Loading