diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index da0afdd50..a4807fed9 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -24,7 +24,7 @@ import { SuperType, SuperTypes, } from '@red/domain'; -import { annotationTypesTranslations, SuggestionAddFalsePositive } from '@translations/annotation-types-translations'; +import { annotationTypesTranslations } from '@translations/annotation-types-translations'; import { chronologicallyBy, timestampOf } from '../../modules/file-preview/services/file-data.service'; export class AnnotationWrapper implements IListable { @@ -32,7 +32,6 @@ export class AnnotationWrapper implements IListable { superType: SuperType; typeValue: string; - recategorizationType: string; color: string; entity: Dictionary; comments: IComment[] = []; @@ -43,19 +42,20 @@ export class AnnotationWrapper implements IListable { value: string; typeLabel: string; pageNumber: number; - hint: boolean; - redaction: boolean; + HINT = false; + redaction = false; status: string; - dictionaryOperation: boolean; + dictionaryOperation = false; positions: IRectangle[]; recommendationType: string; legalBasisValue: string; - rectangle?: boolean; + // AREA === rectangle + AREA = false; section?: string; reference: string[]; - imported?: boolean; - image?: boolean; - manual?: boolean; + imported = false; + IMAGE = false; + manual = false; pending = false; hintDictionary = false; textAfter?: string; @@ -106,11 +106,7 @@ export class AnnotationWrapper implements IListable { } get isImage() { - return this.type?.toLowerCase() === 'image' || this.image; - } - - get isNotSignatureImage() { - return this.isImage && this.recategorizationType === 'signature'; + return this.type?.toLowerCase() === 'image' || this.IMAGE; } get isOCR() { @@ -118,7 +114,7 @@ export class AnnotationWrapper implements IListable { } get type() { - return this.recategorizationType || this.typeValue; + return this.typeValue; } get topLevelFilter() { @@ -243,7 +239,7 @@ export class AnnotationWrapper implements IListable { annotationWrapper.changeLogType = changeLogType; annotationWrapper.legalBasisList = legalBasisList; annotationWrapper.redaction = logEntry.entryType === EntryTypes.ENTITY; - annotationWrapper.hint = logEntry.entryType === EntryTypes.HINT; + annotationWrapper.HINT = logEntry.entryType === EntryTypes.HINT; annotationWrapper.typeValue = logEntry.type; annotationWrapper.value = logEntry.value; annotationWrapper.firstTopLeftPoint = { x: logEntry.positions[0].rectangle[0], y: logEntry.positions[0].rectangle[1] }; @@ -257,7 +253,7 @@ export class AnnotationWrapper implements IListable { annotationWrapper.textBefore = logEntry.textBefore; annotationWrapper.textAfter = logEntry.textAfter; annotationWrapper.dictionaryOperation = logEntry.dictionaryEntry; - annotationWrapper.image = logEntry.entryType === EntryTypes.IMAGE; + annotationWrapper.IMAGE = logEntry.entryType === EntryTypes.IMAGE; annotationWrapper.imported = logEntry.imported; annotationWrapper.legalBasisValue = logEntry.legalBasis; annotationWrapper.comments = []; //logEntry.comments || []; @@ -265,7 +261,7 @@ export class AnnotationWrapper implements IListable { annotationWrapper.engines = logEntry.engines; annotationWrapper.section = logEntry.section; annotationWrapper.reference = logEntry.reference || []; - annotationWrapper.rectangle = logEntry.entryType === EntryTypes.AREA; + annotationWrapper.AREA = logEntry.entryType === EntryTypes.AREA; annotationWrapper.hintDictionary = hintDictionary; annotationWrapper.hasBeenResized = !!logEntry.manualChanges?.find( c => c.manualRedactionType === ManualRedactionTypes.RESIZE && c.annotationStatus === LogEntryStatuses.APPROVED, @@ -289,7 +285,7 @@ export class AnnotationWrapper implements IListable { this.#createContent(annotationWrapper, logEntry, isDocumine); this.#setSuperType(annotationWrapper, logEntry); this.#handleRecommendations(annotationWrapper, logEntry); - annotationWrapper.typeLabel = this.#getTypeLabel(logEntry, annotationWrapper); + annotationWrapper.typeLabel = this.#getTypeLabel(annotationWrapper); const entity = dictionaries.find(d => d.type === annotationWrapper.typeValue); annotationWrapper.entity = entity?.virtual ? null : entity; @@ -300,10 +296,7 @@ export class AnnotationWrapper implements IListable { return annotationWrapper; } - static #getTypeLabel(logEntry: IEntityLogEntry, annotation: AnnotationWrapper): string { - if (logEntry.reason?.toLowerCase() === 'false positive') { - return annotationTypesTranslations[SuggestionAddFalsePositive]; - } + static #getTypeLabel(annotation: AnnotationWrapper): string { if (annotation.superType === SuperTypes.ManualRedaction && annotation.hintDictionary) { return _('annotation-type.manual-hint'); } @@ -408,17 +401,9 @@ export class AnnotationWrapper implements IListable { static #selectSuperType(logEntry: IEntityLogEntry, lastManualChange: IManualChange, isHintDictionary: boolean): SuperType { switch (lastManualChange.manualRedactionType) { case ManualRedactionTypes.ADD_LOCALLY: - switch (lastManualChange.annotationStatus) { - case LogEntryStatuses.APPROVED: - return SuperTypes.ManualRedaction; - } - break; + return SuperTypes.ManualRedaction; case ManualRedactionTypes.ADD_TO_DICTIONARY: - switch (lastManualChange.annotationStatus) { - case LogEntryStatuses.APPROVED: - return isHintDictionary ? SuperTypes.Hint : SuperTypes.Redaction; - } - break; + return isHintDictionary ? SuperTypes.Hint : SuperTypes.Redaction; case ManualRedactionTypes.REMOVE_LOCALLY: switch (lastManualChange.annotationStatus) { case LogEntryStatuses.APPROVED: @@ -446,11 +431,7 @@ export class AnnotationWrapper implements IListable { return SuperTypes.Redaction; } } - switch (lastManualChange.annotationStatus) { - case LogEntryStatuses.APPROVED: - case LogEntryStatuses.DECLINED: - return SuperTypes.Redaction; - } + return SuperTypes.Redaction; } if (lastManualChange.processed) { @@ -462,12 +443,7 @@ export class AnnotationWrapper implements IListable { } } - switch (lastManualChange.annotationStatus) { - case LogEntryStatuses.APPROVED: - case LogEntryStatuses.DECLINED: - return isHintDictionary ? SuperTypes.Hint : SuperTypes.Skipped; - } - break; + return isHintDictionary ? SuperTypes.Hint : SuperTypes.Skipped; case ManualRedactionTypes.FORCE_REDACT: switch (lastManualChange.annotationStatus) { case LogEntryStatuses.APPROVED: @@ -485,50 +461,34 @@ export class AnnotationWrapper implements IListable { } break; case ManualRedactionTypes.RECATEGORIZE: - switch (lastManualChange.annotationStatus) { - case LogEntryStatuses.APPROVED: - case LogEntryStatuses.DECLINED: { - if (logEntry.entryType === EntryTypes.RECOMMENDATION) { - return SuperTypes.Recommendation; - } - - if (logEntry.entryType === EntryTypes.ENTITY) { - return SuperTypes.Redaction; - } - - if (logEntry.entryType === EntryTypes.HINT) { - return SuperTypes.Hint; - } - - return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped; - } + if (logEntry.entryType === EntryTypes.RECOMMENDATION) { + return SuperTypes.Recommendation; } - break; + + if (logEntry.entryType === EntryTypes.ENTITY) { + return SuperTypes.Redaction; + } + + if (logEntry.entryType === EntryTypes.HINT) { + return SuperTypes.Hint; + } + + return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped; case ManualRedactionTypes.LEGAL_BASIS_CHANGE: - switch (lastManualChange.annotationStatus) { - case LogEntryStatuses.APPROVED: - case LogEntryStatuses.DECLINED: - return logEntry.type === SuperTypes.ManualRedaction ? SuperTypes.ManualRedaction : SuperTypes.Redaction; - } - break; + return logEntry.type === SuperTypes.ManualRedaction ? SuperTypes.ManualRedaction : SuperTypes.Redaction; case ManualRedactionTypes.RESIZE: - switch (lastManualChange.annotationStatus) { - case LogEntryStatuses.APPROVED: - case LogEntryStatuses.DECLINED: - if (logEntry.entryType === EntryTypes.RECOMMENDATION) { - return SuperTypes.Recommendation; - } - - if (logEntry.entryType === EntryTypes.ENTITY) { - return logEntry.type === SuperTypes.ManualRedaction ? SuperTypes.ManualRedaction : SuperTypes.Redaction; - } - - if (logEntry.entryType === EntryTypes.HINT) { - return SuperTypes.Hint; - } - return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped; + if (logEntry.entryType === EntryTypes.RECOMMENDATION) { + return SuperTypes.Recommendation; } - break; + + if (logEntry.entryType === EntryTypes.ENTITY) { + return logEntry.type === SuperTypes.ManualRedaction ? SuperTypes.ManualRedaction : SuperTypes.Redaction; + } + + if (logEntry.entryType === EntryTypes.HINT) { + return SuperTypes.Hint; + } + return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped; } } } diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html index 920c5d427..1b5004da6 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html @@ -20,7 +20,7 @@ {{ annotation.descriptor | translate }}: - {{ annotation.recategorizationType ?? annotation.entity.label }} + {{ annotation.entity.label }}