Search in sources :

Example 11 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class CodeSystemTest method serializeCodeSystem.

@Test
public void serializeCodeSystem() throws Exception {
    Identifier identifier = Identifier.builder().use(IdentifierUse.OFFICIAL).system(new Uri("www.hl7.org")).value("OID:1234.1234").build();
    CodeSystem codeSystem = CodeSystem.builder("repo/shortName").addProperty(SupportedConceptProperty.builder(CommonConceptProperties.CHILD).build()).description("Code system description").date("2018-03-09T19:50:21.000+0000").hierarchyMeaning(CodeSystemHierarchyMeaning.IS_A).addIdentifier(identifier).language("en").name("Local code system").narrative(NarrativeStatus.ADDITIONAL, "<div>Some html text</div>").title("title").publisher("B2i").status(PublicationStatus.ACTIVE).content(CodeSystemContentMode.COMPLETE).supplements(new Uri("http://b2i.sg/supplement")).url(new Uri("code system uri")).version("2018.01.01").addConcept(Concept.builder().code("conceptCode").definition("This is a code definition").display("Label").addDesignation(Designation.builder().languageCode("uk_en").use(Coding.builder().code("internal").system("http://b2i.sg/test").build()).value("conceptLabel_uk").build()).addProperty(CodeConceptProperty.builder().code("childConcept").value(new Code("childId")).build()).build()).build();
    applyFilter(codeSystem);
    JsonPath jsonPath = getJsonPath(codeSystem);
    assertThat(jsonPath.getString("resourceType"), equalTo("CodeSystem"));
    assertThat(jsonPath.getString("id"), equalTo("repo/shortName"));
    assertThat(jsonPath.getString("language"), equalTo("en"));
    assertThat(jsonPath.getString("text.status"), equalTo("additional"));
    assertThat(jsonPath.getString("text.div"), equalTo("<div>Some html text</div>"));
    assertThat(jsonPath.getString("url"), equalTo("code system uri"));
    assertThat(jsonPath.getString("identifier[0].use"), equalTo("official"));
    assertThat(jsonPath.getString("identifier[0].system"), equalTo("www.hl7.org"));
    assertThat(jsonPath.getString("identifier[0].value"), equalTo("OID:1234.1234"));
    assertThat(jsonPath.getString("version"), equalTo("2018.01.01"));
    assertThat(jsonPath.getString("name"), equalTo("Local code system"));
    assertThat(jsonPath.getString("title"), equalTo("title"));
    assertThat(jsonPath.getString("status"), equalTo("active"));
    assertThat(jsonPath.getString("publisher"), equalTo("B2i"));
    assertThat(jsonPath.getString("description"), equalTo("Code system description"));
    assertThat(jsonPath.getString("hierarchyMeaning"), equalTo("is-a"));
    assertThat(jsonPath.getString("content"), equalTo("complete"));
    assertThat(jsonPath.getString("supplements"), equalTo("http://b2i.sg/supplement"));
    assertThat(jsonPath.getString("property[0].code"), equalTo("child"));
    assertThat(jsonPath.getString("property[0].uri"), equalTo("http://hl7.org/fhir/concept-properties/child"));
    assertThat(jsonPath.getString("property[0].description"), equalTo("Child"));
    assertThat(jsonPath.getString("property[0].type"), equalTo("code"));
    jsonPath.setRoot("concept[0]");
    assertThat(jsonPath.getString("code"), equalTo("conceptCode"));
    assertThat(jsonPath.getString("display"), equalTo("Label"));
    assertThat(jsonPath.getString("definition"), equalTo("This is a code definition"));
    assertThat(jsonPath.getString("designation[0].language"), equalTo("uk_en"));
    assertThat(jsonPath.getString("designation[0].use.code"), equalTo("internal"));
    assertThat(jsonPath.getString("designation[0].use.system"), equalTo("http://b2i.sg/test"));
    assertThat(jsonPath.getString("designation[0].value"), equalTo("conceptLabel_uk"));
    assertThat(jsonPath.getString("designation[0].languageCode"), equalTo("uk_en"));
    assertThat(jsonPath.getString("property[0].code"), equalTo("childConcept"));
    assertThat(jsonPath.getString("property[0].valueCode"), equalTo("childId"));
}
Also used : Identifier(com.b2international.snowowl.fhir.core.model.dt.Identifier) JsonPath(io.restassured.path.json.JsonPath) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) CodeSystem(com.b2international.snowowl.fhir.core.model.codesystem.CodeSystem) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 12 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class ConceptTest method deserialize.

@Test
public void deserialize() throws Exception {
    Concept readConcept = objectMapper.readValue(objectMapper.writeValueAsString(concept), Concept.class);
    assertEquals(new Code("conceptCode"), readConcept.getCode());
}
Also used : Concept(com.b2international.snowowl.fhir.core.model.codesystem.Concept) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 13 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class QuantityTest method build.

@Test
public void build() throws Exception {
    assertEquals(Double.valueOf(12.3), quantity.getValue());
    assertEquals("mg", quantity.getUnit());
    assertEquals(new Uri("uri:LOINC"), quantity.getSystem());
    assertEquals(new Code("code"), quantity.getCode());
    assertEquals(QuantityComparator.GREATER_OR_EQUAL_TO.getCode(), quantity.getComparator());
}
Also used : Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 14 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class SimpleQuantityTest method deserialize.

@Test
public void deserialize() throws Exception {
    SimpleQuantity readQuantity = objectMapper.readValue(objectMapper.writeValueAsString(quantity), SimpleQuantity.class);
    assertEquals(Double.valueOf(12.3), readQuantity.getValue());
    assertEquals("mg", readQuantity.getUnit());
    assertEquals(new Uri("uri:LOINC"), readQuantity.getSystem());
    assertEquals(new Code("code"), readQuantity.getCode());
}
Also used : SimpleQuantity(com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) OperationOutcomeCode(com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 15 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class FilterTest method deserialize.

@Test
public void deserialize() throws Exception {
    Filter readFilter = objectMapper.readValue(objectMapper.writeValueAsString(filter), Filter.class);
    assertEquals(new Code("code"), readFilter.getCode());
}
Also used : Filter(com.b2international.snowowl.fhir.core.model.codesystem.Filter) OperationOutcomeCode(com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

Code (com.b2international.snowowl.fhir.core.model.dt.Code)22 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)13 Test (org.junit.Test)13 Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)11 OperationOutcomeCode (com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode)4 BatchRequest (com.b2international.snowowl.fhir.core.model.BatchRequest)3 SimpleQuantity (com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 HttpEntity (org.springframework.http.HttpEntity)3 HttpHeaders (org.springframework.http.HttpHeaders)3 RestTemplate (org.springframework.web.client.RestTemplate)3 SnowOwlConfiguration (com.b2international.snowowl.core.config.SnowOwlConfiguration)2 SnowOwlOpenApiWebMvcResource (com.b2international.snowowl.core.rest.SnowOwlOpenApiWebMvcResource)2 Designation (com.b2international.snowowl.fhir.core.model.Designation)2 OperationDefinition (com.b2international.snowowl.fhir.core.model.operationdefinition.OperationDefinition)2 StringUtils (com.b2international.commons.StringUtils)1 NotFoundException (com.b2international.commons.exceptions.NotFoundException)1 ApplicationContext (com.b2international.snowowl.core.ApplicationContext)1 CoreActivator (com.b2international.snowowl.core.CoreActivator)1 FhirApiConfig (com.b2international.snowowl.core.rest.FhirApiConfig)1