update seriesfinding to contain conditions
This commit is contained in:
@@ -127,6 +127,10 @@ class SeriesFindingForm(ModelForm):
|
||||
"structures": autocomplete.ModelSelect2Multiple(
|
||||
url="atlas:structure-autocomplete"
|
||||
),
|
||||
"conditions": autocomplete.ModelSelect2Multiple(
|
||||
url="atlas:condition-autocomplete"
|
||||
),
|
||||
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.2 on 2024-02-24 21:20
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('atlas', '0043_seriesdetail_feedback'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='seriesfinding',
|
||||
name='conditions',
|
||||
field=models.ManyToManyField(blank=True, to='atlas.condition'),
|
||||
),
|
||||
]
|
||||
+2
-1
@@ -514,12 +514,13 @@ class SeriesFinding(models.Model):
|
||||
)
|
||||
findings = models.ManyToManyField(Finding, blank=True)
|
||||
structures = models.ManyToManyField(Structure, blank=True)
|
||||
conditions = models.ManyToManyField(Condition, blank=True)
|
||||
annotation_json = models.TextField(null=True, blank=True)
|
||||
viewport_json = models.TextField(null=True, blank=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
findings = self.findings.all().values_list("name")
|
||||
return f"{self.series.id}/{findings}/{self.description}"
|
||||
return f"SeriesFinding: {self.series.id}/{findings}/{self.description}"
|
||||
|
||||
def annotation_as_string(self) -> str:
|
||||
return json.dumps(self.annotation_json)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<div>Description: {{ series_finding_form.description }}</div>
|
||||
<div>Findings: {{ series_finding_form.findings }}</div>
|
||||
<div>Structures: {{ series_finding_form.structures }}</div>
|
||||
<div>Conditions: {{ series_finding_form.conditions }}</div>
|
||||
</div>
|
||||
<input type="submit" value="Submit">
|
||||
<button id="cancel-add-finding-button">Cancel</button>
|
||||
@@ -48,6 +49,7 @@
|
||||
<span class="view-finding-details">
|
||||
Finding(s): {% for f in finding.findings.all %}{{f.get_link}}{% endfor %}<br />
|
||||
Structure(s): {% for s in finding.structures.all %}{{s.get_link}}{% endfor %}<br />
|
||||
Condition(s): {% for s in finding.conditions.all %}{{s.get_link}}{% endfor %}<br />
|
||||
Description: {{finding.description}}<br />
|
||||
</span>
|
||||
<a href="{% url 'atlas:series_edit_finding' pk=series.pk finding_pk=finding.pk %}" class="edit-finding-link">Edit</a>
|
||||
@@ -252,7 +254,8 @@
|
||||
cornerstone.getEnabledElement(dicom_element).viewport = viewport
|
||||
cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(
|
||||
annotation);
|
||||
console.log(annotation)
|
||||
console.log("annotation", annotation)
|
||||
console.log("viewport", viewport)
|
||||
//cornerstone.getEnabledElement(dicom_element).toolStateManager.restoreToolState(annotationjson)
|
||||
cornerstone.resize(dicom_element);
|
||||
|
||||
@@ -285,6 +288,11 @@
|
||||
.map((i, el) => {
|
||||
return $(el).val()
|
||||
}).toArray()),
|
||||
conditions: JSON.stringify($('#finding-form select[name="conditions"]').find(
|
||||
":selected")
|
||||
.map((i, el) => {
|
||||
return $(el).val()
|
||||
}).toArray()),
|
||||
csrfmiddlewaretoken: $('input[name=csrfmiddlewaretoken]').val(),
|
||||
action: 'post'
|
||||
},
|
||||
|
||||
@@ -1193,6 +1193,7 @@ def create_series_findings(request):
|
||||
series_id = request.POST.get("series")
|
||||
findings_ids = json.loads(request.POST.get("findings"))
|
||||
structure_ids = json.loads(request.POST.get("structures"))
|
||||
condition_ids = json.loads(request.POST.get("conditions"))
|
||||
description = request.POST.get("description")
|
||||
annotation_json = request.POST.get("annotation_json")
|
||||
viewport_json = request.POST.get("viewport_json")
|
||||
@@ -1200,6 +1201,7 @@ def create_series_findings(request):
|
||||
series = Series.objects.get(pk=series_id)
|
||||
findings = Finding.objects.filter(pk__in=findings_ids)
|
||||
structures = Structure.objects.filter(pk__in=structure_ids)
|
||||
conditions = Condition.objects.filter(pk__in=condition_ids)
|
||||
|
||||
if series_finding_id > 0:
|
||||
sf = get_object_or_404(SeriesFinding, pk=series_finding_id)
|
||||
@@ -1217,6 +1219,7 @@ def create_series_findings(request):
|
||||
|
||||
sf.findings.set(findings)
|
||||
sf.structures.set(structures)
|
||||
sf.conditions.set(conditions)
|
||||
sf.save()
|
||||
return JsonResponse({"success": True})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user