diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java index 1d339dea..06167504 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java @@ -135,13 +135,35 @@ public class Section { if (StringUtils.isNotBlank(value)) { Set found = findEntities(value.trim(), asType, false, true, ruleNumber, reason, legalBasis); addNewerToEntities(found); + + if (redactEverywhere && !isLocal()) { + localDictionaryAdds.computeIfAbsent(asType, (x) -> new HashSet<>()).add(value.trim()); + } } } } } - public void redactByRegEx(String pattern, boolean patternCaseInsensitive, int group, String asType, int ruleNumber, String reason, String legalBasis) { + public void recommendLineAfter(String start, String asType) { + + String[] values = StringUtils.substringsBetween(text, start, "\n"); + + if (values != null) { + for (String value : values) { + String cleanValue = value.trim(); + if (StringUtils.isNotBlank(cleanValue) && cleanValue.length() >= 3) { + localDictionaryAdds.computeIfAbsent(RECOMMENDATION_PREFIX + asType, (x) -> new HashSet<>()) + .add(cleanValue); + } + } + } + } + + + public void redactByRegEx(String pattern, boolean patternCaseInsensitive, int group, String asType, int ruleNumber, + String reason, String legalBasis) { + Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive); Matcher matcher = compiledPattern.matcher(searchText); @@ -157,6 +179,7 @@ public class Section { public void addRecommendationByRegEx(String pattern, boolean patternCaseInsensitive, int group, String asType) { + Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive); Matcher matcher = compiledPattern.matcher(text); @@ -164,8 +187,7 @@ public class Section { while (matcher.find()) { String match = matcher.group(group); if (StringUtils.isNotBlank(match) && match.length() >= 3) { - localDictionaryAdds.computeIfAbsent(RECOMMENDATION_PREFIX + asType, (x) -> new HashSet<>()) - .add(match); + localDictionaryAdds.computeIfAbsent(RECOMMENDATION_PREFIX + asType, (x) -> new HashSet<>()).add(match); } } } @@ -192,8 +214,7 @@ public class Section { } - public void redactLinesBetween(String start, String stop, String asType, int ruleNumber, - boolean redactEverywhere, + public void redactLinesBetween(String start, String stop, String asType, int ruleNumber, boolean redactEverywhere, String reason, String legalBasis) { String[] values = StringUtils.substringsBetween(text, start, stop); @@ -228,8 +249,7 @@ public class Section { } - public void redactCell(String cellHeader, int ruleNumber, String type, boolean addAsRecommendations, String - reason, + public void redactCell(String cellHeader, int ruleNumber, String type, boolean addAsRecommendations, String reason, String legalBasis) { annotateCell(cellHeader, ruleNumber, type, true, addAsRecommendations, reason, legalBasis); @@ -320,6 +340,7 @@ public class Section { entities.addAll(found); } + private void addNewerToEntities(Entity found) { // HashSet keeps the older value, but we want the new only. entities.remove(found); diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/allAuthors.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/allAuthors.drl new file mode 100644 index 00000000..ff3140d3 --- /dev/null +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/allAuthors.drl @@ -0,0 +1,289 @@ +package drools + +import com.iqser.red.service.redaction.v1.server.redaction.model.Section + +global Section section + + +// --------------------------------------- CBI rules ------------------------------------------------------------------- + +rule "1: Redact CBI Authors" + when + Section(matchesType("CBI_author") || matchesType("recommendation_CBI_author")) + then + section.redact("CBI_author", 1, "Author found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + end + + +rule "2: Redacted because Section contains Vertebrate" + when + Section(matchesType("vertebrate")) + then + section.redact("CBI_address", 2, "Vertebrate found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + end + + +rule "3: Not Redacted because Section contains no Vertebrate" + when + Section(!matchesType("vertebrate")) + then + section.redactNot("CBI_address", 3, "No Vertebrate found"); + end + + +rule "4: Do not redact Names and Addresses if no redaction Indicator is contained" + when + Section(matchesType("vertebrate"), matchesType("no_redaction_indicator")) + then + section.redactNot("CBI_address", 4, "Vertebrate and No Redaction Indicator found"); + end + + +rule "5: Do not redact Names and Addresses if no redaction Indicator is contained" + when + Section(matchesType("vertebrate"), matchesType("published_information")) + then + section.redactNot("CBI_address", 5, "Vertebrate and Published Information found"); + end + + +rule "6: Redact Names and Addresses if no_redaction_indicator and redaction_indicator is contained" + when + Section(matchesType("vertebrate"), matchesType("no_redaction_indicator"), matchesType("redaction_indicator")) + then + section.redact("CBI_address", 6, "Vertebrate and Redaction Indicator found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + end + + +rule "7: Not redacted because Vertebrate Study = N" + when + Section(rowEquals("Vertebrate study Y/N", "N") || rowEquals("Vertebrate study Y/N", "No")) + then + section.redactCell("Author(s)", 7, "CBI_author", true, "Author found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.redactNot("CBI_address", 7, "Not redacted because row is not a vertebrate study"); + section.highlightCell("Vertebrate study Y/N", 7, "hint_only"); + end + + +rule "8: Redact if must redact entry is found" + when + Section(matchesType("must_redact")) + then + section.redact("CBI_address", 8, "must_redact entry was found.", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + end + + +rule "9: Redact Authors and Addresses in Reference Table if it is a Vertebrate study" + when + Section(rowEquals("Vertebrate study Y/N", "Y") || rowEquals("Vertebrate study Y/N", "Yes")) + then + section.redactCell("Author(s)", 9, "CBI_author", true, "Author found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.redact("CBI_address", 9, "Redacted because row is a vertebrate study", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.highlightCell("Vertebrate study Y/N", 9, "must_redact"); + end + + +rule "10: Redact sponsor company" + when + Section(searchText.toLowerCase().contains("batches produced at")) + then + section.redactIfPrecededBy("batches produced at", "CBI_sponsor", 10, "Redacted because it represents a sponsor company", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.addHintAnnotation("batches produced at", "must_redact"); + end + + +rule "11: Redact determination of residues" + when + Section(( + searchText.toLowerCase.contains("determination of residues") || + searchText.toLowerCase.contains("determination of total residues") + ) && ( + searchText.toLowerCase.contains("livestock") || + searchText.toLowerCase.contains("live stock") || + searchText.toLowerCase.contains("tissue") || + searchText.toLowerCase.contains("tissues") || + searchText.toLowerCase.contains("liver") || + searchText.toLowerCase.contains("muscle") || + searchText.toLowerCase.contains("bovine") || + searchText.toLowerCase.contains("ruminant") || + searchText.toLowerCase.contains("ruminants") + )) + then + section.redact("CBI_address", 11, "Determination of residues was found.", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.addHintAnnotation("determination of residues", "must_redact"); + section.addHintAnnotation("livestock", "must_redact"); + section.addHintAnnotation("live stock", "must_redact"); + section.addHintAnnotation("tissue", "must_redact"); + section.addHintAnnotation("tissues", "must_redact"); + section.addHintAnnotation("liver", "must_redact"); + section.addHintAnnotation("muscle", "must_redact"); + section.addHintAnnotation("bovine", "must_redact"); + section.addHintAnnotation("ruminant", "must_redact"); + section.addHintAnnotation("ruminants", "must_redact"); + end + + +rule "12: Redact if CTL/* or BL/* was found" + when + Section(searchText.contains("CTL/") || searchText.contains("BL/")) + then + section.redact("CBI_address", 12, "Laboraty for vertebrate studies found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.addHintAnnotation("CTL", "must_redact"); + section.addHintAnnotation("BL", "must_redact"); + end + + +rule "13: Add recommendation for et al. author" + when + Section(searchText.contains("et al.")) + then + section.addRecommendationByRegEx("\\b([A-ZÄÖÜ][^\\s\\.,]+( [A-ZÄÖÜ]\\.?)?( [A-ZÄÖÜ]\\.?)?) et al\\.?", false, 1, "CBI_author"); + end + + +rule "14: Add recommendation for Addresses in Test Organism sections" + when + Section(searchText.contains("Species:") && searchText.contains("Source:")) + then + section.recommendLineAfter("Source:", "CBI_address"); + end + + +rule "15: Add recommendation for Addresses in Test Animals sections" + when + Section(searchText.contains("Species") && searchText.contains("Source")) + then + section.recommendLineAfter("Source", "CBI_address"); + end + + +// --------------------------------------- PII rules ------------------------------------------------------------------- + + +rule "16: Redacted PII Personal Identification Information" + when + Section(matchesType("PII")) + then + section.redact("PII", 16, "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "17: Redact Emails by RegEx" + when + Section(searchText.contains("@")) + then + section.redactByRegEx("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", true, 0, "PII", 17, "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "18: Redact contact information" + when + Section(text.contains("Contact point:") + || text.contains("Phone:") + || text.contains("Fax:") + || text.contains("Tel.:") + || text.contains("Tel:") + || text.contains("E-mail:") + || text.contains("Email:") + || text.contains("e-mail:") + || text.contains("E-mail address:") + || text.contains("Alternative contact:") + || text.contains("Telephone number:") + || text.contains("Telephone No:") + || text.contains("Fax number:") + || text.contains("Telephone:") + || text.contains("European contact:")) + then + section.redactLineAfter("Contact point:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Phone:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel.:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Email:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("e-mail:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail address:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Alternative contact:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone number:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone No:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax number:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("No:", "Fax", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("Contact:", "Tel.:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("European contact:", "PII", 18, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "19: Redact contact information if applicant is found" + when + Section(headlineContainsWord("applicant") || text.contains("Applicant") || headlineContainsWord("Primary contact") || headlineContainsWord("Alternative contact") || text.contains("Telephone number:")) + then + section.redactLineAfter("Contact point:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Phone:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel.:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Email:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("e-mail:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail address:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Alternative contact:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone number:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone No:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax number:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("No:", "Fax", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("Contact:", "Tel.:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("European contact:", "PII", 19, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "20: Redact contact information if Producer is found" + when + Section(text.toLowerCase().contains("producer of the plant protection") || text.toLowerCase().contains("producer of the active substance") || text.contains("Manufacturer of the active substance") || text.contains("Manufacturer:") || text.contains("Producer or producers of the active substance")) + then + section.redactLineAfter("Contact:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Phone:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax number:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone number:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel:", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("No:", "Fax", "PII", 20, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "21: Redact AUTHOR(S)" + when + Section(searchText.contains("AUTHOR(S):")) + then + section.redactLinesBetween("AUTHOR(S):", "COMPLETION DATE:", "PII", 21, true, "AUTHOR(S) was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "22: Redact PERFORMING LABORATORY" + when + Section(searchText.contains("PERFORMING LABORATORY:")) + then + section.redactBetween("PERFORMING LABORATORY:", "LABORATORY PROJECT ID:", "PII", 22, true, "PERFORMING LABORATORY was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "23: Redact On behalf of Sequani Ltd.:" + when + Section(searchText.contains("On behalf of Sequani Ltd.: Name Title")) + then + section.redactBetween("On behalf of Sequani Ltd.: Name Title", "On behalf of", "PII", 23, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end + + +rule "24: Redact On behalf of Syngenta Ltd.:" + when + Section(searchText.contains("On behalf of Syngenta Ltd.: Name Title")) + then + section.redactBetween("On behalf of Syngenta Ltd.: Name Title", "Study dates", "PII", 24, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + end \ No newline at end of file diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl index 0d455e36..852e57ae 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl @@ -141,26 +141,42 @@ rule "12: Add recommendation for et al. author" section.addRecommendationByRegEx("\\b([A-ZÄÖÜ][^\\s\\.,]+( [A-ZÄÖÜ]\\.?)?( [A-ZÄÖÜ]\\.?)?) et al\\.?", false, 1, "CBI_author"); end + +rule "13: Add recommendation for Addresses in Test Organism sections" + when + Section(searchText.contains("Species:") && searchText.contains("Source:")) + then + section.recommendLineAfter("Source:", "CBI_address"); + end + + +rule "14: Add recommendation for Addresses in Test Animals sections" + when + Section(searchText.contains("Species") && searchText.contains("Source")) + then + section.recommendLineAfter("Source", "CBI_address"); + end + // --------------------------------------- PII rules ------------------------------------------------------------------- -rule "13: Redacted PII Personal Identification Information" +rule "14: Redacted PII Personal Identification Information" when Section(matchesType("PII")) then - section.redact("PII", 13, "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redact("PII", 14, "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "14: Redact Emails by RegEx" +rule "15: Redact Emails by RegEx" when Section(searchText.contains("@")) then - section.redactByRegEx("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", true, 0, "PII", 14, "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactByRegEx("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", true, 0, "PII", 15, "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "15: Redact contact information" +rule "16: Redact contact information" when Section(text.contains("Contact point:") || text.contains("Phone:") @@ -178,96 +194,96 @@ rule "15: Redact contact information" || text.contains("Telephone:") || text.contains("European contact:")) then - section.redactLineAfter("Contact point:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Phone:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Fax:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Tel.:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Tel:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("E-mail:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Email:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("e-mail:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("E-mail address:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Contact:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Alternative contact:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone number:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone No:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Fax number:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactBetween("No:", "Fax", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactBetween("Contact:", "Tel.:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("European contact:", "PII", 15, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact point:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Phone:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel.:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Email:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("e-mail:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail address:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Alternative contact:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone number:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone No:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax number:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("No:", "Fax", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("Contact:", "Tel.:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("European contact:", "PII", 16, true, "Contact information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "16: Redact contact information if applicant is found" +rule "17: Redact contact information if applicant is found" when Section(headlineContainsWord("applicant") || text.contains("Applicant") || headlineContainsWord("Primary contact") || headlineContainsWord("Alternative contact") || text.contains("Telephone number:")) then - section.redactLineAfter("Contact point:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Phone:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Fax:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Tel.:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Tel:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("E-mail:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Email:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("e-mail:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("E-mail address:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Contact:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Alternative contact:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone number:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone No:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Fax number:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactBetween("No:", "Fax", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactBetween("Contact:", "Tel.:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("European contact:", "PII", 16, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact point:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Phone:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel.:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Email:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("e-mail:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail address:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Alternative contact:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone number:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone No:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax number:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("No:", "Fax", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("Contact:", "Tel.:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("European contact:", "PII", 17, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "17: Redact contact information if Producer is found" +rule "18: Redact contact information if Producer is found" when Section(text.toLowerCase().contains("producer of the plant protection") || text.toLowerCase().contains("producer of the active substance") || text.contains("Manufacturer of the active substance") || text.contains("Manufacturer:") || text.contains("Producer or producers of the active substance")) then - section.redactLineAfter("Contact:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Phone:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Fax:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("E-mail:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Contact:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Fax number:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Telephone number:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactLineAfter("Tel:", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); - section.redactBetween("No:", "Fax", "PII", 17, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Phone:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("E-mail:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Contact:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Fax number:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Telephone number:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLineAfter("Tel:", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("No:", "Fax", "PII", 18, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "18: Redact AUTHOR(S)" +rule "19: Redact AUTHOR(S)" when Section(searchText.contains("AUTHOR(S):")) then - section.redactLinesBetween("AUTHOR(S):", "COMPLETION DATE:", "PII", 18, true, "AUTHOR(S) was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactLinesBetween("AUTHOR(S):", "COMPLETION DATE:", "PII", 19, true, "AUTHOR(S) was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "19: Redact PERFORMING LABORATORY" +rule "20: Redact PERFORMING LABORATORY" when Section(searchText.contains("PERFORMING LABORATORY:")) then - section.redactBetween("PERFORMING LABORATORY:", "LABORATORY PROJECT ID:", "PII", 19, true, "PERFORMING LABORATORY was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("PERFORMING LABORATORY:", "LABORATORY PROJECT ID:", "PII", 20, true, "PERFORMING LABORATORY was found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "20: Redact On behalf of Sequani Ltd.:" +rule "21: Redact On behalf of Sequani Ltd.:" when Section(searchText.contains("On behalf of Sequani Ltd.: Name Title")) then - section.redactBetween("On behalf of Sequani Ltd.: Name Title", "On behalf of", "PII", 20, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("On behalf of Sequani Ltd.: Name Title", "On behalf of", "PII", 21, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end -rule "21: Redact On behalf of Syngenta Ltd.:" +rule "22: Redact On behalf of Syngenta Ltd.:" when Section(searchText.contains("On behalf of Syngenta Ltd.: Name Title")) then - section.redactBetween("On behalf of Syngenta Ltd.: Name Title", "Study dates", "PII", 21, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); + section.redactBetween("On behalf of Syngenta Ltd.: Name Title", "Study dates", "PII", 22, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)"); end \ No newline at end of file