diff --git a/atlas/migrations/0001_initial.py b/atlas/migrations/0001_initial.py new file mode 100644 index 00000000..44bbd5c6 --- /dev/null +++ b/atlas/migrations/0001_initial.py @@ -0,0 +1,68 @@ +# Generated by Django 3.2.8 on 2021-11-23 19:28 + +import atlas.models +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone +import sortedm2m.fields +import tagulous.models.fields + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('anatomy', '0053_anatomyquestion_structure'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('generic', '0014_alter_questionnote_note'), + ] + + operations = [ + migrations.CreateModel( + name='Series', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.TextField(blank=True, help_text='Description of stack, for admin organisation, will not be visible when taking')), + ('open_access', models.BooleanField(default=True, help_text='If a question should be freely available to browse')), + ('author', models.ManyToManyField(blank=True, related_name='series', to=settings.AUTH_USER_MODEL)), + ('contrast', models.ForeignKey(blank=True, help_text='MRI / CT contrast', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='atlas_series_contrast', to='generic.contrast')), + ('examination', models.ForeignKey(help_text='Name of the examination', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='atlas_series_examination', to='generic.examination')), + ('modality', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='atlas_series_modality', to='anatomy.modality')), + ('plane', models.ForeignKey(blank=True, help_text='Plane of the examination', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='atlas_series_plane', to='generic.plane')), + ], + ), + migrations.CreateModel( + name='SeriesImage', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image', models.FileField(upload_to=atlas.models.image_directory_path)), + ('position', models.IntegerField(default=0)), + ('upload_filename', models.CharField(blank=True, max_length=255)), + ('series', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='images', to='atlas.series')), + ], + options={ + 'ordering': ['position'], + }, + ), + migrations.CreateModel( + name='Case', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.TextField(blank=True, help_text='Description of the case, for admin organisation, will not be visible when taking')), + ('history', models.TextField(blank=True, null=True)), + ('findings', models.TextField(blank=True, null=True)), + ('subpecialty', models.CharField(choices=[('BR', 'Breast'), ('CA', 'Cardiac'), ('GI', 'Gastrointestinal and hepatobiliary'), ('HN', 'Head and Neck'), ('MS', 'Musculoskeletal'), ('NE', 'Neuroradiology'), ('OG', 'Obstectric and Gynaecological'), ('PA', 'Paediatric'), ('UR', 'Uroradiology'), ('VA', 'Vascular'), ('HA', 'Haemotology and Oncology')], max_length=2)), + ('verified', models.BooleanField(default=False)), + ('created_date', models.DateTimeField(default=django.utils.timezone.now)), + ('published_date', models.DateTimeField(blank=True, null=True)), + ('scrapped', models.BooleanField(default=False, help_text='Question has been scrapped and will not be shown')), + ('open_access', models.BooleanField(default=True, help_text='If a question should be freely available to browse')), + ('author', models.ManyToManyField(blank=True, help_text='Author of question', related_name='atlas_authored_questions', to=settings.AUTH_USER_MODEL)), + ('condition', tagulous.models.fields.TagField(_set_tag_meta=True, blank=True, help_text='Associated condition. Will allow searching / filtering and tips / hints to be displayed. Conditions with spaces must be enclosed in quotes "..."', to='generic.Condition')), + ('series', sortedm2m.fields.SortedManyToManyField(help_text=None, related_name='atlas', to='atlas.Series')), + ('sign', tagulous.models.fields.TagField(_set_tag_meta=True, blank=True, help_text='Radiological signs in the question', to='generic.Sign')), + ], + ), + ] diff --git a/atlas/models.py b/atlas/models.py index b0cbfd60..9b0b8d36 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -186,19 +186,19 @@ class SeriesImage(models.Model): @reversion.register class Series(models.Model): modality = models.ForeignKey( - Modality, related_name="series_modality", on_delete=models.SET_NULL, null=True + Modality, related_name="atlas_series_modality", on_delete=models.SET_NULL, null=True ) examination = models.ForeignKey( Examination, help_text="Name of the examination", - related_name="series_examination", + related_name="atlas_series_examination", on_delete=models.SET_NULL, null=True, ) plane = models.ForeignKey( Plane, help_text="Plane of the examination", - related_name="series_plane", + related_name="atlas_series_plane", on_delete=models.SET_NULL, null=True, blank=True, @@ -206,7 +206,7 @@ class Series(models.Model): contrast = models.ForeignKey( Contrast, help_text="MRI / CT contrast", - related_name="series_contrast", + related_name="atlas_series_contrast", on_delete=models.SET_NULL, null=True, blank=True, diff --git a/rad/settings.py b/rad/settings.py index 7acf0c32..f8b93c15 100644 --- a/rad/settings.py +++ b/rad/settings.py @@ -37,6 +37,7 @@ INSTALLED_APPS = [ 'longs', 'sbas', 'wally', + 'atlas', "reversion", "django_tables2", "django_filters", diff --git a/rad/urls.py b/rad/urls.py index 10306c96..f7d679c1 100644 --- a/rad/urls.py +++ b/rad/urls.py @@ -52,6 +52,7 @@ urlpatterns = [ path("longs/", include("longs.urls"), name="longs"), path("sbas/", include("sbas.urls"), name="sbas"), path("generic/", include("generic.urls"), name="generic"), + path("atlas/", include("atlas.urls"), name="atlas"), path("accounts/", include("django.contrib.auth.urls")), path("accounts/profile", views.profile, name="profile"), path("", TemplateView.as_view(template_name="index.html"), name="home"),