DM-165: Renamed isOnPage to onPage to prevent not working drools optimizations #81
@ -12,7 +12,7 @@ plugins {
|
||||
description = "redaction-service-server-v1"
|
||||
|
||||
|
||||
val layoutParserVersion = "0.18.0"
|
||||
val layoutParserVersion = "0.23.0"
|
||||
val jacksonVersion = "2.15.2"
|
||||
val droolsVersion = "8.42.0.Final"
|
||||
val pdfBoxVersion = "3.0.0-alpha2"
|
||||
|
||||
@ -85,7 +85,7 @@ public interface SemanticNode {
|
||||
}
|
||||
|
||||
|
||||
default boolean isOnPage(int pageNumber) {
|
||||
default boolean onPage(int pageNumber) {
|
||||
|
||||
return getPages().stream().anyMatch(page -> page.getNumber() == pageNumber);
|
||||
}
|
||||
|
||||
@ -143,10 +143,10 @@ public class CustomEntityCreationAdapter {
|
||||
|
||||
private Map<String, List<RedactionEntity>> findAllPossibleEntitiesAndGroupByValue(SemanticNode node, Set<Integer> pageNumbers, Set<String> entryValues) {
|
||||
|
||||
if (!pageNumbers.stream().allMatch(node::isOnPage)) {
|
||||
if (!pageNumbers.stream().allMatch(node::onPage)) {
|
||||
throw new IllegalArgumentException(format("SemanticNode \"%s\" does not contain these pages %s, it has pages: %s",
|
||||
node,
|
||||
pageNumbers.stream().filter(pageNumber -> !node.isOnPage(pageNumber)).toList(),
|
||||
pageNumbers.stream().filter(pageNumber -> !node.onPage(pageNumber)).toList(),
|
||||
node.getPages()));
|
||||
}
|
||||
SearchImplementation searchImplementation = new SearchImplementation(entryValues, true);
|
||||
|
||||
@ -63,7 +63,7 @@ query "getFileAttributes"
|
||||
rule "H.0.0 retract table of contents page"
|
||||
when
|
||||
$page: Page(getMainBodyTextBlock().getSearchText().contains("........") || (getMainBodyTextBlock().getSearchText().contains("APPENDICES") && getMainBodyTextBlock().getSearchText().contains("TABLES")))
|
||||
$node: SemanticNode(isOnPage($page.getNumber()), !isOnPage($page.getNumber() -1))
|
||||
$node: SemanticNode(onPage($page.getNumber()), !onPage($page.getNumber() -1))
|
||||
then
|
||||
retract($node);
|
||||
end
|
||||
@ -347,7 +347,7 @@ rule "DOC.5.0: Strain"
|
||||
|
||||
rule "DOC.7.0: study title by document structure"
|
||||
when
|
||||
$table: Table(isOnPage(1),
|
||||
$table: Table(onPage(1),
|
||||
(containsString("Final Report") || containsString("SPL")),
|
||||
numberOfRows == 1,
|
||||
numberOfCols == 1)
|
||||
@ -361,7 +361,7 @@ rule "DOC.7.0: study title by document structure"
|
||||
|
||||
rule "DOC.7.1: study title"
|
||||
when
|
||||
$table: Table(isOnPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||
$table: Table(onPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||
then
|
||||
entityCreationService.byRegexWithLineBreaksIgnoreCase("(?<=\\n)[\\w\\W]{1,300}(?=\\nFinal Report)", "title", EntityType.ENTITY, $table).findFirst().ifPresent(entity -> {
|
||||
entity.apply("DOC.7.1", "Title found", "n-a");
|
||||
@ -371,8 +371,8 @@ rule "DOC.7.1: study title"
|
||||
|
||||
rule "DOC.7.2: study title"
|
||||
when
|
||||
not Table(isOnPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||
$section: Section(isOnPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||
not Table(onPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||
$section: Section(onPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||
then
|
||||
entityCreationService.byRegexWithLineBreaksIgnoreCase("(?<=\\n)[\\w\\W]{1,300}(?=\\nFinal Report)", "title", EntityType.ENTITY, $section).findFirst().ifPresent(entity -> {
|
||||
entity.apply("DOC.7.2", "Title found", "n-a");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user