Search in sources :

Example 31 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule326.

@Test
public void rule326() throws Exception {
    final String ruleId = "326";
    indexRule(ruleId);
    SnomedConceptDocument concept1 = concept(generateConceptId()).effectiveTime(effectiveTime).build();
    SnomedDescriptionIndexEntry description1 = description(generateDescriptionId(), Concepts.SYNONYM, "Good       synonym!?+$*~~~~").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept1.getId()).build();
    SnomedConceptDocument concept2 = concept(generateConceptId()).effectiveTime(effectiveTime).build();
    SnomedDescriptionIndexEntry description2 = description(generateDescriptionId(), Concepts.SYNONYM, "Bád synonym ©").conceptId(concept2.getId()).build();
    SnomedConceptDocument concept3 = concept(generateConceptId()).effectiveTime(effectiveTime).build();
    SnomedDescriptionIndexEntry description3 = description(generateDescriptionId(), Concepts.SYNONYM, "Bád synonym ©").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept3.getId()).build();
    indexRevision(MAIN, concept1, concept2, concept3, description1, description2, description3);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, description3.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 32 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule266.

@Test
public void rule266() throws Exception {
    final String ruleId = "266";
    indexRule(ruleId);
    SnomedConceptDocument concept = concept(generateConceptId()).build();
    SnomedDescriptionIndexEntry validDescription1 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Clinical finding (semantic tag)").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept.getId()).build();
    SnomedDescriptionIndexEntry irrelevantDescription1 = description(generateDescriptionId(), Concepts.TEXT_DEFINITION, "Clinical finding (semantic tag)").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept.getId()).build();
    SnomedDescriptionIndexEntry validDescription2 = description(generateDescriptionId(), Concepts.SYNONYM, "Clinical finding ( regime/therapy )").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept.getId()).build();
    SnomedDescriptionIndexEntry invalidDescription1 = description(generateDescriptionId(), Concepts.SYNONYM, "Clinical finding (regime/therapy)").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept.getId()).build();
    SnomedDescriptionIndexEntry invalidDescription2 = description(generateDescriptionId(), Concepts.SYNONYM, "Clinical finding (specimen)").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept.getId()).build();
    indexRevision(MAIN, concept, validDescription1, irrelevantDescription1, validDescription2, invalidDescription1, invalidDescription2);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, invalidDescription1.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, invalidDescription2.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 33 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule663.

@Test
public void rule663() throws Exception {
    final String ruleId = "663";
    indexRule(ruleId);
    SnomedConceptDocument inactiveDestinationConcept = concept(generateConceptId()).active(false).build();
    SnomedConceptDocument inactiveSourceConcept = concept(generateConceptId()).active(false).build();
    SnomedConceptDocument inactiveTypeConcept = concept(generateConceptId()).active(false).build();
    SnomedConceptDocument activeConcept = concept(generateConceptId()).build();
    SnomedRelationshipIndexEntry invalidSourceRelationship = relationship(inactiveSourceConcept.getId(), Concepts.IS_A, activeConcept.getId()).build();
    SnomedRelationshipIndexEntry invalidDestinationRelationship = relationship(activeConcept.getId(), Concepts.IS_A, inactiveDestinationConcept.getId()).build();
    SnomedRelationshipIndexEntry invalidTypeRelationship = relationship(activeConcept.getId(), inactiveTypeConcept.getId(), Concepts.FINDING_SITE).build();
    SnomedRelationshipIndexEntry validRelationship = relationship(activeConcept.getId(), Concepts.IS_A, Concepts.FINDING_SITE).build();
    indexRevision(MAIN, inactiveDestinationConcept, inactiveSourceConcept, inactiveTypeConcept, activeConcept, invalidSourceRelationship, invalidDestinationRelationship, invalidTypeRelationship, validRelationship);
    ValidationIssues validationIssues = validate(ruleId);
    assertAffectedComponents(validationIssues, ComponentIdentifier.of(SnomedRelationship.TYPE, invalidSourceRelationship.getId()), ComponentIdentifier.of(SnomedRelationship.TYPE, invalidDestinationRelationship.getId()), ComponentIdentifier.of(SnomedRelationship.TYPE, invalidTypeRelationship.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 34 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method affectedComponentURI.

@Test
public void affectedComponentURI() throws Exception {
    final String ruleId = "45a";
    indexRule(ruleId);
    // index invalid hierarchical relationship to group 1
    final SnomedRelationshipIndexEntry relationship = relationship(Concepts.FINDING_SITE, Concepts.IS_A, Concepts.MODULE_SCT_MODEL_COMPONENT).relationshipGroup(1).build();
    indexRevision(MAIN, relationship);
    ValidationIssues issues = validate(ruleId);
    ComponentURI componentURI = issues.stream().map(issue -> issue.getAffectedComponentURI()).findFirst().orElse(null);
    assertThat(componentURI).isEqualTo(ComponentURI.of(CodeSystem.uri(CODESYSTEM), SnomedRelationship.TYPE, relationship.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) ComponentURI(com.b2international.snowowl.core.uri.ComponentURI) Test(org.junit.Test)

Example 35 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule54.

@Test
public void rule54() throws Exception {
    final String ruleId = "54";
    indexRule(ruleId);
    // index term with case insensitive case significance
    SnomedDescriptionIndexEntry description = description(generateDescriptionId(), Concepts.SYNONYM, "hello").moduleId(Concepts.MODULE_B2I_EXTENSION).caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).build();
    SnomedDescriptionIndexEntry description2 = description(generateDescriptionId(), Concepts.SYNONYM, "Hello").moduleId(Concepts.MODULE_B2I_EXTENSION).caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).build();
    indexRevision(MAIN, description, description2);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, description.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Aggregations

ValidationIssues (com.b2international.snowowl.core.validation.issue.ValidationIssues)44 Test (org.junit.Test)43 ValidationIssue (com.b2international.snowowl.core.validation.issue.ValidationIssue)9 BaseRevisionIndexTest (com.b2international.index.revision.BaseRevisionIndexTest)5 BaseValidationTest (com.b2international.snowowl.test.commons.validation.BaseValidationTest)5 ComponentURI (com.b2international.snowowl.core.uri.ComponentURI)1 SnomedConceptDocument (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument)1