.
This commit is contained in:
+40
-1
@@ -1,6 +1,6 @@
|
||||
import django_filters
|
||||
|
||||
from .models import Case, Condition, Finding, Series, Structure
|
||||
from .models import Case, Condition, Finding, PathalogicalProcess, Presentation, Series, Structure
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
@@ -134,3 +134,42 @@ class StructureFilter(django_filters.FilterSet):
|
||||
data=data, queryset=queryset, prefix=prefix, request=request
|
||||
)
|
||||
pass
|
||||
|
||||
class PresentationFilter(django_filters.FilterSet):
|
||||
class Meta:
|
||||
model = Presentation
|
||||
fields = ("name", "subspecialty")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
data=None,
|
||||
queryset=None,
|
||||
prefix=None,
|
||||
strict=None,
|
||||
user=None,
|
||||
request=None,
|
||||
):
|
||||
super(PresentationFilter, self).__init__(
|
||||
data=data, queryset=queryset, prefix=prefix, request=request
|
||||
)
|
||||
pass
|
||||
|
||||
|
||||
class PathologicalProcessFilter(django_filters.FilterSet):
|
||||
class Meta:
|
||||
model = PathalogicalProcess
|
||||
fields = ("name")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
data=None,
|
||||
queryset=None,
|
||||
prefix=None,
|
||||
strict=None,
|
||||
user=None,
|
||||
request=None,
|
||||
):
|
||||
super(PathologicalProcessFilter, self).__init__(
|
||||
data=data, queryset=queryset, prefix=prefix, request=request
|
||||
)
|
||||
pass
|
||||
|
||||
+10
-1
@@ -131,7 +131,7 @@ class Condition(SynMixin, models.Model):
|
||||
return reverse("atlas:condition_detail", kwargs={"pk": self.pk})
|
||||
|
||||
|
||||
class Presentation(SynMixin, models.Model):
|
||||
class Presentation(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
subspecialty = models.ManyToManyField("subspecialty", blank=True)
|
||||
@@ -146,6 +146,9 @@ class Presentation(SynMixin, models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse("atlas:presentation_detail", kwargs={"pk": self.pk})
|
||||
|
||||
def get_link(self):
|
||||
return format_html("<a href='{}'>{}</a>", self.get_absolute_url(), self.name)
|
||||
|
||||
|
||||
class Subspecialty(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
@@ -156,6 +159,9 @@ class Subspecialty(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse("atlas:subspecialty_detail", kwargs={"pk": self.pk})
|
||||
|
||||
def get_link(self):
|
||||
return format_html("<a href='{}'>{}</a>", self.get_absolute_url(), self.name)
|
||||
|
||||
|
||||
class PathalogicalProcess(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
@@ -166,6 +172,9 @@ class PathalogicalProcess(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse("atlas:pathalogical_process_detail", kwargs={"pk": self.pk})
|
||||
|
||||
def get_link(self):
|
||||
return format_html("<a href='{}'>{}</a>", self.get_absolute_url(), self.name)
|
||||
|
||||
|
||||
class Differential(models.Model):
|
||||
condition = models.ForeignKey(Condition, on_delete=models.CASCADE)
|
||||
|
||||
+47
-2
@@ -1,7 +1,7 @@
|
||||
import django_tables2 as tables
|
||||
from django_tables2.utils import A
|
||||
|
||||
from .models import Case, Condition, Series, Structure, Finding
|
||||
from .models import Case, Condition, PathalogicalProcess, Presentation, Series, Structure, Finding
|
||||
|
||||
from django.utils.html import format_html
|
||||
|
||||
@@ -225,4 +225,49 @@ class StructureTable(tables.Table):
|
||||
sequence = ("name",)
|
||||
|
||||
def render_synonym(self, value, record):
|
||||
return format_html(record.get_synonym_link())
|
||||
return format_html(record.get_synonym_link())
|
||||
|
||||
class PresentationTable(tables.Table):
|
||||
name = tables.Column(
|
||||
linkify=("atlas:condition_detail", {"pk": tables.A("pk")}),
|
||||
verbose_name="Presentation",
|
||||
)
|
||||
|
||||
edit = tables.LinkColumn(
|
||||
"atlas:condition_update", text="Edit", args=[A("pk")], orderable=False
|
||||
)
|
||||
delete = tables.LinkColumn(
|
||||
"atlas:condition_delete", text="Delete", args=[A("pk")], orderable=False
|
||||
)
|
||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
||||
|
||||
subspecialty = tables.ManyToManyColumn(verbose_name="Parents")
|
||||
|
||||
class Meta:
|
||||
model = Presentation
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ()
|
||||
sequence = ("name",)
|
||||
|
||||
|
||||
class PathologicalProcessTable(tables.Table):
|
||||
name = tables.Column(
|
||||
linkify=("atlas:condition_detail", {"pk": tables.A("pk")}),
|
||||
verbose_name="PathologicalProcess",
|
||||
)
|
||||
|
||||
edit = tables.LinkColumn(
|
||||
"atlas:condition_update", text="Edit", args=[A("pk")], orderable=False
|
||||
)
|
||||
delete = tables.LinkColumn(
|
||||
"atlas:condition_delete", text="Delete", args=[A("pk")], orderable=False
|
||||
)
|
||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
||||
|
||||
subspecialty = tables.ManyToManyColumn(verbose_name="Parents")
|
||||
|
||||
class Meta:
|
||||
model = PathalogicalProcess
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ()
|
||||
sequence = ("name",)
|
||||
@@ -9,9 +9,18 @@
|
||||
|
||||
<p class="pre-whitespace"><b>Description:</b> {{ case.description }}</p>
|
||||
|
||||
<p>
|
||||
Presentation:
|
||||
<ul>
|
||||
{% for presentation in case.presentation.all %}
|
||||
<li>{{presentation.get_link}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p class="pre-whitespace"><b>History:</b> {{ case.history }}</p>
|
||||
|
||||
<p class="pre-whitespace"><b>History:</b> {{ case.discussion }}</p>
|
||||
<p class="pre-whitespace"><b>Discussion:</b> {{ case.discussion }}</p>
|
||||
|
||||
<div class="pre-whitespace multi-image-block"><b>Series:</b>
|
||||
{% for series in case.series.all %}
|
||||
@@ -42,40 +51,40 @@
|
||||
</ul>
|
||||
<details>
|
||||
<summary><b>Findings</b></summary>
|
||||
{% if case.series.all %}
|
||||
See individual series for more details.<br/>
|
||||
{% for series in case.series.all %}
|
||||
{% for finding in series.findings.all %}
|
||||
<div class="finding-box">
|
||||
{% if case.series.all %}
|
||||
See individual series for more details.<br/>
|
||||
{% for series in case.series.all %}
|
||||
{% for finding in series.findings.all %}
|
||||
<div class="finding-box">
|
||||
<span>
|
||||
<a href="{{series.get_absolute_url}}">Series {{series.pk}}</a>: {{series.get_examination_full}} |
|
||||
</span>
|
||||
{% if finding.findings.all %}
|
||||
<span>
|
||||
Findings: {% for f in finding.findings.all %}
|
||||
{{f.get_link}},
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if finding.structures.all %}
|
||||
<span>
|
||||
Structure: {% for s in finding.structures.all %}
|
||||
{{s.get_link}},
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if finding.description %}
|
||||
<span>
|
||||
Description: {{finding.description}}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if finding.findings.all %}
|
||||
<span>
|
||||
Findings: {% for f in finding.findings.all %}
|
||||
{{f.get_link}},
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if finding.structures.all %}
|
||||
<span>
|
||||
Structure: {% for s in finding.structures.all %}
|
||||
{{s.get_link}},
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if finding.description %}
|
||||
<span>
|
||||
Description: {{finding.description}}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
No findings associated with case.
|
||||
{% endif %}
|
||||
No findings associated with case.
|
||||
{% endif %}
|
||||
</details>
|
||||
<details open>
|
||||
<summary><b>Differentials</b></summary>
|
||||
@@ -90,7 +99,13 @@
|
||||
Subspecialty:
|
||||
<ul>
|
||||
{% for sub in case.subspecialty.all %}
|
||||
<li>{{sub}}</li>
|
||||
<li>{{sub.get_link}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
Pathological Process:
|
||||
<ul>
|
||||
{% for p in case.pathological_process.all %}
|
||||
<li>{{p.get_link}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
@@ -138,4 +138,8 @@ urlpatterns = [
|
||||
views.StructureAutocomplete.as_view(model=Structure, create_field="name"),
|
||||
name="structure-autocomplete",
|
||||
),
|
||||
path("presentation/", views.PresentationView.as_view(), name="presentation_view"),
|
||||
path("presentation/<int:pk>", views.presentation_detail, name="presentation_detail"),
|
||||
path("process/", views.PathologicalProcessView.as_view(), name="pathological_process_view"),
|
||||
path("process/<int:pk>", views.pathological_process_detail, name="pathological_process_detail"),
|
||||
]
|
||||
|
||||
+17
-1
@@ -40,6 +40,7 @@ from .forms import (
|
||||
from .models import (
|
||||
Case,
|
||||
Condition,
|
||||
PathalogicalProcess,
|
||||
Presentation,
|
||||
Series,
|
||||
Examination,
|
||||
@@ -49,11 +50,13 @@ from .models import (
|
||||
SeriesFinding,
|
||||
SeriesImage,
|
||||
)
|
||||
from .tables import CaseTable, ConditionTable, FindingTable, SeriesTable, StructureTable
|
||||
from .tables import CaseTable, ConditionTable, FindingTable, PathologicalProcessTable, PresentationTable, SeriesTable, StructureTable
|
||||
from .filters import (
|
||||
CaseFilter,
|
||||
ConditionFilter,
|
||||
FindingFilter,
|
||||
PathologicalProcessFilter,
|
||||
PresentationFilter,
|
||||
SeriesFilter,
|
||||
StructureFilter,
|
||||
)
|
||||
@@ -609,6 +612,19 @@ class ConditionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
|
||||
filterset_class = ConditionFilter
|
||||
|
||||
class PresentationView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Presentation
|
||||
table_class = PresentationTable
|
||||
template_name = "atlas/view.html"
|
||||
|
||||
filterset_class = PresentationFilter
|
||||
|
||||
class PathologicalProcessView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = PathalogicalProcess
|
||||
table_class = PathologicalProcessTable
|
||||
template_name = "atlas/view.html"
|
||||
|
||||
filterset_class = PathologicalProcessFilter
|
||||
|
||||
class StructureView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Structure
|
||||
|
||||
Reference in New Issue
Block a user