diff --git a/anatomy/static/css/anatomy.css b/anatomy/static/css/anatomy.css index 512012f6..3f0bca3b 100644 --- a/anatomy/static/css/anatomy.css +++ b/anatomy/static/css/anatomy.css @@ -810,4 +810,8 @@ input { .finding-box { display: flex; border: 1px dashed gray; +} + +.delete-finding-link { + float: right; } \ No newline at end of file diff --git a/atlas/forms.py b/atlas/forms.py index bc9c1570..3dd5e45c 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -25,12 +25,6 @@ from tinymce.widgets import TinyMCE from dal import autocomplete -class ExaminationForm(ModelForm): - class Meta: - model = Examination - fields = ["examination"] - - class SeriesFindingForm(ModelForm): class Meta: model = SeriesFinding @@ -129,6 +123,13 @@ class SeriesForm(ModelForm): exclude = ["author"] + widgets = { + "examination": autocomplete.ModelSelect2Multiple( + url="generic:examination-autocomplete" + ), + } + + class CaseForm(ModelForm): # exams = ModelMultipleChoiceField(required=False, queryset=Exam.objects.all(),widget=FilteredSelectMultiple(verbose_name="Exams", is_stacked=False)) diff --git a/atlas/migrations/0014_remove_case_sign.py b/atlas/migrations/0014_remove_case_sign.py new file mode 100644 index 00000000..920dd994 --- /dev/null +++ b/atlas/migrations/0014_remove_case_sign.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.8 on 2021-12-01 19:32 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('atlas', '0013_rename_structure_structure_name'), + ] + + operations = [ + migrations.RemoveField( + model_name='case', + name='sign', + ), + ] diff --git a/atlas/templates/atlas/series_form.html b/atlas/templates/atlas/series_form.html index 61ad33cf..2e02bd57 100755 --- a/atlas/templates/atlas/series_form.html +++ b/atlas/templates/atlas/series_form.html @@ -304,6 +304,43 @@ } } + + function extractDicomStudyDescription(byteArray) { + // We need to setup a try/catch block because parseDicom will throw an exception + // if you attempt to parse a non dicom part 10 file (or one that is corrupted) + try { + // parse byteArray into a DataSet object using the parseDicom library + var dataSet = dicomParser.parseDicom(byteArray); + + // dataSet contains the parsed elements. Each element is available via a property + // in the dataSet.elements object. The property name is based on the elements group + // and element in the following format: xggggeeee where gggg is the group number + // and eeee is the element number with lowercase hex characters. + + // To access the data for an element, we need to know its type and its tag. + // We will get the sopInstanceUid from the file which is a string and + // has the tag (0020,000D) + var study_description = dataSet.string('x00081030').toLowerCase(); + console.log("STUDY", study_description); + + // try to match with a study description (if not already selected) + if ($(`#id_examination_to option`).length < 1) { + option = $(`#id_examination_from option[title*='${study_description}' i]`); + + if (option.length) { + option.appendTo($("#id_examination_to")); + toastr.success(`Examination set to ${option.attr('title')} from dicom data`); + } else { + toastr.warning( + `Unable to set examination ${study_description} from dicom data (it needs creating)`); + + } + } + + } catch (err) { + console.log(err); + } + } {{ form.media }} diff --git a/atlas/templates/atlas/series_viewer.html b/atlas/templates/atlas/series_viewer.html index 0dba8a2b..2b366040 100755 --- a/atlas/templates/atlas/series_viewer.html +++ b/atlas/templates/atlas/series_viewer.html @@ -23,10 +23,10 @@ {% for finding in series.findings.all %}