DM-307: Added rules function to check if section has paragraphs #19

Merged
dominique.eiflaender1 merged 1 commits from DM-307-2 into master 2023-06-27 16:29:13 +02:00
3 changed files with 12 additions and 6 deletions
Showing only changes of commit 83329dd0c1 - Show all commits

View File

@ -86,4 +86,9 @@ public class Section implements GenericSemanticNode {
.map(node -> (Headline) node).anyMatch(h -> h.containsStringIgnoreCase(value)); .map(node -> (Headline) node).anyMatch(h -> h.containsStringIgnoreCase(value));
} }
public boolean hasParagraphs(){
return streamAllSubNodesOfType(NodeType.PARAGRAPH).findFirst().isPresent();
}
} }

View File

@ -43,7 +43,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
@Test @Test
public void titleExtraction() throws IOException { public void titleExtraction() throws IOException {
AnalyzeRequest request = uploadFileToStorage("files/Documine/Flora/A13617AV/402_F.3.1 - A13617AV - Acute Dermal Toxicity.pdf"); AnalyzeRequest request = uploadFileToStorage("files/Documine/Flora/A13617AV/474_G.1.2 - 1768300_MMNA_A13617AV_report.pdf");
System.out.println("Start Full integration test"); System.out.println("Start Full integration test");
analyzeService.analyzeDocumentStructure(new StructureAnalyzeRequest(request.getDossierId(), request.getFileId())); analyzeService.analyzeDocumentStructure(new StructureAnalyzeRequest(request.getDossierId(), request.getFileId()));
System.out.println("Finished structure analysis"); System.out.println("Finished structure analysis");

View File

@ -874,6 +874,7 @@ rule "23: Bodyweight changes"
) )
&& !getHeadline().containsString("Appendix") && !getHeadline().containsString("Appendix")
&& !getHeadline().containsString("TABLE") && !getHeadline().containsString("TABLE")
&& hasParagraphs()
) )
then then
var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "bodyweight_changes", EntityType.ENTITY, $section); var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "bodyweight_changes", EntityType.ENTITY, $section);