From 3cb97f6e2782f880f1dbd370a05f29ec2d50e616 Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Thu, 26 Oct 2023 16:06:01 +0200 Subject: [PATCH] RED-6807: updated flora rules --- .../test/resources/drools/documine_flora.drl | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl index 498ae922..1361cd25 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl @@ -227,7 +227,7 @@ rule "DOC.1.3: Guidelines" ) then $section.getEntitiesOfType(List.of("oecd_guideline", "ec_guideline", "epa_guideline")).forEach(entity -> { - entity.removeFromGraph(); + entity.remove("DOC.1.3", "removed"); retract(entity); }); end @@ -292,7 +292,7 @@ rule "DOC.5.0: Ignore species and strain in irrelevant study types" $section: Section(hasEntitiesOfType("species") || hasEntitiesOfType("strain")) then $section.getEntitiesOfType(List.of("species", "strain")).forEach(entity -> { - entity.removeFromGraph(); + entity.remove("DOC.5.0", "removed"); retract(entity); }); end @@ -311,7 +311,7 @@ rule "DOC.5.1: Hide all skipped species and strains except in the relevant secti ) then $section.getEntitiesOfType(List.of("species", "strain")).forEach(entity -> { - entity.removeFromGraph(); + entity.remove("DOC.5.1", "removed"); retract(entity); }); end @@ -401,13 +401,13 @@ rule "DOC.7.1: Performing Laboratory (Country)" .map(nerEntity -> entityCreationService.byNerEntity(nerEntity, "laboratory_country", EntityType.ENTITY, $section)) .forEach(entity -> { entity.apply("DOC.7.1", "Performing Laboratory found", "n-a"); - }); - end + }); + end rule "DOC.7.2: Performing Laboratory (Country & Name) from dict" when $section: Section(containsString("PERFORMING LABORATORY:") || (containsString("PERFORMING") && containsString("LABORATORY:"))) - $countryOrNameFromDictionary: TextEntity(type == "laboratory_country" || type == "laboratory_name", $type: type, isDictionaryEntry()) + $countryOrNameFromDictionary: TextEntity(type == "laboratory_country" || type == "laboratory_name", $type: type, isDictionaryEntry()) from $section.getEntities() then $countryOrNameFromDictionary.apply("DOC.7.2", "Performing " + $type + " dictionary entry found."); end @@ -419,7 +419,10 @@ rule "DOC.7.3: Performing Laboratory (Country) from dict" && !(containsString("PERFORMING LABORATORY:") || (containsString("PERFORMING") && containsString("LABORATORY:"))) ) then - $section.getEntitiesOfType("laboratory_country", "laboratory_name").forEach(entity -> entity.remove("DOC.7.3", "Removed due to wrong section")); + $section.getEntitiesOfType(List.of("laboratory_country", "laboratory_name")).forEach(entity -> { + entity.remove("DOC.7.3", "removed"); + retract(entity); + }); end @@ -953,7 +956,6 @@ rule "DOC.28.1: No. Of animals - Fallback to appendix tables listing all individ .map(Optional::get) .forEach(entity -> { entity.apply("DOC.28.1", "Animal number found.", "n-a"); - insert(entity); }); end @@ -1034,7 +1036,6 @@ rule "DOC.33.0: Dose Mortality" .map(Optional::get) .forEach(entity -> { entity.apply("DOC.33.0", "Dose Mortality Data found.", "n-a"); - insert(entity); }); Stream.of($table.streamTableCellsWithHeader("Dose [mg/kg bodyweight]"), @@ -1050,7 +1051,6 @@ rule "DOC.33.0: Dose Mortality" .map(Optional::get) .forEach(entity -> { entity.apply("DOC.33.0", "Dose Mortality Data found.", "n-a"); - insert(entity); }); end @@ -1290,7 +1290,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when contained by ENTITY" // Rule unit: X.7 -rule "X.7.0: remove all images" +rule "X.7.0: Remove all images" salience 512 when $image: Image(imageType != ImageType.OCR, !hasManualChanges()) -- 2.47.2