lots of further updates

This commit is contained in:
Ross
2024-04-10 22:43:57 +01:00
parent 98756baa37
commit bf519a2807
14 changed files with 92 additions and 42 deletions
+4
View File
@@ -15,6 +15,8 @@ from .models import (
PathologicalProcess,
Presentation,
UncategorisedDicom,
SeriesDetail,
Resource
)
from django.forms import ModelForm
@@ -42,6 +44,8 @@ admin.site.register(PathologicalProcess)
admin.site.register(Presentation)
admin.site.register(CaseDetail)
admin.site.register(UncategorisedDicom)
admin.site.register(SeriesDetail)
admin.site.register(Resource)
class DifferentialInline(admin.TabularInline):
+3
View File
@@ -23,6 +23,8 @@ from generic.models import Examination, Modality
from .models import Case, DuplicateDicom, Series, SeriesImage, UncategorisedDicom
from loguru import logger
router = Router()
@@ -52,6 +54,7 @@ class CaseSchema(ModelSchema):
model_fields = ["id", "title"]
@logger.catch()
@router.post("/upload_dicom", auth=django_auth)
def upload_dicom(request, files: List[UploadedFile] = File(...)):
uploaded = []
+4 -1
View File
@@ -695,4 +695,7 @@ class CaseCollectionAuthorForm(ExamAuthorFormMixin):
class CaseAuthorForm(ExamAuthorFormMixin):
class Meta(ExamAuthorFormMixin.Meta):
model = Case
model = Case
class SeriesAuthorForm(ExamAuthorFormMixin):
class Meta(ExamAuthorFormMixin.Meta):
model = Series
+10
View File
@@ -69,6 +69,8 @@ from django.contrib.contenttypes.fields import GenericRelation
from django.core.validators import MaxValueValidator, MinValueValidator
from loguru import logger
image_storage = FileSystemStorage(
# Physical file location ROOT
@@ -685,6 +687,13 @@ class Series(SeriesBase):
self.save()
def get_base_template(self):
return "atlas/base.html"
def get_link_headers(self):
return "atlas/series_headers.html"
class CaseCollection(ExamOrCollectionGenericBase):
app_name = "atlas"
@@ -1099,6 +1108,7 @@ class UncategorisedDicom(models.Model):
return duplicate
@logger.catch()
def save(self, *args, **kwargs):
"""Override save method to add image hash"""
if self.image:
+1 -1
View File
@@ -71,7 +71,7 @@
<div class="alert alert-info" role="alert">Creating a case in the collection: <a href="{% url 'atlas:collection_detail' pk=form.collection.pk %}">{{form.collection.name}}</a></div>
{% endif %}
<form action="" method="post" enctype="multipart/form-data" id="atlas-form">
<form class="highlight" action="" method="post" enctype="multipart/form-data" id="atlas-form">
{% csrf_token %}
{{ form }}
@@ -33,7 +33,7 @@
{% endif %}
<form action="" method="post" enctype="multipart/form-data" id="atlas-form">
<form class="highlight" action="" method="post" enctype="multipart/form-data" id="atlas-form">
{% csrf_token %}
{{ form }}
+1 -1
View File
@@ -8,7 +8,7 @@
Adding self feedback for {{user_exam.exam}}/{{case}}
</div>
<form action="" method="post">
<form class="highlight" action="" method="post">
{% csrf_token %}
{{ form.non_field_errors }}
+6 -5
View File
@@ -1,12 +1,13 @@
{% extends "atlas/base.html" %}
{% block navigation%}
{{ block.super }}
{% include 'atlas/series_headers.html' %}
{% endblock %}
{% block content %}
<a href="{% url 'atlas:series_update' pk=series.pk %}" title="Edit the Series">Edit</a>
<a href="{% url 'atlas:series_delete' pk=series.pk %}" title="Delete the Series">Delete</a>
{% if request.user.is_superuser %}
<a href="{% url 'admin:atlas_series_change' series.id %}" title="Edit the Series using the admin interface">Admin Edit</a>
{% endif %}
{% include 'atlas/series_viewer.html' %}
{% endblock %}
+37 -28
View File
@@ -6,8 +6,8 @@
<!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
<script type="text/javascript">
let csrf_token = "{{csrf_token}}";
let hash_url = false;
let csrf_token = "{{csrf_token}}";
let hash_url = false;
document.addEventListener('drop', function (e) { e.preventDefault(); }, false);
$(document).ready(function () {
@@ -332,7 +332,7 @@
}
let select_object = document.getElementsByName("examination")[0]
if (select_object.value == "") {
$.get(`${select_object.dataset.autocompleteLightUrl}?q=${study_description}`, (data) => {
console.log(data)
@@ -341,9 +341,9 @@
$(select_object).select2("trigger","select", {
data: data.results[0]
})
}
})
})
}
@@ -353,31 +353,31 @@
for (let i = 0; i < site_codes.length; i++) {
if (
accession_number.startsWith(site_codes[i])
|| patient_id.startsWith(site_codes[i])) {
not_anon = true;
}
accession_number.startsWith(site_codes[i])
|| patient_id.startsWith(site_codes[i])) {
not_anon = true;
}
}
if (not_anon) {
toastr.warning(`File does not appear to be annonymised<br/>Accession: ${accession_number} <br/>Patient ID: ${patient_id}<br/>`, 'Anonymisation warning', {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-full-width",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": 0,
"extendedTimeOut": 0,
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
});
}
toastr.warning(`File does not appear to be annonymised<br/>Accession: ${accession_number} <br/>Patient ID: ${patient_id}<br/>`, 'Anonymisation warning', {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-full-width",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": 0,
"extendedTimeOut": 0,
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
});
}
// TODO: fix
//$.ajax({
@@ -410,14 +410,23 @@
{{ form.media }}
{% endblock %}
{% block navigation%}
{{ block.super }}
{% if object %}
{% include "atlas/series_headers.html" %}
{% endif %}
{% endblock %}
{% block content %}
<h2>Series Form</h2>
This form will create a image set that can be associated with a atlas question. If the question has already been created
it can be linked below.
<form action="" method="post" enctype="multipart/form-data" id="atlas-form">
{% csrf_token %}
<a href="/generic/examination/create" id="add_examination" class="add-popup"
onclick="return showAddPopup(this);"><img src="{% static '/img/icon-addlink.svg' %}"></a>
onclick="return showAddPopup(this);"><img src="{% static '/img/icon-addlink.svg' %}"></a>
<table>
{{ form.as_table }}
</table>
@@ -0,0 +1,8 @@
<br/>
<a href="{% url 'atlas:series_detail' pk=series.pk %}" title="View the Series">View</a>
<a href="{% url 'atlas:series_update' pk=series.pk %}" title="Edit the Series">Edit</a>
<a href="{% url 'atlas:series_delete' pk=series.pk %}" title="Delete the Series">Delete</a>
<a href="{% url 'atlas:series_authors' pk=series.pk %}" title="Update the authors">Authors</a>
{% if request.user.is_superuser %}
<a href="{% url 'admin:atlas_series_change' series.id %}" title="Edit the Series using the admin interface">Admin Edit</a>
{% endif %}
+1
View File
@@ -242,6 +242,7 @@ urlpatterns = [
),
path("structure/create", views.StructureCreate.as_view(), name="structure_create"),
path("series/<int:pk>", views.series_detail, name="series_detail"),
path("series/<int:pk>/authors", views.SeriesAuthorUpdate.as_view(), name="series_authors"),
path("series/", views.SeriesView.as_view(), name="series_view"),
path("series_image/<int:pk>/dicom", views.series_image_dicom, name="series_image_dicom"),
path(
+11
View File
@@ -48,6 +48,7 @@ from .forms import (
FindingForm,
ResourceForm,
SelfReviewForm,
SeriesAuthorForm,
SeriesForm,
SeriesImageFormSet,
SeriesFormSet,
@@ -2387,3 +2388,13 @@ class CaseAuthorUpdate(RevisionMixin, AuthorRequiredMixin, UpdateView):
context = super(CaseAuthorUpdate, self).get_context_data(**kwargs)
context["collection"] = context["object"]
return context
class SeriesAuthorUpdate(RevisionMixin, AuthorRequiredMixin, UpdateView):
model = Series
form_class = SeriesAuthorForm
template_name = "author_form.html"
def get_context_data(self, **kwargs):
context = super(SeriesAuthorUpdate, self).get_context_data(**kwargs)
context["collection"] = context["object"]
return context
+4 -4
View File
@@ -8,14 +8,14 @@ form>div:hover .helptext {
color: #666;
opacity: 1;
}
form > div {
margin: 1px;
}
form > div:hover {
border: 1px solid #666;
margin: -1px;
form.highlight > div:hover {
/* border: 1px solid #666;
margin: -1px; */
background-color: #002635;
}
+1 -1
View File
@@ -7,7 +7,7 @@
{% block navigation %}
{{ block.super }}
{{ block.super }}
{% include object.get_link_headers %}
{% endblock navigation %}