DM-305: Improved rules for DocuMine

This commit is contained in:
deiflaender 2023-06-26 16:40:24 +02:00
parent 78a42ed86a
commit a36dcc5db1

View File

@ -265,9 +265,9 @@ rule "3: Experimental Completion Date"
$section: Section( $section: Section(
(hasEntitiesOfType("species") || hasEntitiesOfType("strain")) (hasEntitiesOfType("species") || hasEntitiesOfType("strain"))
&& !( && !(
getHeadline().containsString("test system") anyHeadlineContainsStringIgnoreCase("test system")
|| getHeadline().containsString("animals") || anyHeadlineContainsStringIgnoreCase("animals")
|| getHeadline().containsString("specification") || anyHeadlineContainsStringIgnoreCase("specification")
) )
) )
then then
@ -304,9 +304,9 @@ rule "5: Strain"
hasEntitiesOfType("species") hasEntitiesOfType("species")
&& hasEntitiesOfType("strain") && hasEntitiesOfType("strain")
&& ( && (
getHeadline().containsStringIgnoreCase("test system") anyHeadlineContainsStringIgnoreCase("test system")
|| getHeadline().containsStringIgnoreCase("animals") || anyHeadlineContainsStringIgnoreCase("animals")
|| getHeadline().containsStringIgnoreCase("specification") || anyHeadlineContainsStringIgnoreCase("specification")
) )
) )
then then
@ -681,12 +681,11 @@ rule "13: Clinical Signs"
&& !getHeadline().containsString("TABLE") && !getHeadline().containsString("TABLE")
) )
then then
entityCreationService.bySemanticNode($section, "clinical_signs", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "clinical_signs", EntityType.ENTITY, $section);
entity.setRedactionReason("Clinical Signs found"); entity.setRedactionReason("Clinical Signs found");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("13"); entity.addMatchedRule("13");
});
end end
@ -781,12 +780,11 @@ rule "19: Necropsy findings"
&& !getHeadline().containsString("Appendix") && !getHeadline().containsString("Appendix")
) )
then then
entityCreationService.bySemanticNode($section, "necropsy_findings", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "necropsy_findings", EntityType.ENTITY, $section);
entity.setRedactionReason("Necropsy section found"); entity.setRedactionReason("Necropsy section found");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("19"); entity.addMatchedRule("19");
});
end end
@ -805,12 +803,12 @@ rule "22: Clinical observations"
) )
then then
entityCreationService.bySemanticNode($section, "clinical_observations", EntityType.ENTITY).ifPresent(entity -> {
entity.setRedactionReason("Clinical observations section found"); var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "clinical_observations", EntityType.ENTITY, $section);
entity.setLegalBasis("n-a"); entity.setRedactionReason("Clinical observations section found");
entity.setRedaction(true); entity.setLegalBasis("n-a");
entity.addMatchedRule("22"); entity.setRedaction(true);
}); entity.addMatchedRule("22");
end end
@ -878,13 +876,11 @@ rule "23: Bodyweight changes"
&& !getHeadline().containsString("TABLE") && !getHeadline().containsString("TABLE")
) )
then then
var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "bodyweight_changes", EntityType.ENTITY, $section);
entityCreationService.bySemanticNode($section, "bodyweight_changes", EntityType.ENTITY).ifPresent(entity -> { entity.setRedactionReason("Bodyweight section found");
entity.setRedactionReason("Bodyweight section found"); entity.setLegalBasis("n-a");
entity.setLegalBasis("n-a"); entity.setRedaction(true);
entity.setRedaction(true); entity.addMatchedRule("23");
entity.addMatchedRule("23");
});
end end
@ -895,13 +891,11 @@ rule "24: Study Design"
getHeadline().containsString("study design") getHeadline().containsString("study design")
) )
then then
var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "study_design", EntityType.ENTITY, $section);
entityCreationService.bySemanticNode($section, "study_design", EntityType.ENTITY).ifPresent(entity -> { entity.setRedactionReason("Study design section found");
entity.setRedactionReason("Study design section found"); entity.setLegalBasis("n-a");
entity.setLegalBasis("n-a"); entity.setRedaction(true);
entity.setRedaction(true); entity.addMatchedRule("24");
entity.addMatchedRule("24");
});
end end
@ -916,13 +910,11 @@ rule "25: Results and Conclusion (406, 428, 438, 439, 474 & 487)"
!getHeadline().containsString("TABLE") && !getHeadline().containsString("DISCUSSION") && !getHeadline().containsString("TABLE") && !getHeadline().containsString("DISCUSSION") &&
!getHeadline().containsString("CONCLUSIONS") && !getHeadline().containsString("Interpretation") && !getHeadline().containsString("Viability")) !getHeadline().containsString("CONCLUSIONS") && !getHeadline().containsString("Interpretation") && !getHeadline().containsString("Viability"))
then then
var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "results_and_conclusion", EntityType.ENTITY, $section);
entityCreationService.bySemanticNode($section, "results_and_conclusion", EntityType.ENTITY).ifPresent(entity -> { entity.setRedactionReason("Results and Conclusion found");
entity.setRedactionReason("Results and Conclusion found"); entity.setLegalBasis("n-a");
entity.setLegalBasis("n-a"); entity.setRedaction(true);
entity.setRedaction(true); entity.addMatchedRule("25");
entity.addMatchedRule("25");
});
end end
@ -934,12 +926,11 @@ rule "26: Detailing (404 & 405)"
getHeadline().containsString("Results") && !getHeadline().containsString("Evaluation") && !getHeadline().containsString("study") getHeadline().containsString("Results") && !getHeadline().containsString("Evaluation") && !getHeadline().containsString("study")
) )
then then
entityCreationService.bySemanticNode($section, "detailing", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "detailing", EntityType.ENTITY, $section);
entity.setRedactionReason("Detailing found"); entity.setRedactionReason("Detailing found");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("26"); entity.addMatchedRule("26");
});
end end
@ -952,12 +943,11 @@ rule "32: Preliminary Test Results (429)"
|| getHeadline().containsString("Pre-Experiment")) || getHeadline().containsString("Pre-Experiment"))
) )
then then
entityCreationService.bySemanticNode($section, "preliminary_test_results", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "preliminary_test_results", EntityType.ENTITY, $section);
entity.setRedactionReason("Preliminary Test Results found"); entity.setRedactionReason("Preliminary Test Results found");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("32"); entity.addMatchedRule("32");
});
end end
@ -966,12 +956,11 @@ rule "33: Test Results (429)"
FileAttribute(label == "OECD Number", value == "429") FileAttribute(label == "OECD Number", value == "429")
$section: Section((getHeadline().containsString("RESULTS AND DISCUSSION") || getHeadline().containsString("Estimation of the proliferative response of lymph node cells") || getHeadline().containsString("Results in the Main Experiment"))) $section: Section((getHeadline().containsString("RESULTS AND DISCUSSION") || getHeadline().containsString("Estimation of the proliferative response of lymph node cells") || getHeadline().containsString("Results in the Main Experiment")))
then then
entityCreationService.bySemanticNode($section, "test_results", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "test_results", EntityType.ENTITY, $section);
entity.setRedactionReason("Test Results found"); entity.setRedactionReason("Test Results found");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("33"); entity.addMatchedRule("33");
});
end end
@ -1148,12 +1137,11 @@ rule "39: Dilution of the test substance"
&& containsString("dilution") && containsString("dilution")
) )
then then
entityCreationService.bySemanticNode($section, "dilution", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "dilution", EntityType.ENTITY, $section);
entity.setRedactionReason("Dilution found."); entity.setRedactionReason("Dilution found.");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("39"); entity.addMatchedRule("39");
});
end end
@ -1168,12 +1156,11 @@ rule "40: Positive Control"
) )
) )
then then
entityCreationService.bySemanticNode($section, "positive_control", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "positive_control", EntityType.ENTITY, $section);
entity.setRedactionReason("Positive control found."); entity.setRedactionReason("Positive control found.");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("40"); entity.addMatchedRule("40");
});
end end
@ -1237,12 +1224,11 @@ rule "44: Results (Main Study)"
) )
) )
then then
entityCreationService.bySemanticNode($section, "results_(main_study)", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "results_(main_study)", EntityType.ENTITY, $section);
entity.setRedactionReason("Results for main study found."); entity.setRedactionReason("Results for main study found.");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("44"); entity.addMatchedRule("44");
});
end end
@ -1253,12 +1239,11 @@ rule "45: Doses (mg/kg bodyweight)"
getHeadline().containsString("study design") getHeadline().containsString("study design")
) )
then then
entityCreationService.bySemanticNode($section, "doses_(mg_kg_bw)", EntityType.ENTITY).ifPresent(entity -> { var entity = entityCreationService.byBoundary(Boundary.merge($section.streamAllSubNodesOfType(NodeType.PARAGRAPH).map(SemanticNode::getBoundary).toList()), "doses_(mg_kg_bw)", EntityType.ENTITY, $section);
entity.setRedactionReason("Doses per bodyweight information found"); entity.setRedactionReason("Doses per bodyweight information found");
entity.setLegalBasis("n-a"); entity.setLegalBasis("n-a");
entity.setRedaction(true); entity.setRedaction(true);
entity.addMatchedRule("45"); entity.addMatchedRule("45");
});
end end