Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
63ef2d85
Commit
63ef2d85
authored
2 years ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
add scheme to resolve response
parent
d6c45913
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#870
failed
2 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/api/routes/annotations.py
+27
-15
27 additions, 15 deletions
server/api/routes/annotations.py
server/api/routes/project/items.py
+1
-1
1 addition, 1 deletion
server/api/routes/project/items.py
with
28 additions
and
16 deletions
server/api/routes/annotations.py
+
27
−
15
View file @
63ef2d85
from
pydantic
import
BaseModel
from
sqlalchemy
import
select
from
sqlalchemy.ext.asyncio
import
AsyncSession
from
fastapi
import
APIRouter
,
Depends
,
HTTPException
,
status
as
http_status
,
Query
from
nacsos_data.db.schemas
import
BotAnnotationMetaData
,
BotAnnotation
from
nacsos_data.models.annotations
import
\
AnnotationSchemeModel
,
\
...
...
@@ -6,7 +10,8 @@ from nacsos_data.models.annotations import \
AssignmentModel
,
\
AssignmentStatus
,
\
AssignmentScopeConfig
,
\
AnnotationSchemeModelFlat
AnnotationSchemeModelFlat
,
\
FlattenedAnnotationSchemeLabel
from
nacsos_data.models.bot_annotations
import
\
ResolutionMethod
,
\
AnnotationFilters
,
\
...
...
@@ -48,13 +53,14 @@ from nacsos_data.util.annotations.validation import \
flatten_annotation_scheme
from
nacsos_data.util.annotations.assignments.random
import
random_assignments
from
uuid
import
UUID
from
pydantic
import
BaseModel
from
sqlalchemy
import
select
from
sqlalchemy.ext.asyncio
import
AsyncSession
from
server.api.errors
import
SaveFailedError
,
AssignmentScopeNotFoundError
,
NoNextAssignmentWarning
,
\
ProjectNotFoundError
,
AnnotationSchemeNotFoundError
,
MissingInformationError
,
NoDataForKeyError
from
server.api.errors
import
\
SaveFailedError
,
\
AssignmentScopeNotFoundError
,
\
NoNextAssignmentWarning
,
\
ProjectNotFoundError
,
\
AnnotationSchemeNotFoundError
,
\
MissingInformationError
,
\
NoDataForKeyError
from
server.util.security
import
UserPermissionChecker
from
server.data
import
db_engine
...
...
@@ -324,6 +330,7 @@ async def make_assignments(payload: MakeAssignmentsRequestModel,
class
ResolutionProposalResponse
(
BaseModel
):
collection
:
AnnotationCollection
proposal
:
list
[
BotAnnotationModel
]
scheme_flat
:
list
[
FlattenedAnnotationSchemeLabel
]
class
SavedResolutionResponse
(
BaseModel
):
...
...
@@ -366,12 +373,17 @@ async def get_item_annotation_matrix(strategy: ResolutionMethod,
key
=
key
,
repeat
=
repeat
,
)
collection
,
resolved
=
await
get_resolved_item_annotations
(
strategy
=
strategy
,
filters
=
AnnotationFilterObject
.
parse_obj
(
filters
),
ignore_order
=
ignore_order
,
ignore_hierarchy
=
ignore_hierarchy
,
db_engine
=
db_engine
)
return
ResolutionProposalResponse
(
collection
=
collection
,
proposal
=
resolved
)
if
ignore_hierarchy
is
None
:
ignore_hierarchy
=
False
if
ignore_order
is
None
:
ignore_order
=
False
scheme
,
flat_labels
,
collection
,
resolved
=
\
await
get_resolved_item_annotations
(
strategy
=
strategy
,
filters
=
AnnotationFilterObject
.
parse_obj
(
filters
),
ignore_order
=
ignore_order
,
ignore_hierarchy
=
ignore_hierarchy
,
db_engine
=
db_engine
)
return
ResolutionProposalResponse
(
collection
=
collection
,
proposal
=
resolved
,
scheme_flat
=
flat_labels
)
@router.get
(
'
/config/resolved/:bot_annotation_meta_id
'
,
response_model
=
SavedResolutionResponse
)
...
...
@@ -386,5 +398,5 @@ async def get_saved_resolved_annotations(bot_annotation_meta_id: str,
return
SavedResolutionResponse
(
meta
=
meta
.
meta
,
saved
=
[
BotAnnotationModel
.
parse_obj
(
bot_annotation
)
for
bot_annotation
in
bot_annotations
]
saved
=
[
BotAnnotationModel
.
parse_obj
(
bot_annotation
)
for
bot_annotation
in
bot_annotations
]
)
This diff is collapsed.
Click to expand it.
server/api/routes/project/items.py
+
1
−
1
View file @
63ef2d85
...
...
@@ -42,7 +42,7 @@ async def list_project_data(item_type: ItemTypeLiteral,
async
def
list_project_data_paged
(
item_type
:
ItemTypeLiteral
,
page
:
int
,
page_size
:
int
,
permission
=
Depends
(
UserPermissionChecker
(
'
dataset_read
'
))):
project_id
=
permission
.
permissions
.
project_id
if
item_type
==
'
bas
ic
'
:
if
item_type
==
'
gener
ic
'
:
return
await
read_paged_for_project
(
Model
=
GenericItemModel
,
Schema
=
GenericItem
,
page
=
page
,
page_size
=
page_size
,
project_id
=
project_id
,
engine
=
db_engine
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment