diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/model/ReportRedactionEntry.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/model/ReportRedactionEntry.java index 4f7df9e..4a19ff4 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/model/ReportRedactionEntry.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/model/ReportRedactionEntry.java @@ -12,4 +12,7 @@ public class ReportRedactionEntry { private float y; private String section; private String justification; + private String justificationParagraph; + private String justificationReason; + private String excerpt; } diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java index 19c5114..63deac4 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelTemplateReportGenerationService.java @@ -1,6 +1,7 @@ package com.iqser.red.service.redaction.report.v1.server.service; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.DOSSIER_NAME_PLACEHOLDER; +import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.EXCERPT_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FILE_NAME_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ENG; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ENG_PLACEHOLDER; @@ -10,7 +11,9 @@ import static com.iqser.red.service.redaction.report.v1.server.service.Placehold import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ISO_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_TIME_ISO; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_TIME_ISO_PLACEHOLDER; +import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.JUSTIFICATION_PARAGRAPH_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.JUSTIFICATION_PLACEHOLDER; +import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.JUSTIFICATION_REASON_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.PAGE_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.PARAGRAPH_PLACEHOLDER; @@ -186,7 +189,7 @@ public class ExcelTemplateReportGenerationService { } else { sheet.shiftRows(rowIndex.get(), rowIndex.get() + reportEntries.size(), reportEntries.size(), true, true); } - + reportEntries.forEach(entry -> { sheet.createRow(rowIndex.get()); for (Map.Entry entry1 : placeholderCellPos.entrySet()) { @@ -202,8 +205,7 @@ public class ExcelTemplateReportGenerationService { private boolean containsRedactionPlaceholder(String text) { - return text.contains(FILE_NAME_PLACEHOLDER) || text.contains(PAGE_PLACEHOLDER) || text.contains(PARAGRAPH_PLACEHOLDER) || text - .contains(JUSTIFICATION_PLACEHOLDER); + return text.contains(FILE_NAME_PLACEHOLDER) || text.contains(PAGE_PLACEHOLDER) || text.contains(PARAGRAPH_PLACEHOLDER) || text.contains(JUSTIFICATION_PLACEHOLDER) || text.contains(EXCERPT_PLACEHOLDER) || text.contains(JUSTIFICATION_PARAGRAPH_PLACEHOLDER) || text.contains(JUSTIFICATION_REASON_PLACEHOLDER); } @@ -221,6 +223,15 @@ public class ExcelTemplateReportGenerationService { if (placeholder.equals(JUSTIFICATION_PLACEHOLDER)) { return entry.getJustification(); } + if (placeholder.equals(JUSTIFICATION_PARAGRAPH_PLACEHOLDER)) { + return entry.getJustificationParagraph(); + } + if (placeholder.equals(JUSTIFICATION_REASON_PLACEHOLDER)) { + return entry.getJustificationReason(); + } + if (placeholder.equals(EXCERPT_PLACEHOLDER)) { + return entry.getExcerpt(); + } throw new RuntimeException("invalid placeholder"); } diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/PlaceholderService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/PlaceholderService.java index f9ea53b..cd5980e 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/PlaceholderService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/PlaceholderService.java @@ -1,7 +1,6 @@ package com.iqser.red.service.redaction.report.v1.server.service; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; @@ -18,6 +17,9 @@ public class PlaceholderService { public static final String PAGE_PLACEHOLDER = "{{redaction.page}}"; public static final String PARAGRAPH_PLACEHOLDER = "{{redaction.paragraph}}"; public static final String JUSTIFICATION_PLACEHOLDER = "{{redaction.justification}}"; + public static final String JUSTIFICATION_PARAGRAPH_PLACEHOLDER = "{{redaction.justificationParagraph}}"; + public static final String JUSTIFICATION_REASON_PLACEHOLDER = "{{redaction.justificationReason}}"; + public static final String EXCERPT_PLACEHOLDER = "{{redaction.excerpt}}"; public static final DateTimeFormatter FORMAT_DATE_ISO = DateTimeFormatter.ofPattern("yyyy-MM-dd"); public static final DateTimeFormatter FORMAT_DATE_GER = DateTimeFormatter.ofPattern("dd.MM.yyyy"); @@ -34,7 +36,7 @@ public class PlaceholderService { public List getGeneralPlaceholders() { - return List.of(FILE_NAME_PLACEHOLDER, PAGE_PLACEHOLDER, PARAGRAPH_PLACEHOLDER, JUSTIFICATION_PLACEHOLDER, FORMAT_DATE_ISO_PLACEHOLDER, FORMAT_DATE_GER_PLACEHOLDER, FORMAT_DATE_ENG_PLACEHOLDER, FORMAT_TIME_ISO_PLACEHOLDER, DOSSIER_NAME_PLACEHOLDER); + return List.of(FILE_NAME_PLACEHOLDER, PAGE_PLACEHOLDER, PARAGRAPH_PLACEHOLDER, JUSTIFICATION_PLACEHOLDER, JUSTIFICATION_PARAGRAPH_PLACEHOLDER, JUSTIFICATION_REASON_PLACEHOLDER, EXCERPT_PLACEHOLDER, FORMAT_DATE_ISO_PLACEHOLDER, FORMAT_DATE_GER_PLACEHOLDER, FORMAT_DATE_ENG_PLACEHOLDER, FORMAT_TIME_ISO_PLACEHOLDER, DOSSIER_NAME_PLACEHOLDER); } } diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java index 8890da7..aae1ce3 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java @@ -55,7 +55,11 @@ public class RedactionLogConverterService { .filter(lbm -> lbm.getReason().equalsIgnoreCase(entry.getLegalBasis())) .findAny() .map(LegalBasisMapping::getDescription) - .orElse(""))); + .orElse(""), entry.getLegalBasis(), legalBasisMappings.stream() + .filter(lbm -> lbm.getReason().equalsIgnoreCase(entry.getLegalBasis())) + .findAny() + .map(LegalBasisMapping::getDescription) + .orElse(""), entry.getTextBefore() + entry.getValue() + entry.getTextAfter())); } } } diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java index e1e863e..7102b4f 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java @@ -1,6 +1,7 @@ package com.iqser.red.service.redaction.report.v1.server.service; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.DOSSIER_NAME_PLACEHOLDER; +import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.EXCERPT_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FILE_NAME_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ENG; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ENG_PLACEHOLDER; @@ -10,7 +11,9 @@ import static com.iqser.red.service.redaction.report.v1.server.service.Placehold import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ISO_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_TIME_ISO; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_TIME_ISO_PLACEHOLDER; +import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.JUSTIFICATION_PARAGRAPH_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.JUSTIFICATION_PLACEHOLDER; +import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.JUSTIFICATION_REASON_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.PAGE_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.PARAGRAPH_PLACEHOLDER; @@ -32,6 +35,7 @@ import javax.annotation.PostConstruct; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.util.Units; import org.apache.poi.xwpf.usermodel.IBodyElement; +import org.apache.poi.xwpf.usermodel.IRunElement; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; @@ -64,8 +68,6 @@ import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class WordReportGenerationService { - private byte[] appendixA1Template; - private byte[] appendixA2Template; private final FileAttributesClient fileAttributesClient; private final ReportStorageService reportStorageService; private final DossierAttributesClient dossierAttributesClient; @@ -268,7 +270,7 @@ public class WordReportGenerationService { for (XWPFTable tbl : doc.getTables()) { String tblText = tbl.getText(); - if (tblText.contains(PAGE_PLACEHOLDER) || tblText.contains(PARAGRAPH_PLACEHOLDER) || tblText.contains(JUSTIFICATION_PLACEHOLDER)) { + if (tblText.contains(PAGE_PLACEHOLDER) || tblText.contains(PARAGRAPH_PLACEHOLDER) || tblText.contains(JUSTIFICATION_PLACEHOLDER) || tblText.contains(EXCERPT_PLACEHOLDER) || tblText.contains(JUSTIFICATION_PARAGRAPH_PLACEHOLDER) || tblText.contains(JUSTIFICATION_REASON_PLACEHOLDER)) { return tbl; } } @@ -278,7 +280,7 @@ public class WordReportGenerationService { private boolean containsRedactionPlaceholder(String text) { - return text.contains(FILE_NAME_PLACEHOLDER) || text.contains(PAGE_PLACEHOLDER) || text.contains(PARAGRAPH_PLACEHOLDER) || text.contains(JUSTIFICATION_PLACEHOLDER); + return text.contains(FILE_NAME_PLACEHOLDER) || text.contains(PAGE_PLACEHOLDER) || text.contains(PARAGRAPH_PLACEHOLDER) || text.contains(JUSTIFICATION_PLACEHOLDER) || text.contains(EXCERPT_PLACEHOLDER) || text.contains(JUSTIFICATION_PARAGRAPH_PLACEHOLDER) || text.contains(JUSTIFICATION_REASON_PLACEHOLDER); } @@ -326,6 +328,15 @@ public class WordReportGenerationService { if (placeholder.equals(JUSTIFICATION_PLACEHOLDER)) { return entry.getJustification(); } + if (placeholder.equals(JUSTIFICATION_PARAGRAPH_PLACEHOLDER)) { + return entry.getJustificationParagraph(); + } + if (placeholder.equals(JUSTIFICATION_REASON_PLACEHOLDER)) { + return entry.getJustificationReason(); + } + if (placeholder.equals(EXCERPT_PLACEHOLDER)) { + return entry.getExcerpt(); + } throw new RuntimeException("invalid placeholder"); } diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java index f9c3dcf..ce343e4 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java @@ -1,11 +1,13 @@ package com.iqser.red.service.redaction.report.v1.server; +import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ENG; import static org.mockito.Mockito.when; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; import java.io.FileOutputStream; import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.Base64; @@ -301,4 +303,76 @@ public class RedactionReportIntegrationTest { } } + @Test + public void testExcerptReportGeneration() throws IOException { + + String dossierTemplateId = "dossierTemplateId"; + + ClassPathResource redactionLogResource = new ClassPathResource("files/Seite13log.json"); + ClassPathResource imageResource = new ClassPathResource("files/exampleImage.jpg"); + + RedactionLog redactionLog = objectMapper.readValue(redactionLogResource.getInputStream(), RedactionLog.class); + + ClassPathResource legalBasisMappingResource = new ClassPathResource("files/legal13.json"); + + List legalBasisMapping = objectMapper.readValue(legalBasisMappingResource.getInputStream(), new TypeReference<>() { + }); + + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping); + + DossierAttributesConfig dossierAttributesConfig = new DossierAttributesConfig(Arrays.asList( + new DossierAttributeConfig("id", "Active Substance", true, DossierAttributeConfig.DossierAttributeType.TEXT, "{{dossier.attribute.ActiveSubstance}}"), + new DossierAttributeConfig("id2", "Rapporteur Member State", false, DossierAttributeConfig.DossierAttributeType.TEXT, "{{dossier.attribute.RapporteurMemberState}}"), + new DossierAttributeConfig("id3", "Dossier Name", true, DossierAttributeConfig.DossierAttributeType.TEXT, "{{dossier.attribute.Name}}"), + new DossierAttributeConfig("id4", "Company", false, DossierAttributeConfig.DossierAttributeType.TEXT, "{{dossier.attribute.Company}}"), + new DossierAttributeConfig("id5", "Date", true, DossierAttributeConfig.DossierAttributeType.DATE, "{{dossier.attribute.Date}}"), + new DossierAttributeConfig("id6", "Signature", false, DossierAttributeConfig.DossierAttributeType.IMAGE, "{{dossier.attribute.Signature}}"))); + when(dossierAttributesConfigClient.getDossierAttributes(dossierTemplateId)).thenReturn(dossierAttributesConfig); + + DossierAttributes dossierAttributes = new DossierAttributes(Arrays.asList( + new DossierAttribute("id", "Aktive Substanz"), + new DossierAttribute("id2", "Reporter Status"), + new DossierAttribute("id3", "Dossier Name"), + new DossierAttribute("id4", "Firma"), + new DossierAttribute("id5", OffsetDateTime.now().format(FORMAT_DATE_ENG)), + new DossierAttribute("id6", "data:image/png;base64," + Base64.getEncoder().encodeToString(IOUtils.toByteArray(imageResource.getInputStream()))))); + + when(dossierAttributesClient.getDossierAttributes("dossierId")).thenReturn(dossierAttributes); + + List fileAttributeConfigs = new ArrayList<>(); + fileAttributeConfigs.add(new FileAttributeConfig("3e9b9569-5d2e-4619-848b-dd0a3e96527f", "", "Document Title", true, true, false, false, FileAttributeConfig.FileAttributeType.TEXT, "{{file.attribute.placeholder}}")); + FileAttributesConfig fileAttributesConfig = new FileAttributesConfig("", "", fileAttributeConfigs); + when(fileAttributesClient.getFileAttributes(dossierTemplateId)).thenReturn(fileAttributesConfig); + + Map attributeIdToValue = new HashMap(); + attributeIdToValue.put("3e9b9569-5d2e-4619-848b-dd0a3e96527f", "Test"); + + FileAttributes fileAttributes = new FileAttributes(attributeIdToValue); + FileStatus fileStatus = FileStatus.builder().filename("filename").fileAttributes(fileAttributes).build(); + + Dossier project = Dossier.builder().dossierId("dossierId").dossierName("projectName").build(); + + String templateId = "templateId"; + String storageId = "storageId"; + when(reportTemplateClient.getReportTemplate(dossierTemplateId, templateId)).thenReturn(ReportTemplate.builder() + .dossierTemplateId(dossierTemplateId) + .storageId(storageId) + .build()); + + ClassPathResource templateResource = new ClassPathResource("templates/6464 appendix_b EFSA dRAR justification.docx"); + when(reportStorageService.getReportTemplate(storageId)).thenReturn(IOUtils.toByteArray(templateResource.getInputStream())); + ReportTemplate reportTemplate = ReportTemplate.builder() + .dossierTemplateId("dossierTemplateId") + .templateId("templateId") + .fileName("filename") + .storageId("storageId") + .uploadDate(OffsetDateTime.now()) + .build(); + byte[] report = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE, reportEntries, dossierTemplateId, reportTemplate, fileStatus, project); + + try (FileOutputStream fileOutputStream = new FileOutputStream("/tmp/efsa_template13.docx")) { + fileOutputStream.write(report); + } + } + } diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/Seite13log.json b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/Seite13log.json new file mode 100644 index 0000000..ffaf3db --- /dev/null +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/Seite13log.json @@ -0,0 +1,543 @@ +{ + "analysisVersion": 1, + "redactionLogEntry": [ + { + "id": "c1189b63b3293a2cb315c30feaec3a02", + "type": "false_positive", + "value": "Not stated", + "reason": null, + "matchedRule": 0, + "legalBasis": null, + "redacted": false, + "section": "", + "color": [ + 1, + 0.80784315, + 0.80784315 + ], + "positions": [ + { + "topLeft": { + "x": 197.93, + "y": 568.67 + }, + "width": 45.965927, + "height": 11.017679, + "page": 1 + } + ], + "sectionNumber": 1, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": null, + "textAfter": null, + "comments": null, + "startOffset": 713, + "endOffset": 723, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081665Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": true, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "2e9ba259e223dc1205b5c2b6085bec60", + "type": "CBI_author", + "value": "Cheung", + "reason": "Author found", + "matchedRule": 1, + "legalBasis": "Article 39(e)(1) of Regulation (EC) No 178/2002", + "redacted": true, + "section": "Materials and methods:", + "color": [ + 0.5764706, + 0.59607846, + 0.627451 + ], + "positions": [ + { + "topLeft": { + "x": 153.5, + "y": 403.91 + }, + "width": 35.3013, + "height": 11.017679, + "page": 1 + } + ], + "sectionNumber": 2, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": "ABR89090 (see above, ", + "textAfter": ", 1990 RIP9800436).", + "comments": null, + "startOffset": 425, + "endOffset": 431, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081673Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": false, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "4424ae80a70d7b0ce6d39272ca8b7a19", + "type": "CBI_author", + "value": "Cheung", + "reason": "Author found", + "matchedRule": 1, + "legalBasis": "Article 39(e)(1) of Regulation (EC) No 178/2002", + "redacted": true, + "section": "Materials and methods:", + "color": [ + 0.5764706, + 0.59607846, + 0.627451 + ], + "positions": [ + { + "topLeft": { + "x": 341.23, + "y": 416.51 + }, + "width": 35.30124, + "height": 11.017679, + "page": 1 + } + ], + "sectionNumber": 2, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": "ABR-89089 (see above, ", + "textAfter": ", 1990, RIP9800437)", + "comments": null, + "startOffset": 374, + "endOffset": 380, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081673Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": false, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "d5b033c5e84d2c9d5a8eb0478d8acf20", + "type": "false_positive", + "value": "September", + "reason": null, + "matchedRule": 0, + "legalBasis": null, + "redacted": false, + "section": "Header", + "color": [ + 1, + 0.80784315, + 0.80784315 + ], + "positions": [ + { + "topLeft": { + "x": 459.31998, + "y": 795.04 + }, + "width": 43.519257, + "height": 10.526819, + "page": 1 + } + ], + "sectionNumber": 4, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": null, + "textAfter": null, + "comments": null, + "startOffset": 54, + "endOffset": 63, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081674Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": true, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "e80985688619cc8d4fdff3091a7b397a", + "type": "false_positive", + "value": "Syngenta", + "reason": null, + "matchedRule": 0, + "legalBasis": null, + "redacted": false, + "section": "", + "color": [ + 1, + 0.80784315, + 0.80784315 + ], + "positions": [ + { + "topLeft": { + "x": 289.84998, + "y": 605.3 + }, + "width": 42.112946, + "height": 11.017679, + "page": 1 + } + ], + "sectionNumber": 1, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": null, + "textAfter": null, + "comments": null, + "startOffset": 630, + "endOffset": 638, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081674Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": true, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "4745a1125efdc81700e0ab9be95e5c75", + "type": "CBI_author", + "value": "Rollins R.D.", + "reason": "Author found", + "matchedRule": 1, + "legalBasis": "Article 39(e)(1) of Regulation (EC) No 178/2002", + "redacted": true, + "section": "", + "color": [ + 0.5764706, + 0.59607846, + 0.627451 + ], + "positions": [ + { + "topLeft": { + "x": 409.96426, + "y": 618.02 + }, + "width": 56.28833, + "height": 11.017679, + "page": 1 + } + ], + "sectionNumber": 1, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": "freezer storage conditions, ", + "textAfter": ", 1995, Study", + "comments": null, + "startOffset": 586, + "endOffset": 598, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081674Z" + } + ], + "engines": [ + "NER", + "DICTIONARY" + ], + "hint": false, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "379492d57d7cf987f7177fb8b31ce0bc", + "type": "recommendation_CBI_author", + "value": "Guideline", + "reason": "Author found", + "matchedRule": 1, + "legalBasis": "Article 39(e)(1) of Regulation (EC) No 178/2002", + "redacted": true, + "section": "", + "color": [ + 0.5529412, + 0.9411765, + 0.42352942 + ], + "positions": [ + { + "topLeft": { + "x": 70.944, + "y": 586.82 + }, + "width": 46.95952, + "height": 10.929359, + "page": 1 + } + ], + "sectionNumber": 1, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": "No CGA24705/2567, RIP9800438 ", + "textAfter": "(s): Not specified", + "comments": null, + "startOffset": 673, + "endOffset": 682, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081675Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": false, + "recommendation": true, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "39b497ef7a81c0283a01c0156fb523ab", + "type": "false_positive", + "value": "August", + "reason": null, + "matchedRule": 0, + "legalBasis": null, + "redacted": false, + "section": "", + "color": [ + 1, + 0.80784315, + 0.80784315 + ], + "positions": [ + { + "topLeft": { + "x": 489.86035, + "y": 740.42 + }, + "width": 32.82184, + "height": 11.017679, + "page": 1 + } + ], + "sectionNumber": 1, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": null, + "textAfter": null, + "comments": null, + "startOffset": 90, + "endOffset": 96, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081675Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": true, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + }, + { + "id": "c0eace8eb34ea01a13a7a55c14dc6e1b", + "type": "false_positive", + "value": "All", + "reason": null, + "matchedRule": 0, + "legalBasis": null, + "redacted": false, + "section": "Materials and methods:", + "color": [ + 1, + 0.80784315, + 0.80784315 + ], + "positions": [ + { + "topLeft": { + "x": 70.944, + "y": 378.57 + }, + "width": 15.0980835, + "height": 11.017679, + "page": 1 + } + ], + "sectionNumber": 2, + "manual": false, + "status": null, + "manualRedactionType": null, + "manualRedactionUserId": null, + "textBefore": null, + "textAfter": null, + "comments": null, + "startOffset": 451, + "endOffset": 454, + "imageHasTransparency": false, + "excluded": false, + "recategorizationType": null, + "legalBasisChangeValue": null, + "changes": [ + { + "type": "ADDED", + "dateTime": "2021-09-09T08:00:53.081675Z" + } + ], + "engines": [ + "DICTIONARY" + ], + "hint": true, + "recommendation": false, + "dictionaryEntry": true, + "image": false, + "dossierDictionaryEntry": false + } + ], + "legalBasis": [ + { + "name": "1.1 personal data (incl. geolocation); Article 39(e)(1)", + "description": "any other personal data except for\n a. the name and address of the applicant;\n b. the names of authors of published or publicly available studies supporting such requests; and the names of all participants and observers in meetings of the Scientific Committee and the Scientific Panels, their working groups and any other ad hoc group meeting on the subject matter.", + "reason": "Article 39(e)(1) of Regulation (EC) No 178/2002" + }, + { + "name": "1.2 vertebrate study related personal data (incl. geolocation); Article 39(e)(2)", + "description": "personal data (names and addresses) of individuals involved in testing on vertebrate studies or in obtaining toxicological information", + "reason": "Article 39(e)(2) of Regulation (EC) No 178/2002" + }, + { + "name": "2. manufacturing or production process", + "description": "the manufacturing or production process, including the method and innovative aspects thereof, as well as other technical and industrial specifications inherent to that process or method, except for information which is relevant to the assessment of safety", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "3. links between a producer and applicant", + "description": "commercial links between a producer or importer and the applicant or the authorisation holder, where applicable", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "4. commercial information", + "description": "commercial information revealing sourcing, market shares or business strategy of the applicant", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "5. quantitative composition", + "description": "quantitative composition of the subject matter of the request, except for information which is relevant to the assessment of safety", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "6. specification of impurity", + "description": "the specification of impurity of the active substance and the related methods of analysis for impurities in the active substance as manufactured, except for the impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant and the related methods of analysis for such impurities", + "reason": "Article 63(2)(b) of Regulation (EC) No 1107/2009" + }, + { + "name": "7. results of production batches", + "description": "results of production batches of the active substance including impurities", + "reason": "Article 63(2)(c) of Regulation (EC) No 1107/2009" + }, + { + "name": "8. composition of a plant protection product", + "description": "information on the complete composition of a plant protection product", + "reason": "Article 63(2)(d) of Regulation (EC) No 1107/2009" + } + ], + "dictionaryVersion": 28, + "dossierDictionaryVersion": 1, + "rulesVersion": 1, + "legalBasisVersion": 1 +} \ No newline at end of file diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/legal13.json b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/legal13.json new file mode 100644 index 0000000..2a84d87 --- /dev/null +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/legal13.json @@ -0,0 +1,47 @@ +[ + { + "name": "1.1 personal data (incl. geolocation); Article 39(e)(1)", + "description": "any other personal data except for\n a. the name and address of the applicant;\n b. the names of authors of published or publicly available studies supporting such requests; and the names of all participants and observers in meetings of the Scientific Committee and the Scientific Panels, their working groups and any other ad hoc group meeting on the subject matter.", + "reason": "Article 39(e)(1) of Regulation (EC) No 178/2002" + }, + { + "name": "1.2 vertebrate study related personal data (incl. geolocation); Article 39(e)(2)", + "description": "personal data (names and addresses) of individuals involved in testing on vertebrate studies or in obtaining toxicological information", + "reason": "Article 39(e)(2) of Regulation (EC) No 178/2002" + }, + { + "name": "2. manufacturing or production process", + "description": "the manufacturing or production process, including the method and innovative aspects thereof, as well as other technical and industrial specifications inherent to that process or method, except for information which is relevant to the assessment of safety", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "3. links between a producer and applicant", + "description": "commercial links between a producer or importer and the applicant or the authorisation holder, where applicable", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "4. commercial information", + "description": "commercial information revealing sourcing, market shares or business strategy of the applicant", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "5. quantitative composition", + "description": "quantitative composition of the subject matter of the request, except for information which is relevant to the assessment of safety", + "reason": "Article 63(2)(a) of Regulation (EC) No 1107/2009 (making reference to Article 39 of Regulation EC No 178/2002)" + }, + { + "name": "6. specification of impurity", + "description": "the specification of impurity of the active substance and the related methods of analysis for impurities in the active substance as manufactured, except for the impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant and the related methods of analysis for such impurities", + "reason": "Article 63(2)(b) of Regulation (EC) No 1107/2009" + }, + { + "name": "7. results of production batches", + "description": "results of production batches of the active substance including impurities", + "reason": "Article 63(2)(c) of Regulation (EC) No 1107/2009" + }, + { + "name": "8. composition of a plant protection product", + "description": "information on the complete composition of a plant protection product", + "reason": "Article 63(2)(d) of Regulation (EC) No 1107/2009" + } +] \ No newline at end of file diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/templates/6464 appendix_b EFSA dRAR justification.docx b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/templates/6464 appendix_b EFSA dRAR justification.docx new file mode 100644 index 0000000..c8e1955 Binary files /dev/null and b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/templates/6464 appendix_b EFSA dRAR justification.docx differ