Skip to content

Commit e10bc8f

Browse files
authored
Merge pull request #413 from Kitware/rm-views
2 parents defda9b + 3e412d4 commit e10bc8f

4 files changed

Lines changed: 29 additions & 135 deletions

File tree

bats_ai/core/views/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
from .annotations import router as annotation_router
43
from .configuration import router as configuration_router
54
from .export_annotation import router as export_annotation_router
65
from .grts_cells import router as grts_cells_router
@@ -9,12 +8,10 @@
98
from .recording import router as recording_router
109
from .recording_annotation import router as recording_annotation_router
1110
from .recording_tag import router as recording_tag_router
12-
from .sequence_annotations import router as sequence_annotation_router
1311
from .species import router as species_router
1412
from .vetting_details import router as vetting_router
1513

1614
__all__ = [
17-
"annotation_router",
1815
"configuration_router",
1916
"export_annotation_router",
2017
"grts_cells_router",
@@ -23,7 +20,6 @@
2320
"recording_annotation_router",
2421
"recording_router",
2522
"recording_tag_router",
26-
"sequence_annotation_router",
2723
"species_router",
2824
"vetting_router",
2925
]

bats_ai/core/views/annotations.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

bats_ai/core/views/recording.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
Spectrogram,
2626
)
2727
from bats_ai.core.tasks.tasks import recording_compute_spectrogram
28-
from bats_ai.core.views.sequence_annotations import (
29-
SequenceAnnotationSchema,
30-
UpdateSequenceAnnotationSchema,
31-
)
3228
from bats_ai.core.views.species import SpeciesSchema
3329

3430
if TYPE_CHECKING:
@@ -272,6 +268,35 @@ def linestring_to_list(ls):
272268
)
273269

274270

271+
class SequenceAnnotationSchema(Schema):
272+
id: int
273+
start_time: int
274+
end_time: int
275+
type: str | None
276+
comments: str
277+
species: list[SpeciesSchema] | None
278+
owner_email: str = None
279+
280+
@classmethod
281+
def from_orm(cls, obj, owner_email=None):
282+
return cls(
283+
start_time=obj.start_time,
284+
end_time=obj.end_time,
285+
type=obj.type,
286+
species=[SpeciesSchema.from_orm(species) for species in obj.species.all()],
287+
comments=obj.comments,
288+
id=obj.id,
289+
owner_email=owner_email, # Include owner_email in the schema
290+
)
291+
292+
293+
class UpdateSequenceAnnotationSchema(Schema):
294+
start_time: int = None
295+
end_time: int = None
296+
type: str | None = None
297+
comments: str | None = None
298+
299+
275300
@router.post("/")
276301
def create_recording(
277302
request: HttpRequest,

bats_ai/core/views/sequence_annotations.py

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)