RED-9348: move component log to mongodb #519
@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
description = "redaction-service-api-v1"
|
description = "redaction-service-api-v1"
|
||||||
val persistenceServiceVersion = "2.564.0-RED9010.0"
|
val persistenceServiceVersion = "2.570.0-RED9348.0"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.springframework:spring-web:6.0.12")
|
implementation("org.springframework:spring-web:6.0.12")
|
||||||
|
|||||||
@ -16,7 +16,7 @@ val layoutParserVersion = "0.174.0"
|
|||||||
val jacksonVersion = "2.15.2"
|
val jacksonVersion = "2.15.2"
|
||||||
val droolsVersion = "9.44.0.Final"
|
val droolsVersion = "9.44.0.Final"
|
||||||
val pdfBoxVersion = "3.0.0"
|
val pdfBoxVersion = "3.0.0"
|
||||||
val persistenceServiceVersion = "2.564.0-RED9010.0"
|
val persistenceServiceVersion = "2.570.0-RED9348.0"
|
||||||
val llmServiceVersion = "1.11.0"
|
val llmServiceVersion = "1.11.0"
|
||||||
val springBootStarterVersion = "3.1.5"
|
val springBootStarterVersion = "3.1.5"
|
||||||
val springCloudVersion = "4.0.4"
|
val springCloudVersion = "4.0.4"
|
||||||
|
|||||||
@ -324,7 +324,7 @@ public class AnalyzeService {
|
|||||||
|
|
||||||
ComponentLog componentLog = componentLogCreatorService.buildComponentLog(analyzeRequest.getAnalysisNumber(), components, kieWrapperComponentRules.rulesVersion());
|
ComponentLog componentLog = componentLogCreatorService.buildComponentLog(analyzeRequest.getAnalysisNumber(), components, kieWrapperComponentRules.rulesVersion());
|
||||||
|
|
||||||
redactionStorageService.storeObject(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), FileType.COMPONENT_LOG, componentLog);
|
redactionStorageService.saveComponentLog(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), componentLog);
|
||||||
|
|
||||||
log.info("Stored component log for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
log.info("Stored component log for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class ComponentLogCreatorService {
|
|||||||
});
|
});
|
||||||
List<ComponentLogEntry> componentLogComponents = map.entrySet()
|
List<ComponentLogEntry> componentLogComponents = map.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.map(entry -> new ComponentLogEntry(entry.getKey(), entry.getValue(), false))
|
.map(entry -> new ComponentLogEntry(entry.getKey(), entry.getValue(), entry.getValue(), false))
|
||||||
.toList();
|
.toList();
|
||||||
return new ComponentLog(analysisNumber, componentRulesVersion, componentLogComponents);
|
return new ComponentLog(analysisNumber, componentRulesVersion, componentLogComponents);
|
||||||
}
|
}
|
||||||
@ -41,7 +41,6 @@ public class ComponentLogCreatorService {
|
|||||||
|
|
||||||
return ComponentLogEntryValue.builder()
|
return ComponentLogEntryValue.builder()
|
||||||
.value(component.getValue())
|
.value(component.getValue())
|
||||||
.originalValue(component.getValue())
|
|
||||||
.componentRuleId(component.getMatchedRule().toString())
|
.componentRuleId(component.getMatchedRule().toString())
|
||||||
.valueDescription(component.getValueDescription())
|
.valueDescription(component.getValueDescription())
|
||||||
.componentLogEntityReferences(toComponentEntityReferences(component.getReferences()
|
.componentLogEntityReferences(toComponentEntityReferences(component.getReferences()
|
||||||
|
|||||||
@ -24,6 +24,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.ImportedRedactions;
|
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.analysislog.entitylog.imported.ImportedRedactionsPerPage;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.imported.ImportedRedactionsPerPage;
|
||||||
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.dossier.file.FileType;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.service.ComponentLogMongoService;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.service.EntityLogMongoService;
|
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.service.EntityLogMongoService;
|
||||||
import com.iqser.red.service.redaction.v1.server.client.model.NerEntitiesModel;
|
import com.iqser.red.service.redaction.v1.server.client.model.NerEntitiesModel;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.document.DocumentData;
|
import com.iqser.red.service.redaction.v1.server.model.document.DocumentData;
|
||||||
@ -51,15 +52,19 @@ public class RedactionStorageService {
|
|||||||
|
|
||||||
private final EntityLogMongoService entityLogMongoService;
|
private final EntityLogMongoService entityLogMongoService;
|
||||||
|
|
||||||
|
private final ComponentLogMongoService componentLogMongoService;
|
||||||
|
|
||||||
private final TaskExecutor taskExecutor;
|
private final TaskExecutor taskExecutor;
|
||||||
|
|
||||||
|
|
||||||
public RedactionStorageService(StorageService storageService,
|
public RedactionStorageService(StorageService storageService,
|
||||||
EntityLogMongoService entityLogMongoService,
|
EntityLogMongoService entityLogMongoService,
|
||||||
|
ComponentLogMongoService componentLogMongoService,
|
||||||
@Qualifier(APPLICATION_TASK_EXECUTOR_BEAN_NAME) TaskExecutor taskExecutor) {
|
@Qualifier(APPLICATION_TASK_EXECUTOR_BEAN_NAME) TaskExecutor taskExecutor) {
|
||||||
|
|
||||||
this.storageService = storageService;
|
this.storageService = storageService;
|
||||||
this.entityLogMongoService = entityLogMongoService;
|
this.entityLogMongoService = entityLogMongoService;
|
||||||
|
this.componentLogMongoService = componentLogMongoService;
|
||||||
this.taskExecutor = taskExecutor;
|
this.taskExecutor = taskExecutor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,6 +125,13 @@ public class RedactionStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public void saveComponentLog(String dossierId, String fileId, ComponentLog componentLog) {
|
||||||
|
|
||||||
|
componentLogMongoService.saveComponentLog(dossierId, fileId, componentLog);
|
||||||
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void updateEntityLogEntries(String dossierId, String fileId, List<EntityLogEntry> entityLogEntries) {
|
public void updateEntityLogEntries(String dossierId, String fileId, List<EntityLogEntry> entityLogEntries) {
|
||||||
|
|
||||||
@ -212,6 +224,17 @@ public class RedactionStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ComponentLog getComponentLog(String dossierId, String fileId) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
return componentLogMongoService.findComponentLogByDossierIdAndFileId(dossierId, fileId)
|
||||||
|
.orElseThrow(() -> new StorageObjectDoesNotExist(""));
|
||||||
|
} catch (StorageObjectDoesNotExist e) {
|
||||||
|
throw new NotFoundException("Component is not available.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<Integer> findIdsOfSectionsToReanalyse(String dossierId, String fileId, Collection<String> entryIds) {
|
public Set<Integer> findIdsOfSectionsToReanalyse(String dossierId, String fileId, Collection<String> entryIds) {
|
||||||
|
|
||||||
return entityLogMongoService.findFirstContainingNodeIdForEachEntry(dossierId, fileId, entryIds);
|
return entityLogMongoService.findFirstContainingNodeIdForEachEntry(dossierId, fileId, entryIds);
|
||||||
@ -302,16 +325,6 @@ public class RedactionStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ComponentLog getComponentLog(String dossierId, String fileId) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
return storageService.readJSONObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, FileType.COMPONENT_LOG), ComponentLog.class);
|
|
||||||
} catch (StorageObjectDoesNotExist e) {
|
|
||||||
throw new NotFoundException("Component Log is not available.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean entityLogExists(String dossierId, String fileId) {
|
public boolean entityLogExists(String dossierId, String fileId) {
|
||||||
|
|
||||||
return entityLogMongoService.entityLogDocumentExists(dossierId, fileId);
|
return entityLogMongoService.entityLogDocumentExists(dossierId, fileId);
|
||||||
|
|||||||
@ -176,7 +176,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
|||||||
expectedDates.add("13/08/1992");
|
expectedDates.add("13/08/1992");
|
||||||
expectedDates.add("27/02/1992");
|
expectedDates.add("27/02/1992");
|
||||||
|
|
||||||
String dates = experimentalDates.getComponentValues()
|
String dates = experimentalDates.getValues()
|
||||||
.get(0).getValue();
|
.get(0).getValue();
|
||||||
String[] dateArray = dates.split(", ");
|
String[] dateArray = dates.split(", ");
|
||||||
boolean allEqual = true;
|
boolean allEqual = true;
|
||||||
@ -256,7 +256,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.get();
|
.get();
|
||||||
assertEquals("Yes",
|
assertEquals("Yes",
|
||||||
glpStudy.getComponentValues()
|
glpStudy.getValues()
|
||||||
.get(0).getValue());
|
.get(0).getValue());
|
||||||
var glpStudyAnnotations = entityLog.getEntityLogEntry()
|
var glpStudyAnnotations = entityLog.getEntityLogEntry()
|
||||||
.stream()
|
.stream()
|
||||||
@ -287,7 +287,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.get();
|
.get();
|
||||||
assertEquals("No",
|
assertEquals("No",
|
||||||
glpStudy.getComponentValues()
|
glpStudy.getValues()
|
||||||
.get(0).getValue());
|
.get(0).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,10 +306,10 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
|||||||
var componentLog = redactionStorageService.getComponentLog(TEST_DOSSIER_ID, TEST_FILE_ID);
|
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);
|
assertEquals(doseMortality.getValues().size(), 5);
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile("^5000, [SD]$");
|
Pattern pattern = Pattern.compile("^5000, [SD]$");
|
||||||
boolean allMatch = doseMortality.getComponentValues().stream().map(ComponentLogEntryValue::getValue).allMatch(pattern.asPredicate());
|
boolean allMatch = doseMortality.getValues().stream().map(ComponentLogEntryValue::getValue).allMatch(pattern.asPredicate());
|
||||||
assertTrue(allMatch);
|
assertTrue(allMatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user