use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers in project snow-owl by b2ihealthcare.
the class SnomedConceptMapSearchRequestEvaluator method evaluate.
@Override
public ConceptMapMappings evaluate(ResourceURI uri, ServiceProvider context, Options search) {
final String preferredDisplay = search.get(OptionKey.DISPLAY, String.class);
final SnomedDisplayTermType snomedDisplayTermType = SnomedDisplayTermType.getEnum(preferredDisplay);
SnomedReferenceSetMembers referenceSetMembers = fetchRefsetMembers(uri, context, search, snomedDisplayTermType);
return toCollectionResource(referenceSetMembers, uri, context, search, snomedDisplayTermType);
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers in project snow-owl by b2ihealthcare.
the class SnomedDescriptionApiTest method updateAcceptabilityWithDefaultModule.
@Test
public void updateAcceptabilityWithDefaultModule() throws Exception {
// All preferred descriptions in the UK language reference set should be changed to acceptable on SNOMED CT Root
changeToAcceptable(branchPath, Concepts.ROOT_CONCEPT, Concepts.REFSET_LANGUAGE_TYPE_UK);
// Add new UK preferred term to SNOMED CT Root
String descriptionId = createNewDescription(branchPath, Concepts.ROOT_CONCEPT, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
// All preferred descriptions in the US language reference set should be changed to acceptable on SNOMED CT Root
changeToAcceptable(branchPath, Concepts.ROOT_CONCEPT, Concepts.REFSET_LANGUAGE_TYPE_US);
// Change UK preferred synonym to US preferred, UK acceptable, with default module ID parameter
Json requestBody = Json.object("acceptability", Json.object(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED), // SNOMED CT Spanish edition module
"defaultModuleId", // SNOMED CT Spanish edition module
"449081005", "commitComment", "Changed UK, added US acceptability to description");
updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, requestBody).statusCode(204);
// Check language member count and module
SnomedReferenceSetMembers members = getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "members()").statusCode(200).body("members.items.refsetId", hasItems(Concepts.REFSET_LANGUAGE_TYPE_UK, Concepts.REFSET_LANGUAGE_TYPE_US)).extract().as(SnomedDescription.class).getMembers();
assertEquals(2, members.getTotal());
members.forEach(m -> assertEquals("Reference set member should be placed in the default module", "449081005", m.getModuleId()));
getComponent(branchPath, SnomedComponentType.CONCEPT, Concepts.ROOT_CONCEPT, "pt()").statusCode(200).body("pt.id", equalTo(descriptionId));
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers in project snow-owl by b2ihealthcare.
the class SnomedDescriptionApiTest method updateAcceptabilityWithRemove.
@Test
public void updateAcceptabilityWithRemove() throws Exception {
changeToAcceptable(branchPath, Concepts.ROOT_CONCEPT, Concepts.REFSET_LANGUAGE_TYPE_US);
String descriptionId = createNewDescription(branchPath, Concepts.ROOT_CONCEPT, Concepts.SYNONYM, Map.<String, Acceptability>of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
Json requestBody = Json.object("acceptability", Json.object(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE), "commitComment", "Removed US preferred acceptability from description");
updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, requestBody).statusCode(204);
SnomedReferenceSetMembers members = getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "members()").statusCode(200).extract().as(SnomedDescription.class).getMembers();
assertEquals(1, members.getTotal());
SnomedReferenceSetMember member = Iterables.getOnlyElement(members);
assertEquals(Concepts.REFSET_LANGUAGE_TYPE_UK, member.getRefsetId());
assertEquals(Concepts.REFSET_DESCRIPTION_ACCEPTABILITY_ACCEPTABLE, member.getProperties().get(SnomedRf2Headers.FIELD_ACCEPTABILITY_ID));
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers in project snow-owl by b2ihealthcare.
the class SnomedConceptApiTest method updateInactivationIndicatorOnActiveConceptWithAssociationTargets.
@Test
public void updateInactivationIndicatorOnActiveConceptWithAssociationTargets() throws Exception {
String conceptId = createNewConcept(branchPath);
Map<?, ?> requestBody = createRefSetMemberRequestBody(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, conceptId).with(SnomedRf2Headers.FIELD_TARGET_COMPONENT_ID, Concepts.ROOT_CONCEPT).with("commitComment", "Created new reference set member");
final String associationMemberId = lastPathSegment(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody).statusCode(201).extract().header("Location"));
// ensure that the concept does not have any indicator set before the update
SnomedReferenceSetMembers currentMembers = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "inactivationProperties(),members()").statusCode(200).body("inactivationProperties.inactivationIndicatorId", nullValue()).body("inactivationProperties.associationTargets.referenceSetId", equalTo(List.of(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION))).body("inactivationProperties.associationTargets.targetComponentId", equalTo(List.of(Concepts.ROOT_CONCEPT))).extract().jsonPath().getObject("members", SnomedReferenceSetMembers.class);
Map<?, ?> updateReq = Json.object("inactivationProperties", new InactivationProperties(Concepts.PENDING_MOVE, List.of(new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, Concepts.ROOT_CONCEPT))), // XXX also pass the current members to the update, without the fix this would cause duplicate association members
"members", currentMembers, "commitComment", "Add a pending move indicator to an active concept");
updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, updateReq).statusCode(204);
List<String> memberIds = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "inactivationProperties(),members()").statusCode(200).body("inactivationProperties.inactivationIndicatorId", equalTo(Concepts.PENDING_MOVE)).body("inactivationProperties.associationTargets.referenceSetId", equalTo(List.of(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION))).body("inactivationProperties.associationTargets.targetComponentId", equalTo(List.of(Concepts.ROOT_CONCEPT))).extract().path("members.items.id");
assertThat(memberIds.remove(associationMemberId)).isTrue();
assertThat(memberIds.remove(associationMemberId)).isFalse();
// the remaining member is the inactivation indicator
assertThat(memberIds).hasSize(1);
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers in project snow-owl by b2ihealthcare.
the class SnomedConceptApiTest method updateAssociationTargetWithDefaultModule.
@Test
public void updateAssociationTargetWithDefaultModule() throws Exception {
String conceptToInactivate = createNewConcept(branchPath);
String firstAssociationTarget = createNewConcept(branchPath);
String secondAssociationTarget = createNewConcept(branchPath);
// Inactivate the duplicate concept and point to the other one
assertInactivation(branchPath, conceptToInactivate, new InactivationProperties(Concepts.DUPLICATE, List.of(new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, firstAssociationTarget))));
// Update the inactivation reason and association target properties, specifying the module
final ValidatableResponse response = assertInactivation(branchPath, conceptToInactivate, new InactivationProperties(Concepts.AMBIGUOUS, List.of(new AssociationTarget(Concepts.REFSET_REPLACED_BY_ASSOCIATION, secondAssociationTarget))), // defaultModuleId
"449081005");
// Check that the default module is honored
final SnomedReferenceSetMembers refSetMembers = response.extract().body().jsonPath().getObject("members", SnomedReferenceSetMembers.class);
refSetMembers.forEach(m -> assertEquals("Reference set member should be placed in the default module", "449081005", m.getModuleId()));
}
Aggregations