use of com.b2international.snowowl.fhir.core.model.codesystem.Property 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.codesystem.Property in project snow-owl by b2ihealthcare.
the class PropertySerializationTest method basicPropertyTest.
@Test
public void basicPropertyTest() throws Exception {
Property property = Property.builder().code("123").valueInteger(2).description("propertyDescription").build();
Fhir fhirParameters = new Parameters.Fhir(property);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
assertThat(jsonPath.getList("parameter").size(), is(3));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("code", FhirDataType.CODE, "123"));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("value", FhirDataType.INTEGER, 2));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("description", FhirDataType.STRING, "propertyDescription"));
}
use of com.b2international.snowowl.fhir.core.model.codesystem.Property in project snow-owl by b2ihealthcare.
the class PropertySerializationTest method minimalPropertyTest.
@Test
public void minimalPropertyTest() throws Exception {
Property property = Property.builder().code("123").build();
Fhir fhirParameters = new Parameters.Fhir(property);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
assertThat(jsonPath.getList("parameter").size(), is(1));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("code", FhirDataType.CODE, "123"));
}
use of com.b2international.snowowl.fhir.core.model.codesystem.Property 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");
}
use of com.b2international.snowowl.fhir.core.model.codesystem.Property in project snow-owl by b2ihealthcare.
the class PropertySerializationTest method dateTimePropertyTest.
@Test
public void dateTimePropertyTest() throws Exception {
Date date = Dates.parse("2018-03-09T20:50:21.000+0100", FhirDates.DATE_TIME_FORMAT);
Property property = Property.builder().code("123").valueDateTime(date).description("propertyDescription").build();
Fhir fhirParameters = new Parameters.Fhir(property);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(fhirParameters));
assertThat(jsonPath.getString("resourceType"), equalTo("Parameters"));
assertThat(jsonPath.getList("parameter").size(), is(3));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("code", FhirDataType.CODE, "123"));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("value", FhirDataType.DATETIME, "2018-03-09T19:50:21.000+0000"));
assertThat(jsonPath, FhirParameterMatcher.hasParameter("description", FhirDataType.STRING, "propertyDescription"));
}
Aggregations