Search in sources :

Example 1 with DvCount

use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.

the class DvCountValidatorTest method testValidate.

@Test
void testValidate() throws Exception {
    var node = parseNode("/webtemplate_nodes/dv_count.json");
    var result = validator.validate(new DvCount(10L), node);
    assertTrue(result.isEmpty());
}
Also used : DvCount(com.nedap.archie.rm.datavalues.quantity.DvCount) Test(org.junit.jupiter.api.Test)

Example 2 with DvCount

use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.

the class StatusesTestOverwrite method count.

@Override
@Test
public void count() throws Exception {
    String template = this.getFileContent("/res/test_statuses.opt");
    Map<String, Object> flatComposition = Map.of("ctx/language", "sl", "ctx/territory", "SI", "ctx/composer_name", "George Orwell", "test_statuses/test_statuses:0/count", 1, "test_statuses/test_statuses:0/count|normal_status", "L", "test_statuses/test_statuses:0/count|magnitude_status", ">=", "test_statuses/test_statuses:0/count|accuracy", 10.0, "test_statuses/test_statuses:0/count|accuracy_is_percent", true);
    RMDataFormat flatJson = getFlatJson(template, FlatFormat.SIM_SDT);
    Composition composition = flatJson.unmarshal(OBJECT_MAPPER.writeValueAsString(flatComposition));
    DvCount rmObject = (DvCount) composition.itemAtPath("/content[openEHR-EHR-OBSERVATION.test_statuses.v0]/data[at0001]/events[at0002]/data[at0003]/items[at0014]/value");
    assertThat(rmObject.getNormalStatus()).isNotNull();
    assertThat(rmObject.getNormalStatus().getTerminologyId().getValue()).isEqualTo("openehr_normal_statuses");
    assertThat(rmObject.getNormalStatus().getCodeString()).isEqualTo("L");
    assertThat(rmObject.getMagnitudeStatus()).isEqualTo(">=");
    assertThat(rmObject.getAccuracy()).isEqualTo(10);
    assertThat(rmObject.getAccuracyIsPercent()).isTrue();
    Map<String, Object> value = OBJECT_MAPPER.readValue(flatJson.marshal(composition), Map.class);
    assertThat(value).containsEntry("test_statuses/test_statuses:0/count|normal_status", "L").containsEntry("test_statuses/test_statuses:0/count|magnitude_status", ">=").containsEntry("test_statuses/test_statuses:0/count|accuracy", 10.0).containsEntry("test_statuses/test_statuses:0/count|accuracy_is_percent", true);
}
Also used : Composition(com.nedap.archie.rm.composition.Composition) RMDataFormat(org.ehrbase.serialisation.RMDataFormat) DvCount(com.nedap.archie.rm.datavalues.quantity.DvCount) Test(org.junit.Test) StatusesTest(care.better.platform.web.template.StatusesTest)

Example 3 with DvCount

use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.

the class DvCountValidatorTest method testValidate_Range_Unbounded.

@Test
void testValidate_Range_Unbounded() throws Exception {
    var node = parseNode("/webtemplate_nodes/dv_count_range_unbounded.json");
    var result = validator.validate(new DvCount(0L), node);
    assertTrue(result.isEmpty());
    result = validator.validate(new DvCount(10L), node);
    assertTrue(result.isEmpty());
    result = validator.validate(new DvCount(10000L), node);
    assertTrue(result.isEmpty());
    result = validator.validate(new DvCount(-1L), node);
    assertEquals(1, result.size());
}
Also used : DvCount(com.nedap.archie.rm.datavalues.quantity.DvCount) Test(org.junit.jupiter.api.Test)

Example 4 with DvCount

use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.

the class DvCountValidatorTest method testValidate_Range.

@Test
void testValidate_Range() throws Exception {
    var node = parseNode("/webtemplate_nodes/dv_count_range.json");
    var result = validator.validate(new DvCount(10L), node);
    assertTrue(result.isEmpty());
    result = validator.validate(new DvCount(1L), node);
    assertTrue(result.isEmpty());
    result = validator.validate(new DvCount(0L), node);
    assertEquals(1, result.size());
    result = validator.validate(new DvCount(20L), node);
    assertEquals(1, result.size());
    result = validator.validate(new DvCount(100L), node);
    assertEquals(1, result.size());
}
Also used : DvCount(com.nedap.archie.rm.datavalues.quantity.DvCount) Test(org.junit.jupiter.api.Test)

Aggregations

DvCount (com.nedap.archie.rm.datavalues.quantity.DvCount)4 Test (org.junit.jupiter.api.Test)3 StatusesTest (care.better.platform.web.template.StatusesTest)1 Composition (com.nedap.archie.rm.composition.Composition)1 RMDataFormat (org.ehrbase.serialisation.RMDataFormat)1 Test (org.junit.Test)1