Merge branch 'RED-6807-zyx' into 'master'

RED-6807: updated flora rules

Closes RED-6807

See merge request redactmanager/redaction-service!182
This commit is contained in:
Ali Oezyetimoglu 2023-10-26 16:47:33 +02:00
commit f38adabb8c

View File

@ -227,7 +227,7 @@ rule "DOC.1.3: Guidelines"
) )
then then
$section.getEntitiesOfType(List.of("oecd_guideline", "ec_guideline", "epa_guideline")).forEach(entity -> { $section.getEntitiesOfType(List.of("oecd_guideline", "ec_guideline", "epa_guideline")).forEach(entity -> {
entity.removeFromGraph(); entity.remove("DOC.1.3", "removed");
retract(entity); retract(entity);
}); });
end end
@ -292,7 +292,7 @@ rule "DOC.5.0: Ignore species and strain in irrelevant study types"
$section: Section(hasEntitiesOfType("species") || hasEntitiesOfType("strain")) $section: Section(hasEntitiesOfType("species") || hasEntitiesOfType("strain"))
then then
$section.getEntitiesOfType(List.of("species", "strain")).forEach(entity -> { $section.getEntitiesOfType(List.of("species", "strain")).forEach(entity -> {
entity.removeFromGraph(); entity.remove("DOC.5.0", "removed");
retract(entity); retract(entity);
}); });
end end
@ -311,7 +311,7 @@ rule "DOC.5.1: Hide all skipped species and strains except in the relevant secti
) )
then then
$section.getEntitiesOfType(List.of("species", "strain")).forEach(entity -> { $section.getEntitiesOfType(List.of("species", "strain")).forEach(entity -> {
entity.removeFromGraph(); entity.remove("DOC.5.1", "removed");
retract(entity); retract(entity);
}); });
end end
@ -401,13 +401,13 @@ rule "DOC.7.1: Performing Laboratory (Country)"
.map(nerEntity -> entityCreationService.byNerEntity(nerEntity, "laboratory_country", EntityType.ENTITY, $section)) .map(nerEntity -> entityCreationService.byNerEntity(nerEntity, "laboratory_country", EntityType.ENTITY, $section))
.forEach(entity -> { .forEach(entity -> {
entity.apply("DOC.7.1", "Performing Laboratory found", "n-a"); entity.apply("DOC.7.1", "Performing Laboratory found", "n-a");
}); });
end end
rule "DOC.7.2: Performing Laboratory (Country & Name) from dict" rule "DOC.7.2: Performing Laboratory (Country & Name) from dict"
when when
$section: Section(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()) $countryOrNameFromDictionary: TextEntity(type == "laboratory_country" || type == "laboratory_name", $type: type, isDictionaryEntry()) from $section.getEntities()
then then
$countryOrNameFromDictionary.apply("DOC.7.2", "Performing " + $type + " dictionary entry found."); $countryOrNameFromDictionary.apply("DOC.7.2", "Performing " + $type + " dictionary entry found.");
end end
@ -419,7 +419,10 @@ rule "DOC.7.3: Performing Laboratory (Country) from dict"
&& !(containsString("PERFORMING LABORATORY:") || (containsString("PERFORMING") && containsString("LABORATORY:"))) && !(containsString("PERFORMING LABORATORY:") || (containsString("PERFORMING") && containsString("LABORATORY:")))
) )
then 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 end
@ -953,7 +956,6 @@ rule "DOC.28.1: No. Of animals - Fallback to appendix tables listing all individ
.map(Optional::get) .map(Optional::get)
.forEach(entity -> { .forEach(entity -> {
entity.apply("DOC.28.1", "Animal number found.", "n-a"); entity.apply("DOC.28.1", "Animal number found.", "n-a");
insert(entity);
}); });
end end
@ -1034,7 +1036,6 @@ rule "DOC.33.0: Dose Mortality"
.map(Optional::get) .map(Optional::get)
.forEach(entity -> { .forEach(entity -> {
entity.apply("DOC.33.0", "Dose Mortality Data found.", "n-a"); entity.apply("DOC.33.0", "Dose Mortality Data found.", "n-a");
insert(entity);
}); });
Stream.of($table.streamTableCellsWithHeader("Dose [mg/kg bodyweight]"), Stream.of($table.streamTableCellsWithHeader("Dose [mg/kg bodyweight]"),
@ -1050,7 +1051,6 @@ rule "DOC.33.0: Dose Mortality"
.map(Optional::get) .map(Optional::get)
.forEach(entity -> { .forEach(entity -> {
entity.apply("DOC.33.0", "Dose Mortality Data found.", "n-a"); entity.apply("DOC.33.0", "Dose Mortality Data found.", "n-a");
insert(entity);
}); });
end end
@ -1290,7 +1290,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when contained by ENTITY"
// Rule unit: X.7 // Rule unit: X.7
rule "X.7.0: remove all images" rule "X.7.0: Remove all images"
salience 512 salience 512
when when
$image: Image(imageType != ImageType.OCR, !hasManualChanges()) $image: Image(imageType != ImageType.OCR, !hasManualChanges())