This commit is contained in:
Ross
2024-10-28 10:12:17 +00:00
parent bfe5be807e
commit 0d7cac594b
6 changed files with 191 additions and 5 deletions
+8
View File
@@ -100,6 +100,14 @@ class Item(models.Model):
else: else:
return "" return ""
def get_level(self):
return ", ".join([l.name for l in self.level.all()])
def get_radiology_categories(self):
return ", ".join([l.name for l in self.radiology_categories.all()])
def get_radiology_condition(self):
return ", ".join([l.name for l in self.radiology_condition.all()])
class RadiologyCategory(models.Model): class RadiologyCategory(models.Model):
+4 -1
View File
@@ -37,7 +37,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/md5.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/md5.js"></script>
{% comment %} <script src="https://unpkg.com/alpinejs" defer></script> {% endcomment %} {% comment %} <script src="https://unpkg.com/alpinejs" defer></script> {% endcomment %}
<script src="https://unpkg.com/hyperscript.org@0.9.7"></script> <script src="https://unpkg.com/hyperscript.org@0.9.13"></script>
<script src="https://unpkg.com/htmx.org@1.8.5/dist/htmx.min.js" defer></script> <script src="https://unpkg.com/htmx.org@1.8.5/dist/htmx.min.js" defer></script>
{% django_htmx_script %} {% django_htmx_script %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
@@ -91,6 +91,9 @@
<span id="" class="top-bar-link"> <span id="" class="top-bar-link">
<a href="{% url 'rcr:radiology_review_view' %}">Review</a> <a href="{% url 'rcr:radiology_review_view' %}">Review</a>
</span> </span>
<span id="" class="top-bar-link">
<a href="{% url 'rcr:radiology_gap' %}">Gap Analysis</a>
</span>
{% if request.user.is_staff %} {% if request.user.is_staff %}
<span id="admin-link" class="top-bar-link"> <span id="admin-link" class="top-bar-link">
<a href="{% url 'admin:index' %}">Admin</a> <a href="{% url 'admin:index' %}">Admin</a>
+134
View File
@@ -0,0 +1,134 @@
{% extends 'rcr/base.html' %}
{% block content %}
<h1>Radiology Gap Analysis</h1>
<p>This page lists all of the radiology categories and the items that exist within them. The items are grouped by category.</p>
<button _='on click toggle .visible on .id'> Toggle IDs</button>
<br/>
Show outcomes
{% for outcome in outcomes %}
<span class="outcome-selection">
<label for="{{outcome.name}}">{{outcome.name}}</label><input type="checkbox" name="{{outcome.name}}" value="{{outcome}}" checked
_="on click if me.checked show .outcome-{{outcome.id}} else hide .outcome-{{outcome.id}} end">
</span>
{% endfor %}
{% for category in categories %}
<h2>{{category.name}}</h2>
<table>
<tr>
<th class="id">ID</th>
<th>Item</th>
<th>Content type</th>
<th>Level</th>
<th>Outcome</th>
<th>Radiology condition</th>
</tr>
{% for item in category.items_radiology.all %}
<tr class="outcome-{{item.outcome.id}}">
<td class="id">{{item.rcr_platform_id}}</td>
<td>{{item.name}}</td>
<td>{{item.content_type}}</td>
<td>{{item.get_level}}</td>
<td>{{item.outcome}}</td>
<td>{{item.get_radiology_condition}}</td>
</tr>
{% endfor %}
</table>
<p>
Item count: {{category.items_radiology.count}}
</p>
{% endfor %}
{% comment %} {% for condition in conditions %}
<h2>{{condition.name}}</h2>
{{condition.items.all}}
{% endfor %} {% endcomment %}
{% endblock %}
{% block css %}
<style type="text/css">
.review::after {
content: '(R)';
color: orange;
}
.completed-radiology::after {
content: '✓';
color: green;
}
.completed-oncology::after {
content: '✓';
color: blue;
}
.completed-oncology.completed-radiology::after {
content: '✓';
color: purple;
}
.completed::after {
content: '✓';
color: green;
}
.Radiology::before {
content: "R";
}
.Radiology {
color: green;
}
.Oncology::before {
content: "O";
}
.Oncology {
color: blue;
}
.Cross-faculty::before {
content: "C";
}
.Cross-faculty {
color: purple;
}
td {
padding-right: 10px;
}
* {
box-sizing: unset;
}
.id {
display: none;
}
.visible {
display: block;
}
.outcome-selection {
display: inline-block;
margin-right: 10px;
}
</style>
{% endblock css %}
{% block js %}
<script type="text/hyperscript">
</script>
{% endblock js %}
+17
View File
@@ -1,6 +1,13 @@
{% extends 'rcr/base.html' %} {% extends 'rcr/base.html' %}
{% block content %} {% block content %}
<details>
<summary>Filter</summary>
<form method="get">
{{ item_filter.form.as_p }}
<input type="submit" />
</form>
</details>
<table> <table>
<thead> <thead>
@@ -13,6 +20,7 @@
<th>Outcome (reason)</th> <th>Outcome (reason)</th>
<th>Outcome (free text)</th> <th>Outcome (free text)</th>
<th>Comments</th> <th>Comments</th>
<th>Level</th>
<th>Radiology Category</th> <th>Radiology Category</th>
<th>Oncology Category</th> <th>Oncology Category</th>
<th>Radiology Condition</th> <th>Radiology Condition</th>
@@ -30,6 +38,15 @@
<td>{{item.outcome_reason}}</td> <td>{{item.outcome_reason}}</td>
<td>{{item.outcome_free_text}}</td> <td>{{item.outcome_free_text}}</td>
<td>{{item.comments}}</td> <td>{{item.comments}}</td>
<td>{% for cat in item.level.all %}
{% if forloop.last %}
{{cat}}
{% else %}
{{cat}},
{% endif %}
{% endfor %}
</td>
<td>{% for cat in item.radiology_categories.all %} <td>{% for cat in item.radiology_categories.all %}
{% if forloop.last %} {% if forloop.last %}
{{cat}} {{cat}}
+1
View File
@@ -11,6 +11,7 @@ app_name = "rcr"
urlpatterns = [ urlpatterns = [
path("radiology/", views.radiology_index, name="radiology_index_view"), path("radiology/", views.radiology_index, name="radiology_index_view"),
path("radiology/all", views.radiology_index_all, name="radiology_index_all_view"), path("radiology/all", views.radiology_index_all, name="radiology_index_all_view"),
path("radiology/gap", views.radiology_gap, name="radiology_gap"),
path("radiology/results", views.radiology_results, name="radiology_results"), path("radiology/results", views.radiology_results, name="radiology_results"),
path("radiology/review", views.radiology_review, name="radiology_review_view"), path("radiology/review", views.radiology_review, name="radiology_review_view"),
path( path(
+27 -4
View File
@@ -13,8 +13,9 @@ from django.contrib.auth.decorators import user_passes_test
from django.db.models import Q from django.db.models import Q
from rcr.filters import ItemFilter from rcr.filters import ItemFilter
from rcr.models import Item from rcr.models import Item, Outcome, RadiologyCategory
from rcr.forms import AssessorAssignmentForm, ItemForm from rcr.forms import AssessorAssignmentForm, ItemForm
from atlas.models import Condition
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
# Create your views here. # Create your views here.
@@ -72,10 +73,32 @@ def radiology_index_all(request):
def radiology_review(request): def radiology_review(request):
return redirect(f"{reverse('rcr:radiology_index_all_view')}?needs_review=true") return redirect(f"{reverse('rcr:radiology_index_all_view')}?needs_review=true")
def radiology_results(request): def radiology_gap(request):
items = Item.objects.all().prefetch_related("assessed_by") #items = Item.objects.all().prefetch_related("assessed_by")
return render(request, "rcr/results.html", {"items": items}) item_filter = ItemFilter(request.GET, queryset=Item.objects.all().prefetch_related("assessed_by"))
items = item_filter.qs.prefetch_related("assessed_by")
categories = RadiologyCategory.objects.all().order_by("name").prefetch_related("items_radiology", "items_radiology__level", "items_radiology__radiology_condition")
conditions = Condition.objects.all().order_by("name")
outcomes = Outcome.objects.all().order_by("name")
return render(request, "rcr/gap.html", {"items": items,
"item_filter": item_filter,
"categories": categories,
"conditions": conditions,
"outcomes": outcomes,
})
def radiology_results(request):
#items = Item.objects.all().prefetch_related("assessed_by")
item_filter = ItemFilter(request.GET, queryset=Item.objects.all().prefetch_related("assessed_by", "level", "radiology_condition", "radiology_categories", "oncology_category"))
items = item_filter.qs.prefetch_related("assessed_by")
return render(request, "rcr/results.html", {"items": items, "item_filter": item_filter})
@user_is_rcr @user_is_rcr
def radiology_index(request, assigned=True, user_pk: int | None = None): def radiology_index(request, assigned=True, user_pk: int | None = None):