diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl index c5d87449..b3e45289 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl @@ -153,6 +153,32 @@ rule "CBI.7.1: Do not redact Names and Addresses if published information found $authorOrAddress.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $authorOrAddress)); end +rule "CBI.7.2: Do not redact PII if published information found in Section without tables" + when + $section: Section(!hasTables(), + hasEntitiesOfType("published_information"), + hasEntitiesOfType("PII")) + then + $section.getEntitiesOfType("PII") + .forEach(redactionEntity -> { + redactionEntity.skipWithReferences( + "CBI.7.2", + "Published Information found in section", + $section.getEntitiesOfType("published_information") + ); + }); + end + +rule "CBI.7.3: Do not redact PII if published information found in same table row" + when + $table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("PII")) + $cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList() + $tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList() + $pii: TextEntity(type() == "PII", active()) from $tableCell.getEntities() + then + $pii.skipWithReferences("CBI.7.3", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $pii)); + end + // Rule unit: CBI.9 rule "CBI.9.0: Redact all cells with Header Author(s) as CBI_author (non vertebrate study)" diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl index c4a828b9..6c1e2519 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl @@ -336,6 +336,32 @@ rule "CBI.7.1: Do not redact Names and Addresses if published information found $authorOrAddress.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $authorOrAddress)); end +rule "CBI.7.2: Do not redact PII if published information found in Section without tables" + when + $section: Section(!hasTables(), + hasEntitiesOfType("published_information"), + hasEntitiesOfType("PII")) + then + $section.getEntitiesOfType("PII") + .forEach(redactionEntity -> { + redactionEntity.skipWithReferences( + "CBI.7.2", + "Published Information found in section", + $section.getEntitiesOfType("published_information") + ); + }); + end + +rule "CBI.7.3: Do not redact PII if published information found in same table row" + when + $table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("PII")) + $cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList() + $tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList() + $pii: TextEntity(type() == "PII", active()) from $tableCell.getEntities() + then + $pii.skipWithReferences("CBI.7.3", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $pii)); + end + // Rule unit: CBI.8 rule "CBI.8.0: Redacted because Section contains must_redact entity" diff --git a/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl b/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl index 892ec7f3..01244c8f 100644 --- a/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl +++ b/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl @@ -337,6 +337,32 @@ rule "CBI.7.1: Do not redact Names and Addresses if published information found $authorOrAddress.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $authorOrAddress)); end +rule "CBI.7.2: Do not redact PII if published information found in Section without tables" + when + $section: Section(!hasTables(), + hasEntitiesOfType("published_information"), + hasEntitiesOfType("PII")) + then + $section.getEntitiesOfType("PII") + .forEach(redactionEntity -> { + redactionEntity.skipWithReferences( + "CBI.7.2", + "Published Information found in section", + $section.getEntitiesOfType("published_information") + ); + }); + end + +rule "CBI.7.3: Do not redact PII if published information found in same table row" + when + $table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("PII")) + $cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList() + $tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList() + $pii: TextEntity(type() == "PII", active()) from $tableCell.getEntities() + then + $pii.skipWithReferences("CBI.7.3", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $pii)); + end + // Rule unit: CBI.8 rule "CBI.8.0: Redacted because Section contains must_redact entity"