From 926d507583fb1813e2f16090d6921e6b6bc2da8a Mon Sep 17 00:00:00 2001 From: Kilian Schuettler Date: Tue, 16 May 2023 14:18:32 +0200 Subject: [PATCH] RED-6009: Document Tree Structure * ignore wrong pmd vioaltions --- .../layoutparsing/document/factory/TableNodeFactory.java | 1 + .../layoutparsing/document/graph/DocumentTree.java | 1 + .../src/test/resources/drools/prod_syngenta_new.drl | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/factory/TableNodeFactory.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/factory/TableNodeFactory.java index 9b692fc3..b862ca5f 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/factory/TableNodeFactory.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/factory/TableNodeFactory.java @@ -55,6 +55,7 @@ public class TableNodeFactory { } + @SuppressWarnings("PMD.UnusedPrivateMethod") // PMD actually flags this wrong private static void addTableToPage(Page page, SemanticNode parentNode, Table table) { if (!page.getMainBody().contains(parentNode)) { diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/graph/DocumentTree.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/graph/DocumentTree.java index e4649aed..77c358a8 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/graph/DocumentTree.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/layoutparsing/document/graph/DocumentTree.java @@ -67,6 +67,7 @@ public class DocumentTree { } + @SuppressWarnings("PMD.UnusedPrivateMethod") // PMD actually flags this wrong private List createNewChildEntryAndReturnIdImpl(List parentId, NodeType nodeType, SemanticNode node) { if (!entryExists(parentId)) { diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/prod_syngenta_new.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/prod_syngenta_new.drl index e47c1c30..297cac55 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/prod_syngenta_new.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/prod_syngenta_new.drl @@ -334,6 +334,7 @@ rule "22: Redact Emails by RegEx (vertebrate study)" entityCreationService.byRegex("\\b([A-Za-z0-9._%+\\-]+@[A-Za-z0-9.\\-]+\\.[A-Za-z\\-]{1,23}[A-Za-z])\\b", "PII", EntityType.ENTITY, 1, $section) .forEach(emailEntity -> { emailEntity.setRedaction(true); + emailEntity.addEngine(Engine.RULE); emailEntity.setRedactionReason("Found by Email Regex"); emailEntity.setLegalBasis("Article 39(e)(3) of Regulation (EC) No 178/2002"); emailEntity.addMatchedRule(22); @@ -358,6 +359,7 @@ rule "25: Redact Phone and Fax by RegEx (non vertebrate study)" entityCreationService.byRegexIgnoreCase("\\b(contact|telephone|phone|ph\\.|fax|tel|ter|mobile|fel|fer)[a-zA-Z\\s]{0,10}[:.\\s]{0,3}([\\+\\d\\(][\\s\\d\\(\\)\\-\\/\\.]{4,100}\\d)\\b", "PII", EntityType.ENTITY, 2, $section) .forEach(contactEntity -> { contactEntity.setRedaction(true); + contactEntity.addEngine(Engine.RULE); contactEntity.setRedactionReason("Found by Email Regex"); contactEntity.setLegalBasis("Article 39(e)(3) of Regulation (EC) No 178/2002"); contactEntity.addMatchedRule(25); @@ -382,6 +384,7 @@ rule "26: Redact Phone and Fax by RegEx (vertebrate study)" entityCreationService.byRegexIgnoreCase("\\b(contact|telephone|phone|ph\\.|fax|tel|ter|mobile|fel|fer)[a-zA-Z\\s]{0,10}[:.\\s]{0,3}([\\+\\d\\(][\\s\\d\\(\\)\\-\\/\\.]{4,100}\\d)\\b", "PII", EntityType.ENTITY, 2, $section) .forEach(contactEntity -> { contactEntity.setRedaction(true); + contactEntity.addEngine(Engine.RULE); contactEntity.setRedactionReason("Found by Email Regex"); contactEntity.setLegalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002"); contactEntity.addMatchedRule(26); @@ -399,6 +402,7 @@ rule "27: Redact AUTHOR(S) (non vertebrate study)" .forEach(authorEntity -> { authorEntity.setRedaction(true); authorEntity.addMatchedRule(27); + authorEntity.addEngine(Engine.RULE); authorEntity.setRedactionReason("AUTHOR(S) was found"); authorEntity.setLegalBasis("Article 39(e)(3) of Regulation (EC) No 178/2002"); insert(authorEntity); @@ -414,6 +418,7 @@ rule "28: Redact AUTHOR(S) (vertebrate study)" .forEach(authorEntity -> { authorEntity.setRedaction(true); authorEntity.addMatchedRule(28); + authorEntity.addEngine(Engine.RULE); authorEntity.setRedactionReason("AUTHOR(S) was found"); authorEntity.setLegalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002"); insert(authorEntity); @@ -430,6 +435,7 @@ rule "29: Redact AUTHOR(S) (non vertebrate study)" .forEach(authorEntity -> { authorEntity.setRedaction(true); authorEntity.addMatchedRule(29); + authorEntity.addEngine(Engine.RULE); authorEntity.setRedactionReason("AUTHOR(S) was found"); authorEntity.setLegalBasis("Article 39(e)(3) of Regulation (EC) No 178/2002"); insert(authorEntity); @@ -445,6 +451,7 @@ rule "30: Redact AUTHOR(S) (vertebrate study)" .forEach(authorEntity -> { authorEntity.setRedaction(true); authorEntity.addMatchedRule(30); + authorEntity.addEngine(Engine.RULE); authorEntity.setRedactionReason("AUTHOR(S) was found"); authorEntity.setLegalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002"); insert(authorEntity); @@ -461,6 +468,7 @@ rule "31: Redact PERFORMING LABORATORY (Non vertebrate study)" .forEach(laboratoryEntity -> { laboratoryEntity.setRedaction(false); laboratoryEntity.addMatchedRule(31); + laboratoryEntity.addEngine(Engine.RULE); laboratoryEntity.setRedactionReason("PERFORMING LABORATORY was found for non vertebrate study"); dictionary.addLocalDictionaryEntry(laboratoryEntity); insert(laboratoryEntity); @@ -477,6 +485,7 @@ rule "32: Redact PERFORMING LABORATORY (Vertebrate study)" .forEach(laboratoryEntity -> { laboratoryEntity.setRedaction(true); laboratoryEntity.addMatchedRule(32); + laboratoryEntity.addEngine(Engine.RULE); laboratoryEntity.setRedactionReason("PERFORMING LABORATORY was found"); laboratoryEntity.setLegalBasis("Article 39(e)(2) of Regulation (EC) No 178/2002"); dictionary.addLocalDictionaryEntry(laboratoryEntity);