diff --git a/atlas/templates/atlas/partials/displayset_row.html b/atlas/templates/atlas/partials/displayset_row.html
index 88c93c64..5bfead5b 100644
--- a/atlas/templates/atlas/partials/displayset_row.html
+++ b/atlas/templates/atlas/partials/displayset_row.html
@@ -55,12 +55,10 @@
Show advanced (viewer state & annotations)
{{ ds.viewerstate|default:"{}" }}
+ {% include 'atlas/partials/json_pretty.html' with json_value=ds.viewerstate title='Viewer State' %}
{{ ds.annotations|default:"{}" }}
+ {% include 'atlas/partials/json_pretty.html' with json_value=ds.annotations title='Annotations' %}
.
+
+ Returns an HTML-escaped, pretty-formatted JSON string (marked safe).
+ """
+ try:
+ if isinstance(value, str):
+ obj = json.loads(value)
+ else:
+ obj = value
+ pretty = json.dumps(obj, indent=2, default=str, sort_keys=True)
+ except Exception:
+ try:
+ pretty = str(value) if value is not None else "{}"
+ except Exception:
+ pretty = "{}"
+
+ return mark_safe(escape(pretty))
diff --git a/atlas/views.py b/atlas/views.py
index 79b58926..45d724a8 100755
--- a/atlas/views.py
+++ b/atlas/views.py
@@ -3395,6 +3395,19 @@ def case_download(request, pk):
"id": case.pk,
"title": case.title,
"authors": [str(a) for a in case.author.all()],
+ # Non-DICOM metadata
+ "description": case.description,
+ "history": case.history,
+ "discussion": case.discussion,
+ "report": case.report,
+ "created_date": getattr(case, "created_date", None),
+ "modified_date": getattr(case, "modified_date", None),
+ "presentation": [str(p) for p in case.presentation.all()],
+ "subspecialty": [str(s) for s in case.subspecialty.all()],
+ "pathological_process": [str(p) for p in case.pathological_process.all()],
+ "procedures": [str(p) for p in case.procedures.all()],
+ "conditions": [str(c) for c in case.condition.all()],
+ "case_size_bytes": case.get_total_series_images_size() if hasattr(case, "get_total_series_images_size") else None,
},
"series": [],
}