RED-8670: add idp fields and llm tracking

This commit is contained in:
Kilian Schuettler 2024-12-17 17:49:26 +01:00
parent 6656c9eb8a
commit 758aa3b165
4 changed files with 36 additions and 4 deletions

View File

@ -314,6 +314,8 @@ public class DossierTemplateController implements DossierTemplateResource {
.applyDictionaryUpdatesToAllDossiersByDefault(dossierTemplate.isApplyDictionaryUpdatesToAllDossiersByDefault())
.ocrByDefault(dossierTemplate.isOcrByDefault())
.removeWatermark(dossierTemplate.isRemoveWatermark())
.idpByDefault(dossierTemplate.isIdpByDefault())
.rotationCorrectionByDefault(dossierTemplate.isRotationCorrectionByDefault())
.build();
}

View File

@ -769,6 +769,9 @@ public class FileStatusService {
DossierTemplateEntity dt = dossierTemplatePersistenceService.getDossierTemplate(dossierPersistenceService.getDossierTemplateId(dossierId));
Set<AzureOcrFeature> features = new HashSet<>();
features.add(AzureOcrFeature.FONT_STYLE_DETECTION);
if (dt.isRemoveWatermark()) {
features.add(AzureOcrFeature.REMOVE_WATERMARKS);
}
@ -778,9 +781,6 @@ public class FileStatusService {
if (dt.isRotationCorrectionByDefault()) {
features.add(AzureOcrFeature.ROTATION_CORRECTION);
}
if (currentApplicationTypeProvider.isDocuMine()) {
features.add(AzureOcrFeature.FONT_STYLE_DETECTION);
}
addToOcrQueue(dossierId, fileId, priority, features);
}

View File

@ -1,6 +1,7 @@
package com.iqser.red.service.peristence.v1.server.integration.tests;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -1005,4 +1006,33 @@ public class DossierTemplateTest extends AbstractPersistenceServerServiceTest {
assertTrue(exception.getMessage().contains("Invalid dates! validFrom can't be after validTo."));
}
@Test
public void testUpdateDossierTemplateWithIdp() {
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
var allTemplates = dossierTemplateClient.getAllDossierTemplates();
assertThat(allTemplates.size()).isEqualTo(1);
assertThat(allTemplates.get(0)).isEqualTo(dossierTemplate);
// update
var cru = new DossierTemplateModel();
cru.setDossierTemplateId(dossierTemplate.getId());
BeanUtils.copyProperties(dossierTemplate, cru);
String updatedName = "Template 1 Update";
cru.setName(updatedName);
cru.setIdpByDefault(true);
cru.setRotationCorrectionByDefault(true);
var updatedDT = dossierTemplateClient.createOrUpdateDossierTemplate(cru);
assertEquals(updatedName, updatedDT.getName());
assertTrue(updatedDT.isIdpByDefault());
assertTrue(updatedDT.isRotationCorrectionByDefault());
var loadedDT = dossierTemplateClient.getDossierTemplate(updatedDT.getId());
assertEquals(updatedName, loadedDT.getName());
assertTrue(loadedDT.isIdpByDefault());
assertTrue(loadedDT.isRotationCorrectionByDefault());
}
}

View File

@ -71,7 +71,7 @@ public class DossierTemplateModel {
@Schema(description = "Flag that specifies if rotation correction is attempted during OCR for all dossiers of this template")
private boolean rotationCorrectionByDefault;
@Schema(description = "Flag that specifies if IDP is automatically performed on upload for all dossiers of this template")
@Schema(description = "Flag that specifies if IDP is performed instead of OCR for all dossiers of this template")
private boolean idpByDefault;
@Schema(description = "Flag that specifies the watermark removal in documents will be performed before the OCR processing")