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

View File

@ -86,4 +86,9 @@ public class Section implements GenericSemanticNode {
.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
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");
analyzeService.analyzeDocumentStructure(new StructureAnalyzeRequest(request.getDossierId(), request.getFileId()));
System.out.println("Finished structure analysis");

View File

@ -874,13 +874,14 @@ rule "23: Bodyweight changes"
)
&& !getHeadline().containsString("Appendix")
&& !getHeadline().containsString("TABLE")
&& hasParagraphs()
)
then
var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "bodyweight_changes", EntityType.ENTITY, $section);
entity.setRedactionReason("Bodyweight section found");
entity.setLegalBasis("n-a");
entity.setRedaction(true);
entity.addMatchedRule("23");
var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "bodyweight_changes", EntityType.ENTITY, $section);
entity.setRedactionReason("Bodyweight section found");
entity.setLegalBasis("n-a");
entity.setRedaction(true);
entity.addMatchedRule("23");
end