RED-7327 - Change to group annotation
This commit is contained in:
parent
78990b5555
commit
cdfa1afcd0
@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
description = "redaction-service-api-v1"
|
||||
val persistenceServiceVersion = "2.522.0"
|
||||
val persistenceServiceVersion = "2.528.0"
|
||||
|
||||
dependencies {
|
||||
implementation("org.springframework:spring-web:6.0.12")
|
||||
|
||||
@ -16,7 +16,7 @@ val layoutParserVersion = "0.141.0"
|
||||
val jacksonVersion = "2.15.2"
|
||||
val droolsVersion = "9.44.0.Final"
|
||||
val pdfBoxVersion = "3.0.0"
|
||||
val persistenceServiceVersion = "2.522.0"
|
||||
val persistenceServiceVersion = "2.528.0"
|
||||
val springBootStarterVersion = "3.1.5"
|
||||
val springCloudVersion = "4.0.4"
|
||||
val testContainersVersion = "1.19.7"
|
||||
|
||||
@ -2,9 +2,9 @@ package com.iqser.red.service.redaction.v1.server.client;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.internal.resources.GroupRedactionResource;
|
||||
import com.iqser.red.service.persistence.service.v1.api.internal.resources.GroupAnnotationResource;
|
||||
|
||||
@FeignClient(name = "GroupRedactionResource", url = "${persistence-service.url}")
|
||||
public interface GroupRedactionClient extends GroupRedactionResource {
|
||||
@FeignClient(name = "GroupAnnotationResource", url = "${persistence-service.url}")
|
||||
public interface GroupRedactionClient extends GroupAnnotationResource {
|
||||
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.imported.ImportedRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualRedactionEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualResizeRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupAnnotation;
|
||||
import com.iqser.red.service.redaction.v1.server.model.document.TextRange;
|
||||
import com.iqser.red.service.redaction.v1.server.model.document.entity.EntityType;
|
||||
import com.iqser.red.service.redaction.v1.server.model.document.entity.IEntity;
|
||||
@ -153,17 +153,17 @@ public class PrecursorEntity implements IEntity {
|
||||
}
|
||||
|
||||
|
||||
public static List<PrecursorEntity> fromAreaGroupRedaction(AreaGroupRedaction areaGroupRedaction) {
|
||||
public static List<PrecursorEntity> fromAreaGroupAnnotation(AreaGroupAnnotation areaGroupAnnotation) {
|
||||
|
||||
List<PrecursorEntity> precursorEntities = new ArrayList<>();
|
||||
|
||||
areaGroupRedaction.getPageRanges()
|
||||
areaGroupAnnotation.getPageRanges()
|
||||
.forEach(pageRange -> {
|
||||
for (int pageStart = pageRange.getStartPage(); pageStart <= pageRange.getEndPage(); pageStart++) {
|
||||
boolean isHint = areaGroupRedaction.getEntryType() == EntryType.HINT;
|
||||
boolean isHint = areaGroupAnnotation.getEntryType() == EntryType.HINT;
|
||||
String ruleIdentifier = isHint ? "GRP.5.0" : "GRP.5.1";
|
||||
String reason = isHint ? "group hint is skipped by default" : "group area is applied by default";
|
||||
String legalBasis = isHint ? "" : areaGroupRedaction.getLegalBasis();
|
||||
String legalBasis = isHint ? "" : areaGroupAnnotation.getLegalBasis();
|
||||
MatchedRule.MatchedRuleBuilder matchedRule = MatchedRule.builder().ruleIdentifier(RuleIdentifier.fromString(ruleIdentifier)).reason(reason);
|
||||
if (!isHint) {
|
||||
matchedRule.legalBasis(legalBasis);
|
||||
@ -171,22 +171,22 @@ public class PrecursorEntity implements IEntity {
|
||||
}
|
||||
precursorEntities.add(PrecursorEntity.builder()
|
||||
.id(UUID.randomUUID().toString())
|
||||
.value(areaGroupRedaction.getValue())
|
||||
.entityPosition(List.of(RectangleWithPage.fromPositionOnPage(pageStart, areaGroupRedaction.getPositionOnPage())))
|
||||
.value(areaGroupAnnotation.getValue())
|
||||
.entityPosition(List.of(RectangleWithPage.fromPositionOnPage(pageStart, areaGroupAnnotation.getPositionOnPage())))
|
||||
.ruleIdentifier(ruleIdentifier)
|
||||
.matchedRuleList(new PriorityQueue<>(List.of(matchedRule.build())))
|
||||
.reason(reason)
|
||||
.legalBasis(legalBasis)
|
||||
.section(areaGroupRedaction.getSection())
|
||||
.type(areaGroupRedaction.getTypeId())
|
||||
.section(areaGroupAnnotation.getSection())
|
||||
.type(areaGroupAnnotation.getTypeId())
|
||||
.entityType(isHint ? EntityType.HINT : EntityType.ENTITY)
|
||||
.applied(!isHint)
|
||||
.isDictionaryEntry(false)
|
||||
.isDossierDictionaryEntry(false)
|
||||
.rectangle(true)
|
||||
.section(areaGroupRedaction.getSection())
|
||||
.section(areaGroupAnnotation.getSection())
|
||||
.engines(Set.of(Engine.GROUP))
|
||||
.groupId(areaGroupRedaction.getGroupId())
|
||||
.groupId(areaGroupAnnotation.getGroupId())
|
||||
.manualOverwrite(new ManualChangeOverwrite(isHint ? EntityType.HINT : EntityType.ENTITY))
|
||||
.build());
|
||||
}
|
||||
|
||||
@ -20,11 +20,10 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.AnalyzeRequ
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.RuleFileType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.imported.ImportedRedactions;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupAnnotation;
|
||||
import com.iqser.red.service.redaction.v1.server.RedactionServiceSettings;
|
||||
import com.iqser.red.service.redaction.v1.server.client.GroupRedactionClient;
|
||||
import com.iqser.red.service.redaction.v1.server.client.model.NerEntitiesModel;
|
||||
@ -36,7 +35,7 @@ import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryIncr
|
||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryVersion;
|
||||
import com.iqser.red.service.redaction.v1.server.model.document.nodes.Document;
|
||||
import com.iqser.red.service.redaction.v1.server.model.document.nodes.SemanticNode;
|
||||
import com.iqser.red.service.redaction.v1.server.service.document.AreaGroupRedactionService;
|
||||
import com.iqser.red.service.redaction.v1.server.service.document.AreaGroupAnnotationService;
|
||||
import com.iqser.red.service.redaction.v1.server.service.document.DocumentGraphMapper;
|
||||
import com.iqser.red.service.redaction.v1.server.service.document.ImportedRedactionEntryService;
|
||||
import com.iqser.red.service.redaction.v1.server.service.document.ManualRedactionEntryService;
|
||||
@ -67,7 +66,7 @@ public class AnalysisPreparationService {
|
||||
SectionFinderService sectionFinderService;
|
||||
GroupRedactionClient groupRedactionClient;
|
||||
TaskExecutor taskExecutor;
|
||||
AreaGroupRedactionService areaGroupRedactionService;
|
||||
AreaGroupAnnotationService areaGroupAnnotationService;
|
||||
|
||||
|
||||
public AnalysisPreparationService(KieContainerCreationService kieContainerCreationService,
|
||||
@ -80,7 +79,7 @@ public class AnalysisPreparationService {
|
||||
SectionFinderService sectionFinderService,
|
||||
GroupRedactionClient groupRedactionClient,
|
||||
@Qualifier(APPLICATION_TASK_EXECUTOR_BEAN_NAME) TaskExecutor taskExecutor,
|
||||
AreaGroupRedactionService areaGroupRedactionService) {
|
||||
AreaGroupAnnotationService areaGroupAnnotationService) {
|
||||
|
||||
this.kieContainerCreationService = kieContainerCreationService;
|
||||
this.observedStorageService = observedStorageService;
|
||||
@ -92,7 +91,7 @@ public class AnalysisPreparationService {
|
||||
this.sectionFinderService = sectionFinderService;
|
||||
this.groupRedactionClient = groupRedactionClient;
|
||||
this.taskExecutor = taskExecutor;
|
||||
this.areaGroupRedactionService = areaGroupRedactionService;
|
||||
this.areaGroupAnnotationService = areaGroupAnnotationService;
|
||||
}
|
||||
|
||||
|
||||
@ -109,7 +108,9 @@ public class AnalysisPreparationService {
|
||||
|
||||
CompletableFuture<NerEntities> nerEntitiesFuture = documentFuture.thenApplyAsync((document) -> getNerEntities(analyzeRequest, document), taskExecutor);
|
||||
|
||||
CompletableFuture<GroupRedactionInternalResponse> internalResponseFuture = CompletableFuture.supplyAsync(() -> getGroupRedactions(analyzeRequest, false), taskExecutor);
|
||||
CompletableFuture<GroupAnnotationInternalResponse> groupAnnotationInternalResponseCompletableFuture = CompletableFuture.supplyAsync(() -> getGroupAnnotations(analyzeRequest,
|
||||
false),
|
||||
taskExecutor);
|
||||
|
||||
CompletableFuture.allOf(kieWrapperEntityRulesFuture, kieWrapperComponentRulesFuture, documentFuture, importedRedactionsFuture, nerEntitiesFuture).join();
|
||||
|
||||
@ -124,7 +125,8 @@ public class AnalysisPreparationService {
|
||||
|
||||
List<PrecursorEntity> notFoundImportedEntries = importedRedactionEntryService.addImportedEntriesAndReturnNotFoundEntries(analyzeRequest, importedRedactions, document);
|
||||
|
||||
List<PrecursorEntity> areaGroupRedactions = areaGroupRedactionService.createAreaGroupRedactions(internalResponseFuture.get().getAreaGroupRedactions());
|
||||
List<PrecursorEntity> areaGroupRedactions = areaGroupAnnotationService.createAreaGroupAnnotations(groupAnnotationInternalResponseCompletableFuture.get()
|
||||
.getAreaGroupAnnotations());
|
||||
|
||||
return new AnalysisData(kieWrapperEntityRulesFuture.get(),
|
||||
kieWrapperComponentRulesFuture.get(),
|
||||
@ -134,7 +136,7 @@ public class AnalysisPreparationService {
|
||||
notFoundManualRedactionEntries,
|
||||
notFoundImportedEntries,
|
||||
nerEntitiesFuture.get(),
|
||||
internalResponseFuture.get(),
|
||||
groupAnnotationInternalResponseCompletableFuture.get(),
|
||||
areaGroupRedactions);
|
||||
}
|
||||
|
||||
@ -157,14 +159,14 @@ public class AnalysisPreparationService {
|
||||
|
||||
CompletableFuture<ImportedRedactions> importedRedactionsFuture = CompletableFuture.supplyAsync(() -> getImportedRedactions(analyzeRequest), taskExecutor);
|
||||
|
||||
CompletableFuture<GroupRedactionInternalResponse> internalResponseFuture = CompletableFuture.supplyAsync(() -> getGroupRedactions(analyzeRequest, true), taskExecutor);
|
||||
CompletableFuture<GroupAnnotationInternalResponse> internalResponseFuture = CompletableFuture.supplyAsync(() -> getGroupAnnotations(analyzeRequest, true), taskExecutor);
|
||||
|
||||
CompletableFuture<SectionsToReanalyzeData> incrementAndSectionsToReanalyzeFuture = importedRedactionsFuture.thenCombineAsync(internalResponseFuture,
|
||||
(importedRedactions, groupRedactions) -> {
|
||||
List<AreaGroupRedaction> areaGroupRedactions = groupRedactions.getAreaGroupRedactions();
|
||||
List<TextGroupRedaction> textGroupRedactions = groupRedactions.getTextGroupRedactions();
|
||||
List<AreaGroupAnnotation> areaGroupRedactions = groupRedactions.getAreaGroupAnnotations();
|
||||
List<TextGroupAnnotation> textGroupRedactions = groupRedactions.getTextGroupAnnotations();
|
||||
|
||||
List<GroupRedaction> internalGroupRedactions = Stream.concat(
|
||||
List<GroupAnnotation> groupAnnotations = Stream.concat(
|
||||
Optional.ofNullable(
|
||||
areaGroupRedactions)
|
||||
.orElseGet(List::of)
|
||||
@ -182,7 +184,7 @@ public class AnalysisPreparationService {
|
||||
dictionaryIncrement,
|
||||
reanalysisSetupData,
|
||||
importedRedactions,
|
||||
internalGroupRedactions);
|
||||
groupAnnotations);
|
||||
|
||||
},
|
||||
taskExecutor);
|
||||
@ -193,8 +195,9 @@ public class AnalysisPreparationService {
|
||||
|
||||
CompletableFuture.allOf(importedRedactionsFuture, incrementAndSectionsToReanalyzeFuture, kieWrapperComponentRulesFuture, kieWrapperEntityRulesFuture).join();
|
||||
|
||||
List<AreaGroupRedaction> areaGroupRedactions = internalResponseFuture.get().getAreaGroupRedactions().stream()
|
||||
.filter(UnprocessedUtils::isUnprocessedGroupedRedaction)
|
||||
List<AreaGroupAnnotation> areaGroupAnnotations = internalResponseFuture.get().getAreaGroupAnnotations()
|
||||
.stream()
|
||||
.filter(UnprocessedUtils::isUnprocessedGroupAnnotation)
|
||||
.toList();
|
||||
|
||||
return new ReanalysisInitialProcessingData(importedRedactionsFuture.get(),
|
||||
@ -204,7 +207,7 @@ public class AnalysisPreparationService {
|
||||
kieWrapperComponentRulesFuture.get(),
|
||||
kieWrapperEntityRulesFuture.get(),
|
||||
internalResponseFuture.get(),
|
||||
areaGroupRedactions);
|
||||
areaGroupAnnotations);
|
||||
}
|
||||
|
||||
|
||||
@ -212,7 +215,7 @@ public class AnalysisPreparationService {
|
||||
public ReanalysisFinalProcessingData getReanalysisFinalProcessingData(AnalyzeRequest analyzeRequest,
|
||||
ReanalysisSetupData reanalysisSetupData,
|
||||
ReanalysisInitialProcessingData reanalysisInitialProcessingData,
|
||||
GroupRedactionInternalResponse groupRedactions) {
|
||||
GroupAnnotationInternalResponse groupAnnotationInternalResponse) {
|
||||
|
||||
CompletableFuture<NerEntities> nerEntitiesFuture = CompletableFuture.supplyAsync(() -> getNerEntitiesFiltered(analyzeRequest,
|
||||
reanalysisSetupData.document,
|
||||
@ -224,16 +227,21 @@ public class AnalysisPreparationService {
|
||||
NotFoundEntries notFoundEntries = getNotFoundEntries(analyzeRequest,
|
||||
reanalysisSetupData.document(),
|
||||
reanalysisInitialProcessingData.importedRedactions(),
|
||||
groupRedactions.getAreaGroupRedactions().stream().filter(gR -> gR.getSoftDeletedTime() == null).toList());
|
||||
groupAnnotationInternalResponse.getAreaGroupAnnotations()
|
||||
.stream()
|
||||
.filter(gR -> gR.getSoftDeletedTime() == null)
|
||||
.toList());
|
||||
return new DictionaryAndNotFoundEntries(dictionary,
|
||||
notFoundEntries.notFoundManualRedactionEntries(),
|
||||
notFoundEntries.notFoundImportedEntries(),
|
||||
notFoundEntries.areaGroupRedactions());
|
||||
}, taskExecutor);
|
||||
|
||||
CompletableFuture<GroupRedactionInternalResponse> internalResponseFuture = CompletableFuture.supplyAsync(() -> getGroupRedactions(analyzeRequest, false), taskExecutor);
|
||||
CompletableFuture<GroupAnnotationInternalResponse> groupAnnotationInternalResponseCompletableFuture = CompletableFuture.supplyAsync(() -> getGroupAnnotations(analyzeRequest,
|
||||
false),
|
||||
taskExecutor);
|
||||
|
||||
CompletableFuture.allOf(nerEntitiesFuture, dictionaryAndNotFoundEntriesCompletableFuture, internalResponseFuture).join();
|
||||
CompletableFuture.allOf(nerEntitiesFuture, dictionaryAndNotFoundEntriesCompletableFuture, groupAnnotationInternalResponseCompletableFuture).join();
|
||||
|
||||
return new ReanalysisFinalProcessingData(nerEntitiesFuture.get(),
|
||||
dictionaryAndNotFoundEntriesCompletableFuture.get().dictionary(),
|
||||
@ -263,9 +271,11 @@ public class AnalysisPreparationService {
|
||||
}
|
||||
|
||||
|
||||
public GroupRedactionInternalResponse getGroupRedactions(AnalyzeRequest analyzeRequest, boolean includeDeleted) {
|
||||
public GroupAnnotationInternalResponse getGroupAnnotations(AnalyzeRequest analyzeRequest, boolean includeDeleted) {
|
||||
|
||||
GroupRedactionInternalResponse groupRedactionResponse = groupRedactionClient.getGroupRedactions(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), includeDeleted);
|
||||
GroupAnnotationInternalResponse groupRedactionResponse = groupRedactionClient.getGroupAnnotations(analyzeRequest.getDossierId(),
|
||||
analyzeRequest.getFileId(),
|
||||
includeDeleted);
|
||||
log.info("Loaded group redactions for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||
return groupRedactionResponse;
|
||||
}
|
||||
@ -304,13 +314,16 @@ public class AnalysisPreparationService {
|
||||
}
|
||||
|
||||
|
||||
private NotFoundEntries getNotFoundEntries(AnalyzeRequest analyzeRequest, Document document, ImportedRedactions importedRedactions, List<AreaGroupRedaction> groupRedactions) {
|
||||
private NotFoundEntries getNotFoundEntries(AnalyzeRequest analyzeRequest,
|
||||
Document document,
|
||||
ImportedRedactions importedRedactions,
|
||||
List<AreaGroupAnnotation> groupAnnotations) {
|
||||
|
||||
var notFoundManualRedactionEntries = manualRedactionEntryService.addManualRedactionEntriesAndReturnNotFoundEntries(analyzeRequest,
|
||||
document,
|
||||
analyzeRequest.getDossierTemplateId());
|
||||
var notFoundImportedEntries = importedRedactionEntryService.addImportedEntriesAndReturnNotFoundEntries(analyzeRequest, importedRedactions, document);
|
||||
var areaGroupRedactions = areaGroupRedactionService.createAreaGroupRedactions(groupRedactions);
|
||||
var areaGroupRedactions = areaGroupAnnotationService.createAreaGroupAnnotations(groupAnnotations);
|
||||
return new NotFoundEntries(notFoundManualRedactionEntries, notFoundImportedEntries, areaGroupRedactions);
|
||||
}
|
||||
|
||||
@ -339,7 +352,7 @@ public class AnalysisPreparationService {
|
||||
DictionaryIncrement dictionaryIncrement,
|
||||
ReanalysisSetupData reanalysisSetupData,
|
||||
ImportedRedactions importedRedactions,
|
||||
List<GroupRedaction> groupRedactions) {
|
||||
List<GroupAnnotation> groupAnnotations) {
|
||||
|
||||
Set<String> relevantManuallyModifiedAnnotationIds = getRelevantManuallyModifiedAnnotationIds(analyzeRequest.getManualRedactions());
|
||||
|
||||
@ -351,7 +364,7 @@ public class AnalysisPreparationService {
|
||||
dictionaryIncrement,
|
||||
importedRedactions,
|
||||
relevantManuallyModifiedAnnotationIds,
|
||||
groupRedactions));
|
||||
groupAnnotations));
|
||||
|
||||
List<SemanticNode> sectionsToReAnalyse = getSectionsToReAnalyse(reanalysisSetupData.document(), sectionsToReanalyseIds);
|
||||
log.info("{} Sections to reanalyze found for file {} in dossier {}", sectionsToReanalyseIds.size(), analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||
@ -413,14 +426,14 @@ public class AnalysisPreparationService {
|
||||
DictionaryIncrement dictionaryIncrement,
|
||||
ImportedRedactions importedRedactions,
|
||||
Set<String> relevantManuallyModifiedAnnotationIds,
|
||||
List<GroupRedaction> groupRedactions) {
|
||||
List<GroupAnnotation> groupAnnotations) {
|
||||
|
||||
return sectionFinderService.findSectionsToReanalyse(dictionaryIncrement,
|
||||
document,
|
||||
analyzeRequest,
|
||||
importedRedactions,
|
||||
relevantManuallyModifiedAnnotationIds,
|
||||
groupRedactions);
|
||||
groupAnnotations);
|
||||
}
|
||||
|
||||
|
||||
@ -435,9 +448,7 @@ public class AnalysisPreparationService {
|
||||
}
|
||||
|
||||
private record SectionsToReanalyzeData(
|
||||
DictionaryIncrement dictionaryIncrement,
|
||||
Set<Integer> sectionsToReanalyseIds,
|
||||
List<SemanticNode> sectionsToReanalyze
|
||||
DictionaryIncrement dictionaryIncrement, Set<Integer> sectionsToReanalyseIds, List<SemanticNode> sectionsToReanalyze
|
||||
) {
|
||||
|
||||
}
|
||||
@ -451,7 +462,7 @@ public class AnalysisPreparationService {
|
||||
List<PrecursorEntity> notFoundManualRedactionEntries,
|
||||
List<PrecursorEntity> notFoundImportedEntries,
|
||||
NerEntities nerEntities,
|
||||
GroupRedactionInternalResponse groupRedactions,
|
||||
GroupAnnotationInternalResponse groupRedactions,
|
||||
List<PrecursorEntity> areaGroupRedactions
|
||||
) {
|
||||
|
||||
@ -470,8 +481,8 @@ public class AnalysisPreparationService {
|
||||
List<SemanticNode> sectionsToReAnalyse,
|
||||
KieWrapper kieWrapperComponentRules,
|
||||
KieWrapper kieWrapperEntityRules,
|
||||
GroupRedactionInternalResponse groupRedactions,
|
||||
List<AreaGroupRedaction> unprocessedAreaGroupRedactions
|
||||
GroupAnnotationInternalResponse groupAnnotations,
|
||||
List<AreaGroupAnnotation> unprocessedAreaGroupAnnotations
|
||||
) {
|
||||
|
||||
}
|
||||
@ -481,7 +492,7 @@ public class AnalysisPreparationService {
|
||||
Dictionary dictionary,
|
||||
List<PrecursorEntity> notFoundManualRedactionEntries,
|
||||
List<PrecursorEntity> notFoundImportedEntries,
|
||||
List<PrecursorEntity> areaGroupRedactions
|
||||
List<PrecursorEntity> areaGroupAnnotations
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ import static com.iqser.red.service.redaction.v1.server.service.AnalysisPreparat
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@ -26,10 +25,10 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogChanges;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.imported.ImportedLegalBases;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.FileType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.mapper.ImportedLegalBasisMapper;
|
||||
import com.iqser.red.service.redaction.v1.server.RedactionServiceSettings;
|
||||
import com.iqser.red.service.redaction.v1.server.logger.Context;
|
||||
@ -93,7 +92,7 @@ public class AnalyzeService {
|
||||
|
||||
ReanalysisInitialProcessingData initialProcessingData = analysisPreparationService.getReanalysisInitialProcessingData(analyzeRequest, setupData);
|
||||
|
||||
if (initialProcessingData.sectionsToReAnalyse().isEmpty() && initialProcessingData.groupRedactions().getAreaGroupRedactions().isEmpty()) {
|
||||
if (initialProcessingData.sectionsToReAnalyse().isEmpty() && initialProcessingData.groupAnnotations().getAreaGroupAnnotations().isEmpty()) {
|
||||
|
||||
EntityLogChanges entityLogChanges = entityLogCreatorService.updateVersionsAndReturnChanges(setupData.entityLog(),
|
||||
initialProcessingData.dictionaryIncrement().getDictionaryVersion(),
|
||||
@ -101,7 +100,7 @@ public class AnalyzeService {
|
||||
new ArrayList<>(),
|
||||
new ArrayList<>());
|
||||
|
||||
Set<GroupRedaction> groupRedactions = getGroupRedactionsList(initialProcessingData.groupRedactions());
|
||||
Set<GroupAnnotation> groupAnnotations = getGroupAnnotations(initialProcessingData.groupAnnotations());
|
||||
|
||||
return finalizeAnalysis(analyzeRequest,
|
||||
startTime,
|
||||
@ -111,7 +110,7 @@ public class AnalyzeService {
|
||||
setupData.document().getNumberOfPages(),
|
||||
true,
|
||||
new HashSet<>(),
|
||||
groupRedactions,
|
||||
groupAnnotations,
|
||||
context);
|
||||
}
|
||||
|
||||
@ -120,19 +119,19 @@ public class AnalyzeService {
|
||||
ReanalysisFinalProcessingData finalProcessingData = analysisPreparationService.getReanalysisFinalProcessingData(analyzeRequest,
|
||||
setupData,
|
||||
initialProcessingData,
|
||||
initialProcessingData.groupRedactions());
|
||||
initialProcessingData.groupAnnotations());
|
||||
|
||||
if (!initialProcessingData.sectionsToReAnalyse().isEmpty()) {
|
||||
dictionarySearchService.addDictionaryEntities(finalProcessingData.dictionary(), initialProcessingData.sectionsToReAnalyse());
|
||||
log.info("Finished Dictionary Search for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||
|
||||
groupSearchService.addGroupEntities(initialProcessingData.groupRedactions().getTextGroupRedactions(), initialProcessingData.sectionsToReAnalyse());
|
||||
groupSearchService.addGroupEntities(initialProcessingData.groupAnnotations().getTextGroupAnnotations(), initialProcessingData.sectionsToReAnalyse());
|
||||
log.info("Finished Group redaction search for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||
}
|
||||
|
||||
var notFoundManualOrImportedEntriesOrAreaGroupRedactions = Stream.of(finalProcessingData.notFoundManualRedactionEntries(),
|
||||
finalProcessingData.notFoundImportedEntries(),
|
||||
finalProcessingData.areaGroupRedactions())
|
||||
finalProcessingData.areaGroupAnnotations())
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -156,7 +155,7 @@ public class AnalyzeService {
|
||||
|
||||
notFoundImportedEntitiesService.processEntityLog(entityLogChanges.getEntityLog(), analyzeRequest, finalProcessingData.notFoundImportedEntries());
|
||||
|
||||
Set<GroupRedaction> groupRedactions = getGroupRedactionsList(initialProcessingData.groupRedactions());
|
||||
Set<GroupAnnotation> groupAnnotations = getGroupAnnotations(initialProcessingData.groupAnnotations());
|
||||
|
||||
return finalizeAnalysis(analyzeRequest,
|
||||
startTime,
|
||||
@ -166,7 +165,7 @@ public class AnalyzeService {
|
||||
setupData.document().getNumberOfPages(),
|
||||
true,
|
||||
new HashSet<>(allFileAttributes),
|
||||
groupRedactions,
|
||||
groupAnnotations,
|
||||
context);
|
||||
}
|
||||
|
||||
@ -196,7 +195,7 @@ public class AnalyzeService {
|
||||
dictionarySearchService.addDictionaryEntities(analysisData.dictionary(), analysisData.document());
|
||||
log.info("Finished Dictionary Search for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||
|
||||
groupSearchService.addGroupEntities(analysisData.groupRedactions().getTextGroupRedactions(), analysisData.document());
|
||||
groupSearchService.addGroupEntities(analysisData.groupRedactions().getTextGroupAnnotations(), analysisData.document());
|
||||
log.info("Finished Group redaction search for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||
|
||||
// we could add the imported redactions similar to the manual redactions here as well for additional processing
|
||||
@ -217,7 +216,7 @@ public class AnalyzeService {
|
||||
|
||||
notFoundImportedEntitiesService.processEntityLog(entityLogChanges.getEntityLog(), analyzeRequest, analysisData.notFoundImportedEntries());
|
||||
|
||||
Set<GroupRedaction> groupRedactions = getGroupRedactionsList(analysisData.groupRedactions());
|
||||
Set<GroupAnnotation> groupAnnotations = getGroupAnnotations(analysisData.groupRedactions());
|
||||
|
||||
return finalizeAnalysis(analyzeRequest,
|
||||
startTime,
|
||||
@ -227,7 +226,7 @@ public class AnalyzeService {
|
||||
analysisData.document().getNumberOfPages(),
|
||||
false,
|
||||
new HashSet<>(allFileAttributes),
|
||||
groupRedactions,
|
||||
groupAnnotations,
|
||||
context);
|
||||
}
|
||||
|
||||
@ -267,7 +266,7 @@ public class AnalyzeService {
|
||||
|
||||
notFoundImportedEntitiesService.processEntityLog(entityLogChanges.getEntityLog(), analyzeRequest, analysisData.notFoundImportedEntries());
|
||||
|
||||
Set<GroupRedaction> groupRedactions = getGroupRedactionsList(analysisData.groupRedactions());
|
||||
Set<GroupAnnotation> groupAnnotations = getGroupAnnotations(analysisData.groupRedactions());
|
||||
|
||||
return finalizeAnalysis(analyzeRequest,
|
||||
startTime,
|
||||
@ -277,7 +276,7 @@ public class AnalyzeService {
|
||||
analysisData.document().getNumberOfPages(),
|
||||
false,
|
||||
new HashSet<>(),
|
||||
groupRedactions,
|
||||
groupAnnotations,
|
||||
context);
|
||||
}
|
||||
|
||||
@ -290,7 +289,7 @@ public class AnalyzeService {
|
||||
int numberOfPages,
|
||||
boolean isReanalysis,
|
||||
Set<FileAttribute> addedFileAttributes,
|
||||
Set<GroupRedaction> groupRedactions,
|
||||
Set<GroupAnnotation> groupAnnotations,
|
||||
Context context) {
|
||||
|
||||
EntityLog entityLog = entityLogChanges.getEntityLog();
|
||||
@ -336,7 +335,7 @@ public class AnalyzeService {
|
||||
.manualRedactions(analyzeRequest.getManualRedactions())
|
||||
.addedFileAttributes(addedFileAttributes)
|
||||
.usedComponentMappings(analyzeRequest.getComponentMappings())
|
||||
.groupRedactions(groupRedactions)
|
||||
.groupAnnotations(groupAnnotations)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -372,10 +371,10 @@ public class AnalyzeService {
|
||||
}
|
||||
|
||||
|
||||
private Set<GroupRedaction> getGroupRedactionsList(GroupRedactionInternalResponse groupRedactionInternalResponse) {
|
||||
private Set<GroupAnnotation> getGroupAnnotations(GroupAnnotationInternalResponse groupAnnotationInternalResponse) {
|
||||
|
||||
List<AreaGroupRedaction> areaGroupRedactions = groupRedactionInternalResponse.getAreaGroupRedactions();
|
||||
List<TextGroupRedaction> textGroupRedactions = groupRedactionInternalResponse.getTextGroupRedactions();
|
||||
List<AreaGroupAnnotation> areaGroupRedactions = groupAnnotationInternalResponse.getAreaGroupAnnotations();
|
||||
List<TextGroupAnnotation> textGroupRedactions = groupAnnotationInternalResponse.getTextGroupAnnotations();
|
||||
|
||||
return Stream.concat(Optional.ofNullable(areaGroupRedactions)
|
||||
.orElseGet(List::of)
|
||||
|
||||
@ -24,7 +24,6 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Position;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ManualChangeFactory;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.legalbasis.LegalBasis;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.service.EntityLogMongoService;
|
||||
import com.iqser.red.service.redaction.v1.server.RedactionServiceSettings;
|
||||
import com.iqser.red.service.redaction.v1.server.client.LegalBasisClient;
|
||||
|
||||
@ -7,7 +7,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Engine;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupAnnotation;
|
||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.SearchImplementation;
|
||||
import com.iqser.red.service.redaction.v1.server.model.document.entity.EntityType;
|
||||
import com.iqser.red.service.redaction.v1.server.model.document.nodes.SemanticNode;
|
||||
@ -28,15 +28,15 @@ public class GroupSearchService {
|
||||
EntityEnrichmentService entityEnrichmentService;
|
||||
|
||||
|
||||
public void addGroupEntities(List<TextGroupRedaction> groupRedactions, List<SemanticNode> nodes) {
|
||||
public void addGroupEntities(List<TextGroupAnnotation> groupAnnotations, List<SemanticNode> nodes) {
|
||||
|
||||
nodes.forEach(node -> addGroupEntities(groupRedactions, node));
|
||||
nodes.forEach(node -> addGroupEntities(groupAnnotations, node));
|
||||
}
|
||||
|
||||
|
||||
public void addGroupEntities(List<TextGroupRedaction> groupRedactions, SemanticNode node) {
|
||||
public void addGroupEntities(List<TextGroupAnnotation> groupAnnotations, SemanticNode node) {
|
||||
|
||||
groupRedactions.stream()
|
||||
groupAnnotations.stream()
|
||||
.filter(groupRedaction -> groupRedaction.getSoftDeletedTime() == null)
|
||||
.forEach(groupRedaction -> {
|
||||
SearchImplementation searchImplementation = new SearchImplementation(groupRedaction.getValue(), false);
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupAnnotation;
|
||||
import com.iqser.red.service.redaction.v1.server.model.PrecursorEntity;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -14,13 +14,13 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AreaGroupRedactionService {
|
||||
public class AreaGroupAnnotationService {
|
||||
|
||||
public List<PrecursorEntity> createAreaGroupRedactions(List<AreaGroupRedaction> groupRedactions) {
|
||||
public List<PrecursorEntity> createAreaGroupAnnotations(List<AreaGroupAnnotation> groupAnnotations) {
|
||||
|
||||
List<PrecursorEntity> precursorEntities = new ArrayList<>();
|
||||
if (groupRedactions != null) {
|
||||
groupRedactions.forEach(groupRedaction -> precursorEntities.addAll(PrecursorEntity.fromAreaGroupRedaction(groupRedaction)));
|
||||
if (groupAnnotations != null) {
|
||||
groupAnnotations.forEach(groupAnnotation -> precursorEntities.addAll(PrecursorEntity.fromAreaGroupAnnotation(groupAnnotation)));
|
||||
}
|
||||
return precursorEntities;
|
||||
}
|
||||
@ -22,8 +22,8 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualRecategorization;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualRedactionEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualResizeRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationType;
|
||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryIncrement;
|
||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryIncrementValue;
|
||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.SearchImplementation;
|
||||
@ -49,7 +49,7 @@ public class SectionFinderService {
|
||||
AnalyzeRequest analyzeRequest,
|
||||
ImportedRedactions importedRedactions,
|
||||
Set<String> relevantManuallyModifiedAnnotationIds,
|
||||
List<GroupRedaction> groupRedactions) {
|
||||
List<GroupAnnotation> groupAnnotations) {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
Set<Integer> sectionsToReanalyse = new HashSet<>();
|
||||
@ -59,11 +59,10 @@ public class SectionFinderService {
|
||||
.map(DictionaryIncrementValue::getValue)
|
||||
.toList(), true);
|
||||
|
||||
List<String> unprocessedGroupRedactions = groupRedactions
|
||||
.stream()
|
||||
.filter(groupRedaction -> groupRedaction.getGroupRedactionType().equals(GroupRedactionType.TEXT))
|
||||
.filter(UnprocessedUtils::isUnprocessedGroupedRedaction)
|
||||
.map(GroupRedaction::getValue)
|
||||
List<String> unprocessedGroupRedactions = groupAnnotations.stream()
|
||||
.filter(groupAnnotation -> groupAnnotation.getGroupAnnotationType().equals(GroupAnnotationType.TEXT))
|
||||
.filter(UnprocessedUtils::isUnprocessedGroupAnnotation)
|
||||
.map(GroupAnnotation::getValue)
|
||||
.toList();
|
||||
|
||||
var groupRedactionSearch = new SearchImplementation(unprocessedGroupRedactions, false);
|
||||
|
||||
@ -2,16 +2,15 @@ package com.iqser.red.service.redaction.v1.server.utils;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupChange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class UnprocessedUtils {
|
||||
|
||||
|
||||
public static boolean isUnprocessedGroupedRedaction(GroupRedaction groupRedaction) {
|
||||
public static boolean isUnprocessedGroupAnnotation(GroupAnnotation groupRedaction) {
|
||||
|
||||
if (groupRedaction.getGroupChanges().isEmpty() && groupRedaction.getProcessedDate() == null) {
|
||||
return true;
|
||||
@ -24,7 +23,8 @@ public class UnprocessedUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
OffsetDateTime lastChangeDate = groupRedaction.getGroupChanges().stream()
|
||||
OffsetDateTime lastChangeDate = groupRedaction.getGroupChanges()
|
||||
.stream()
|
||||
.map(GroupChange::getChangeDate)
|
||||
.max(OffsetDateTime::compareTo)
|
||||
.orElse(null);
|
||||
@ -34,4 +34,5 @@ public class UnprocessedUtils {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.iqser.red.service.redaction.v1.server;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.when;
|
||||
@ -42,11 +41,9 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.IdRemoval;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.common.JSONPrimitive;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.FileType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.Type;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateRequest;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateResponse;
|
||||
import com.iqser.red.service.redaction.v1.server.client.GroupRedactionClient;
|
||||
import com.iqser.red.service.redaction.v1.server.redaction.utils.OsUtils;
|
||||
import com.iqser.red.service.redaction.v1.server.storage.RedactionStorageService;
|
||||
import com.iqser.red.storage.commons.StorageAutoConfiguration;
|
||||
@ -236,10 +233,10 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
||||
|
||||
when(dictionaryClient.getColors(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(colors);
|
||||
|
||||
when(groupRedactionClient.getGroupRedactions(anyString(), anyString(), anyBoolean())).thenReturn(GroupRedactionInternalResponse.builder()
|
||||
.textGroupRedactions(Collections.emptyList())
|
||||
.areaGroupRedactions(Collections.emptyList())
|
||||
.build());
|
||||
when(groupRedactionClient.getGroupAnnotations(anyString(), anyString(), anyBoolean())).thenReturn(GroupAnnotationInternalResponse.builder()
|
||||
.textGroupAnnotations(Collections.emptyList())
|
||||
.areaGroupAnnotations(Collections.emptyList())
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -285,9 +282,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
||||
.fileId(TEST_FILE_ID)
|
||||
.build());
|
||||
});
|
||||
request.setManualRedactions(ManualRedactions.builder()
|
||||
.idsToRemove(idRemovalSet)
|
||||
.build());
|
||||
request.setManualRedactions(ManualRedactions.builder().idsToRemove(idRemovalSet).build());
|
||||
|
||||
analyzeService.reanalyze(request);
|
||||
|
||||
@ -315,12 +310,20 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
||||
System.out.println("Finished analysis");
|
||||
|
||||
var componentLog = redactionStorageService.getComponentLog(TEST_DOSSIER_ID, TEST_FILE_ID);
|
||||
var doseMortality = componentLog.getComponentLogEntries().stream().filter(componentLogEntry -> componentLogEntry.getName().equals("Dose_Mortality")).findFirst().get();
|
||||
var doseMortality = componentLog.getComponentLogEntries()
|
||||
.stream()
|
||||
.filter(componentLogEntry -> componentLogEntry.getName().equals("Dose_Mortality"))
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
assertEquals(doseMortality.getComponentValues().size(), 5);
|
||||
|
||||
Pattern pattern = Pattern.compile("^5000, [SD]$");
|
||||
boolean allMatch = doseMortality.getComponentValues().stream().map(ComponentLogEntryValue::getValue).allMatch(pattern.asPredicate());
|
||||
boolean allMatch = doseMortality.getComponentValues()
|
||||
.stream()
|
||||
.map(ComponentLogEntryValue::getValue)
|
||||
.allMatch(pattern.asPredicate());
|
||||
assertTrue(allMatch);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -29,11 +29,11 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.PageRange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.RuleFileType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.common.JSONPrimitive;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.PositionOnPage;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupAnnotation;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateRequest;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateResponse;
|
||||
import com.iqser.red.service.redaction.v1.server.redaction.utils.OsUtils;
|
||||
@ -100,30 +100,30 @@ public class GroupRedactionTest extends AbstractRedactionIntegrationTest {
|
||||
String textID = UUID.randomUUID().toString();
|
||||
String areaID = UUID.randomUUID().toString();
|
||||
|
||||
TextGroupRedaction textGroupRedaction = TextGroupRedaction.builder()
|
||||
TextGroupAnnotation textGroupRedaction = TextGroupAnnotation.builder()
|
||||
.positionOnPage(PositionOnPage.builder().x(423.9f).y(505.5f).width(43.9f).height(15.4f).pageNumber(1).build())
|
||||
.groupId(textID)
|
||||
.typeId("CBI_author")
|
||||
.value("medicine")
|
||||
.legalBasis("test legal basis")
|
||||
.entryType(EntryType.ENTITY)
|
||||
.groupRedactionType(GroupRedactionType.TEXT)
|
||||
.groupAnnotationType(GroupAnnotationType.TEXT)
|
||||
.build();
|
||||
|
||||
AreaGroupRedaction areaGroupRedaction = AreaGroupRedaction.builder()
|
||||
AreaGroupAnnotation areaGroupRedaction = AreaGroupAnnotation.builder()
|
||||
.positionOnPage(PositionOnPage.builder().x(346.27f).y(644.24f).width(219.4f).height(52.24f).pageNumber(2).build())
|
||||
.groupId(areaID)
|
||||
.pageRanges(List.of(PageRange.builder().startPage(2).endPage(5).build()))
|
||||
.typeId("PII")
|
||||
.value("non-readable content")
|
||||
.entryType(EntryType.AREA)
|
||||
.groupRedactionType(GroupRedactionType.AREA)
|
||||
.groupAnnotationType(GroupAnnotationType.AREA)
|
||||
.section("my section")
|
||||
.build();
|
||||
|
||||
when(groupRedactionClient.getGroupRedactions(anyString(), anyString(), anyBoolean())).thenReturn(GroupRedactionInternalResponse.builder()
|
||||
.textGroupRedactions(List.of(textGroupRedaction))
|
||||
.areaGroupRedactions(List.of(areaGroupRedaction))
|
||||
when(groupRedactionClient.getGroupAnnotations(anyString(), anyString(), anyBoolean())).thenReturn(GroupAnnotationInternalResponse.builder()
|
||||
.textGroupAnnotations(List.of(textGroupRedaction))
|
||||
.areaGroupAnnotations(List.of(areaGroupRedaction))
|
||||
.build());
|
||||
|
||||
AnalyzeRequest request = uploadFileToStorage("files/new/SYNGENTA_EFSA_sanitisation_GFL_v1 3.pdf");
|
||||
|
||||
@ -47,8 +47,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualRedactionEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.common.JSONPrimitive;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.FileType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.Type;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateRequest;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateResponse;
|
||||
import com.iqser.red.service.redaction.v1.server.redaction.utils.OsUtils;
|
||||
@ -110,9 +109,9 @@ public class RedactionAcceptanceTest extends AbstractRedactionIntegrationTest {
|
||||
|
||||
mockDictionaryCalls(null);
|
||||
|
||||
when(groupRedactionClient.getGroupRedactions(anyString(), anyString(), anyBoolean())).thenReturn(GroupRedactionInternalResponse.builder()
|
||||
.textGroupRedactions(Collections.emptyList())
|
||||
.areaGroupRedactions(Collections.emptyList())
|
||||
when(groupRedactionClient.getGroupAnnotations(anyString(), anyString(), anyBoolean())).thenReturn(GroupAnnotationInternalResponse.builder()
|
||||
.textGroupAnnotations(Collections.emptyList())
|
||||
.areaGroupAnnotations(Collections.emptyList())
|
||||
.build());
|
||||
|
||||
when(dictionaryClient.getColors(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(colors);
|
||||
|
||||
@ -68,7 +68,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.common.JSON
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.configuration.Colors;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.FileType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.Type;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.Point;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateRequest;
|
||||
import com.iqser.red.service.redaction.v1.server.annotate.AnnotateResponse;
|
||||
@ -132,9 +132,9 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
|
||||
|
||||
mockDictionaryCalls(null);
|
||||
|
||||
when(groupRedactionClient.getGroupRedactions(anyString(), anyString(), anyBoolean())).thenReturn(GroupRedactionInternalResponse.builder()
|
||||
.textGroupRedactions(Collections.emptyList())
|
||||
.areaGroupRedactions(Collections.emptyList())
|
||||
when(groupRedactionClient.getGroupAnnotations(anyString(), anyString(), anyBoolean())).thenReturn(GroupAnnotationInternalResponse.builder()
|
||||
.textGroupAnnotations(Collections.emptyList())
|
||||
.areaGroupAnnotations(Collections.emptyList())
|
||||
.build());
|
||||
|
||||
when(dictionaryClient.getColors(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(colors);
|
||||
|
||||
@ -3,7 +3,6 @@ package com.iqser.red.service.redaction.v1.server.service.document;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@ -43,8 +42,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualRedactionEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualResizeRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.common.JSONPrimitive;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.Type;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.redaction.v1.model.AnalyzeResponse;
|
||||
import com.iqser.red.service.redaction.v1.model.QueueNames;
|
||||
import com.iqser.red.service.redaction.v1.model.UnprocessedManualEntity;
|
||||
@ -109,10 +107,10 @@ public class UnprocessedChangesServiceTest extends AbstractRedactionIntegrationT
|
||||
when(dictionaryClient.getAllTypesForDossier(TEST_DOSSIER_ID, null, true)).thenReturn(getDossierDictionaryTypeResponse());
|
||||
mockDictionaryCalls(null);
|
||||
|
||||
when(groupRedactionClient.getGroupRedactions(anyString(), anyString(), anyBoolean())).thenReturn(GroupRedactionInternalResponse.builder()
|
||||
.textGroupRedactions(Collections.emptyList())
|
||||
.areaGroupRedactions(Collections.emptyList())
|
||||
.build());
|
||||
when(groupRedactionClient.getGroupAnnotations(anyString(), anyString(), anyBoolean())).thenReturn(GroupAnnotationInternalResponse.builder()
|
||||
.textGroupAnnotations(Collections.emptyList())
|
||||
.areaGroupAnnotations(Collections.emptyList())
|
||||
.build());
|
||||
|
||||
when(dictionaryClient.getColors(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(colors);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user