Skip to content

Commit

Permalink
add plots
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Aug 5, 2024
1 parent 6da6058 commit d5a40bf
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
8 changes: 8 additions & 0 deletions core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ class Blending(str, Enum):
ADDITIVE = "additive"
MULTIPLICATIVE = "multiplicative"

@strawberry.enum
class MetricDataType(str, Enum):
INT = "INT"
FLOAT= "FLOAT"
DATETIME = "DATETIME"
STRING = "STRING"




@strawberry.enum
Expand Down
26 changes: 26 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ class EntityMetric(models.Model):
)
created_at = models.DateTimeField(auto_now_add=True)
creator = models.ForeignKey(get_user_model(), on_delete=models.CASCADE, null=True)
values = models.JSONField(default=dict)

class Meta:
abstract = True
Expand All @@ -1387,5 +1388,30 @@ class ImageIntMetric(ImageMetric, IntMetric):



class Plot(models.Model):
entity = models.ForeignKey("Entity", on_delete=models.CASCADE, null=True, blank=True)


class Meta:
abstract = True


class RenderedPlot(Plot):

store = models.ForeignKey(
MediaStore,
on_delete=models.CASCADE,
null=True,
blank=True,
help_text="The store of the file",
)
created_at = models.DateTimeField(auto_now_add=True)
history = HistoryField()







from core import signals
22 changes: 21 additions & 1 deletion core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,22 @@ def pinned(self, info: Info) -> bool:
.exists()
)



@strawberry_django.interface(models.Plot)
class Plot:
"""A view is a subset of an image."""

entity: Optional["Entity"] = None


@strawberry_django.type(models.RenderedPlot)
class RenderedPlot:
""" A rendered plot"""

store: MediaStore





@strawberry_django.type(models.RenderTree, filters=filters.RenderTreeFilter, order=filters.RenderTreeOrder, pagination=True)
Expand Down Expand Up @@ -901,6 +916,11 @@ class Entity:
name: str
epitope: str | None






@strawberry_django.type(models.EntityKind, filters=filters.EntityKindFilter, pagination=True)
class EntityKind:
id: auto
Expand Down

0 comments on commit d5a40bf

Please sign in to comment.