This commit is contained in:
Ross
2021-11-29 19:08:27 +00:00
parent 0344b149a6
commit e6a6fdc6e2
5 changed files with 118 additions and 65 deletions
+15 -7
View File
@@ -73,8 +73,9 @@ def findMiddle(input_list):
return input_list[int(middle)]
return (input_list[int(middle)], input_list[int(middle - 1)])
class SynMixin(object):
#class Meta:
# class Meta:
# abstract = True
def __str__(self) -> str:
@@ -94,6 +95,7 @@ class Finding(SynMixin, models.Model):
primary_name = models.BooleanField(default="True")
class Condition(SynMixin, models.Model):
name = models.CharField(max_length=255)
@@ -103,15 +105,17 @@ class Condition(SynMixin, models.Model):
subspecialty = models.ManyToManyField("subspecialty", blank=True)
class Subspecialty(models.Model):
name = models.CharField(max_length=255)
def __str__(self) -> str:
return self.name
@reversion.register
class Case(models.Model):
#class SubspecialtyChoices(models.TextChoices):
# class SubspecialtyChoices(models.TextChoices):
# BREAST = "BR", _("Breast")
# CARDIAC = "CA", _("Cardiac")
# GASTRO = "GI", _("Gastrointestinal and hepatobiliary")
@@ -134,9 +138,9 @@ class Case(models.Model):
history = models.TextField(null=True, blank=True)
#findings = models.TextField(null=True, blank=True)
# findings = models.TextField(null=True, blank=True)
#subspecialty = models.CharField(max_length=2, choices=SubspecialtyChoices.choices)
# subspecialty = models.CharField(max_length=2, choices=SubspecialtyChoices.choices)
subspecialty = models.ManyToManyField(Subspecialty, blank=True)
condition = models.ManyToManyField(Condition, blank=True)
@@ -205,18 +209,22 @@ class SeriesImage(models.Model):
info = "File is not a dicom."
return info
class SeriesFindings(models.Model):
class SeriesFinding(models.Model):
series = models.ForeignKey(
"Series", related_name="findings", on_delete=models.SET_NULL, null=True
)
description = models.TextField(null=True, blank=True, help_text="Findings on the series / stack")
description = models.TextField(
null=True, blank=True, help_text="Findings on the series / stack"
)
findings = models.ManyToManyField(Finding, blank=True)
annotation_json = models.TextField(null=True, blank=True)
def __str__(self) -> str:
return f"{self.series.id}/{self.description}"
@reversion.register
class Series(models.Model):
modality = models.ForeignKey(
@@ -259,7 +267,7 @@ class Series(models.Model):
related_name="series",
)
#findings = models.TextField(null=True, blank=True, help_text="Findings on the series / stack")
# findings = models.TextField(null=True, blank=True, help_text="Findings on the series / stack")
open_access = models.BooleanField(
help_text="If a question should be freely available to browse", default=True