fix many issues

This commit is contained in:
Ross
2026-06-03 20:38:29 +01:00
parent 46518a45c1
commit 2e854c43b6
7 changed files with 166 additions and 12 deletions
+10 -5
View File
@@ -1379,7 +1379,7 @@ def _populate_case_study_date_on_series_image_save(sender, instance, **kwargs):
if not instance.series_id:
return
tags = instance.basic_dicom_tags or {}
tags = getattr(instance, "basic_dicom_tags", None) or {}
raw_date = tags.get("StudyDate") or tags.get("AcquisitionDate") or tags.get("SeriesDate")
parsed = Case._parse_dicom_date(raw_date)
if not parsed:
@@ -1520,6 +1520,14 @@ class Series(SeriesBase):
self.pk, self.get_examination_full(), self.description, case_id
)
def get_viewer_stack_description(self) -> str:
description = self.description or str(self.examination or "Series")
if self.plane:
description = f"{description} ({self.plane})"
if self.contrast:
description = f"{description} / {self.contrast}"
return description
def get_absolute_url(self):
return reverse("atlas:series_detail", kwargs={"pk": self.pk})
@@ -1558,10 +1566,7 @@ class Series(SeriesBase):
# else:
# instances.append(image.get_image_dicom_json(image_index))
description = f"{self.examination} ({self.plane})"
if self.contrast and self.contrast is not None:
description = f"{description} / {self.contrast}"
series_json["SeriesDescription"] = description
series_json["SeriesDescription"] = self.get_viewer_stack_description()
series_json["instances"] = instances
return series_json