use of com.b2international.snowowl.fhir.core.model.Designation in project snow-owl by b2ihealthcare.
the class LookupSnomedRestTest method lookupSnomedCodeSystemCodeTest.
// GET SNOMED CT with properties
@Test
public void lookupSnomedCodeSystemCodeTest() throws Exception {
String responseString = givenAuthenticatedRequest(FHIR_ROOT_CONTEXT).param("system", "http://snomed.info/sct").param("code", // procedure by method
"128927009").param("property", "inactive").param("property", // method
"http://snomed.info/id/260686004").param("_format", "json").when().get("/CodeSystem/$lookup").then().assertThat().statusCode(200).extract().body().asString();
LookupResult result = convertToResult(responseString);
// Mandatory parameters
assertEquals("SNOMED CT", result.getName());
assertEquals("Procedure by method", result.getDisplay());
assertNull(result.getVersion());
// Designations
Collection<Designation> designations = result.getDesignation();
assertTrue(designations.isEmpty());
// Properties
Collection<Property> properties = result.getProperty();
assertEquals(2, properties.size());
Property inactiveProperty = getProperty(properties, "inactive");
assertThat(inactiveProperty.getValue()).isEqualTo(false);
Property associatedMProperty = getProperty(properties, Concepts.METHOD);
// method = Action
assertThat(associatedMProperty.getValue()).isEqualTo("129264002");
}
use of com.b2international.snowowl.fhir.core.model.Designation in project snow-owl by b2ihealthcare.
the class SnomedFhirCodeSystemLookupConverter method expandDesignations.
@Override
public List<Designation> expandDesignations(ServiceProvider context, CodeSystem codeSystem, Concept concept, LookupRequest request, String acceptLanguage) {
SnomedConcept snomedConcept = concept.getInternalConceptAs();
if (request.isPropertyRequested(SupportedCodeSystemRequestProperties.DESIGNATION)) {
List<Designation> designations = new ArrayList<>();
for (SnomedDescription description : snomedConcept.getDescriptions()) {
Coding coding = Coding.builder().system(codeSystem.getUrl().getUriValue()).code(description.getTypeId()).display(SnomedDisplayTermType.PT.getLabel(description.getType())).build();
designations.add(Designation.builder().languageCode(description.getLanguageCode()).use(coding).value(description.getTerm()).build());
}
return designations;
} else {
return FhirCodeSystemLookupConverter.super.expandDesignations(context, codeSystem, concept, request, acceptLanguage);
}
}
use of com.b2international.snowowl.fhir.core.model.Designation in project snow-owl by b2ihealthcare.
the class DesignationSerializationTest method designationTest.
@Test
public void designationTest() throws Exception {
Coding coding = Coding.builder().code("1234").system("http://www.whocc.no/atc").version("20180131").build();
Designation designation = Designation.builder().languageCode("en_uk").use(coding).value("dValue").build();
Fhir fhirParameters = new Parameters.Fhir(designation);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
assertThat(jsonPath.getString("parameter[0].name"), equalTo("language"));
assertThat(jsonPath.getString("parameter[0].valueCode"), equalTo("en_uk"));
assertThat(jsonPath.getString("parameter[2].name"), equalTo("value"));
assertThat(jsonPath.getString("parameter[2].valueString"), equalTo("dValue"));
jsonPath.setRoot("parameter[1]");
assertThat(jsonPath.getString("name"), equalTo("use"));
assertThat(jsonPath.getString("valueCoding.code"), equalTo("1234"));
assertThat(jsonPath.getString("valueCoding.system"), equalTo("http://www.whocc.no/atc"));
assertThat(jsonPath.getString("valueCoding.version"), equalTo("20180131"));
}
use of com.b2international.snowowl.fhir.core.model.Designation in project snow-owl by b2ihealthcare.
the class IncludeTest method validate.
private void validate(Include include) {
assertEquals(new Uri("system"), include.getSystem());
assertEquals("version", include.getVersion());
assertEquals("valueSetUri", include.getValueSets().iterator().next().getUriValue());
ValueSetFilter filter = include.getFilters().iterator().next();
assertEquals(new Code("filterProperty"), filter.getProperty());
assertEquals(FilterOperator.EQUALS.getCode(), filter.getOperator());
assertEquals(new Code("1234567"), filter.getValue());
ValueSetConcept concept = include.getConcepts().iterator().next();
assertEquals("code", concept.getCode().getCodeValue());
assertEquals("display", concept.getDisplay());
Designation designation = concept.getDesignations().iterator().next();
assertEquals("gb_en", designation.getLanguage());
assertEquals("designationValue", designation.getValue());
assertEquals("internal", designation.getUse().getCode().getCodeValue());
}
use of com.b2international.snowowl.fhir.core.model.Designation in project snow-owl by b2ihealthcare.
the class LookupSnomedRestTest method lookupDefaultPropertiesTest.
// GET SNOMED CT with parameters, default properties
@Test
public void lookupDefaultPropertiesTest() throws Exception {
String responseString = givenAuthenticatedRequest(FHIR_ROOT_CONTEXT).param("system", "http://snomed.info/sct").param("code", Concepts.IS_A).param("property", "designation", "sufficientlyDefined", "inactive", "effectiveTime").param("_format", "json").when().get("/CodeSystem/$lookup").then().assertThat().statusCode(200).extract().body().asString();
LookupResult result = convertToResult(responseString);
assertEquals("SNOMED CT", result.getName());
assertEquals("Is a", result.getDisplay());
// Designations
Collection<Designation> designations = result.getDesignation();
Designation ptDesignation = designations.stream().filter(d -> "Is a".equals(d.getValue())).findFirst().get();
assertThat(ptDesignation.getUse().getCodeValue()).isEqualTo(Concepts.SYNONYM);
assertThat(ptDesignation.getUse().getDisplay()).isEqualTo("Synonym");
Designation fsnDesignation = designations.stream().filter(d -> d.getValue().equals("Is a (attribute)")).findFirst().get();
assertThat(fsnDesignation.getUse().getCodeValue()).isEqualTo(Concepts.FULLY_SPECIFIED_NAME);
assertThat(fsnDesignation.getUse().getDisplay()).isEqualTo("Fully specified name");
// Properties
Collection<Property> properties = result.getProperty();
properties.forEach(System.out::println);
Property definitionProperty = getProperty(properties, "sufficientlyDefined");
assertThat(definitionProperty.getValue()).isEqualTo(false);
Property statusProperty = getProperty(properties, "inactive");
assertThat(statusProperty.getValue()).isEqualTo(false);
Property effectiveTimeProperty = getProperty(properties, "effectiveTime");
assertThat(effectiveTimeProperty.getValue()).isEqualTo("20110131");
Set<String> codeValues = properties.stream().map(p -> p.getCode()).collect(Collectors.toSet());
assertThat(codeValues).doesNotContain("parent");
}
Aggregations