-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic annotation rendering, beginning annotation editing
- Loading branch information
1 parent
074bd28
commit 0a770f7
Showing
14 changed files
with
743 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from datetime import datetime | ||
import logging | ||
|
||
from django.contrib.auth.models import User | ||
from django.core.files.storage import default_storage | ||
from django.http import HttpRequest | ||
from ninja import File, Form, Schema | ||
from ninja.errors import HttpError | ||
from ninja.files import UploadedFile | ||
from ninja.pagination import RouterPaginated | ||
from oauth2_provider.models import AccessToken | ||
|
||
from bats_ai.core.models import Annotations | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
router = RouterPaginated() | ||
|
||
|
||
class AnnotationSchema(Schema): | ||
recording: int # Foreign Key to index | ||
owner_username: str | ||
start_time: int | ||
end_time: int | ||
low_freq: int | ||
high_freq: int | ||
species: list[int] | ||
comments: str | ||
|
||
|
||
def get_owner_id(request: HttpRequest): | ||
token = request.headers.get('Authorization').replace('Bearer ', '') | ||
token_found = AccessToken.objects.get(token=token) | ||
if not token_found: | ||
raise HttpError(401, 'Authentication credentials were not provided.') | ||
|
||
return token_found.user.pk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.