Files
penracourses/longs/migrations/0001_initial.py
T
2023-06-12 11:14:19 +01:00

177 lines
12 KiB
Python

# 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 longs.models
import sortedm2m.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('generic', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('anatomy', '0001_initial'),
]
operations = [
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=4500, help_text='Exam time limit (in seconds). Default is 4500 seconds (75 minutes)')),
('double_mark', models.BooleanField(default=True, help_text='Defines if an exam is expected to be double marked')),
('author', models.ManyToManyField(blank=True, help_text='Author of exam', related_name='long_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='longs_cid_user_groups', to='generic.cidusergroup')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Long',
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)),
('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)),
('model_observations', models.TextField(blank=True, null=True)),
('model_interpretation', models.TextField(blank=True, null=True)),
('model_principle_diagnosis', models.TextField(blank=True, null=True)),
('model_differential_diagnosis', models.TextField(blank=True, null=True)),
('model_management', models.TextField(blank=True, null=True)),
('mark_scheme', models.TextField(blank=True, null=True)),
('verified', models.BooleanField(default=False)),
('scrapped', models.BooleanField(default=False, help_text='Question has been scrapped and will not be shown')),
('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)),
('question_json_id', models.IntegerField(default=1, help_text='Auto incrementing json creation number')),
('author', models.ManyToManyField(blank=True, help_text='Author of question', related_name='long_authored_questions', to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='LongSeries',
fields=[
('id', models.AutoField(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 series should be freely available to browse')),
('author', models.ManyToManyField(blank=True, related_name='long_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='series_contrast', to='generic.contrast')),
('examination', models.ForeignKey(help_text='Name of the examination, this appears as the thumbnail title on the test system', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='series_examination', to='generic.examination')),
('modality', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='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='series_plane', to='generic.plane')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='UserAnswer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('answer_observations', models.TextField(blank=True, null=True)),
('answer_interpretation', models.TextField(blank=True, null=True)),
('answer_principle_diagnosis', models.TextField(blank=True, null=True)),
('answer_differential_diagnosis', models.TextField(blank=True, null=True)),
('answer_management', models.TextField(blank=True, null=True)),
('cid', models.BigIntegerField(blank=True, help_text='Candidate ID (limitied by BigIntegerField size)', null=True)),
('score', models.CharField(blank=True, choices=[('', 'Unmarked'), ('4', '4'), ('4.5', '4.5'), ('5', '5'), ('5.5', '5.5'), ('6', '6'), ('6.5', '6.5'), ('7', '7'), ('7.5', '7.5'), ('8', '8')], default='', help_text='The final score for the candidate', max_length=3)),
('exam', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='longs.exam')),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='longs.long')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_longs_user_answers', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['cid'],
'abstract': False,
},
),
migrations.CreateModel(
name='LongSeriesImage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.FileField(upload_to=longs.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='longs.longseries')),
],
options={
'ordering': ['position'],
},
),
migrations.CreateModel(
name='LongCreationDefault',
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='long_default', to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='long',
name='series',
field=sortedm2m.fields.SortedManyToManyField(help_text=None, related_name='long', to='longs.longseries'),
),
migrations.AddField(
model_name='exam',
name='exam_questions',
field=sortedm2m.fields.SortedManyToManyField(blank='true', help_text=None, related_name='exams', to='longs.long'),
),
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='longs_user_user_groups', to='generic.userusergroup'),
),
migrations.AddField(
model_name='exam',
name='valid_cid_users',
field=models.ManyToManyField(blank=True, related_name='longs_exams', to='generic.ciduser'),
),
migrations.AddField(
model_name='exam',
name='valid_user_users',
field=models.ManyToManyField(blank=True, related_name='user_longs_exams', to=settings.AUTH_USER_MODEL),
),
migrations.CreateModel(
name='AnswerMarks',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('score', models.CharField(choices=[('', 'Unmarked'), ('4', '4'), ('4.5', '4.5'), ('5', '5'), ('5.5', '5.5'), ('6', '6'), ('6.5', '6.5'), ('7', '7'), ('7.5', '7.5'), ('8', '8')], max_length=3)),
('mark_reason', models.TextField(blank=True, help_text='Reason for the given mark - not visible to candidates', null=True)),
('candidate_feedback', models.TextField(blank=True, help_text='Feedback for the candidate', null=True)),
('marker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='marker', to=settings.AUTH_USER_MODEL)),
('user_answer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mark', to='longs.useranswer')),
],
),
]