diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/hint_only.txt b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/hint_only.txt index bcb25021..930d1f51 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/hint_only.txt +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/hint_only.txt @@ -1,2 +1 @@ -guideline unpublished \ 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 b031c21d..84cbb704 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 @@ -9,8 +9,8 @@ rule "1: Redacted because Section contains Vertebrate" when Section(matchesType("vertebrate")) then - section.redact("name", 1, "Redacted because Section contains Vertebrate", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - section.redact("address", 1, "Redacted because Section contains Vertebrate", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.redact("name", 1, "Vertebrate found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.redact("address", 1, "Vertebrate found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); end @@ -18,8 +18,8 @@ rule "2: Not Redacted because Section contains no Vertebrate" when Section(!matchesType("vertebrate")) then - section.redactNot("name", 2, "Not Redacted because Section contains no Vertebrate"); - section.redactNot("address", 2, "Not Redacted because Section contains no Vertebrate"); + section.redactNot("name", 2, "No Vertebrate found"); + section.redactNot("address", 2, "No Vertebrate found"); end @@ -27,26 +27,26 @@ rule "3: Do not redact Names and Addresses if no redaction Indicator is containe when Section(matchesType("vertebrate"), matchesType("no_redaction_indicator")) then - section.redactNot("name", 3, "Vertebrate was found, but also a no redaction indicator"); - section.redactNot("address", 3, "Vertebrate was found, but also a no redaction indicator"); + section.redactNot("name", 3, "Vertebrate and No Redaction Indicator found"); + section.redactNot("address", 3, "Vertebrate and No Redaction Indicator found"); end -rule "4: Redact Names and Addresses if no_redaction_indicator and redaction_indicator is contained" +rule "4: Do not redact Names and Addresses if no redaction Indicator is contained" + when + Section(matchesType("vertebrate"), matchesType("published_information")) + then + section.redactNot("name", 4, "Vertebrate and Published Information found"); + section.redactNot("address", 4, "Vertebrate and Published Information found"); + end + + +rule "5: 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("name", 4, "Vertebrate was found and no_redaction_indicator and redaction_indicator", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - section.redact("address", 4, "Vertebrate was found and no_redaction_indicator and redaction_indicator", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - end - - -rule "5: Do not redact in guideline sections" - when - Section(headlineContainsWord("guideline") || headlineContainsWord("Guidance")) - then - section.redactNot("name", 5, "Section is a guideline section."); - section.redactNot("address", 5, "Section is a guideline section."); + section.redact("name", 5, "Vertebrate and Redaction Indicator found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.redact("address", 5, "Vertebrate and Redaction Indicator found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); end @@ -54,8 +54,6 @@ rule "6: Redact contact information if applicant is found" when Section(headlineContainsWord("applicant") || text.contains("Applicant") || headlineContainsWord("Primary contact") || headlineContainsWord("Alternative contact")) then - section.redactLineAfter("Name:", "address", 6, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - section.redactBetween("Address:", "Contact", "address", 6, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); section.redactLineAfter("Contact point:", "address", 6, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); section.redactLineAfter("Phone:", "address", 6, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); section.redactLineAfter("Fax:", "address", 6, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); @@ -81,11 +79,8 @@ rule "7: 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("Name:", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - section.redactBetween("Address:", "Contact", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - section.redactBetween("Contact:", "Phone", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - section.redactBetween("Contact:", "Telephone number:", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); - section.redactBetween("Address:", "Manufacturing", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.redactLineAfter("Contact:", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); + section.redactLineAfter("Contact:", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); section.redactLineAfter("Telephone:", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); section.redactLineAfter("Phone:", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)"); section.redactLineAfter("Fax:", "address", 7, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2g)");