.
This commit is contained in:
+40
-1
@@ -1,6 +1,6 @@
|
|||||||
import django_filters
|
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
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
|
||||||
@@ -134,3 +134,42 @@ class StructureFilter(django_filters.FilterSet):
|
|||||||
data=data, queryset=queryset, prefix=prefix, request=request
|
data=data, queryset=queryset, prefix=prefix, request=request
|
||||||
)
|
)
|
||||||
pass
|
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})
|
return reverse("atlas:condition_detail", kwargs={"pk": self.pk})
|
||||||
|
|
||||||
|
|
||||||
class Presentation(SynMixin, models.Model):
|
class Presentation(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
|
|
||||||
subspecialty = models.ManyToManyField("subspecialty", blank=True)
|
subspecialty = models.ManyToManyField("subspecialty", blank=True)
|
||||||
@@ -146,6 +146,9 @@ class Presentation(SynMixin, models.Model):
|
|||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse("atlas:presentation_detail", kwargs={"pk": self.pk})
|
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):
|
class Subspecialty(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
@@ -156,6 +159,9 @@ class Subspecialty(models.Model):
|
|||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse("atlas:subspecialty_detail", kwargs={"pk": self.pk})
|
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):
|
class PathalogicalProcess(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
@@ -166,6 +172,9 @@ class PathalogicalProcess(models.Model):
|
|||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse("atlas:pathalogical_process_detail", kwargs={"pk": self.pk})
|
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):
|
class Differential(models.Model):
|
||||||
condition = models.ForeignKey(Condition, on_delete=models.CASCADE)
|
condition = models.ForeignKey(Condition, on_delete=models.CASCADE)
|
||||||
|
|||||||
+47
-2
@@ -1,7 +1,7 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django_tables2.utils import A
|
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
|
from django.utils.html import format_html
|
||||||
|
|
||||||
@@ -225,4 +225,49 @@ class StructureTable(tables.Table):
|
|||||||
sequence = ("name",)
|
sequence = ("name",)
|
||||||
|
|
||||||
def render_synonym(self, value, record):
|
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 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.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>
|
<div class="pre-whitespace multi-image-block"><b>Series:</b>
|
||||||
{% for series in case.series.all %}
|
{% for series in case.series.all %}
|
||||||
@@ -42,40 +51,40 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Findings</b></summary>
|
<summary><b>Findings</b></summary>
|
||||||
{% if case.series.all %}
|
{% if case.series.all %}
|
||||||
See individual series for more details.<br/>
|
See individual series for more details.<br/>
|
||||||
{% for series in case.series.all %}
|
{% for series in case.series.all %}
|
||||||
{% for finding in series.findings.all %}
|
{% for finding in series.findings.all %}
|
||||||
<div class="finding-box">
|
<div class="finding-box">
|
||||||
<span>
|
<span>
|
||||||
<a href="{{series.get_absolute_url}}">Series {{series.pk}}</a>: {{series.get_examination_full}} |
|
<a href="{{series.get_absolute_url}}">Series {{series.pk}}</a>: {{series.get_examination_full}} |
|
||||||
</span>
|
</span>
|
||||||
{% if finding.findings.all %}
|
{% if finding.findings.all %}
|
||||||
<span>
|
<span>
|
||||||
Findings: {% for f in finding.findings.all %}
|
Findings: {% for f in finding.findings.all %}
|
||||||
{{f.get_link}},
|
{{f.get_link}},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if finding.structures.all %}
|
{% if finding.structures.all %}
|
||||||
<span>
|
<span>
|
||||||
Structure: {% for s in finding.structures.all %}
|
Structure: {% for s in finding.structures.all %}
|
||||||
{{s.get_link}},
|
{{s.get_link}},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if finding.description %}
|
{% if finding.description %}
|
||||||
<span>
|
<span>
|
||||||
Description: {{finding.description}}
|
Description: {{finding.description}}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
No findings associated with case.
|
No findings associated with case.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</details>
|
</details>
|
||||||
<details open>
|
<details open>
|
||||||
<summary><b>Differentials</b></summary>
|
<summary><b>Differentials</b></summary>
|
||||||
@@ -90,7 +99,13 @@
|
|||||||
Subspecialty:
|
Subspecialty:
|
||||||
<ul>
|
<ul>
|
||||||
{% for sub in case.subspecialty.all %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -138,4 +138,8 @@ urlpatterns = [
|
|||||||
views.StructureAutocomplete.as_view(model=Structure, create_field="name"),
|
views.StructureAutocomplete.as_view(model=Structure, create_field="name"),
|
||||||
name="structure-autocomplete",
|
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 (
|
from .models import (
|
||||||
Case,
|
Case,
|
||||||
Condition,
|
Condition,
|
||||||
|
PathalogicalProcess,
|
||||||
Presentation,
|
Presentation,
|
||||||
Series,
|
Series,
|
||||||
Examination,
|
Examination,
|
||||||
@@ -49,11 +50,13 @@ from .models import (
|
|||||||
SeriesFinding,
|
SeriesFinding,
|
||||||
SeriesImage,
|
SeriesImage,
|
||||||
)
|
)
|
||||||
from .tables import CaseTable, ConditionTable, FindingTable, SeriesTable, StructureTable
|
from .tables import CaseTable, ConditionTable, FindingTable, PathologicalProcessTable, PresentationTable, SeriesTable, StructureTable
|
||||||
from .filters import (
|
from .filters import (
|
||||||
CaseFilter,
|
CaseFilter,
|
||||||
ConditionFilter,
|
ConditionFilter,
|
||||||
FindingFilter,
|
FindingFilter,
|
||||||
|
PathologicalProcessFilter,
|
||||||
|
PresentationFilter,
|
||||||
SeriesFilter,
|
SeriesFilter,
|
||||||
StructureFilter,
|
StructureFilter,
|
||||||
)
|
)
|
||||||
@@ -609,6 +612,19 @@ class ConditionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
|||||||
|
|
||||||
filterset_class = ConditionFilter
|
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):
|
class StructureView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||||
model = Structure
|
model = Structure
|
||||||
|
|||||||
Reference in New Issue
Block a user