DM-165: Renamed isOnPage to onPage to prevent not working drools optimizations
This commit is contained in:
parent
a9c02540c2
commit
ea36f31df4
@ -12,7 +12,7 @@ plugins {
|
|||||||
description = "redaction-service-server-v1"
|
description = "redaction-service-server-v1"
|
||||||
|
|
||||||
|
|
||||||
val layoutParserVersion = "0.18.0"
|
val layoutParserVersion = "0.23.0"
|
||||||
val jacksonVersion = "2.15.2"
|
val jacksonVersion = "2.15.2"
|
||||||
val droolsVersion = "8.42.0.Final"
|
val droolsVersion = "8.42.0.Final"
|
||||||
val pdfBoxVersion = "3.0.0-alpha2"
|
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);
|
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) {
|
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",
|
throw new IllegalArgumentException(format("SemanticNode \"%s\" does not contain these pages %s, it has pages: %s",
|
||||||
node,
|
node,
|
||||||
pageNumbers.stream().filter(pageNumber -> !node.isOnPage(pageNumber)).toList(),
|
pageNumbers.stream().filter(pageNumber -> !node.onPage(pageNumber)).toList(),
|
||||||
node.getPages()));
|
node.getPages()));
|
||||||
}
|
}
|
||||||
SearchImplementation searchImplementation = new SearchImplementation(entryValues, true);
|
SearchImplementation searchImplementation = new SearchImplementation(entryValues, true);
|
||||||
|
|||||||
@ -63,7 +63,7 @@ query "getFileAttributes"
|
|||||||
rule "H.0.0 retract table of contents page"
|
rule "H.0.0 retract table of contents page"
|
||||||
when
|
when
|
||||||
$page: Page(getMainBodyTextBlock().getSearchText().contains("........") || (getMainBodyTextBlock().getSearchText().contains("APPENDICES") && getMainBodyTextBlock().getSearchText().contains("TABLES")))
|
$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
|
then
|
||||||
retract($node);
|
retract($node);
|
||||||
end
|
end
|
||||||
@ -347,7 +347,7 @@ rule "DOC.5.0: Strain"
|
|||||||
|
|
||||||
rule "DOC.7.0: study title by document structure"
|
rule "DOC.7.0: study title by document structure"
|
||||||
when
|
when
|
||||||
$table: Table(isOnPage(1),
|
$table: Table(onPage(1),
|
||||||
(containsString("Final Report") || containsString("SPL")),
|
(containsString("Final Report") || containsString("SPL")),
|
||||||
numberOfRows == 1,
|
numberOfRows == 1,
|
||||||
numberOfCols == 1)
|
numberOfCols == 1)
|
||||||
@ -361,7 +361,7 @@ rule "DOC.7.0: study title by document structure"
|
|||||||
|
|
||||||
rule "DOC.7.1: study title"
|
rule "DOC.7.1: study title"
|
||||||
when
|
when
|
||||||
$table: Table(isOnPage(1), (containsString("Final Report") || containsString("SPL")))
|
$table: Table(onPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||||
then
|
then
|
||||||
entityCreationService.byRegexWithLineBreaksIgnoreCase("(?<=\\n)[\\w\\W]{1,300}(?=\\nFinal Report)", "title", EntityType.ENTITY, $table).findFirst().ifPresent(entity -> {
|
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");
|
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"
|
rule "DOC.7.2: study title"
|
||||||
when
|
when
|
||||||
not Table(isOnPage(1), (containsString("Final Report") || containsString("SPL")))
|
not Table(onPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||||
$section: Section(isOnPage(1), (containsString("Final Report") || containsString("SPL")))
|
$section: Section(onPage(1), (containsString("Final Report") || containsString("SPL")))
|
||||||
then
|
then
|
||||||
entityCreationService.byRegexWithLineBreaksIgnoreCase("(?<=\\n)[\\w\\W]{1,300}(?=\\nFinal Report)", "title", EntityType.ENTITY, $section).findFirst().ifPresent(entity -> {
|
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");
|
entity.apply("DOC.7.2", "Title found", "n-a");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user