199 lines
10 KiB
Plaintext
199 lines
10 KiB
Plaintext
package drools
|
|
|
|
import com.iqser.red.service.redaction.v1.server.redaction.model.Section
|
|
|
|
global Section section
|
|
|
|
|
|
// --------------------------------------- CBI rules -------------------------------------------------------------------
|
|
|
|
rule "1: Redacted because Section contains Vertebrate"
|
|
when
|
|
Section(matchesType("vertebrate"))
|
|
then
|
|
section.redact("CBI_author", 1, "Vertebrate found", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
section.redact("CBI_address", 1, "Vertebrate found", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
end
|
|
|
|
|
|
rule "2: Not Redacted because Section contains no Vertebrate"
|
|
when
|
|
Section(!matchesType("vertebrate"))
|
|
then
|
|
section.redactNot("CBI_author", 2, "No Vertebrate found");
|
|
section.redactNot("CBI_address", 2, "No Vertebrate found");
|
|
end
|
|
|
|
|
|
rule "3: Do not redact Names and Addresses if no redaction Indicator is contained"
|
|
when
|
|
Section(matchesType("vertebrate"), matchesType("no_redaction_indicator"))
|
|
then
|
|
section.redactNot("CBI_author", 3, "Vertebrate and No Redaction Indicator found");
|
|
section.redactNot("CBI_address", 3, "Vertebrate and No Redaction Indicator found");
|
|
end
|
|
|
|
|
|
rule "4: Do not redact Names and Addresses if no redaction Indicator is contained"
|
|
when
|
|
Section(matchesType("vertebrate"), matchesType("published_information"))
|
|
then
|
|
section.redactNot("CBI_author", 4, "Vertebrate and Published Information found");
|
|
section.redactNot("CBI_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("CBI_author", 5, "Vertebrate and Redaction Indicator found", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
section.redact("CBI_address", 5, "Vertebrate and Redaction Indicator found", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
end
|
|
|
|
|
|
rule "6: Not redacted because Vertebrate Study = N"
|
|
when
|
|
Section(rowEquals("Vertebrate study Y/N", "N") || rowEquals("Vertebrate study Y/N", "No"))
|
|
then
|
|
section.redactNotCell("Author(s)", 6, "CBI_author", "Not redacted because row is not a vertebrate study");
|
|
section.redactNot("CBI_address", 6, "Not redacted because row is not a vertebrate study");
|
|
section.highlightCell("Vertebrate study Y/N", 6, "hint_only");
|
|
end
|
|
|
|
|
|
rule "7: Redact if must redact entry is found"
|
|
when
|
|
Section(matchesType("must_redact"))
|
|
then
|
|
section.redact("CBI_author", 7, "must_redact entry was found.", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
section.redact("CBI_address", 7, "must_redact entry was found.", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
end
|
|
|
|
|
|
rule "8: 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)", 8, "CBI_author", "Redacted because row is a vertebrate study", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
section.redact("CBI_address", 8, "Redacted because row is a vertebrate study", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
section.highlightCell("Vertebrate study Y/N", 8, "must_redact");
|
|
end
|
|
|
|
|
|
rule "9: Redact sponsor company"
|
|
when
|
|
Section(searchText.toLowerCase().contains("batches produced at"))
|
|
then
|
|
section.redactIfPrecededBy("batches produced at", "CBI_sponsor", 9, "Redacted because it represents a sponsor company", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
section.addHintAnnotation("batches produced at", "must_redact");
|
|
end
|
|
|
|
|
|
rule "10: Redact determination of residues"
|
|
when
|
|
Section(searchText.toLowerCase.contains("determination of residues") && (
|
|
searchText.toLowerCase.contains("livestock") ||
|
|
searchText.toLowerCase.contains("live stock") ||
|
|
searchText.toLowerCase.contains("egg") ||
|
|
searchText.toLowerCase.contains("milk") ||
|
|
searchText.toLowerCase.contains("bovine") ||
|
|
searchText.toLowerCase.contains("ruminant")
|
|
))
|
|
then
|
|
section.redact("CBI_author", 10, "Determination of residues was found.", "Reg (EC) No 1107/2009 Art. 63 (2g)");
|
|
section.redact("CBI_address", 10, "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("egg", "must_redact");
|
|
section.addHintAnnotation("milk", "must_redact");
|
|
section.addHintAnnotation("bovine", "must_redact");
|
|
section.addHintAnnotation("ruminant", "must_redact");
|
|
end
|
|
|
|
|
|
// --------------------------------------- PII rules -------------------------------------------------------------------
|
|
|
|
|
|
rule "11: Redacted PII Personal Identification Information"
|
|
when
|
|
Section(matchesType("PII"))
|
|
then
|
|
section.redact("PII", 11, "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
end
|
|
|
|
|
|
rule "12: Redact contact information if applicant is found"
|
|
when
|
|
Section(headlineContainsWord("applicant") || text.contains("Applicant") || headlineContainsWord("Primary contact") || headlineContainsWord("Alternative contact") || text.contains("Contact:") || text.contains("Telephone number:"))
|
|
then
|
|
section.redactLineAfter("Contact point:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Phone:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Fax:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Tel.:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Tel:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("E-mail:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Email:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("e-mail:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("E-mail address:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Contact:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Alternative contact:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Telephone number:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Telephone No:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Fax number:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Telephone:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Company:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactBetween("No:", "Fax", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactBetween("Contact:", "Tel.:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("European contact:", "PII", 12, true, "Applicant information was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
end
|
|
|
|
|
|
rule "13: 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", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Telephone:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Phone:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Fax:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("E-mail:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Contact:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Fax number:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Telephone number:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactLineAfter("Tel:", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
section.redactBetween("No:", "Fax", "PII", 13, true, "Producer was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
end
|
|
|
|
|
|
rule "14: Redact AUTHOR(S)"
|
|
when
|
|
Section(searchText.contains("AUTHOR(S):"))
|
|
then
|
|
section.redactLinesBetween("AUTHOR(S):", "COMPLETION DATE:", "PII", 14, true, "AUTHOR(S) was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
end
|
|
|
|
|
|
rule "15: Redact PERFORMING LABORATORY"
|
|
when
|
|
Section(searchText.contains("PERFORMING LABORATORY:"))
|
|
then
|
|
section.redactBetween("PERFORMING LABORATORY:", "LABORATORY PROJECT ID:", "PII", 15, true, "PERFORMING LABORATORY was found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
end
|
|
|
|
|
|
rule "16: 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", 16, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
end
|
|
|
|
|
|
rule "17: 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", 17, false , "PII (Personal Identification Information) found", "Reg (EC) No 1107/2009 Art. 63 (2e)");
|
|
end |