From c4ef02901c006e973df2a141d20c8bb55ebe77d4 Mon Sep 17 00:00:00 2001 From: Elodie MORIN Date: Fri, 29 May 2026 11:11:58 +0200 Subject: [PATCH 1/4] fix(backend): remove analysis from annotation model --- .../0006_remove_annotation_analysis.py | 17 +++++++++++++++++ backend/api/models/annotation/annotation.py | 5 ----- backend/api/serializers/annotation.py | 4 ---- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 backend/api/migrations/0006_remove_annotation_analysis.py diff --git a/backend/api/migrations/0006_remove_annotation_analysis.py b/backend/api/migrations/0006_remove_annotation_analysis.py new file mode 100644 index 000000000..f56c09ce0 --- /dev/null +++ b/backend/api/migrations/0006_remove_annotation_analysis.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.25 on 2026-05-29 09:08 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0005_alter_spectrogramanalysisrelation_analysis'), + ] + + operations = [ + migrations.RemoveField( + model_name='annotation', + name='analysis', + ), + ] diff --git a/backend/api/models/annotation/annotation.py b/backend/api/models/annotation/annotation.py index 44054216c..bf4840ae8 100644 --- a/backend/api/models/annotation/annotation.py +++ b/backend/api/models/annotation/annotation.py @@ -176,11 +176,6 @@ class Meta: on_delete=models.CASCADE, related_name="annotations", ) - analysis = models.ForeignKey( - SpectrogramAnalysis, - on_delete=models.CASCADE, - related_name="annotations", - ) detector_configuration = models.ForeignKey( DetectorConfiguration, diff --git a/backend/api/serializers/annotation.py b/backend/api/serializers/annotation.py index c062749e2..ef28c7a8e 100644 --- a/backend/api/serializers/annotation.py +++ b/backend/api/serializers/annotation.py @@ -14,7 +14,6 @@ Label, Confidence, AnnotationValidation, - SpectrogramAnalysis, AnnotationComment, ) from backend.aplose.models import ExpertiseLevel @@ -80,9 +79,6 @@ def get_fields(self): fields["spectrogram"].queryset = Spectrogram.objects.filter( analysis__in=campaign.analysis.all() ).distinct() - fields["analysis"].queryset = SpectrogramAnalysis.objects.filter( - id__in=campaign.analysis.values_list("id", flat=True) - ) if campaign.confidence_set is not None: fields["confidence"] = serializers.SlugRelatedField( queryset=campaign.confidence_set.confidence_indicators.all(), From 599e47d7a606d4bf148ed9c3cc022588ff724280 Mon Sep 17 00:00:00 2001 From: Elodie MORIN Date: Fri, 29 May 2026 11:22:28 +0200 Subject: [PATCH 2/4] fix(frontend): update schema --- frontend/schema.graphql | 3 --- .../annotation-task.generated.ts | 8 +----- .../annotation-task/annotation-task.graphql | 6 ----- frontend/src/api/types.gql-generated.ts | 20 -------------- .../Annotator/Annotation/conversions.ts | 3 --- .../features/Annotator/Annotation/slice.ts | 26 +++---------------- 6 files changed, 4 insertions(+), 62 deletions(-) diff --git a/frontend/schema.graphql b/frontend/schema.graphql index 133efd559..9ebbe5be9 100644 --- a/frontend/schema.graphql +++ b/frontend/schema.graphql @@ -1326,7 +1326,6 @@ type AnnotationNode implements ExtendedInterface { """Expertise level of the annotator.""" annotatorExpertiseLevel: ApiAnnotationAnnotatorExpertiseLevelChoices spectrogram: AnnotationSpectrogramNode! - analysis: SpectrogramAnalysisNode! detectorConfiguration: DetectorConfigurationNode """Acoustic features add a better description to the signal""" @@ -1881,7 +1880,6 @@ type SpectrogramAnalysisNode implements ExtendedInterface { """Ordering""" orderBy: String ): SpectrogramNodeNodeConnection - annotations(offset: Int, before: String, after: String, first: Int, last: Int, confidence_Label: String, label_Name: String, detectorConfiguration_Detector: ID, acousticFeatures_Exists: Boolean, isValidatedBy: ID, isUpdated: Boolean, annotator: ID): AnnotationNodeConnection! annotationCampaigns( offset: Int before: String @@ -4610,7 +4608,6 @@ input AnnotationInput { endFrequency: Float annotationPhase: String! annotator: String - analysis: String! detectorConfiguration: String isUpdateOf: String } diff --git a/frontend/src/api/annotation-task/annotation-task.generated.ts b/frontend/src/api/annotation-task/annotation-task.generated.ts index a88679a13..99b7bce16 100644 --- a/frontend/src/api/annotation-task/annotation-task.generated.ts +++ b/frontend/src/api/annotation-task/annotation-task.generated.ts @@ -43,7 +43,7 @@ export type GetAnnotationTaskQueryVariables = Types.Exact<{ }>; -export type GetAnnotationTaskQuery = { __typename?: 'Query', spectrogramPaths?: { __typename?: 'SpectrogramPathsNode', audioPath?: string | null, spectrogramPath?: string | null } | null, annotationSpectrogramById?: { __typename?: 'AnnotationSpectrogramNode', id: string, filename: string, start: any, duration: number, isAssigned: boolean, task?: { __typename?: 'AnnotationTaskNode', status: Types.AnnotationTaskStatus, userComments?: { __typename?: 'AnnotationCommentNodeNodeConnection', results: Array<{ __typename?: 'AnnotationCommentNode', id: string, comment: string } | null> } | null, userAnnotations?: { __typename?: 'AnnotationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationNode', id: string, type: Types.AnnotationType, startTime?: number | null, endTime?: number | null, startFrequency?: number | null, endFrequency?: number | null, annotationPhase: { __typename?: 'AnnotationPhaseNode', id: string }, label: { __typename?: 'AnnotationLabelNode', name: string }, confidence?: { __typename?: 'ConfidenceNode', label: string } | null, detectorConfiguration?: { __typename?: 'DetectorConfigurationNode', id: string, detector: { __typename?: 'DetectorNode', id: string, name: string } } | null, annotator?: { __typename?: 'UserNode', id: string, displayName: string } | null, comments?: { __typename?: 'AnnotationCommentNodeNodeConnection', results: Array<{ __typename?: 'AnnotationCommentNode', id: string, comment: string } | null> } | null, validations?: { __typename?: 'AnnotationValidationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationValidationNode', id: string, isValid: boolean } | null> } | null, isUpdateOf?: { __typename?: 'AnnotationNode', id: string } | null, acousticFeatures?: { __typename?: 'AcousticFeaturesNode', id: string, isIntensityTooLow?: boolean | null, doesOverlapOtherSignals?: boolean | null, startFrequency?: number | null, endFrequency?: number | null, relativeMinFrequencyCount?: number | null, relativeMaxFrequencyCount?: number | null, stepsCount?: number | null, hasHarmonics?: boolean | null, trend?: Types.SignalTrendType | null, hasSidebands?: boolean | null, hasSubharmonics?: boolean | null, hasFrequencyJumps?: boolean | null, frequencyJumpsCount?: number | null, hasDeterministicChaos?: boolean | null } | null, analysis: { __typename?: 'SpectrogramAnalysisNode', id: string } } | null> } | null, annotationsToCheck?: { __typename?: 'AnnotationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationNode', id: string, type: Types.AnnotationType, startTime?: number | null, endTime?: number | null, startFrequency?: number | null, endFrequency?: number | null, annotationPhase: { __typename?: 'AnnotationPhaseNode', id: string }, label: { __typename?: 'AnnotationLabelNode', name: string }, confidence?: { __typename?: 'ConfidenceNode', label: string } | null, detectorConfiguration?: { __typename?: 'DetectorConfigurationNode', id: string, detector: { __typename?: 'DetectorNode', id: string, name: string } } | null, annotator?: { __typename?: 'UserNode', id: string, displayName: string } | null, comments?: { __typename?: 'AnnotationCommentNodeNodeConnection', results: Array<{ __typename?: 'AnnotationCommentNode', id: string, comment: string } | null> } | null, validations?: { __typename?: 'AnnotationValidationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationValidationNode', id: string, isValid: boolean } | null> } | null, isUpdateOf?: { __typename?: 'AnnotationNode', id: string } | null, acousticFeatures?: { __typename?: 'AcousticFeaturesNode', id: string, isIntensityTooLow?: boolean | null, doesOverlapOtherSignals?: boolean | null, startFrequency?: number | null, endFrequency?: number | null, relativeMinFrequencyCount?: number | null, relativeMaxFrequencyCount?: number | null, stepsCount?: number | null, hasHarmonics?: boolean | null, trend?: Types.SignalTrendType | null, hasSidebands?: boolean | null, hasSubharmonics?: boolean | null, hasFrequencyJumps?: boolean | null, frequencyJumpsCount?: number | null, hasDeterministicChaos?: boolean | null } | null, analysis: { __typename?: 'SpectrogramAnalysisNode', id: string } } | null> } | null } | null } | null, allAnnotationSpectrograms?: { __typename?: 'AnnotationSpectrogramNodeNodeConnection', currentIndex?: number | null, totalCount: number, previousSpectrogramId?: string | null, nextSpectrogramId?: string | null } | null }; +export type GetAnnotationTaskQuery = { __typename?: 'Query', spectrogramPaths?: { __typename?: 'SpectrogramPathsNode', audioPath?: string | null, spectrogramPath?: string | null } | null, annotationSpectrogramById?: { __typename?: 'AnnotationSpectrogramNode', id: string, filename: string, start: any, duration: number, isAssigned: boolean, task?: { __typename?: 'AnnotationTaskNode', status: Types.AnnotationTaskStatus, userComments?: { __typename?: 'AnnotationCommentNodeNodeConnection', results: Array<{ __typename?: 'AnnotationCommentNode', id: string, comment: string } | null> } | null, userAnnotations?: { __typename?: 'AnnotationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationNode', id: string, type: Types.AnnotationType, startTime?: number | null, endTime?: number | null, startFrequency?: number | null, endFrequency?: number | null, annotationPhase: { __typename?: 'AnnotationPhaseNode', id: string }, label: { __typename?: 'AnnotationLabelNode', name: string }, confidence?: { __typename?: 'ConfidenceNode', label: string } | null, detectorConfiguration?: { __typename?: 'DetectorConfigurationNode', id: string, detector: { __typename?: 'DetectorNode', id: string, name: string } } | null, annotator?: { __typename?: 'UserNode', id: string, displayName: string } | null, comments?: { __typename?: 'AnnotationCommentNodeNodeConnection', results: Array<{ __typename?: 'AnnotationCommentNode', id: string, comment: string } | null> } | null, validations?: { __typename?: 'AnnotationValidationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationValidationNode', id: string, isValid: boolean } | null> } | null, isUpdateOf?: { __typename?: 'AnnotationNode', id: string } | null, acousticFeatures?: { __typename?: 'AcousticFeaturesNode', id: string, isIntensityTooLow?: boolean | null, doesOverlapOtherSignals?: boolean | null, startFrequency?: number | null, endFrequency?: number | null, relativeMinFrequencyCount?: number | null, relativeMaxFrequencyCount?: number | null, stepsCount?: number | null, hasHarmonics?: boolean | null, trend?: Types.SignalTrendType | null, hasSidebands?: boolean | null, hasSubharmonics?: boolean | null, hasFrequencyJumps?: boolean | null, frequencyJumpsCount?: number | null, hasDeterministicChaos?: boolean | null } | null } | null> } | null, annotationsToCheck?: { __typename?: 'AnnotationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationNode', id: string, type: Types.AnnotationType, startTime?: number | null, endTime?: number | null, startFrequency?: number | null, endFrequency?: number | null, annotationPhase: { __typename?: 'AnnotationPhaseNode', id: string }, label: { __typename?: 'AnnotationLabelNode', name: string }, confidence?: { __typename?: 'ConfidenceNode', label: string } | null, detectorConfiguration?: { __typename?: 'DetectorConfigurationNode', id: string, detector: { __typename?: 'DetectorNode', id: string, name: string } } | null, annotator?: { __typename?: 'UserNode', id: string, displayName: string } | null, comments?: { __typename?: 'AnnotationCommentNodeNodeConnection', results: Array<{ __typename?: 'AnnotationCommentNode', id: string, comment: string } | null> } | null, validations?: { __typename?: 'AnnotationValidationNodeNodeConnection', results: Array<{ __typename?: 'AnnotationValidationNode', id: string, isValid: boolean } | null> } | null, isUpdateOf?: { __typename?: 'AnnotationNode', id: string } | null, acousticFeatures?: { __typename?: 'AcousticFeaturesNode', id: string, isIntensityTooLow?: boolean | null, doesOverlapOtherSignals?: boolean | null, startFrequency?: number | null, endFrequency?: number | null, relativeMinFrequencyCount?: number | null, relativeMaxFrequencyCount?: number | null, stepsCount?: number | null, hasHarmonics?: boolean | null, trend?: Types.SignalTrendType | null, hasSidebands?: boolean | null, hasSubharmonics?: boolean | null, hasFrequencyJumps?: boolean | null, frequencyJumpsCount?: number | null, hasDeterministicChaos?: boolean | null } | null } | null> } | null } | null } | null, allAnnotationSpectrograms?: { __typename?: 'AnnotationSpectrogramNodeNodeConnection', currentIndex?: number | null, totalCount: number, previousSpectrogramId?: string | null, nextSpectrogramId?: string | null } | null }; export type SubmitTaskMutationVariables = Types.Exact<{ campaignID: Types.Scalars['ID']['input']; @@ -204,9 +204,6 @@ export const GetAnnotationTaskDocument = ` frequencyJumpsCount hasDeterministicChaos } - analysis { - id - } } } annotationsToCheck { @@ -269,9 +266,6 @@ export const GetAnnotationTaskDocument = ` frequencyJumpsCount hasDeterministicChaos } - analysis { - id - } } } } diff --git a/frontend/src/api/annotation-task/annotation-task.graphql b/frontend/src/api/annotation-task/annotation-task.graphql index 67b3fc8ac..9b43b4b24 100644 --- a/frontend/src/api/annotation-task/annotation-task.graphql +++ b/frontend/src/api/annotation-task/annotation-task.graphql @@ -210,9 +210,6 @@ query getAnnotationTask( frequencyJumpsCount hasDeterministicChaos } - analysis { - id - } } } annotationsToCheck { @@ -275,9 +272,6 @@ query getAnnotationTask( frequencyJumpsCount hasDeterministicChaos } - analysis { - id - } } } } diff --git a/frontend/src/api/types.gql-generated.ts b/frontend/src/api/types.gql-generated.ts index 13ccb6a41..166bda4da 100644 --- a/frontend/src/api/types.gql-generated.ts +++ b/frontend/src/api/types.gql-generated.ts @@ -398,7 +398,6 @@ export type AnnotationFileRangeNodeNodeConnection = { export type AnnotationInput = { acousticFeatures?: InputMaybe; - analysis: Scalars['String']['input']; annotationPhase: Scalars['String']['input']; annotator?: InputMaybe; comments?: InputMaybe>>; @@ -511,7 +510,6 @@ export type AnnotationNode = ExtendedInterface & { __typename?: 'AnnotationNode'; /** Acoustic features add a better description to the signal */ acousticFeatures?: Maybe; - analysis: SpectrogramAnalysisNode; annotationComments: AnnotationCommentNodeConnection; annotationPhase: AnnotationPhaseNode; annotator?: Maybe; @@ -6304,7 +6302,6 @@ export type SourceNodeNodeConnection = { export type SpectrogramAnalysisNode = ExtendedInterface & { __typename?: 'SpectrogramAnalysisNode'; annotationCampaigns: AnnotationCampaignNodeConnection; - annotations: AnnotationNodeConnection; colormap: ColormapNode; createdAt: Scalars['DateTime']['output']; /** Duration of the segmented data (in s) */ @@ -6344,23 +6341,6 @@ export type SpectrogramAnalysisNodeAnnotationCampaignsArgs = { }; -/** SpectrogramAnalysis schema */ -export type SpectrogramAnalysisNodeAnnotationsArgs = { - acousticFeatures_Exists?: InputMaybe; - after?: InputMaybe; - annotator?: InputMaybe; - before?: InputMaybe; - confidence_Label?: InputMaybe; - detectorConfiguration_Detector?: InputMaybe; - first?: InputMaybe; - isUpdated?: InputMaybe; - isValidatedBy?: InputMaybe; - label_Name?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - /** SpectrogramAnalysis schema */ export type SpectrogramAnalysisNodeSpectrogramsArgs = { after?: InputMaybe; diff --git a/frontend/src/features/Annotator/Annotation/conversions.ts b/frontend/src/features/Annotator/Annotation/conversions.ts index b91761ec7..49d30ac5f 100644 --- a/frontend/src/features/Annotator/Annotation/conversions.ts +++ b/frontend/src/features/Annotator/Annotation/conversions.ts @@ -13,7 +13,6 @@ import { type DetectorConfigurationNode, type DetectorNode, type Maybe, - type SpectrogramAnalysisNode, type UserNode, } from '@/api'; import { type Annotation, type Features, type Validation } from './slice'; @@ -88,7 +87,6 @@ type Node = results: Maybe>[], }>, label: Pick, - analysis: Pick, annotationPhase: Pick } @@ -111,7 +109,6 @@ export function convertGqlToAnnotation(annotation: Node, startTime: annotation.startTime === null ? undefined : annotation.startTime, confidence: annotation.confidence?.label, detectorConfiguration: annotation.detectorConfiguration?.id, - analysis: annotation.analysis.id, } as Annotation } diff --git a/frontend/src/features/Annotator/Annotation/slice.ts b/frontend/src/features/Annotator/Annotation/slice.ts index 953213ba2..c21b1f5c8 100644 --- a/frontend/src/features/Annotator/Annotation/slice.ts +++ b/frontend/src/features/Annotator/Annotation/slice.ts @@ -7,12 +7,9 @@ import { AnnotationValidationSerializerInput, getAnnotationTaskFulfilled, GetAnnotationTaskQuery, - getCampaignFulfilled, - type GetCampaignQuery, getCurrentUserFulfilled, type GetCurrentUserQuery, } from '@/api'; -import { type Analysis, getDefaultAnalysisID, setAnalysis } from '@/features/Annotator/Analysis/slice'; import type { GetAnnotationTaskQueryVariables } from '@/api/annotation-task/annotation-task.generated'; import { convertGqlToAnnotations } from '@/features/Annotator/Annotation/conversions'; @@ -38,7 +35,6 @@ type AnnotationState = { id?: number; tempAnnotation?: TempAnnotation; - _analysisID?: string; _campaignID?: string _userID?: string } @@ -48,8 +44,8 @@ const initialState: AnnotationState = { id: undefined, tempAnnotation: undefined, - _analysisID: undefined, _campaignID: undefined, + _userID: undefined, } export const AnnotatorAnnotationSlice = createSlice({ @@ -63,13 +59,8 @@ export const AnnotatorAnnotationSlice = createSlice({ state.id = undefined }, addAnnotation: (state, action: { payload: Omit }) => { - if (!state._analysisID || state.allAnnotations.some(a => a.id === action.payload.id)) return; - const annotation: Annotation = { - ...action.payload, - analysis: state._analysisID, - } - state.allAnnotations = [ ...state.allAnnotations, annotation ]; - action.payload = annotation; + if (state.allAnnotations.some(a => a.id === action.payload.id)) return; + state.allAnnotations = [ ...state.allAnnotations, action.payload ]; }, updateAnnotation: (state, action: { payload: Partial & Pick }) => { const annotation: Annotation | undefined = state.allAnnotations.find(a => a.id === action.payload.id); @@ -78,9 +69,6 @@ export const AnnotatorAnnotationSlice = createSlice({ ...annotation, ...action.payload, } - if (state._analysisID) { - action.payload = { ...action.payload, analysis: state._analysisID } - } state.allAnnotations = state.allAnnotations.map(a => a.id === action.payload.id ? action.payload as Annotation : a) }, removeAnnotation: (state, action: { payload: Annotation }) => { @@ -94,14 +82,6 @@ export const AnnotatorAnnotationSlice = createSlice({ }, }, extraReducers: builder => { - builder.addCase(setAnalysis, (state: AnnotationState, action: { payload: Analysis }) => { - state._analysisID = action.payload?.id; - }) - builder.addMatcher(getCampaignFulfilled, (state: AnnotationState, action: { - payload: GetCampaignQuery - }) => { - state._analysisID = getDefaultAnalysisID({ data: action.payload, id: state._analysisID }) - }) builder.addMatcher(getCurrentUserFulfilled, (state: AnnotationState, action: { payload: GetCurrentUserQuery }) => { From 4e3f804ba7a77fae6e2b193f911cf8a45521aef7 Mon Sep 17 00:00:00 2001 From: Elodie MORIN Date: Fri, 29 May 2026 11:29:04 +0200 Subject: [PATCH 3/4] fix(backend): black & lint --- backend/api/migrations/0006_remove_annotation_analysis.py | 6 +++--- backend/api/models/annotation/annotation.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/api/migrations/0006_remove_annotation_analysis.py b/backend/api/migrations/0006_remove_annotation_analysis.py index f56c09ce0..191a6c965 100644 --- a/backend/api/migrations/0006_remove_annotation_analysis.py +++ b/backend/api/migrations/0006_remove_annotation_analysis.py @@ -6,12 +6,12 @@ class Migration(migrations.Migration): dependencies = [ - ('api', '0005_alter_spectrogramanalysisrelation_analysis'), + ("api", "0005_alter_spectrogramanalysisrelation_analysis"), ] operations = [ migrations.RemoveField( - model_name='annotation', - name='analysis', + model_name="annotation", + name="analysis", ), ] diff --git a/backend/api/models/annotation/annotation.py b/backend/api/models/annotation/annotation.py index bf4840ae8..53e4d238f 100644 --- a/backend/api/models/annotation/annotation.py +++ b/backend/api/models/annotation/annotation.py @@ -12,7 +12,7 @@ from .confidence import Confidence from .detector_configuration import DetectorConfiguration from .label import Label -from ..data import Spectrogram, SpectrogramAnalysis +from ..data import Spectrogram class AnnotationQuerySet(ExtendedQuerySet): From 9461e4b0d377c0ac10f9841a839a78200a354ae5 Mon Sep 17 00:00:00 2001 From: Elodie MORIN Date: Fri, 29 May 2026 11:42:11 +0200 Subject: [PATCH 4/4] fix(backend): tests --- .../tests/fixtures/annotation/annotation.yaml | 11 - .../schema/annotation/update_annotations.py | 7 - frontend/src/api/annotation/api.ts | 1 - frontend/src/api/annotation/types.ts | 3 - .../ImportAnnotations/AnalysisSelect.tsx | 29 - .../ImportAnnotations/ImportFileFormBloc.tsx | 6 +- .../features/ImportAnnotations/context.tsx | 738 +++++++++--------- .../src/features/ImportAnnotations/index.ts | 1 - 8 files changed, 360 insertions(+), 436 deletions(-) delete mode 100644 frontend/src/features/ImportAnnotations/AnalysisSelect.tsx diff --git a/backend/api/tests/fixtures/annotation/annotation.yaml b/backend/api/tests/fixtures/annotation/annotation.yaml index 642a66f7f..ef1940987 100644 --- a/backend/api/tests/fixtures/annotation/annotation.yaml +++ b/backend/api/tests/fixtures/annotation/annotation.yaml @@ -12,7 +12,6 @@ annotation_phase: 1 confidence: 1 spectrogram: 7 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -30,7 +29,6 @@ annotation_phase: 1 confidence: 2 spectrogram: 7 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -48,7 +46,6 @@ annotation_phase: 1 confidence: 1 spectrogram: 7 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -66,7 +63,6 @@ annotation_phase: 1 confidence: 1 spectrogram: 8 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -84,7 +80,6 @@ annotation_phase: 1 confidence: 1 spectrogram: 8 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -102,7 +97,6 @@ annotation_phase: 1 confidence: 2 spectrogram: 8 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -120,7 +114,6 @@ annotation_phase: 1 confidence: 1 spectrogram: 1 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -138,7 +131,6 @@ annotator: 1 confidence: 1 spectrogram: 1 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -157,7 +149,6 @@ confidence: 2 spectrogram: 1 acoustic_features: 1 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -174,7 +165,6 @@ annotation_phase: 4 confidence: 2 spectrogram: 1 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: @@ -191,7 +181,6 @@ annotation_phase: 5 confidence: 2 spectrogram: 1 - analysis: 1 created_at: 2010-11-02 00:00:00+00:00 last_updated_at: 2010-11-02 00:00:00+00:00 is_update_of: 10 \ No newline at end of file diff --git a/backend/api/tests/schema/annotation/update_annotations.py b/backend/api/tests/schema/annotation/update_annotations.py index 051c205fa..dc1ca7e13 100644 --- a/backend/api/tests/schema/annotation/update_annotations.py +++ b/backend/api/tests/schema/annotation/update_annotations.py @@ -41,7 +41,6 @@ "startFrequency": None, "endFrequency": None, "acousticFeatures": None, - "analysis": "1", "annotationPhase": "1", } box_annotation = { @@ -60,7 +59,6 @@ "hasHarmonics": True, "trend": "Modulated", }, - "analysis": "1", "annotationPhase": "1", } @@ -112,7 +110,6 @@ def test_connected_annotator_add_presence(self): self.assertEqual(new_annotation.type, Annotation.Type.WEAK) self.assertEqual(new_annotation.label.name, "Boat") self.assertEqual(new_annotation.confidence.label, "confident") - self.assertEqual(new_annotation.analysis_id, 1) self.assertEqual(new_annotation.spectrogram_id, 9) self.assertEqual(new_annotation.annotator_id, 4) self.assertIsNone(new_annotation.acoustic_features) @@ -132,7 +129,6 @@ def test_connected_annotator_add_box(self): self.assertEqual(new_annotation.start_time, 0.0) self.assertEqual(new_annotation.label.name, "Boat") self.assertEqual(new_annotation.confidence.label, "confident") - self.assertEqual(new_annotation.analysis_id, 1) self.assertEqual(new_annotation.spectrogram_id, 9) self.assertEqual(new_annotation.annotator_id, 4) self.assertEqual(new_annotation.acoustic_features.start_frequency, 10.0) @@ -163,7 +159,6 @@ def test_connected_annotator_update_presence_to_box(self): self.assertEqual(new_annotation.start_time, 0.0) self.assertEqual(new_annotation.label.name, "Boat") self.assertEqual(new_annotation.confidence.label, "confident") - self.assertEqual(new_annotation.analysis_id, 1) self.assertEqual(new_annotation.spectrogram_id, 9) self.assertEqual(new_annotation.annotator_id, 4) self.assertEqual(new_annotation.acoustic_features.start_frequency, 10.0) @@ -275,7 +270,6 @@ def test_connected_annotator_does_not_exists(self): **presence_annotation, "label": "DCall", # label exist in different label set "confidence": "test", - "analysis": "-1", } ], }, @@ -285,7 +279,6 @@ def test_connected_annotator_does_not_exists(self): errors = json.loads(response.content)["data"]["updateAnnotations"]["errors"] self.assertEqual(errors[0][0]["field"], "label") self.assertEqual(errors[0][1]["field"], "confidence") - self.assertEqual(errors[0][2]["field"], "analysis") def test_connected_annotator_min_value(self): previous_count = Annotation.objects.count() diff --git a/frontend/src/api/annotation/api.ts b/frontend/src/api/annotation/api.ts index 5ffc8f0f8..c3442521a 100644 --- a/frontend/src/api/annotation/api.ts +++ b/frontend/src/api/annotation/api.ts @@ -10,7 +10,6 @@ const keys: (keyof ImportAnnotation)[] = [ 'label__name', 'confidence__label', 'confidence__level', - 'analysis', 'detector__name', 'detector_configuration__configuration', ]; diff --git a/frontend/src/api/annotation/types.ts b/frontend/src/api/annotation/types.ts index ae50148c1..abf14770b 100644 --- a/frontend/src/api/annotation/types.ts +++ b/frontend/src/api/annotation/types.ts @@ -9,9 +9,6 @@ export type ImportAnnotation = { /** [0 ; samplingFrequency/2] */ end_frequency?: number; - /** SpectrogramAnalysisNode.id */ - analysis: string | number; - label__name: string confidence__label?: string confidence__level?: number diff --git a/frontend/src/features/ImportAnnotations/AnalysisSelect.tsx b/frontend/src/features/ImportAnnotations/AnalysisSelect.tsx deleted file mode 100644 index 6f53b87b9..000000000 --- a/frontend/src/features/ImportAnnotations/AnalysisSelect.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React, { Fragment } from 'react'; -import { useCurrentCampaign } from '@/api'; -import { useImportAnnotationsContext } from '@/features/ImportAnnotations/context'; -import { type Item, Select } from '@/components/form'; -import { IonNote } from '@ionic/react'; - -export const AnalysisSelect: React.FC = () => { - const { allAnalysis } = useCurrentCampaign(); - const { - analysisID, - analysis, - setAnalysisID, - } = useImportAnnotationsContext() - - if (!allAnalysis) return - if (allAnalysis.length === 1) return Annotations belong to analysis { analysis?.name } - return