# Generated by Django 4.1.4 on 2023-06-12 10:07 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import rapids.models import sortedm2m.fields class Migration(migrations.Migration): initial = True dependencies = [ ('generic', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Abnormality', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(help_text='Primary abnormality on the film(s)', max_length=200, unique=True)), ], options={ 'ordering': ('name',), }, ), migrations.CreateModel( name='Exam', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(help_text='Name of the exam', max_length=200)), ('active', models.BooleanField(default=False, help_text='If an exam should be available to take')), ('exam_mode', models.BooleanField(default=False, help_text='If an exam should be taken in exam mode (users results will be submited to the server for marking)')), ('include_history', models.BooleanField(default=False, help_text='If an exam should include history when taking')), ('publish_results', models.BooleanField(default=False, help_text='If an exams results should be available')), ('recreate_json', models.BooleanField(default=False, help_text='If the json cache needs updating')), ('json_creation_time', models.DateTimeField(blank=True, default=None, null=True)), ('exam_json_id', models.IntegerField(default=1, help_text='auto incrementing field when json recreated')), ('archive', models.BooleanField(default=False, help_text='Archived exams will remain on the test system but will not be displayed by default')), ('open_access', models.BooleanField(default=False, help_text='If the exam is freely accessible (to view and edit on the test system)')), ('authors_only', models.BooleanField(default=False, help_text='If true only exam authors will be able to view.')), ('stats_mean', models.FloatField(default=0)), ('stats_mode', models.CharField(default=0, max_length=25)), ('stats_median', models.FloatField(default=0)), ('stats_candidates', models.FloatField(default=0)), ('stats_min', models.FloatField(default=0)), ('stats_max', models.FloatField(default=0)), ('stats_max_possible', models.FloatField(default=0)), ('user_scores', models.JSONField(default=dict)), ('exam_results_emailed', models.DateTimeField(default=None, null=True)), ('time_limit', models.IntegerField(default=2100, help_text='Exam time limit (in seconds). Default is 2100 secondse (35 minutes)')), ('author', models.ManyToManyField(blank=True, help_text='Author of exam', related_name='rapid_exam_author', to=settings.AUTH_USER_MODEL)), ('cid_user_groups', models.ManyToManyField(blank=True, help_text='These groups define which candidates are able to be added to the exams/collection.', related_name='rapid_cid_user_groups', to='generic.cidusergroup')), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='Examination', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('examination', models.CharField(max_length=200)), ], options={ 'ordering': ('examination',), }, ), migrations.CreateModel( name='Rapid', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('authors_only', models.BooleanField(default=False, help_text='If true only question authors will be able to view.')), ('created_date', models.DateTimeField(default=django.utils.timezone.now)), ('open_access', models.BooleanField(default=True, help_text='If a question should be freely available to browse')), ('feedback', models.TextField(blank=True, help_text='Question Feedback', null=True)), ('question', models.TextField(blank=True, null=True)), ('history', models.TextField(blank=True, null=True)), ('normal', models.BooleanField(default=False, help_text='Tick if true')), ('laterality', models.CharField(choices=[('NONE', 'None'), ('LEFT', 'Left'), ('RIGHT', 'Right'), ('BILAT', 'Bilateral')], default='NONE', help_text='Applies to the answer, not the examination', max_length=20)), ('verified', models.BooleanField(default=False)), ('scrapped', models.BooleanField(default=False, help_text='Question has been scrapped and will not be shown')), ('abnormality', models.ManyToManyField(blank=True, help_text='The abnormality (laterality and region independent). Used for categorisation but does not affect the answer', to='rapids.abnormality')), ('author', models.ManyToManyField(blank=True, help_text='Author of question', related_name='rapid_authored_questions', to=settings.AUTH_USER_MODEL)), ('examination', models.ManyToManyField(help_text='Name of the (primary) examination', to='rapids.examination')), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='Region', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(blank=True, help_text='Region of the abnormality (not including lateralitiy)', max_length=200, unique=True)), ], options={ 'ordering': ('name',), }, ), migrations.CreateModel( name='UserAnswer', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('cid', models.BigIntegerField(blank=True, help_text='Candidate ID (limitied by BigIntegerField size)', null=True)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('normal', models.BooleanField(default=False)), ('answer', models.TextField(blank=True, max_length=500)), ('answer_compare', models.TextField(blank=True, max_length=500)), ('score', models.CharField(blank=True, choices=[('', 'Unmarked'), ('0', 'Incorrect'), ('1', 'Half mark'), ('2', 'Correct')], default='', max_length=1)), ('callstate', models.CharField(blank=True, choices=[('C', 'Correct Call'), ('O', 'Overcall'), ('U', 'Undercall'), ('W', 'Incorrect Call'), ('P', 'Partial Call')], max_length=1, null=True)), ('exam', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='rapids.exam')), ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='rapids.rapid')), ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_rapid_user_answers', to=settings.AUTH_USER_MODEL)), ], options={ 'ordering': ['cid'], 'abstract': False, }, ), migrations.CreateModel( name='RapidImage', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('image', models.FileField(upload_to=rapids.models.image_directory_path)), ('image_annotations', models.TextField(blank=True, help_text='Stores a JSON representation of annotations to be applied by cornerstonetools', null=True)), ('feedback_image', models.BooleanField(default=False)), ('filename', models.CharField(blank=True, help_text='Name of the original file when uploaded', max_length=255, null=True)), ('description', models.CharField(blank=True, max_length=255, null=True)), ('image_md5_hash', models.CharField(blank=True, max_length=32, null=True)), ('is_dicom', models.BooleanField(default=False)), ('rapid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='rapids.rapid')), ], ), migrations.CreateModel( name='RapidCreationDefault', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('author', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='rapid_default', to=settings.AUTH_USER_MODEL)), ], ), migrations.AddField( model_name='rapid', name='region', field=models.ManyToManyField(blank=True, help_text='Region of the abnormality (laterality independent)', to='rapids.region'), ), migrations.AddField( model_name='exam', name='exam_questions', field=sortedm2m.fields.SortedManyToManyField(blank='true', help_text=None, related_name='exams', to='rapids.rapid'), ), migrations.AddField( model_name='exam', name='user_user_groups', field=models.ManyToManyField(blank=True, help_text='These groups define which candidates are able to be added to the exams/collection.', related_name='rapid_user_user_groups', to='generic.userusergroup'), ), migrations.AddField( model_name='exam', name='valid_cid_users', field=models.ManyToManyField(blank=True, related_name='rapid_exams', to='generic.ciduser'), ), migrations.AddField( model_name='exam', name='valid_user_users', field=models.ManyToManyField(blank=True, related_name='user_rapid_exams', to=settings.AUTH_USER_MODEL), ), migrations.CreateModel( name='Answer', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('answer', models.TextField(max_length=500)), ('answer_compare', models.TextField(max_length=500)), ('status', models.CharField(choices=[('', 'Unmarked'), ('0', 'Incorrect'), ('1', 'Half mark'), ('2', 'Correct')], default='', max_length=1)), ('proposed', models.BooleanField(default=False)), ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='rapids.rapid')), ], ), ]