diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index a10dd66b8..bf29fdb54 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -401,10 +401,10 @@ types: inline: true Annotation: docs: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + Annotation Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. properties: bulk_created: type: optional @@ -466,6 +466,7 @@ types: result: type: optional>> docs: List of annotation results for the task + state: string task: type: optional docs: Corresponding task for this annotation @@ -581,10 +582,10 @@ types: inline: true AnnotationRequest: docs: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + Annotation Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. properties: bulk_created: type: optional @@ -651,10 +652,14 @@ types: openapi: openapi/openapi.yaml AnnotationReview: docs: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + AnnotationReview Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: accepted: type: optional @@ -679,14 +684,19 @@ types: remove_from_queue: optional result: optional started_at: optional + state: string source: openapi: openapi/openapi.yaml AnnotationReviewRequest: docs: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + AnnotationReview Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: accepted: type: optional @@ -1592,6 +1602,15 @@ types: source: openapi: openapi/openapi.yaml Comment: + docs: |- + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: annotation: optional classifications: optional @@ -1611,6 +1630,7 @@ types: resolved_at: type: optional docs: Resolving time + state: string task: optional text: type: optional @@ -1621,6 +1641,15 @@ types: source: openapi: openapi/openapi.yaml CommentRequest: + docs: |- + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: annotation: optional classifications: optional @@ -1635,6 +1664,15 @@ types: source: openapi: openapi/openapi.yaml CommentSerializerWithExpandedUser: + docs: |- + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: annotation: optional classifications: optional @@ -1652,6 +1690,7 @@ types: resolved_at: type: optional docs: Resolving time + state: string task: optional text: type: optional @@ -5040,7 +5079,7 @@ types: openapi: openapi/openapi.yaml inline: true LseTask: - docs: Task Serializer with project scheme configs validation + docs: Data Manager Task Serializer with FSM state support. properties: agreement: string agreement_selected: string @@ -5119,6 +5158,7 @@ types: reviewers_count: integer reviews_accepted: optional reviews_rejected: optional + state: string storage_filename: string total_annotations: optional total_predictions: optional @@ -5435,7 +5475,7 @@ types: openapi: openapi/openapi.yaml inline: true LseTaskSerializerForAnnotators: - docs: Task Serializer with project scheme configs validation + docs: Data Manager Task Serializer with FSM state support. properties: annotations: string annotations_results: string @@ -5497,7 +5537,7 @@ types: openapi: openapi/openapi.yaml inline: true LseTaskSerializerForReviewers: - docs: Task Serializer with project scheme configs validation + docs: Data Manager Task Serializer with FSM state support. properties: agreement: string agreement_selected: string @@ -5576,6 +5616,7 @@ types: reviewers_count: integer reviews_accepted: optional reviews_rejected: optional + state: string storage_filename: string total_annotations: optional total_predictions: optional @@ -7451,11 +7492,12 @@ types: source: openapi: openapi/openapi.yaml RoleBasedTask: - discriminated: false + discriminant: user_role + base-properties: {} union: - - LseTask - - LseTaskSerializerForReviewers - - LseTaskSerializerForAnnotators + LseTask: LseTask + LseTaskSerializerForAnnotators: LseTaskSerializerForAnnotators + LseTaskSerializerForReviewers: LseTaskSerializerForReviewers source: openapi: openapi/openapi.yaml S3DatasetStorage: @@ -8030,6 +8072,15 @@ types: source: openapi: openapi/openapi.yaml TaskAssignment: + docs: |- + TaskAssignment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: assignee: type: integer @@ -8038,6 +8089,7 @@ types: type: datetime docs: Time of assignment id: integer + state: string task: type: integer docs: Assigned task diff --git a/.mock/definition/annotationReviews.yml b/.mock/definition/annotationReviews.yml index d644b09cf..9161cca2c 100644 --- a/.mock/definition/annotationReviews.yml +++ b/.mock/definition/annotationReviews.yml @@ -45,6 +45,7 @@ service: result: key: value started_at: '2024-01-15T09:30:00Z' + state: state audiences: - public create: @@ -90,6 +91,7 @@ service: result: key: value started_at: '2024-01-15T09:30:00Z' + state: state audiences: - public get: @@ -131,6 +133,7 @@ service: result: key: value started_at: '2024-01-15T09:30:00Z' + state: state audiences: - public api_annotation_reviews_update: @@ -177,6 +180,7 @@ service: result: key: value started_at: '2024-01-15T09:30:00Z' + state: state audiences: - internal delete: @@ -262,6 +266,7 @@ service: result: key: value started_at: '2024-01-15T09:30:00Z' + state: state audiences: - public source: diff --git a/.mock/definition/annotations.yml b/.mock/definition/annotations.yml index a01e0a71a..808438e21 100644 --- a/.mock/definition/annotations.yml +++ b/.mock/definition/annotations.yml @@ -174,6 +174,7 @@ service: width: 50 x: 20 'y': 30 + state: state task: 1 updated_at: '2024-01-15T09:30:00Z' updated_by: 1 @@ -296,6 +297,7 @@ service: width: 50 x: 20 'y': 30 + state: state task: 1 updated_at: '2024-01-15T09:30:00Z' updated_by: 1 @@ -361,6 +363,7 @@ service: project: 1 result: - key: value + state: state task: 1 updated_at: '2024-01-15T09:30:00Z' updated_by: 1 @@ -486,6 +489,7 @@ service: width: 50 x: 20 'y': 30 + state: state task: 1 updated_at: '2024-01-15T09:30:00Z' updated_by: 1 diff --git a/.mock/definition/comments.yml b/.mock/definition/comments.yml index 8056a8759..d552bf1b8 100644 --- a/.mock/definition/comments.yml +++ b/.mock/definition/comments.yml @@ -48,6 +48,7 @@ service: region_ref: key: value resolved_at: '2024-01-15T09:30:00Z' + state: state task: 1 text: text updated_at: '2024-01-15T09:30:00Z' @@ -95,6 +96,7 @@ service: region_ref: key: value resolved_at: '2024-01-15T09:30:00Z' + state: state task: 1 text: text updated_at: '2024-01-15T09:30:00Z' @@ -176,6 +178,7 @@ service: region_ref: key: value resolved_at: '2024-01-15T09:30:00Z' + state: state task: 1 text: text updated_at: '2024-01-15T09:30:00Z' @@ -227,6 +230,7 @@ service: region_ref: key: value resolved_at: '2024-01-15T09:30:00Z' + state: state task: 1 text: text updated_at: '2024-01-15T09:30:00Z' @@ -317,6 +321,7 @@ service: region_ref: key: value resolved_at: '2024-01-15T09:30:00Z' + state: state task: 1 text: text updated_at: '2024-01-15T09:30:00Z' diff --git a/.mock/definition/projects.yml b/.mock/definition/projects.yml index 05d6da981..baee73f38 100644 --- a/.mock/definition/projects.yml +++ b/.mock/definition/projects.yml @@ -1147,6 +1147,7 @@ service: created_at: '2024-01-15T09:30:00Z' created_username: created_username id: 1 + state: state updated_at: '2024-01-15T09:30:00Z' cancelled_annotations: 1 comment_authors: diff --git a/.mock/definition/projects/assignments.yml b/.mock/definition/projects/assignments.yml index 55ea8997b..7b0ffe3f5 100644 --- a/.mock/definition/projects/assignments.yml +++ b/.mock/definition/projects/assignments.yml @@ -440,6 +440,7 @@ service: - assignee: 1 created_at: '2024-01-15T09:30:00Z' id: 1 + state: state task: 1 type: AN audiences: @@ -493,6 +494,7 @@ service: assignee: 1 created_at: '2024-01-15T09:30:00Z' id: 1 + state: state task: 1 type: AN audiences: @@ -587,6 +589,7 @@ service: assignee: 1 created_at: '2024-01-15T09:30:00Z' id: 1 + state: state task: 1 type: AN audiences: diff --git a/.mock/definition/tasks.yml b/.mock/definition/tasks.yml index cd292d9b4..6c01bebc4 100644 --- a/.mock/definition/tasks.yml +++ b/.mock/definition/tasks.yml @@ -169,11 +169,12 @@ service: - response: body: tasks: - - agreement: agreement - agreement_selected: agreement_selected - annotations: annotations - annotations_ids: annotations_ids - annotations_results: annotations_results + - user_role: LseTaskSerializerForReviewers + agreement: tasks + agreement_selected: tasks + annotations: tasks + annotations_ids: tasks + annotations_results: tasks annotators: - 1 annotators_count: 1 @@ -183,7 +184,7 @@ service: - key: value comment_authors_count: 1 comment_count: 1 - comments: comments + comments: tasks completed_at: '2024-01-15T09:30:00Z' created_at: '2024-01-15T09:30:00Z' data: @@ -191,7 +192,7 @@ service: draft_exists: true drafts: - {} - file_upload: file_upload + file_upload: tasks ground_truth: true id: 1 inner_id: 1 @@ -203,8 +204,8 @@ service: precomputed_agreement: 1.1 predictions: - {} - predictions_model_versions: predictions_model_versions - predictions_results: predictions_results + predictions_model_versions: tasks + predictions_results: tasks predictions_score: 1.1 project: 1 review_time: 1 @@ -214,7 +215,8 @@ service: reviewers_count: 1 reviews_accepted: 1 reviews_rejected: 1 - storage_filename: storage_filename + state: tasks + storage_filename: tasks total_annotations: 1 total_predictions: 1 unresolved_comment_count: 1 @@ -375,6 +377,7 @@ service: reviewers_count: 1 reviews_accepted: 1 reviews_rejected: 1 + state: state storage_filename: storage_filename total_annotations: 1 total_predictions: 1 @@ -406,11 +409,12 @@ service: id: id response: body: - agreement: agreement - agreement_selected: agreement_selected - annotations: annotations - annotations_ids: annotations_ids - annotations_results: annotations_results + user_role: LseTaskSerializerForReviewers + agreement: string + agreement_selected: string + annotations: string + annotations_ids: string + annotations_results: string annotators: - 1 annotators_count: 1 @@ -420,7 +424,7 @@ service: - key: value comment_authors_count: 1 comment_count: 1 - comments: comments + comments: string completed_at: '2024-01-15T09:30:00Z' created_at: '2024-01-15T09:30:00Z' data: @@ -431,7 +435,7 @@ service: result: - key: value updated_at: '2024-01-15T09:30:00Z' - file_upload: file_upload + file_upload: string ground_truth: true id: 1 inner_id: 1 @@ -454,8 +458,8 @@ service: score: 1.1 task: 1 updated_at: '2024-01-15T09:30:00Z' - predictions_model_versions: predictions_model_versions - predictions_results: predictions_results + predictions_model_versions: string + predictions_results: string predictions_score: 1.1 project: 1 review_time: 1 @@ -465,7 +469,8 @@ service: reviewers_count: 1 reviews_accepted: 1 reviews_rejected: 1 - storage_filename: storage_filename + state: string + storage_filename: string total_annotations: 1 total_predictions: 1 unresolved_comment_count: 1 @@ -565,11 +570,12 @@ service: request: {} response: body: - agreement: agreement - agreement_selected: agreement_selected - annotations: annotations - annotations_ids: annotations_ids - annotations_results: annotations_results + user_role: LseTaskSerializerForReviewers + agreement: string + agreement_selected: string + annotations: string + annotations_ids: string + annotations_results: string annotators: - 1 annotators_count: 1 @@ -579,7 +585,7 @@ service: - key: value comment_authors_count: 1 comment_count: 1 - comments: comments + comments: string completed_at: '2024-01-15T09:30:00Z' created_at: '2024-01-15T09:30:00Z' data: @@ -590,7 +596,7 @@ service: result: - key: value updated_at: '2024-01-15T09:30:00Z' - file_upload: file_upload + file_upload: string ground_truth: true id: 1 inner_id: 1 @@ -613,8 +619,8 @@ service: score: 1.1 task: 1 updated_at: '2024-01-15T09:30:00Z' - predictions_model_versions: predictions_model_versions - predictions_results: predictions_results + predictions_model_versions: string + predictions_results: string predictions_score: 1.1 project: 1 review_time: 1 @@ -624,7 +630,8 @@ service: reviewers_count: 1 reviews_accepted: 1 reviews_rejected: 1 - storage_filename: storage_filename + state: string + storage_filename: string total_annotations: 1 total_predictions: 1 unresolved_comment_count: 1 diff --git a/.mock/openapi/openapi.yaml b/.mock/openapi/openapi.yaml index c1370984f..9234e9bc9 100644 --- a/.mock/openapi/openapi.yaml +++ b/.mock/openapi/openapi.yaml @@ -19399,10 +19399,10 @@ components: - exclude Annotation: description: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + Annotation Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. properties: bulk_created: description: Annotation was created in bulk mode @@ -19490,6 +19490,9 @@ components: type: object title: Annotation result list type: array + state: + readOnly: true + type: string task: description: Corresponding task for this annotation nullable: true @@ -19511,14 +19514,15 @@ components: - created_at - created_username - id + - state - updated_at type: object AnnotationBulkSerializerWithSelectedItemsRequest: description: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + Annotation Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. properties: bulk_created: description: Annotation was created in bulk mode @@ -19703,10 +19707,10 @@ components: type: object AnnotationRequest: description: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + Annotation Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. properties: bulk_created: description: Annotation was created in bulk mode @@ -19794,10 +19798,14 @@ components: type: object AnnotationReview: description: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + AnnotationReview Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: accepted: description: Accepted or rejected (if false) flag @@ -19839,6 +19847,9 @@ components: format: date-time nullable: true type: string + state: + readOnly: true + type: string required: - annotation - created_at @@ -19846,13 +19857,18 @@ components: - fixed_annotation_history - id - previous_annotation_history + - state type: object AnnotationReviewRequest: description: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + AnnotationReview Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: accepted: description: Accepted or rejected (if false) flag @@ -21119,6 +21135,15 @@ components: - type type: object Comment: + description: |- + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: annotation: nullable: true @@ -21157,6 +21182,9 @@ components: nullable: true readOnly: true type: string + state: + readOnly: true + type: string task: nullable: true readOnly: true @@ -21176,10 +21204,20 @@ components: - id - project - resolved_at + - state - task - updated_at type: object CommentRequest: + description: |- + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: annotation: nullable: true @@ -21202,6 +21240,15 @@ components: type: string type: object CommentSerializerWithExpandedUser: + description: |- + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: annotation: nullable: true @@ -21238,6 +21285,9 @@ components: nullable: true readOnly: true type: string + state: + readOnly: true + type: string task: nullable: true readOnly: true @@ -21257,6 +21307,7 @@ components: - id - project - resolved_at + - state - task - updated_at type: object @@ -25772,7 +25823,7 @@ components: - role_arn type: object LseTask: - description: Task Serializer with project scheme configs validation + description: Data Manager Task Serializer with FSM state support. properties: agreement: readOnly: true @@ -25964,6 +26015,9 @@ components: type: integer reviews_rejected: type: integer + state: + readOnly: true + type: string storage_filename: readOnly: true type: string @@ -26011,6 +26065,7 @@ components: - review_time - reviewers - reviewers_count + - state - storage_filename - updated_at - updated_by @@ -26195,7 +26250,7 @@ components: - data type: object LseTaskSerializerForAnnotators: - description: Task Serializer with project scheme configs validation + description: Data Manager Task Serializer with FSM state support. properties: annotations: default: [] @@ -26317,7 +26372,7 @@ components: - unresolved_comment_count type: object LseTaskSerializerForReviewers: - description: Task Serializer with project scheme configs validation + description: Data Manager Task Serializer with FSM state support. properties: agreement: readOnly: true @@ -26509,6 +26564,9 @@ components: type: integer reviews_rejected: type: integer + state: + readOnly: true + type: string storage_filename: readOnly: true type: string @@ -26556,6 +26614,7 @@ components: - review_time - reviewers - reviewers_count + - state - storage_filename - updated_at - updated_by @@ -27913,10 +27972,14 @@ components: type: object PatchedAnnotationReviewRequest: description: |- - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + AnnotationReview Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: accepted: description: Accepted or rejected (if false) flag @@ -28200,6 +28263,15 @@ components: type: string type: object PatchedCommentRequest: + description: |- + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: annotation: nullable: true @@ -29264,7 +29336,7 @@ components: type: boolean type: object PatchedLseTaskRequest: - description: Task Serializer with project scheme configs validation + description: Data Manager Task Serializer with FSM state support. properties: avg_lead_time: format: double @@ -31113,6 +31185,12 @@ components: - 'NO' type: string RoleBasedTask: + discriminator: + mapping: + LseTask: '#/components/schemas/LseTask' + LseTaskSerializerForAnnotators: '#/components/schemas/LseTaskSerializerForAnnotators' + LseTaskSerializerForReviewers: '#/components/schemas/LseTaskSerializerForReviewers' + propertyName: user_role oneOf: - $ref: '#/components/schemas/LseTask' - $ref: '#/components/schemas/LseTaskSerializerForReviewers' @@ -31882,6 +31960,15 @@ components: - completed_with_errors type: string TaskAssignment: + description: |- + TaskAssignment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) properties: assignee: description: Assigned user @@ -31894,6 +31981,9 @@ components: id: readOnly: true type: integer + state: + readOnly: true + type: string task: description: Assigned task type: integer @@ -31910,6 +32000,7 @@ components: - assignee - created_at - id + - state - task type: object TaskEvent: diff --git a/src/label_studio_sdk/__init__.py b/src/label_studio_sdk/__init__.py index 0f2fe8c54..942e477eb 100644 --- a/src/label_studio_sdk/__init__.py +++ b/src/label_studio_sdk/__init__.py @@ -197,6 +197,9 @@ ReviewedEnum, Role9E7Enum, RoleBasedTask, + RoleBasedTask_LseTask, + RoleBasedTask_LseTaskSerializerForAnnotators, + RoleBasedTask_LseTaskSerializerForReviewers, S3ExportStorage, S3ImportStorage, SamlSettings, @@ -590,6 +593,9 @@ "ReviewedEnum", "Role9E7Enum", "RoleBasedTask", + "RoleBasedTask_LseTask", + "RoleBasedTask_LseTaskSerializerForAnnotators", + "RoleBasedTask_LseTaskSerializerForReviewers", "S3ExportStorage", "S3ImportStorage", "SamlSettings", diff --git a/src/label_studio_sdk/types/__init__.py b/src/label_studio_sdk/types/__init__.py index 39c5e2cb5..977102db3 100644 --- a/src/label_studio_sdk/types/__init__.py +++ b/src/label_studio_sdk/types/__init__.py @@ -197,7 +197,12 @@ from .review_settings_sampling_enum import ReviewSettingsSamplingEnum from .reviewed_enum import ReviewedEnum from .role9e7enum import Role9E7Enum -from .role_based_task import RoleBasedTask +from .role_based_task import ( + RoleBasedTask, + RoleBasedTask_LseTask, + RoleBasedTask_LseTaskSerializerForAnnotators, + RoleBasedTask_LseTaskSerializerForReviewers, +) from .s3export_storage import S3ExportStorage from .s3import_storage import S3ImportStorage from .saml_settings import SamlSettings @@ -437,6 +442,9 @@ "ReviewedEnum", "Role9E7Enum", "RoleBasedTask", + "RoleBasedTask_LseTask", + "RoleBasedTask_LseTaskSerializerForAnnotators", + "RoleBasedTask_LseTaskSerializerForReviewers", "S3ExportStorage", "S3ImportStorage", "SamlSettings", diff --git a/src/label_studio_sdk/types/annotation.py b/src/label_studio_sdk/types/annotation.py index 916167ca9..531b53821 100644 --- a/src/label_studio_sdk/types/annotation.py +++ b/src/label_studio_sdk/types/annotation.py @@ -10,10 +10,10 @@ class Annotation(UncheckedBaseModel): """ - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + Annotation Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. """ bulk_created: typing.Optional[bool] = pydantic.Field(default=None) @@ -99,6 +99,7 @@ class Annotation(UncheckedBaseModel): List of annotation results for the task """ + state: str task: typing.Optional[int] = pydantic.Field(default=None) """ Corresponding task for this annotation diff --git a/src/label_studio_sdk/types/annotation_request.py b/src/label_studio_sdk/types/annotation_request.py index 0fac166d7..cbeb6ddf0 100644 --- a/src/label_studio_sdk/types/annotation_request.py +++ b/src/label_studio_sdk/types/annotation_request.py @@ -10,10 +10,10 @@ class AnnotationRequest(UncheckedBaseModel): """ - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + Annotation Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. """ bulk_created: typing.Optional[bool] = pydantic.Field(default=None) diff --git a/src/label_studio_sdk/types/annotation_review.py b/src/label_studio_sdk/types/annotation_review.py index ebf9b5b80..b5f50d4da 100644 --- a/src/label_studio_sdk/types/annotation_review.py +++ b/src/label_studio_sdk/types/annotation_review.py @@ -9,10 +9,14 @@ class AnnotationReview(UncheckedBaseModel): """ - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + AnnotationReview Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) """ accepted: typing.Optional[bool] = pydantic.Field(default=None) @@ -50,6 +54,7 @@ class AnnotationReview(UncheckedBaseModel): remove_from_queue: typing.Optional[bool] = None result: typing.Optional[typing.Optional[typing.Any]] = None started_at: typing.Optional[dt.datetime] = None + state: str if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/label_studio_sdk/types/annotation_review_request.py b/src/label_studio_sdk/types/annotation_review_request.py index ad2a6ad0d..797f6cb51 100644 --- a/src/label_studio_sdk/types/annotation_review_request.py +++ b/src/label_studio_sdk/types/annotation_review_request.py @@ -9,10 +9,14 @@ class AnnotationReviewRequest(UncheckedBaseModel): """ - A ModelSerializer that takes additional arguments for - "fields", "omit" and "expand" in order to - control which fields are displayed, and whether to replace simple - values with complex, nested serializations + AnnotationReview Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) """ accepted: typing.Optional[bool] = pydantic.Field(default=None) diff --git a/src/label_studio_sdk/types/comment.py b/src/label_studio_sdk/types/comment.py index 53923fa2d..2c888110b 100644 --- a/src/label_studio_sdk/types/comment.py +++ b/src/label_studio_sdk/types/comment.py @@ -8,6 +8,17 @@ class Comment(UncheckedBaseModel): + """ + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) + """ + annotation: typing.Optional[int] = None classifications: typing.Optional[typing.Optional[typing.Any]] = None created_at: dt.datetime = pydantic.Field() @@ -34,6 +45,7 @@ class Comment(UncheckedBaseModel): Resolving time """ + state: str task: typing.Optional[int] = None text: typing.Optional[str] = pydantic.Field(default=None) """ diff --git a/src/label_studio_sdk/types/comment_request.py b/src/label_studio_sdk/types/comment_request.py index d2435f1b0..089ec5227 100644 --- a/src/label_studio_sdk/types/comment_request.py +++ b/src/label_studio_sdk/types/comment_request.py @@ -7,6 +7,17 @@ class CommentRequest(UncheckedBaseModel): + """ + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) + """ + annotation: typing.Optional[int] = None classifications: typing.Optional[typing.Optional[typing.Any]] = None draft: typing.Optional[int] = None diff --git a/src/label_studio_sdk/types/comment_serializer_with_expanded_user.py b/src/label_studio_sdk/types/comment_serializer_with_expanded_user.py index a9a1e8157..9fc2a824e 100644 --- a/src/label_studio_sdk/types/comment_serializer_with_expanded_user.py +++ b/src/label_studio_sdk/types/comment_serializer_with_expanded_user.py @@ -9,6 +9,17 @@ class CommentSerializerWithExpandedUser(UncheckedBaseModel): + """ + Comment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) + """ + annotation: typing.Optional[int] = None classifications: typing.Optional[typing.Optional[typing.Any]] = None created_at: dt.datetime = pydantic.Field() @@ -31,6 +42,7 @@ class CommentSerializerWithExpandedUser(UncheckedBaseModel): Resolving time """ + state: str task: typing.Optional[int] = None text: typing.Optional[str] = pydantic.Field(default=None) """ diff --git a/src/label_studio_sdk/types/lse_task.py b/src/label_studio_sdk/types/lse_task.py index 58d93f914..bf926c9b0 100644 --- a/src/label_studio_sdk/types/lse_task.py +++ b/src/label_studio_sdk/types/lse_task.py @@ -11,7 +11,7 @@ class LseTask(UncheckedBaseModel): """ - Task Serializer with project scheme configs validation + Data Manager Task Serializer with FSM state support. """ agreement: str @@ -101,6 +101,7 @@ class LseTask(UncheckedBaseModel): reviewers_count: int reviews_accepted: typing.Optional[int] = None reviews_rejected: typing.Optional[int] = None + state: str storage_filename: str total_annotations: typing.Optional[int] = None total_predictions: typing.Optional[int] = None diff --git a/src/label_studio_sdk/types/lse_task_serializer_for_annotators.py b/src/label_studio_sdk/types/lse_task_serializer_for_annotators.py index 1771d45f3..55586f855 100644 --- a/src/label_studio_sdk/types/lse_task_serializer_for_annotators.py +++ b/src/label_studio_sdk/types/lse_task_serializer_for_annotators.py @@ -11,7 +11,7 @@ class LseTaskSerializerForAnnotators(UncheckedBaseModel): """ - Task Serializer with project scheme configs validation + Data Manager Task Serializer with FSM state support. """ annotations: str diff --git a/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py b/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py index 89a803161..1552890bc 100644 --- a/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py +++ b/src/label_studio_sdk/types/lse_task_serializer_for_reviewers.py @@ -11,7 +11,7 @@ class LseTaskSerializerForReviewers(UncheckedBaseModel): """ - Task Serializer with project scheme configs validation + Data Manager Task Serializer with FSM state support. """ agreement: str @@ -101,6 +101,7 @@ class LseTaskSerializerForReviewers(UncheckedBaseModel): reviewers_count: int reviews_accepted: typing.Optional[int] = None reviews_rejected: typing.Optional[int] = None + state: str storage_filename: str total_annotations: typing.Optional[int] = None total_predictions: typing.Optional[int] = None diff --git a/src/label_studio_sdk/types/role_based_task.py b/src/label_studio_sdk/types/role_based_task.py index 4f63825e4..a3a30123a 100644 --- a/src/label_studio_sdk/types/role_based_task.py +++ b/src/label_studio_sdk/types/role_based_task.py @@ -1,8 +1,170 @@ # This file was auto-generated by Fern from our API Definition. +from __future__ import annotations +from ..core.unchecked_base_model import UncheckedBaseModel import typing -from .lse_task import LseTask -from .lse_task_serializer_for_reviewers import LseTaskSerializerForReviewers -from .lse_task_serializer_for_annotators import LseTaskSerializerForAnnotators +import datetime as dt +from .lse_task_drafts_item import LseTaskDraftsItem +from .lse_task_predictions_item import LseTaskPredictionsItem +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic +from .lse_task_serializer_for_annotators_drafts_item import LseTaskSerializerForAnnotatorsDraftsItem +from .lse_task_serializer_for_annotators_predictions_item import LseTaskSerializerForAnnotatorsPredictionsItem +from .lse_task_serializer_for_reviewers_drafts_item import LseTaskSerializerForReviewersDraftsItem +from .lse_task_serializer_for_reviewers_predictions_item import LseTaskSerializerForReviewersPredictionsItem +import typing_extensions +from ..core.unchecked_base_model import UnionMetadata -RoleBasedTask = typing.Union[LseTask, LseTaskSerializerForReviewers, LseTaskSerializerForAnnotators] + +class RoleBasedTask_LseTask(UncheckedBaseModel): + user_role: typing.Literal["LseTask"] = "LseTask" + agreement: str + agreement_selected: str + annotations: str + annotations_ids: str + annotations_results: str + annotators: typing.List[int] + annotators_count: int + avg_lead_time: typing.Optional[float] = None + cancelled_annotations: typing.Optional[int] = None + comment_authors: typing.List[typing.Dict[str, typing.Optional[typing.Any]]] + comment_authors_count: int + comment_count: typing.Optional[int] = None + comments: str + completed_at: typing.Optional[dt.datetime] = None + created_at: dt.datetime + data: typing.Optional[typing.Any] = None + draft_exists: typing.Optional[bool] = None + drafts: typing.List[LseTaskDraftsItem] + file_upload: str + ground_truth: typing.Optional[bool] = None + id: int + inner_id: typing.Optional[int] = None + is_labeled: typing.Optional[bool] = None + last_comment_updated_at: typing.Optional[dt.datetime] = None + meta: typing.Optional[typing.Optional[typing.Any]] = None + overlap: typing.Optional[int] = None + precomputed_agreement: typing.Optional[float] = None + predictions: typing.List[LseTaskPredictionsItem] + predictions_model_versions: str + predictions_results: str + predictions_score: typing.Optional[float] = None + project: typing.Optional[int] = None + review_time: int + reviewed: typing.Optional[bool] = None + reviewers: typing.List[typing.Dict[str, typing.Optional[typing.Any]]] + reviewers_count: int + reviews_accepted: typing.Optional[int] = None + reviews_rejected: typing.Optional[int] = None + state: str + storage_filename: str + total_annotations: typing.Optional[int] = None + total_predictions: typing.Optional[int] = None + unresolved_comment_count: typing.Optional[int] = None + updated_at: dt.datetime + updated_by: typing.List[typing.Dict[str, typing.Optional[typing.Any]]] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class RoleBasedTask_LseTaskSerializerForAnnotators(UncheckedBaseModel): + user_role: typing.Literal["LseTaskSerializerForAnnotators"] = "LseTaskSerializerForAnnotators" + annotations: str + annotations_results: str + cancelled_annotations: typing.Optional[int] = None + comment_count: str + comments: str + created_at: dt.datetime + data: typing.Optional[typing.Any] = None + draft_exists: typing.Optional[bool] = None + drafts: typing.List[LseTaskSerializerForAnnotatorsDraftsItem] + id: int + predictions: typing.List[LseTaskSerializerForAnnotatorsPredictionsItem] + predictions_results: str + predictions_score: typing.Optional[float] = None + reviews_rejected: typing.Optional[int] = None + total_annotations: typing.Optional[int] = None + total_predictions: typing.Optional[int] = None + unresolved_comment_count: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class RoleBasedTask_LseTaskSerializerForReviewers(UncheckedBaseModel): + user_role: typing.Literal["LseTaskSerializerForReviewers"] = "LseTaskSerializerForReviewers" + agreement: str + agreement_selected: str + annotations: str + annotations_ids: str + annotations_results: str + annotators: typing.List[int] + annotators_count: int + avg_lead_time: typing.Optional[float] = None + cancelled_annotations: typing.Optional[int] = None + comment_authors: typing.List[typing.Dict[str, typing.Optional[typing.Any]]] + comment_authors_count: int + comment_count: typing.Optional[int] = None + comments: str + completed_at: typing.Optional[dt.datetime] = None + created_at: dt.datetime + data: typing.Optional[typing.Any] = None + draft_exists: typing.Optional[bool] = None + drafts: typing.List[LseTaskSerializerForReviewersDraftsItem] + file_upload: str + ground_truth: typing.Optional[bool] = None + id: int + inner_id: typing.Optional[int] = None + is_labeled: typing.Optional[bool] = None + last_comment_updated_at: typing.Optional[dt.datetime] = None + meta: typing.Optional[typing.Optional[typing.Any]] = None + overlap: typing.Optional[int] = None + precomputed_agreement: typing.Optional[float] = None + predictions: typing.List[LseTaskSerializerForReviewersPredictionsItem] + predictions_model_versions: str + predictions_results: str + predictions_score: typing.Optional[float] = None + project: typing.Optional[int] = None + review_time: int + reviewed: typing.Optional[bool] = None + reviewers: typing.List[typing.Dict[str, typing.Optional[typing.Any]]] + reviewers_count: int + reviews_accepted: typing.Optional[int] = None + reviews_rejected: typing.Optional[int] = None + state: str + storage_filename: str + total_annotations: typing.Optional[int] = None + total_predictions: typing.Optional[int] = None + unresolved_comment_count: typing.Optional[int] = None + updated_at: dt.datetime + updated_by: typing.List[typing.Dict[str, typing.Optional[typing.Any]]] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +RoleBasedTask = typing_extensions.Annotated[ + typing.Union[ + RoleBasedTask_LseTask, RoleBasedTask_LseTaskSerializerForAnnotators, RoleBasedTask_LseTaskSerializerForReviewers + ], + UnionMetadata(discriminant="user_role"), +] diff --git a/src/label_studio_sdk/types/task_assignment.py b/src/label_studio_sdk/types/task_assignment.py index 0d0d18c03..b1d0304a6 100644 --- a/src/label_studio_sdk/types/task_assignment.py +++ b/src/label_studio_sdk/types/task_assignment.py @@ -9,6 +9,17 @@ class TaskAssignment(UncheckedBaseModel): + """ + TaskAssignment Serializer with FSM state support. + + Note: The 'state' field will be populated from the queryset annotation + if present, preventing N+1 queries. Use .with_state() on your queryset. + + The state field display is controlled by both: + - fflag_feat_fit_568_finite_state_management (FSM background calculations) + - fflag_feat_fit_710_fsm_state_fields (state field display in APIs) + """ + assignee: int = pydantic.Field() """ Assigned user @@ -20,6 +31,7 @@ class TaskAssignment(UncheckedBaseModel): """ id: int + state: str task: int = pydantic.Field() """ Assigned task diff --git a/tests/projects/test_assignments.py b/tests/projects/test_assignments.py index 4bc0d6e9c..0be4be8ce 100644 --- a/tests/projects/test_assignments.py +++ b/tests/projects/test_assignments.py @@ -23,11 +23,20 @@ async def test_bulk_assign(client: LabelStudio, async_client: AsyncLabelStudio) async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> None: expected_response: typing.Any = [ - {"assignee": 1, "created_at": "2024-01-15T09:30:00Z", "id": 1, "task": 1, "type": "AN"} + {"assignee": 1, "created_at": "2024-01-15T09:30:00Z", "id": 1, "state": "state", "task": 1, "type": "AN"} ] expected_types: typing.Tuple[typing.Any, typing.Any] = ( "list", - {0: {"assignee": "integer", "created_at": "datetime", "id": "integer", "task": "integer", "type": None}}, + { + 0: { + "assignee": "integer", + "created_at": "datetime", + "id": "integer", + "state": None, + "task": "integer", + "type": None, + } + }, ) response = client.projects.assignments.list(id=1, task_pk=1) validate_response(response, expected_response, expected_types) @@ -41,6 +50,7 @@ async def test_assign(client: LabelStudio, async_client: AsyncLabelStudio) -> No "assignee": 1, "created_at": "2024-01-15T09:30:00Z", "id": 1, + "state": "state", "task": 1, "type": "AN", } @@ -48,6 +58,7 @@ async def test_assign(client: LabelStudio, async_client: AsyncLabelStudio) -> No "assignee": "integer", "created_at": "datetime", "id": "integer", + "state": None, "task": "integer", "type": None, } @@ -76,6 +87,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "assignee": 1, "created_at": "2024-01-15T09:30:00Z", "id": 1, + "state": "state", "task": 1, "type": "AN", } @@ -83,6 +95,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "assignee": "integer", "created_at": "datetime", "id": "integer", + "state": None, "task": "integer", "type": None, } diff --git a/tests/test_annotation_reviews.py b/tests/test_annotation_reviews.py index 5dd23235d..ae93310b4 100644 --- a/tests/test_annotation_reviews.py +++ b/tests/test_annotation_reviews.py @@ -20,6 +20,7 @@ async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> Non "remove_from_queue": True, "result": {"key": "value"}, "started_at": "2024-01-15T09:30:00Z", + "state": "state", } ] expected_types: typing.Tuple[typing.Any, typing.Any] = ( @@ -37,6 +38,7 @@ async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> Non "remove_from_queue": None, "result": None, "started_at": "datetime", + "state": None, } }, ) @@ -60,6 +62,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No "remove_from_queue": True, "result": {"key": "value"}, "started_at": "2024-01-15T09:30:00Z", + "state": "state", } expected_types: typing.Any = { "accepted": None, @@ -73,6 +76,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No "remove_from_queue": None, "result": None, "started_at": "datetime", + "state": None, } response = client.annotation_reviews.create(annotation=1) validate_response(response, expected_response, expected_types) @@ -94,6 +98,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "remove_from_queue": True, "result": {"key": "value"}, "started_at": "2024-01-15T09:30:00Z", + "state": "state", } expected_types: typing.Any = { "accepted": None, @@ -107,6 +112,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "remove_from_queue": None, "result": None, "started_at": "datetime", + "state": None, } response = client.annotation_reviews.get(id=1) validate_response(response, expected_response, expected_types) @@ -141,6 +147,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "remove_from_queue": True, "result": {"key": "value"}, "started_at": "2024-01-15T09:30:00Z", + "state": "state", } expected_types: typing.Any = { "accepted": None, @@ -154,6 +161,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "remove_from_queue": None, "result": None, "started_at": "datetime", + "state": None, } response = client.annotation_reviews.update(id=1) validate_response(response, expected_response, expected_types) diff --git a/tests/test_annotations.py b/tests/test_annotations.py index 045edcd98..a01c0006c 100644 --- a/tests/test_annotations.py +++ b/tests/test_annotations.py @@ -51,6 +51,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: }, } ], + "state": "state", "task": 1, "updated_at": "2024-01-15T09:30:00Z", "updated_by": 1, @@ -89,6 +90,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: ) }, ), + "state": None, "task": "integer", "updated_at": "datetime", "updated_by": "integer", @@ -149,6 +151,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No }, } ], + "state": "state", "task": 1, "updated_at": "2024-01-15T09:30:00Z", "updated_by": 1, @@ -187,6 +190,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No ) }, ), + "state": None, "task": "integer", "updated_at": "datetime", "updated_by": "integer", @@ -262,6 +266,7 @@ async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> Non "parent_prediction": 1, "project": 1, "result": [{"key": "value"}], + "state": "state", "task": 1, "updated_at": "2024-01-15T09:30:00Z", "updated_by": 1, @@ -288,6 +293,7 @@ async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> Non "parent_prediction": "integer", "project": "integer", "result": ("list", {0: ("dict", {0: (None, None)})}), + "state": None, "task": "integer", "updated_at": "datetime", "updated_by": "integer", @@ -337,6 +343,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No }, } ], + "state": "state", "task": 1, "updated_at": "2024-01-15T09:30:00Z", "updated_by": 1, @@ -375,6 +382,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No ) }, ), + "state": None, "task": "integer", "updated_at": "datetime", "updated_by": "integer", diff --git a/tests/test_comments.py b/tests/test_comments.py index 9fa613bfc..14d34a796 100644 --- a/tests/test_comments.py +++ b/tests/test_comments.py @@ -19,6 +19,7 @@ async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> Non "project": 1, "region_ref": {"key": "value"}, "resolved_at": "2024-01-15T09:30:00Z", + "state": "state", "task": 1, "text": "text", "updated_at": "2024-01-15T09:30:00Z", @@ -38,6 +39,7 @@ async def test_list_(client: LabelStudio, async_client: AsyncLabelStudio) -> Non "project": "integer", "region_ref": None, "resolved_at": "datetime", + "state": None, "task": "integer", "text": None, "updated_at": "datetime", @@ -63,6 +65,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No "project": 1, "region_ref": {"key": "value"}, "resolved_at": "2024-01-15T09:30:00Z", + "state": "state", "task": 1, "text": "text", "updated_at": "2024-01-15T09:30:00Z", @@ -78,6 +81,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No "project": "integer", "region_ref": None, "resolved_at": "datetime", + "state": None, "task": "integer", "text": None, "updated_at": "datetime", @@ -101,6 +105,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "project": 1, "region_ref": {"key": "value"}, "resolved_at": "2024-01-15T09:30:00Z", + "state": "state", "task": 1, "text": "text", "updated_at": "2024-01-15T09:30:00Z", @@ -116,6 +121,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "project": "integer", "region_ref": None, "resolved_at": "datetime", + "state": None, "task": "integer", "text": None, "updated_at": "datetime", @@ -152,6 +158,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "project": 1, "region_ref": {"key": "value"}, "resolved_at": "2024-01-15T09:30:00Z", + "state": "state", "task": 1, "text": "text", "updated_at": "2024-01-15T09:30:00Z", @@ -167,6 +174,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "project": "integer", "region_ref": None, "resolved_at": "datetime", + "state": None, "task": "integer", "text": None, "updated_at": "datetime", diff --git a/tests/test_tasks.py b/tests/test_tasks.py index 15b3f72d7..78475420f 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -128,6 +128,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No "reviewers_count": 1, "reviews_accepted": 1, "reviews_rejected": 1, + "state": "state", "storage_filename": "storage_filename", "total_annotations": 1, "total_predictions": 1, @@ -198,6 +199,7 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No "reviewers_count": "integer", "reviews_accepted": "integer", "reviews_rejected": "integer", + "state": None, "storage_filename": None, "total_annotations": "integer", "total_predictions": "integer", @@ -216,11 +218,12 @@ async def test_create(client: LabelStudio, async_client: AsyncLabelStudio) -> No async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: expected_response: typing.Any = { - "agreement": "agreement", - "agreement_selected": "agreement_selected", - "annotations": "annotations", - "annotations_ids": "annotations_ids", - "annotations_results": "annotations_results", + "user_role": "LseTaskSerializerForReviewers", + "agreement": "string", + "agreement_selected": "string", + "annotations": "string", + "annotations_ids": "string", + "annotations_results": "string", "annotators": [1], "annotators_count": 1, "avg_lead_time": 1.1, @@ -228,7 +231,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "comment_authors": [{"key": "value"}], "comment_authors_count": 1, "comment_count": 1, - "comments": "comments", + "comments": "string", "completed_at": "2024-01-15T09:30:00Z", "created_at": "2024-01-15T09:30:00Z", "data": {"key": "value"}, @@ -236,7 +239,7 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "drafts": [ {"created_at": "2024-01-15T09:30:00Z", "result": [{"key": "value"}], "updated_at": "2024-01-15T09:30:00Z"} ], - "file_upload": "file_upload", + "file_upload": "string", "ground_truth": True, "id": 1, "inner_id": 1, @@ -258,8 +261,8 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "updated_at": "2024-01-15T09:30:00Z", } ], - "predictions_model_versions": "predictions_model_versions", - "predictions_results": "predictions_results", + "predictions_model_versions": "string", + "predictions_results": "string", "predictions_score": 1.1, "project": 1, "review_time": 1, @@ -268,83 +271,15 @@ async def test_get(client: LabelStudio, async_client: AsyncLabelStudio) -> None: "reviewers_count": 1, "reviews_accepted": 1, "reviews_rejected": 1, - "storage_filename": "storage_filename", + "state": "string", + "storage_filename": "string", "total_annotations": 1, "total_predictions": 1, "unresolved_comment_count": 1, "updated_at": "2024-01-15T09:30:00Z", "updated_by": [{"key": "value"}], } - expected_types: typing.Any = { - "agreement": None, - "agreement_selected": None, - "annotations": None, - "annotations_ids": None, - "annotations_results": None, - "annotators": ("list", {0: "integer"}), - "annotators_count": "integer", - "avg_lead_time": None, - "cancelled_annotations": "integer", - "comment_authors": ("list", {0: ("dict", {0: (None, None)})}), - "comment_authors_count": "integer", - "comment_count": "integer", - "comments": None, - "completed_at": "datetime", - "created_at": "datetime", - "data": None, - "draft_exists": None, - "drafts": ( - "list", - { - 0: { - "created_at": "datetime", - "result": ("list", {0: ("dict", {0: (None, None)})}), - "updated_at": "datetime", - } - }, - ), - "file_upload": None, - "ground_truth": None, - "id": "integer", - "inner_id": "integer", - "is_labeled": None, - "last_comment_updated_at": "datetime", - "meta": None, - "overlap": "integer", - "precomputed_agreement": None, - "predictions": ( - "list", - { - 0: { - "created_at": "datetime", - "model": ("dict", {0: (None, None)}), - "model_run": ("dict", {0: (None, None)}), - "model_version": None, - "project": "integer", - "result": ("list", {0: ("dict", {0: (None, None)})}), - "score": None, - "task": "integer", - "updated_at": "datetime", - } - }, - ), - "predictions_model_versions": None, - "predictions_results": None, - "predictions_score": None, - "project": "integer", - "review_time": "integer", - "reviewed": None, - "reviewers": ("list", {0: ("dict", {0: (None, None)})}), - "reviewers_count": "integer", - "reviews_accepted": "integer", - "reviews_rejected": "integer", - "storage_filename": None, - "total_annotations": "integer", - "total_predictions": "integer", - "unresolved_comment_count": "integer", - "updated_at": "datetime", - "updated_by": ("list", {0: ("dict", {0: (None, None)})}), - } + expected_types: typing.Any = "no_validate" response = client.tasks.get(id="id") validate_response(response, expected_response, expected_types) @@ -367,11 +302,12 @@ async def test_delete(client: LabelStudio, async_client: AsyncLabelStudio) -> No async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> None: expected_response: typing.Any = { - "agreement": "agreement", - "agreement_selected": "agreement_selected", - "annotations": "annotations", - "annotations_ids": "annotations_ids", - "annotations_results": "annotations_results", + "user_role": "LseTaskSerializerForReviewers", + "agreement": "string", + "agreement_selected": "string", + "annotations": "string", + "annotations_ids": "string", + "annotations_results": "string", "annotators": [1], "annotators_count": 1, "avg_lead_time": 1.1, @@ -379,7 +315,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "comment_authors": [{"key": "value"}], "comment_authors_count": 1, "comment_count": 1, - "comments": "comments", + "comments": "string", "completed_at": "2024-01-15T09:30:00Z", "created_at": "2024-01-15T09:30:00Z", "data": {"key": "value"}, @@ -387,7 +323,7 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "drafts": [ {"created_at": "2024-01-15T09:30:00Z", "result": [{"key": "value"}], "updated_at": "2024-01-15T09:30:00Z"} ], - "file_upload": "file_upload", + "file_upload": "string", "ground_truth": True, "id": 1, "inner_id": 1, @@ -409,8 +345,8 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "updated_at": "2024-01-15T09:30:00Z", } ], - "predictions_model_versions": "predictions_model_versions", - "predictions_results": "predictions_results", + "predictions_model_versions": "string", + "predictions_results": "string", "predictions_score": 1.1, "project": 1, "review_time": 1, @@ -419,83 +355,15 @@ async def test_update(client: LabelStudio, async_client: AsyncLabelStudio) -> No "reviewers_count": 1, "reviews_accepted": 1, "reviews_rejected": 1, - "storage_filename": "storage_filename", + "state": "string", + "storage_filename": "string", "total_annotations": 1, "total_predictions": 1, "unresolved_comment_count": 1, "updated_at": "2024-01-15T09:30:00Z", "updated_by": [{"key": "value"}], } - expected_types: typing.Any = { - "agreement": None, - "agreement_selected": None, - "annotations": None, - "annotations_ids": None, - "annotations_results": None, - "annotators": ("list", {0: "integer"}), - "annotators_count": "integer", - "avg_lead_time": None, - "cancelled_annotations": "integer", - "comment_authors": ("list", {0: ("dict", {0: (None, None)})}), - "comment_authors_count": "integer", - "comment_count": "integer", - "comments": None, - "completed_at": "datetime", - "created_at": "datetime", - "data": None, - "draft_exists": None, - "drafts": ( - "list", - { - 0: { - "created_at": "datetime", - "result": ("list", {0: ("dict", {0: (None, None)})}), - "updated_at": "datetime", - } - }, - ), - "file_upload": None, - "ground_truth": None, - "id": "integer", - "inner_id": "integer", - "is_labeled": None, - "last_comment_updated_at": "datetime", - "meta": None, - "overlap": "integer", - "precomputed_agreement": None, - "predictions": ( - "list", - { - 0: { - "created_at": "datetime", - "model": ("dict", {0: (None, None)}), - "model_run": ("dict", {0: (None, None)}), - "model_version": None, - "project": "integer", - "result": ("list", {0: ("dict", {0: (None, None)})}), - "score": None, - "task": "integer", - "updated_at": "datetime", - } - }, - ), - "predictions_model_versions": None, - "predictions_results": None, - "predictions_score": None, - "project": "integer", - "review_time": "integer", - "reviewed": None, - "reviewers": ("list", {0: ("dict", {0: (None, None)})}), - "reviewers_count": "integer", - "reviews_accepted": "integer", - "reviews_rejected": "integer", - "storage_filename": None, - "total_annotations": "integer", - "total_predictions": "integer", - "unresolved_comment_count": "integer", - "updated_at": "datetime", - "updated_by": ("list", {0: ("dict", {0: (None, None)})}), - } + expected_types: typing.Any = "no_validate" response = client.tasks.update(id="id") validate_response(response, expected_response, expected_types)