Skip to content

Commit

Permalink
Merge pull request #1077 from ImageMarkup/add-lesion-detail-linkage
Browse files Browse the repository at this point in the history
Add lesion detail linkage to image detail page
  • Loading branch information
danlamanna authored Feb 5, 2025
2 parents 01e0f90 + 3a62486 commit 8bc051b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions isic/core/templates/core/image_detail/right_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,25 @@
{% endfor %}
</dd>
</div>

<div class="py-3 flex justify-between text-sm font-medium">
<dt class="text-gray-500">Belongs to</dt>
<dd class="text-gray-900">
{% if image.accession.patient %}
<span class="inline-flex items-center px-1.5 py-0.5 my-0.5 rounded-md text-sm font-medium bg-blue-100 text-blue-800">
<a href="#">{{ image.accession.patient.id }}</a>
</span>
<br />
{% endif %}

{% if image.accession.lesion %}
<span class="inline-flex items-center px-1.5 py-0.5 my-0.5 rounded-md text-sm font-medium bg-blue-100 text-blue-800">
<a href="{{ image.accession.lesion.get_absolute_url }}">{{ image.accession.lesion.id }}</a>
</span>
<br />
{% endif %}
</dd>
</div>

</dl>
</div>
4 changes: 4 additions & 0 deletions isic/ingest/models/lesion.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.db.models.functions.comparison import Coalesce
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.urls import reverse

from isic.core.constants import LESION_ID_REGEX

Expand Down Expand Up @@ -228,6 +229,9 @@ class Meta:
def __str__(self):
return f"{self.private_lesion_id}->{self.id}"

def get_absolute_url(self):
return reverse("core/lesion-detail", kwargs={"identifier": self.id})

def to_elasticsearch_document(self, *, body_only: bool = False) -> dict | EsLesionDocument:
document: EsLesionDocument = {"lesion_id": self.pk, "images": []}

Expand Down

0 comments on commit 8bc051b

Please sign in to comment.