DM-307: Added rules function to check if section has paragraphs #19
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user