Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions backend/api/migrations/0006_remove_annotation_analysis.py
Original file line number Diff line number Diff line change
@@ -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",
),
]
7 changes: 1 addition & 6 deletions backend/api/models/annotation/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions backend/api/serializers/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Label,
Confidence,
AnnotationValidation,
SpectrogramAnalysis,
AnnotationComment,
)
from backend.aplose.models import ExpertiseLevel
Expand Down Expand Up @@ -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(),
Expand Down
11 changes: 0 additions & 11 deletions backend/api/tests/fixtures/annotation/annotation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
7 changes: 0 additions & 7 deletions backend/api/tests/schema/annotation/update_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"startFrequency": None,
"endFrequency": None,
"acousticFeatures": None,
"analysis": "1",
"annotationPhase": "1",
}
box_annotation = {
Expand All @@ -60,7 +59,6 @@
"hasHarmonics": True,
"trend": "Modulated",
},
"analysis": "1",
"annotationPhase": "1",
}

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",
}
],
},
Expand All @@ -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()
Expand Down
3 changes: 0 additions & 3 deletions frontend/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -4610,7 +4608,6 @@ input AnnotationInput {
endFrequency: Float
annotationPhase: String!
annotator: String
analysis: String!
detectorConfiguration: String
isUpdateOf: String
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -204,9 +204,6 @@ export const GetAnnotationTaskDocument = `
frequencyJumpsCount
hasDeterministicChaos
}
analysis {
id
}
}
}
annotationsToCheck {
Expand Down Expand Up @@ -269,9 +266,6 @@ export const GetAnnotationTaskDocument = `
frequencyJumpsCount
hasDeterministicChaos
}
analysis {
id
}
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/api/annotation-task/annotation-task.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ query getAnnotationTask(
frequencyJumpsCount
hasDeterministicChaos
}
analysis {
id
}
}
}
annotationsToCheck {
Expand Down Expand Up @@ -275,9 +272,6 @@ query getAnnotationTask(
frequencyJumpsCount
hasDeterministicChaos
}
analysis {
id
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion frontend/src/api/annotation/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const keys: (keyof ImportAnnotation)[] = [
'label__name',
'confidence__label',
'confidence__level',
'analysis',
'detector__name',
'detector_configuration__configuration',
];
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/api/annotation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 0 additions & 20 deletions frontend/src/api/types.gql-generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ export type AnnotationFileRangeNodeNodeConnection = {

export type AnnotationInput = {
acousticFeatures?: InputMaybe<AnnotationAcousticFeaturesSerializerInput>;
analysis: Scalars['String']['input'];
annotationPhase: Scalars['String']['input'];
annotator?: InputMaybe<Scalars['String']['input']>;
comments?: InputMaybe<Array<InputMaybe<AnnotationCommentSerializerInput>>>;
Expand Down Expand Up @@ -511,7 +510,6 @@ export type AnnotationNode = ExtendedInterface & {
__typename?: 'AnnotationNode';
/** Acoustic features add a better description to the signal */
acousticFeatures?: Maybe<AcousticFeaturesNode>;
analysis: SpectrogramAnalysisNode;
annotationComments: AnnotationCommentNodeConnection;
annotationPhase: AnnotationPhaseNode;
annotator?: Maybe<UserNode>;
Expand Down Expand Up @@ -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) */
Expand Down Expand Up @@ -6344,23 +6341,6 @@ export type SpectrogramAnalysisNodeAnnotationCampaignsArgs = {
};


/** SpectrogramAnalysis schema */
export type SpectrogramAnalysisNodeAnnotationsArgs = {
acousticFeatures_Exists?: InputMaybe<Scalars['Boolean']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
annotator?: InputMaybe<Scalars['ID']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
confidence_Label?: InputMaybe<Scalars['String']['input']>;
detectorConfiguration_Detector?: InputMaybe<Scalars['ID']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
isUpdated?: InputMaybe<Scalars['Boolean']['input']>;
isValidatedBy?: InputMaybe<Scalars['ID']['input']>;
label_Name?: InputMaybe<Scalars['String']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
offset?: InputMaybe<Scalars['Int']['input']>;
};


/** SpectrogramAnalysis schema */
export type SpectrogramAnalysisNodeSpectrogramsArgs = {
after?: InputMaybe<Scalars['String']['input']>;
Expand Down
Loading
Loading