diff --git a/anatomy/admin.py b/anatomy/admin.py index 2ba4072e..23344123 100644 --- a/anatomy/admin.py +++ b/anatomy/admin.py @@ -6,7 +6,7 @@ from .models import ( Answer, UserAnswer, Exam, - Modality, + #Modality, Region, BodyPart, Structure, @@ -56,7 +56,6 @@ admin.site.register(AnatomyQuestion, AnatomyAdmin) admin.site.register(QuestionType) admin.site.register(UserAnswer) admin.site.register(Exam, ExamAdmin) -admin.site.register(Modality) admin.site.register(Region) admin.site.register(BodyPart) admin.site.register(Structure) diff --git a/anatomy/migrations/0003_alter_anatomyquestion_modality_delete_modality.py b/anatomy/migrations/0003_alter_anatomyquestion_modality_delete_modality.py new file mode 100644 index 00000000..a67d689a --- /dev/null +++ b/anatomy/migrations/0003_alter_anatomyquestion_modality_delete_modality.py @@ -0,0 +1,47 @@ +# Generated by Django 4.1.4 on 2023-06-19 10:51 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ("longs", "0002_alter_longseries_modality"), + ("atlas", "0003_alter_series_modality"), + ("generic", "0002_modality_examination_modality"), + ("anatomy", "0002_initial"), + ] + + operations = [ + # migrations.DeleteModel( + # name='Modality', + # ), + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.DeleteModel( + name="Modality", + ), + ], + database_operations=[ + migrations.AlterModelTable( + name="Modality", + table="generic_modality", + ), + ], + ), + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.AlterField( + model_name="anatomyquestion", + name="modality", + field=models.ForeignKey( + help_text="Modality of the image", + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="generic.modality", + ), + ), + ], + database_operations=[], + ), + ] diff --git a/anatomy/models.py b/anatomy/models.py index 25bb1af6..40f99091 100644 --- a/anatomy/models.py +++ b/anatomy/models.py @@ -16,7 +16,7 @@ from sortedm2m.fields import SortedManyToManyField import string -from generic.models import CidUser, CidUserGroup, ExamUserStatus, Examination, ExamBase, QuestionBase, QuestionNote, UserAnswerBase, UserUserGroup +from generic.models import CidUser, CidUserGroup, ExamUserStatus, Examination, ExamBase, QuestionBase, QuestionNote, UserAnswerBase, UserUserGroup, Modality from collections import defaultdict from helpers.images import image_as_base64 @@ -57,11 +57,12 @@ class Region(models.Model): return self.region -class Modality(models.Model): - modality = models.CharField(max_length=200) - - def __str__(self): - return self.modality +## TODO: ??? Move to generic app +#class Modality(models.Model): +# modality = models.CharField(max_length=200) +# +# def __str__(self): +# return self.modality class QuestionType(models.Model): diff --git a/atlas/migrations/0003_alter_series_modality.py b/atlas/migrations/0003_alter_series_modality.py new file mode 100644 index 00000000..e93d4bf8 --- /dev/null +++ b/atlas/migrations/0003_alter_series_modality.py @@ -0,0 +1,29 @@ +# Generated by Django 4.1.4 on 2023-06-19 10:51 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ("generic", "0002_modality_examination_modality"), + ("atlas", "0002_initial"), + ] + + operations = [ + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.AlterField( + model_name="series", + name="modality", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="atlas_series_modality", + to="generic.modality", + ), + ), + ], + database_operations=[], + ) + ] diff --git a/atlas/models.py b/atlas/models.py index 3c0b146c..84689252 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -29,7 +29,6 @@ import string from collections import defaultdict from helpers.images import image_as_base64, pretty_print_dicom -from anatomy.models import Modality from generic.models import ( CidUser, @@ -44,6 +43,7 @@ from generic.models import ( QuestionNote, SeriesBase, SeriesImageBase, + Modality, ) # from generic.models import Examination, Site, Condition, Sign diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html index 5f009bfe..60c3454b 100755 --- a/atlas/templates/atlas/case_display_block.html +++ b/atlas/templates/atlas/case_display_block.html @@ -34,8 +34,8 @@
- Popup + Popup @@ -53,51 +53,53 @@
  • {{con.get_link}}
  • {% endfor %} -
    - Findings - {% if case.series.all %} - See individual series for more details.
    - {% for series in case.series.all %} - {% for finding in series.findings.all %} -
    - - Series {{series.pk}}: {{series.get_examination_full}} |  - - {% if finding.findings.all %} +
    +
    + Findings + {% if case.series.all %} + {% for series in case.series.all %} + {% for finding in series.findings.all %} +
    - Findings: {% for f in finding.findings.all %} - {{f.get_link}},  - {% endfor %} + Series {{series.pk}}: {{series.get_examination_full}} |  - {% endif %} - {% if finding.structures.all %} - - Structure: {% for s in finding.structures.all %} - {{s.get_link}},  - {% endfor %} - - {% endif %} - {% if finding.description %} - - Description: {{finding.description}} - - {% endif %} -
    - + {% if finding.findings.all %} + + Findings: {% for f in finding.findings.all %} + {{f.get_link}},  + {% endfor %} + + {% endif %} + {% if finding.structures.all %} + + Structure: {% for s in finding.structures.all %} + {{s.get_link}},  + {% endfor %} + + {% endif %} + {% if finding.description %} + + Description: {{finding.description}} + + {% endif %} +
    + {% endfor %} {% endfor %} - {% endfor %} - {% else %} - No findings associated with case. - {% endif %} -
    -
    - Differentials - -
    + {% else %} + No series associated with case. + {% endif %} + + +
    +
    + Differentials + +
    +

    Subspecialty: @@ -114,9 +116,9 @@ Collections: + hx-get="{% url 'atlas:case_collection_form' case.pk %}" + hx-target="#collection-form"> + Add collection