RED-6807: adapted all RM rules

This commit is contained in:
Ali Oezyetimoglu 2023-10-16 20:14:55 +02:00
parent 7e9c6c8695
commit c4e73cbdc5

View File

@ -994,48 +994,21 @@ rule "PII.8.1: Redact contact information if producer is found (vertebrate study
rule "PII.9.0: Redact between \"AUTHOR(S)\" and \"(STUDY) COMPLETION DATE\" (non vertebrate study)" rule "PII.9.0: Redact between \"AUTHOR(S)\" and \"(STUDY) COMPLETION DATE\" (non vertebrate study)"
when when
not FileAttribute(label == "Vertebrate Study", value.toLowerCase() == "yes") not FileAttribute(label == "Vertebrate Study", value.toLowerCase() == "yes")
$section: Section(!hasTables(), containsString("AUTHOR(S)"), containsString("AUTHOR(S):"), containsString("COMPLETION DATE:"), containsString("STUDY COMPLETION DATE:")) $document: Document(containsStringIgnoreCase("AUTHOR(S)"), containsAnyStringIgnoreCase("COMPLETION DATE", "STUDY COMPLETION DATE"))
then then
entityCreationService.shortestBetweenAnyString(List.of("AUTHOR(S)", "AUTHOR(S):"), List.of("COMPLETION DATE:", "STUDY COMPLETION DATE:"), "PII", EntityType.ENTITY, $section) entityCreationService.shortestBetweenAnyStringIgnoreCase(List.of("AUTHOR(S)", "AUTHOR(S):"), List.of("COMPLETION DATE", "COMPLETION DATE:", "STUDY COMPLETION DATE", "STUDY COMPLETION DATE:"), "PII", EntityType.ENTITY, $document)
.forEach(authorEntity -> authorEntity.redact("PII.9.0", "AUTHOR(S) was found", "Article 39(e)(3) of Regulation (EC) No 178/2002")); .forEach(authorEntity -> authorEntity.redact("PII.9.0", "AUTHOR(S) was found", "Article 39(e)(3) of Regulation (EC) No 178/2002"));
end end
//rule "PII.9.1: Redact between \"AUTHOR(S)\" and \"STUDY COMPLETION DATE\" (non vertebrate study)"
// when
// not FileAttribute(label == "Vertebrate Study", value.toLowerCase() == "yes")
// $section: Section(!hasTables(), containsString("AUTHOR(S)"), containsString("AUTHOR(S):"), containsString("STUDY COMPLETION DATE:"))
// then
// entityCreationService.shortestBetweenAnyString(List.of("AUTHOR(S)", "AUTHOR(S):"), List.of("STUDY COMPLETION DATE:"), "PII", EntityType.ENTITY, $section)
// .forEach(authorEntity -> authorEntity.redact("PII.9.1", "AUTHOR(S) was found", "Article 39(e)(3) of Regulation (EC) No 178/2002"));
// end
rule "PII.9.1: Redact between \"AUTHOR(S)\" and \"(STUDY) COMPLETION DATE\" (vertebrate study)" rule "PII.9.1: Redact between \"AUTHOR(S)\" and \"(STUDY) COMPLETION DATE\" (vertebrate study)"
when when
FileAttribute(label == "Vertebrate Study", value.toLowerCase() == "yes") FileAttribute(label == "Vertebrate Study", value.toLowerCase() == "yes")
$section: Section(!hasTables(), containsString("AUTHOR(S)"), containsString("AUTHOR(S):"), containsString("COMPLETION DATE:"), containsString("STUDY COMPLETION DATE:")) $document: Document(containsStringIgnoreCase("AUTHOR(S)"), containsAnyStringIgnoreCase("COMPLETION DATE", "STUDY COMPLETION DATE"))
then then
entityCreationService.shortestBetweenAnyString(List.of("AUTHOR(S)", "AUTHOR(S):"), List.of("COMPLETION DATE:", "STUDY COMPLETION DATE:"), "PII", EntityType.ENTITY, $section) entityCreationService.shortestBetweenAnyStringIgnoreCase(List.of("AUTHOR(S)", "AUTHOR(S):"), List.of("COMPLETION DATE", "COMPLETION DATE:", "STUDY COMPLETION DATE", "STUDY COMPLETION DATE:"), "PII", EntityType.ENTITY, $document)
.forEach(authorEntity -> authorEntity.redact("PII.9.1", "AUTHOR(S) was found", "Article 39(e)(2) of Regulation (EC) No 178/2002")); .forEach(authorEntity -> authorEntity.redact("PII.9.1", "AUTHOR(S) was found", "Article 39(e)(2) of Regulation (EC) No 178/2002"));
end end
//rule "PII.9.3: Redact between \"AUTHOR(S)\" and \"STUDY COMPLETION DATE\" (vertebrate study)"
// when
// FileAttribute(label == "Vertebrate Study", value.toLowerCase() == "yes")
// $section: Section(!hasTables(), containsString("AUTHOR(S)"), containsString("AUTHOR(S):"), containsString("STUDY COMPLETION DATE:"))
// then
// entityCreationService.shortestBetweenAnyString(List.of("AUTHOR(S)", "AUTHOR(S):"), List.of("STUDY COMPLETION DATE:"), "PII", EntityType.ENTITY, $section)
// .forEach(authorEntity -> authorEntity.redact("PII.9.3", "AUTHOR(S) was found", "Article 39(e)(2) of Regulation (EC) No 178/2002"));
// end
rule "PII.9.4: Redact between \"AUTHOR(S)\" and \"STUDY COMPLETION DATE\" (vertebrate study)"
when
FileAttribute(label == "Vertebrate Study", value.toLowerCase() == "yes")
$document: Document(containsStringIgnoreCase("AUTHOR(S)"), containsStringIgnoreCase("STUDY COMPLETION DATE"))
then
entityCreationService.shortestBetweenAnyStringIgnoreCase(List.of("AUTHOR(S):","AUTHOR(S)"), List.of("STUDY COMPLETION DATE:","STUDY COMPLETION DATE"), "PII", EntityType.ENTITY, $document)
.forEach(authorEntity -> authorEntity.apply("PII.9.4", "AUTHOR(S) was found", "Article 39(e)(2) of Regulation (EC) No 178/2002"));
end
// Rule unit: PII.10 // Rule unit: PII.10
rule "PII.10.0: Redact study director abbreviation" rule "PII.10.0: Redact study director abbreviation"