.
This commit is contained in:
@@ -73,6 +73,7 @@ class ExamBase(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
json_creation_time = models.DateTimeField(blank=True, default=None, null=True)
|
json_creation_time = models.DateTimeField(blank=True, default=None, null=True)
|
||||||
|
json_creation_id = models.IntegerField(default=1, help_text="auto incrementing field when json recreated")
|
||||||
|
|
||||||
#time_limit = models.IntegerField(
|
#time_limit = models.IntegerField(
|
||||||
# help_text="Exam time limit (in seconds). Default is 2100 secondse (35 minutes)",
|
# help_text="Exam time limit (in seconds). Default is 2100 secondse (35 minutes)",
|
||||||
|
|||||||
+6
-2
@@ -401,6 +401,7 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
"type": self.question_type,
|
"type": self.question_type,
|
||||||
"eid": "{}/{}".format(self.question_type, exam.pk),
|
"eid": "{}/{}".format(self.question_type, exam.pk),
|
||||||
"json_creation_time": creation_time
|
"json_creation_time": creation_time
|
||||||
|
"json_creation_id": exam.creation_id
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.question_type == "long":
|
if self.question_type == "long":
|
||||||
@@ -409,7 +410,7 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
# Generate json if needed
|
# Generate json if needed
|
||||||
if question.json_creation_time is None:
|
if question.json_creation_time is None:
|
||||||
question.get_json(question.pk)
|
question.get_json(question.pk)
|
||||||
h[question.pk] = question.json_creation_time.isoformat()
|
h[question.pk] = question.json_creation_id
|
||||||
obj["multi_question_json"] = h
|
obj["multi_question_json"] = h
|
||||||
active_exams["exams"].append( obj )
|
active_exams["exams"].append( obj )
|
||||||
|
|
||||||
@@ -476,9 +477,12 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
|
|
||||||
time = datetime.now()
|
time = datetime.now()
|
||||||
|
|
||||||
|
exam.json_creation_id += 1
|
||||||
|
|
||||||
with open(path, "w+") as f:
|
with open(path, "w+") as f:
|
||||||
exam_json = exam.get_exam_json()
|
exam_json = exam.get_exam_json()
|
||||||
exam_json["generated"] = "test"+time.isoformat()
|
exam_json["generated"] = time.isoformat()
|
||||||
|
exam_json["creation_id"] = exam.json_creation_id
|
||||||
f.write(json.dumps(exam_json))
|
f.write(json.dumps(exam_json))
|
||||||
|
|
||||||
exam.recreate_json = False
|
exam.recreate_json = False
|
||||||
|
|||||||
+9
-4
@@ -126,6 +126,8 @@ class Long(models.Model):
|
|||||||
|
|
||||||
json_creation_time = models.DateTimeField(blank=True, default=None, null=True)
|
json_creation_time = models.DateTimeField(blank=True, default=None, null=True)
|
||||||
|
|
||||||
|
json_creation_id = models.IntegerField(default=1, help_text="Auto incrementing json creation number")
|
||||||
|
|
||||||
#question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
#question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
@@ -212,6 +214,8 @@ class Long(models.Model):
|
|||||||
url= "{0}longs/questions/{1}.json".format(settings.MEDIA_URL, question_id)
|
url= "{0}longs/questions/{1}.json".format(settings.MEDIA_URL, question_id)
|
||||||
|
|
||||||
timestamp = datetime.datetime.now()
|
timestamp = datetime.datetime.now()
|
||||||
|
q.json_creation_id += 1
|
||||||
|
|
||||||
with open(path, "w+") as f:
|
with open(path, "w+") as f:
|
||||||
|
|
||||||
# We manually create the json for long questions to reducem memroy usade
|
# We manually create the json for long questions to reducem memroy usade
|
||||||
@@ -219,7 +223,8 @@ class Long(models.Model):
|
|||||||
"title": "{}",
|
"title": "{}",
|
||||||
"type": "long",
|
"type": "long",
|
||||||
"generated": "{}",
|
"generated": "{}",
|
||||||
""".format(q.history, timestamp.isoformat())
|
"creation_id": "{}",
|
||||||
|
""".format(q.history, timestamp.isoformat(), q.json_creation_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -248,8 +253,8 @@ class Long(models.Model):
|
|||||||
f.write('"image_titles" : {} }}'.format(json.dumps(image_titles)))
|
f.write('"image_titles" : {} }}'.format(json.dumps(image_titles)))
|
||||||
|
|
||||||
|
|
||||||
self.json_creation_time = timestamp
|
q.json_creation_time = timestamp
|
||||||
self.save()
|
q.save()
|
||||||
|
|
||||||
#exam_question = {
|
#exam_question = {
|
||||||
# "title": q.history,
|
# "title": q.history,
|
||||||
@@ -584,7 +589,7 @@ class Exam(ExamBase):
|
|||||||
# If it is a new question we need to for a question json refresh
|
# If it is a new question we need to for a question json refresh
|
||||||
if q.json_creation_time is None:
|
if q.json_creation_time is None:
|
||||||
q.get_json(q.pk)
|
q.get_json(q.pk)
|
||||||
exam_questions[q.id] = q.json_creation_time.isoformat()
|
exam_questions[q.id] = q.json_creation_id
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# TODO: combine with question_json
|
# TODO: combine with question_json
|
||||||
|
|||||||
@@ -57,7 +57,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
JSON creation time: {{question.json_creation_time}} ({{question.json_creation_time|date:"c"}})
|
JSON creation time: {{question.json_creation_time}} ({{question.json_creation_time|date:"c"}}),
|
||||||
|
JSON creation id: {{question.json_creation_id}}
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'longs:question_json' pk=question.pk %}">JSON</a>
|
<a href="{% url 'longs:question_json' pk=question.pk %}">JSON</a>
|
||||||
<a href="{% url 'longs:question_json_recreate' pk=question.pk %}">Refresh JSON cache</a>
|
<a href="{% url 'longs:question_json_recreate' pk=question.pk %}">Refresh JSON cache</a>
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
<div>{{ series.modality}}, {{ series.examination }}, {{ series.plane }}, {{ series.contrast }}</div>
|
<div>{{ series.modality}}, {{ series.examination }}, {{ series.plane }}, {{ series.contrast }}</div>
|
||||||
|
|
||||||
{% if series.long %}
|
{% if series.long %}
|
||||||
Associated case:
|
Associated case:
|
||||||
{% for long in series.long.all %}
|
{% for long in series.long.all %}
|
||||||
<a href="{% url 'longs:question_detail' pk=long.pk %}">{{long}}</a>
|
<a href="{% url 'longs:question_detail' pk=long.pk %}">{{long}}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
This series is not associated with any cases.
|
This series is not associated with any cases.
|
||||||
@@ -15,12 +14,20 @@ This series is not associated with any cases.
|
|||||||
<div>Author: {{ series.get_author_display }}</div>
|
<div>Author: {{ series.get_author_display }}</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a href="{% url 'longs:long_series_order_dicom' pk=series.pk %}" title="orders dicom by slice location">Order dicoms by slice location</a>
|
<a href="{% url 'longs:long_series_order_dicom' pk=series.pk %}" title="orders dicom by slice location">Order dicoms
|
||||||
<a href="{% url 'longs:long_series_order_dicom_instance' pk=series.pk %}" title="orders dicom by instance number">Order dicoms by instance number</a>
|
by slice location</a>
|
||||||
<a href="{% url 'longs:long_series_order_dicom_SeriesInstanceUID' pk=series.pk %}" title="orders dicom by instance number">Order dicoms by SeriesInstanceUID</a>
|
<a href="{% url 'longs:long_series_order_dicom_instance' pk=series.pk %}"
|
||||||
<a href="{% url 'longs:long_series_order_upload_filename' pk=series.pk %}" title="orders dicom by uploaded filename">Order by uploaded filename</a>
|
title="orders dicom by instance number">Order dicoms by instance number</a>
|
||||||
|
<a href="{% url 'longs:long_series_order_dicom_SeriesInstanceUID' pk=series.pk %}"
|
||||||
|
title="orders dicom by instance number">Order dicoms by SeriesInstanceUID</a>
|
||||||
|
<a href="{% url 'longs:long_series_order_upload_filename' pk=series.pk %}"
|
||||||
|
title="orders dicom by uploaded filename">Order by uploaded filename</a>
|
||||||
</div>
|
</div>
|
||||||
{% for image in series.images.all %}
|
{% for image in series.images.all %}
|
||||||
{{image.image.url}}, pos: {{image.position}}, {{image.upload_filename}}</br>
|
{{image.image.url}}, pos: {{image.position}}, {{image.upload_filename}}</br>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<div>
|
||||||
|
JSON creation time: {{question.json_creation_time}} ({{question.json_creation_time|date:"c"}}),
|
||||||
|
JSON creation id: {{question.json_creation_id}}
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user