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 317976f8..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,23 +401,15 @@ 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"); - insert(entity); }); end rule "DOC.7.2: Performing Laboratory (Country & Name) from dict" when - $section: Section( - (hasEntitiesOfType("laboratory_country") || hasEntitiesOfType("laboratory_name")) - && (containsString("PERFORMING LABORATORY:") || (containsString("PERFORMING") && containsString("LABORATORY:"))) - ) + $section: Section(containsString("PERFORMING LABORATORY:") || (containsString("PERFORMING") && containsString("LABORATORY:"))) + $countryOrNameFromDictionary: TextEntity(type == "laboratory_country" || type == "laboratory_name", $type: type, isDictionaryEntry()) from $section.getEntities() then - $section.getEntitiesOfType("laboratory_country").forEach(entity -> { - entity.apply("DOC.7.2", "Performing laboratory country dictionary entry found.", "n-a"); - }); - $section.getEntitiesOfType("laboratory_name").forEach(entity -> { - entity.apply("DOC.7.2", "Performing laboratory name dictionary entry found.", "n-a"); - }); + $countryOrNameFromDictionary.apply("DOC.7.2", "Performing " + $type + " dictionary entry found."); end rule "DOC.7.3: Performing Laboratory (Country) from dict" @@ -428,7 +420,7 @@ rule "DOC.7.3: Performing Laboratory (Country) from dict" ) then $section.getEntitiesOfType(List.of("laboratory_country", "laboratory_name")).forEach(entity -> { - entity.removeFromGraph(); + entity.remove("DOC.7.3", "removed"); retract(entity); }); end @@ -964,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 @@ -1045,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]"), @@ -1061,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 @@ -1301,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())