Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Nov 9, 2024
1 parent 116c1a4 commit 4afcd8b
Show file tree
Hide file tree
Showing 6 changed files with 392 additions and 23 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ This is the current roadmap for the merging of the new version of Mikro into the
- [X] Comlete History Management (return to older version of Image)
- [X] Zarr.less (still handled zarr, but without the zarr dependency (direct metadta handling for better performance)
- [X] Views as central Data Model (more flexible than attaching metadata directly to an Image)
- [ ] Endpoints for on-the-fly OME NGFF conversion (generating metadata from db)
- [X] Accessors for Table Data (mapping metadata to tables (columns, row) similar to views)
- [X] Ditch Social Features for central handling in Lok
- [ ] Direct OMERO transpilation

- [ ] CI/CD Pipeline (testing against both old and new apps)
- [ ] Documentation
- [ ] Endpoints for on-the-fly OME NGFF conversion (generating metadata from db)

## Discarded Features

- [ ] Direct OME transpilation


4 changes: 3 additions & 1 deletion core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ def filter_search(self, queryset, info):
return queryset.filter(image__name__contains=self.search)




@strawberry.django.filter(models.Table)
class TableFilter:
id: auto
Expand Down Expand Up @@ -393,7 +395,7 @@ class DatasetChildrenFilter:

@strawberry.input
class RowFilter:
pass
clause: str | None = None


@strawberry.django.filter(models.Protocol)
Expand Down
299 changes: 299 additions & 0 deletions core/migrations/0027_tableview_historicaltableview.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
# Generated by Django 4.2.8 on 2024-11-09 16:50

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models


class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("authentikate", "0002_alter_user_unique_together_and_more"),
("core", "0026_derivedview_operation_and_more"),
]

operations = [
migrations.CreateModel(
name="TableView",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"z_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"z_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"x_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"x_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"y_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"y_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"t_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"t_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"c_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"c_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"is_global",
models.BooleanField(
default=False, help_text="Whether the view is global or not"
),
),
(
"series_identifier",
models.CharField(
blank=True,
help_text="The series identifier of the file",
max_length=1000,
null=True,
),
),
(
"collection",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="core.viewcollection",
),
),
(
"image",
simple_history.models.HistoricForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.image"
),
),
(
"table",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="views",
to="core.table",
),
),
],
options={
"default_related_name": "table_views",
},
),
migrations.CreateModel(
name="HistoricalTableView",
fields=[
(
"id",
models.BigIntegerField(
auto_created=True, blank=True, db_index=True, verbose_name="ID"
),
),
(
"assignation_id",
models.CharField(blank=True, max_length=1000, null=True),
),
(
"z_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"z_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"x_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"x_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"y_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"y_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"t_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"t_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"c_min",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"c_max",
models.IntegerField(
blank=True, help_text="The index of the channel", null=True
),
),
(
"is_global",
models.BooleanField(
default=False, help_text="Whether the view is global or not"
),
),
(
"series_identifier",
models.CharField(
blank=True,
help_text="The series identifier of the file",
max_length=1000,
null=True,
),
),
("history_id", models.AutoField(primary_key=True, serialize=False)),
("history_date", models.DateTimeField(db_index=True)),
("history_change_reason", models.CharField(max_length=100, null=True)),
(
"history_type",
models.CharField(
choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
max_length=1,
),
),
(
"app",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="authentikate.app",
),
),
(
"collection",
models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="core.viewcollection",
),
),
(
"history_relation",
models.ForeignKey(
db_constraint=False,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="provenance",
to="core.tableview",
),
),
(
"history_user",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
(
"image",
simple_history.models.HistoricForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="core.image",
),
),
(
"table",
models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="core.table",
),
),
],
options={
"verbose_name": "historical table view",
"verbose_name_plural": "historical table views",
"ordering": ("-history_date", "-history_id"),
"get_latest_by": ("history_date", "history_id"),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
]
30 changes: 24 additions & 6 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,30 @@ class Meta:
default_related_name = "file_views"


class TableView(View):
""" A TablieView is a view on a file
This means that the image part was created from a table and represents the context of
the table in a specific context (i.e the table represent localisations in SMLIM
"""

table = models.ForeignKey(Table, on_delete=models.CASCADE, related_name="views")
series_identifier = models.CharField(
max_length=1000,
help_text="The series identifier of the file",
null=True,
blank=True,
)



history = HistoryField()

class Meta:
default_related_name = "table_views"


class DerivedView(View):
""" A DerivedView
Expand Down Expand Up @@ -1460,12 +1484,6 @@ def rgb_color_string(self) -> str:










class ROI(models.Model):
"""A ROI is a region of interest in a representation.
Expand Down
Loading

0 comments on commit 4afcd8b

Please sign in to comment.