-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix dv_date_time format see https://jira.vitagroup.ag/browse/CDR-232 * fix test see https://jira.vitagroup.ag/browse/CDR-232
- Loading branch information
1 parent
badd09f
commit 8940c46
Showing
8 changed files
with
395 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ce_test/src/test/java/org/ehrbase/conformance_test/extern/tests/EndTimeTestOverwrite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2022 Stefan Spiska (Vitasystems GmbH) and Hannover Medical School | ||
* | ||
* This file is part of Project EHRbase | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.ehrbase.conformance_test.extern.tests; | ||
|
||
import care.better.platform.web.template.EndTimeTest; | ||
import com.google.common.collect.ImmutableMap; | ||
import com.nedap.archie.rm.composition.Composition; | ||
import com.nedap.archie.rm.composition.Observation; | ||
import com.nedap.archie.rm.composition.Section; | ||
import org.ehrbase.serialisation.RMDataFormat; | ||
import org.ehrbase.serialisation.flatencoding.FlatFormat; | ||
import org.junit.Test; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Map; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.ehrbase.conformance_test.extern.Helper.getFlatJson; | ||
import static org.ehrbase.conformance_test.extern.tests.StatusesTestOverwrite.OBJECT_MAPPER; | ||
|
||
public class EndTimeTestOverwrite extends EndTimeTest { | ||
|
||
@Override | ||
@Test | ||
public void endTimeTest() throws Exception { | ||
String template = this.getFileContent("/res/Demo Vitals.opt"); | ||
OffsetDateTime dateTime = | ||
ZonedDateTime.of(2015, 1, 1, 10, 31, 16, 0, ZoneId.systemDefault()).toOffsetDateTime(); | ||
Map<Object, Object> flatComposition = | ||
ImmutableMap.builder() | ||
.put("ctx/language", "sl") | ||
.put("ctx/territory", "SI") | ||
.put("ctx/composer_name", "Composer") | ||
.put("ctx/id_scheme", "ispek") | ||
.put("ctx/id_namespace", "ispek") | ||
.put("ctx/end_time", "2016-01-01T12:30:30Z") | ||
.put( | ||
"vitals/vitals/haemoglobin_a1c/history_origin", | ||
DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(dateTime)) | ||
.put("vitals/vitals/haemoglobin_a1c/any_event/test_status|terminology", "local") | ||
.put("vitals/vitals/haemoglobin_a1c/any_event/test_status|code", "at0037") | ||
.build(); | ||
|
||
RMDataFormat flatJson = getFlatJson(template, FlatFormat.SIM_SDT); | ||
Composition composition = flatJson.unmarshal(OBJECT_MAPPER.writeValueAsString(flatComposition)); | ||
|
||
Observation observation = | ||
(Observation) ((Section) composition.getContent().get(0)).getItems().get(0); | ||
|
||
assertThat(observation.getData().getOrigin().getValue()).isEqualTo(dateTime); | ||
assertThat(composition.getContext().getEndTime().getValue()) | ||
.hasToString("2016-01-01T12:30:30Z"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...t/src/test/java/org/ehrbase/conformance_test/extern/tests/HistoryOriginTestOverwrite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (c) 2022 Stefan Spiska (Vitasystems GmbH) and Hannover Medical School | ||
* | ||
* This file is part of Project EHRbase | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.ehrbase.conformance_test.extern.tests; | ||
|
||
import care.better.platform.web.template.HistoryOriginTest; | ||
import com.google.common.collect.ImmutableMap; | ||
import com.nedap.archie.rm.composition.Composition; | ||
import com.nedap.archie.rm.composition.Observation; | ||
import com.nedap.archie.rm.composition.Section; | ||
import org.ehrbase.serialisation.RMDataFormat; | ||
import org.ehrbase.serialisation.flatencoding.FlatFormat; | ||
import org.junit.Test; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Map; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.ehrbase.conformance_test.extern.Helper.getFlatJson; | ||
import static org.ehrbase.conformance_test.extern.tests.StatusesTestOverwrite.OBJECT_MAPPER; | ||
|
||
public class HistoryOriginTestOverwrite extends HistoryOriginTest { | ||
|
||
@Override | ||
@Test | ||
public void historyOrigin() throws Exception { | ||
String template = this.getFileContent("/res/Demo Vitals.opt"); | ||
OffsetDateTime dateTime = | ||
ZonedDateTime.of(2015, 1, 1, 10, 31, 16, 0, ZoneId.systemDefault()).toOffsetDateTime(); | ||
Map<Object, Object> flatComposition = | ||
ImmutableMap.builder() | ||
.put("ctx/language", "sl") | ||
.put("ctx/territory", "SI") | ||
.put("ctx/composer_name", "Composer") | ||
.put("ctx/id_scheme", "ispek") | ||
.put("ctx/id_namespace", "ispek") | ||
.put( | ||
"vitals/vitals/haemoglobin_a1c/history_origin", | ||
DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(dateTime)) | ||
.put("vitals/vitals/haemoglobin_a1c/any_event/test_status|terminology", "local") | ||
.put("vitals/vitals/haemoglobin_a1c/any_event/test_status|code", "at0037") | ||
.build(); | ||
|
||
RMDataFormat flatJson = getFlatJson(template, FlatFormat.SIM_SDT); | ||
Composition composition = flatJson.unmarshal(OBJECT_MAPPER.writeValueAsString(flatComposition)); | ||
|
||
Observation observation = | ||
(Observation) ((Section) composition.getContent().get(0)).getItems().get(0); | ||
|
||
assertThat(observation.getData().getOrigin().getValue()).isEqualTo(dateTime); | ||
} | ||
} |
Oops, something went wrong.