From d13a5dc3abde52da5511aecc41a8e3e80326028e Mon Sep 17 00:00:00 2001 From: Severin Date: Fri, 23 Jan 2026 19:25:14 +0100 Subject: [PATCH 1/5] started Testing --- .../medblocks/openfhir/StandardsAsserter.java | 155 +++ .../openfhir/kds/KdsBidirectionalTest.java | 58 +- .../openfhir/kds/diagnose/DiagnoseTest.java | 510 ++++++++++ .../medblocks/openfhir/kds/fall/FallTest.java | 235 +++++ .../kds/laborauftrag/LaborauftragTest.java | 193 ++++ .../kds/laborbericht/LaborberichtTest.java | 451 +++++++++ .../DebugMedikationseintragPrintTest.java | 54 ++ .../MedikationseintragTest.java | 234 +++++ .../MedikamentenverabreichungenTest.java | 133 +++ .../openfhir/kds/person/PersonTest.java | 341 +++++++ .../openfhir/kds/procedure/ProcedureTest.java | 134 +++ .../StudienteilnahmeTest.java | 82 ++ src/test/resources/file_generator.sh | 40 + ...ii-exa-test-data-patient-1-diagnose-1.json | 277 ++++++ ...i-exa-test-data-patient-10-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-2-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-3-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-4-diagnose-1.json | 189 ++++ ...ii-exa-test-data-patient-5-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-6-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-7-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-8-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-9-diagnose-1.json | 247 +++++ ...ii-exa-test-data-patient-1-diagnose-1.json | 124 +++ ...i-exa-test-data-patient-10-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-2-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-3-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-4-diagnose-1.json | 74 ++ ...ii-exa-test-data-patient-5-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-6-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-7-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-8-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-9-diagnose-1.json | 98 ++ .../KDS_Diagnose_Composition_bundle.json | 907 ++++++++++++++++++ ...KDS_Diagnose_Composition_bundle_whole.json | 907 ++++++++++++++++++ .../kds/diagnose/KDS_Diagnose_bundle.json | 23 +- .../diagnose/KDS_Diagnose_bundle_whole.json | 26 +- ...ii-exa-test-data-patient-1-diagnose-1.json | 87 ++ ...i-exa-test-data-patient-10-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-2-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-3-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-4-diagnose-1.json | 74 ++ ...ii-exa-test-data-patient-5-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-6-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-7-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-8-diagnose-1.json | 98 ++ ...ii-exa-test-data-patient-9-diagnose-1.json | 98 ++ .../old/Composition-Fhir-Bundle-input.json | 1 + ...Composition-KDSMedicationRequest.flat.json | 1 + .../old/Composition-jsonobject-from-flat.json | 1 + .../org.highmed/person_data.v0.yml | 21 +- .../versicherungsinformationen.v0.yml | 8 +- .../multiple_coding_icd10gm.v1.yml | 115 ++- .../org.openehr/anatomical_location.v1.yml | 52 +- .../evaluation/org.openehr/gender.v1.yml | 9 +- .../org.openehr/vital_status.v1.yml | 2 +- .../KDS/diagnose/KDS_anatomical_location.yml | 2 +- .../KDS/diagnose/KDS_problem_diagnose.yml | 123 ++- .../KDS_medikationseintrag.context.yaml | 6 +- .../KDS_medikationseintrag.yml | 24 +- .../KDS_medikamentenverabreichung.yml | 24 +- .../org.highmed/KDS/person/KDS_address.yml | 104 ++ .../KDS/person/KDS_admin_entry_person.yml | 5 +- .../KDS/person/person.context.yaml | 8 +- .../KDS/person_pseudo/KDS_address.yml | 105 ++ .../KDS/person_pseudo/KDS_gender.yml | 4 +- .../person_pseudo/pseudo_person.context.yaml | 1 + .../vitalstatus/KDS_Vitalstatus.context.yaml | 5 +- 68 files changed, 9246 insertions(+), 227 deletions(-) create mode 100644 src/test/java/com/medblocks/openfhir/StandardsAsserter.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/fall/FallTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/laborauftrag/LaborauftragTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/laborbericht/LaborberichtTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/medikationseintrag/DebugMedikationseintragPrintTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/medikationseintrag/MedikationseintragTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/medikationsverabreichung/MedikamentenverabreichungenTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/person/PersonTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/procedure/ProcedureTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/studienteilnahme/StudienteilnahmeTest.java create mode 100644 src/test/resources/file_generator.sh create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-10-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-2-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-3-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-4-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-5-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-6-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-7-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-8-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-9-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-1-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-10-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-2-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-3-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-4-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-5-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-6-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-7-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-8-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-9-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle.json create mode 100644 src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle_whole.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-1-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-10-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-2-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-3-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-4-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-5-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-6-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-7-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-8-diagnose-1.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-9-diagnose-1.json create mode 100644 src/test/resources/kds/medikationseintrag/old/Composition-Fhir-Bundle-input.json create mode 100644 src/test/resources/kds/medikationseintrag/old/Composition-KDSMedicationRequest.flat.json create mode 100644 src/test/resources/kds/medikationseintrag/old/Composition-jsonobject-from-flat.json create mode 100644 src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_address.yml create mode 100644 src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_address.yml diff --git a/src/test/java/com/medblocks/openfhir/StandardsAsserter.java b/src/test/java/com/medblocks/openfhir/StandardsAsserter.java new file mode 100644 index 00000000..ec8d0462 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/StandardsAsserter.java @@ -0,0 +1,155 @@ +package com.medblocks.openfhir; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.parser.IParser; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.nedap.archie.rm.composition.Composition; +import org.ehrbase.openehr.sdk.serialisation.jsonencoding.CanonicalJson; +import org.hl7.fhir.r4.model.Bundle; +import org.junit.Assert; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.TreeSet; +import java.util.function.Predicate; +import java.util.regex.Pattern; + +public class StandardsAsserter { + + private static final Gson GSON = new Gson(); + + // sensible defaults (tune these once) + private static final Set DEFAULT_IGNORE_KEYS = Set.of( + "id", + "meta", + "type", + "timestamp" + ); + + private static final List DEFAULT_IGNORE_PATTERNS = List.of( + // NOTE: These patterns apply to *flat keys* in your JsonObject. + // Keep/adjust only if your keys really look like this. + Pattern.compile("^entry\\[\\d+\\]\\.resource\\.id$"), + Pattern.compile("^.*\\|time$"), + Pattern.compile("^.*\\|date_time$") + ); + + JsonObject loadJsonObject(String classpathLocation) { + InputStream is = getClass().getResourceAsStream(classpathLocation); + if (is == null) { + throw new IllegalArgumentException("File not found on classpath: " + classpathLocation); + } + return GSON.fromJson(new InputStreamReader(is, StandardCharsets.UTF_8), JsonObject.class); + } + + public void assertFlatComposition(Composition composition, String filePath) { + JsonObject actual = GSON.fromJson(new CanonicalJson().marshal(composition), JsonObject.class); + JsonObject expected = loadJsonObject(filePath); + assertFlatJsonReadable(actual, expected); // defaults + } + + public void assertBundle(Bundle bundle, String filePath) { + FhirContext ctx = FhirContext.forR4(); + IParser parser = ctx.newJsonParser(); + String serialized = parser.encodeResourceToString(bundle); + + JsonObject actual = GSON.fromJson(serialized, JsonObject.class); + JsonObject expected = loadJsonObject(filePath); + + assertFlatJsonReadable(actual, expected); // defaults + } + + // ------------------------- + // Overloads (clean API) + // ------------------------- + + /** Default ignores, extra keys allowed (recommended for bidirectional tests). */ + public void assertFlatJsonReadable(JsonObject actual, JsonObject expected) { + assertFlatJsonReadable(actual, expected, DEFAULT_IGNORE_KEYS, DEFAULT_IGNORE_PATTERNS, false); + } + + /** Default ignores, choose whether extra keys should fail. */ + public void assertFlatJsonReadable(JsonObject actual, JsonObject expected, boolean strictExtras) { + assertFlatJsonReadable(actual, expected, DEFAULT_IGNORE_KEYS, DEFAULT_IGNORE_PATTERNS, strictExtras); + } + + /** Custom ignores, extra keys allowed. */ + public void assertFlatJsonReadable(JsonObject actual, + JsonObject expected, + Set ignoreKeys, + List ignoreKeyPatterns) { + assertFlatJsonReadable(actual, expected, ignoreKeys, ignoreKeyPatterns, false); + } + + public void assertFlatJsonReadable(JsonObject actual, + JsonObject expected, + Set ignoreKeys, + List ignoreKeyPatterns, + boolean strictExtras) { + + Objects.requireNonNull(actual, "actual JsonObject must not be null"); + Objects.requireNonNull(expected, "expected JsonObject must not be null"); + + Set ignoreKeySet = (ignoreKeys == null) ? Collections.emptySet() : ignoreKeys; + List ignorePatterns = (ignoreKeyPatterns == null) ? Collections.emptyList() : ignoreKeyPatterns; + + Predicate ignored = k -> + ignoreKeySet.contains(k) || + ignorePatterns.stream().anyMatch(p -> p.matcher(k).matches()); + + // filter keys first (so missing/extra logic respects ignores) + Set aKeys = new TreeSet<>(actual.keySet()); + Set eKeys = new TreeSet<>(expected.keySet()); + aKeys.removeIf(ignored); + eKeys.removeIf(ignored); + + Set missing = new TreeSet<>(eKeys); + missing.removeAll(aKeys); + + Set extra = new TreeSet<>(aKeys); + extra.removeAll(eKeys); + + StringBuilder sb = new StringBuilder(); + + Set common = new TreeSet<>(aKeys); + common.retainAll(eKeys); + + for (String key : common) { + JsonElement av = actual.get(key); + JsonElement ev = expected.get(key); + + boolean mismatch = + (av == null && ev != null) || + (av != null && ev == null) || + (av != null && ev != null && !av.equals(ev)); + + if (mismatch) { + sb.append("\nValue mismatch:\n") + .append(" key: ").append(key).append("\n") + .append(" expected: ").append(ev).append("\n") + .append(" actual: ").append(av).append("\n"); + } + } + + if (!missing.isEmpty()) { + sb.append("\nMissing keys (expected but not present):\n"); + missing.forEach(k -> sb.append(" - ").append(k).append("\n")); + } + + if (strictExtras && !extra.isEmpty()) { + sb.append("\nExtra keys (present in actual but not expected):\n"); + extra.forEach(k -> sb.append(" + ").append(k).append("\n")); + } + + if (sb.length() > 0) { + Assert.fail("JSON comparison failed:" + sb); + } + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/KdsBidirectionalTest.java b/src/test/java/com/medblocks/openfhir/kds/KdsBidirectionalTest.java index a30633c9..c60d58ea 100644 --- a/src/test/java/com/medblocks/openfhir/kds/KdsBidirectionalTest.java +++ b/src/test/java/com/medblocks/openfhir/kds/KdsBidirectionalTest.java @@ -7,6 +7,7 @@ import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.medblocks.openfhir.StandardsAsserter; import com.medblocks.openfhir.OpenEhrRmWorker; import com.medblocks.openfhir.TestOpenFhirMappingContext; import com.medblocks.openfhir.fc.schema.context.FhirConnectContext; @@ -29,9 +30,8 @@ import jakarta.annotation.Nullable; import java.io.IOException; import java.io.InputStream; -import java.util.Arrays; -import java.util.Map; -import java.util.TimeZone; +import java.util.*; + import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.marshal.FlatJsonMarshaller; @@ -47,7 +47,7 @@ import org.openehr.schemas.v1.OPERATIONALTEMPLATE; import org.openehr.schemas.v1.TemplateDocument; import org.springframework.http.ResponseEntity; -import org.yaml.snakeyaml.Yaml; + @Slf4j public abstract class KdsBidirectionalTest { @@ -57,27 +57,28 @@ public abstract class KdsBidirectionalTest { * to automatically be created against a running (by yourself) EHRBase instance. Meant for an integration * test and implicit validation of the mapped Composition. */ - final boolean TEST_AGAINST_EHRBASE = false; - final String EHRBASE_BASIC_USERNAME = "ehrbase-user"; - final String EHRBASE_BASIC_PASSWORD = "SuperSecretPassword"; - final String EHRBASE_HOST = "http://localhost:8081"; + public final boolean TEST_AGAINST_EHRBASE = false; + public final String EHRBASE_BASIC_USERNAME = "ehrbase-user"; + public final String EHRBASE_BASIC_PASSWORD = "SuperSecretPassword"; + public final String EHRBASE_HOST = "http://localhost:8081"; - final OpenFhirStringUtils openFhirStringUtils = new OpenFhirStringUtils(); - final OpenFhirMapperUtils openFhirMapperUtils = new OpenFhirMapperUtils(); - final FhirConnectModelMerger fhirConnectModelMerger = new FhirConnectModelMerger(); - final FhirPathR4 fhirPath = new FhirPathR4(FhirContext.forR4()); - final JsonParser jsonParser = (JsonParser) FhirContext.forR4().newJsonParser(); + public final OpenFhirStringUtils openFhirStringUtils = new OpenFhirStringUtils(); + public final OpenFhirMapperUtils openFhirMapperUtils = new OpenFhirMapperUtils(); + public final FhirConnectModelMerger fhirConnectModelMerger = new FhirConnectModelMerger(); + public final FhirPathR4 fhirPath = new FhirPathR4(FhirContext.forR4()); + public final JsonParser jsonParser = (JsonParser) FhirContext.forR4().newJsonParser(); - TestOpenFhirMappingContext repo; - OpenEhrToFhir openEhrToFhir; - FhirToOpenEhr fhirToOpenEhr; + public TestOpenFhirMappingContext repo; + public OpenEhrToFhir openEhrToFhir; + public FhirToOpenEhr fhirToOpenEhr; - FhirConnectContext context; - OPERATIONALTEMPLATE operationaltemplate; - String operationaltemplateSerialized; - WebTemplate webTemplate; + public FhirConnectContext context; + public OPERATIONALTEMPLATE operationaltemplate; + public String operationaltemplateSerialized; + public WebTemplate webTemplate; + public StandardsAsserter standardsAsserter = new StandardsAsserter(); - protected abstract void prepareState(); + public abstract void prepareState(); @Before public void init() { @@ -152,13 +153,13 @@ public void toOpenEhrTest() { } } - protected abstract JsonObject toOpenEhr(); + public abstract JsonObject toOpenEhr(); - protected boolean testAgainstEhrBase() { + boolean testAgainstEhrBase() { return TEST_AGAINST_EHRBASE; } - protected String getFlat(final String path) { + protected String getFile(final String path) { final InputStream inputStream = this.getClass().getResourceAsStream(path); try { return IOUtils.toString(inputStream); @@ -167,7 +168,7 @@ protected String getFlat(final String path) { } } - protected void compareJsonObjects(final JsonObject initial, final JsonObject expected) { + public void compareJsonObjects(final JsonObject initial, final JsonObject expected) { for (Map.Entry initialEntrySet : expected.entrySet()) { final String initialKey = initialEntrySet.getKey(); final String initialValue = initialEntrySet.getValue().getAsString(); @@ -179,12 +180,12 @@ protected void compareJsonObjects(final JsonObject initial, final JsonObject exp } } - protected org.hl7.fhir.r4.model.Bundle getTestBundle(final String path) { + public org.hl7.fhir.r4.model.Bundle getTestBundle(final String path) { final InputStream inputStream = this.getClass().getResourceAsStream(path); return (org.hl7.fhir.r4.model.Bundle) jsonParser.parseResource(inputStream); } - protected FhirConnectContext getContext(final String path) { + public FhirConnectContext getContext(final String path) { final ObjectMapper yaml = OpenFhirTestUtility.getYaml(); final InputStream inputStream = this.getClass().getResourceAsStream(path); try { @@ -194,11 +195,12 @@ protected FhirConnectContext getContext(final String path) { } } - protected OPERATIONALTEMPLATE getOperationalTemplate() { + public OPERATIONALTEMPLATE getOperationalTemplate() { try { return TemplateDocument.Factory.parse(operationaltemplateSerialized).getTemplate(); } catch (final Exception e) { throw new RuntimeException(e); } } + } diff --git a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseTest.java b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseTest.java new file mode 100644 index 00000000..d878d05a --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseTest.java @@ -0,0 +1,510 @@ +package com.medblocks.openfhir.kds.diagnose; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.json.JacksonUtil; +import com.nedap.archie.rm.composition.Composition; + +import java.util.List; +import java.util.stream.Collectors; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Condition; +import org.hl7.fhir.r4.model.DateTimeType; +import org.hl7.fhir.r4.model.Encounter; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Type; +import org.junit.Assert; +import org.junit.Test; + +public class DiagnoseTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT_MAPPING = "/kds_new/projects/org.highmed/KDS/diagnose/KDS_diagnose.context.yaml"; + final String TEST_FILES_DIR = "/kds/diagnose/"; + final String OPT = "KDS_Diagnose.opt"; + final String FLAT = "KDS_Diagnose_Composition.flat.json"; + final String FLAT_MULTIPLE = "KDS_Diagnose_multiple_Composition.flat.json"; // todo change to multiple + final String BUNDLE = "KDS_Diagnose_bundle_whole.json"; + final String BUNDLE_SINGLE = "KDS_Diagnose_bundle.json"; + final String COMPOSITION_SINGLE = TEST_FILES_DIR +"KDS_Diagnose_Composition_bundle.json"; + final String COMPOSITION_MULTIPLE = TEST_FILES_DIR +"KDS_Diagnose_Composition_bundle_whole.json"; + final String FHIR_CONDITION_1 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-1-diagnose-1.json"; + final String FHIR_CONDITION_2 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-2-diagnose-1.json"; + final String FHIR_CONDITION_3 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-3-diagnose-1.json"; + final String FHIR_CONDITION_4 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-4-diagnose-1.json"; + final String FHIR_CONDITION_5 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-5-diagnose-1.json"; + final String FHIR_CONDITION_6 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-6-diagnose-1.json"; + final String FHIR_CONDITION_7 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-7-diagnose-1.json"; + final String FHIR_CONDITION_8 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-8-diagnose-1.json"; + final String FHIR_CONDITION_9 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-9-diagnose-1.json"; + final String FHIR_CONDITION_10 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-10-diagnose-1.json"; + final String OPENEHR_COMPOSITION_1 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-1-diagnose-1.json"; + final String OPENEHR_COMPOSITION_2 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-2-diagnose-1.json"; + final String OPENEHR_COMPOSITION_3 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-3-diagnose-1.json"; + final String OPENEHR_COMPOSITION_4 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-4-diagnose-1.json"; + final String OPENEHR_COMPOSITION_5 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-5-diagnose-1.json"; + final String OPENEHR_COMPOSITION_6 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-6-diagnose-1.json"; + final String OPENEHR_COMPOSITION_7 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-7-diagnose-1.json"; + final String OPENEHR_COMPOSITION_8 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-8-diagnose-1.json"; + final String OPENEHR_COMPOSITION_9 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-9-diagnose-1.json"; + final String OPENEHR_COMPOSITION_10 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-10-diagnose-1.json"; + + + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT_MAPPING); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(TEST_FILES_DIR + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void assertToOpenEHRBundle() { + final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(TEST_FILES_DIR + BUNDLE_SINGLE), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, COMPOSITION_SINGLE); + } + + @Test + public void assertToOpenEHRBundleWhole() { + final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(TEST_FILES_DIR + BUNDLE), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, COMPOSITION_MULTIPLE); + } + + @Test + public void assertToOpenEHR1() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_1), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_1); + } + + @Test + public void assertToOpenEHR2() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_2), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_2); + } + + @Test + public void assertToOpenEHR3() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_3), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_3); + } + + @Test + public void assertToOpenEHR4() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_4), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_4); + } + + @Test + public void assertToOpenEHR5() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_5), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_5); + } + + @Test + public void assertToOpenEHR6() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_6), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_6); + } + + @Test + public void assertToOpenEHR7() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_7), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_7); + } + + @Test + public void assertToOpenEHR8() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_8), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_8); + } + + @Test + public void assertToOpenEHR9() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_9), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_9); + } + + @Test + public void assertToOpenEHR10() { + final Composition composition = + fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_10), operationaltemplate); + standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_10); + } + + @SneakyThrows + @Test + public void assertToFHIR1(){ + Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(OPENEHR_COMPOSITION_1), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_1); + } + + @SneakyThrows + @Test + public void assertToFHIR2(){ + Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(OPENEHR_COMPOSITION_2), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_2); + } + + private void assertCondition(final Condition condition, final boolean second) { + // - name: "contextStartTime" + final String expectedTime = second ? "2023-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; +// Assert.assertEquals(expectedTime, condition.getRecordedDateElement().getValueAsString()); + + + // - name: "fallIdentifikationIdentifier" + if (!second) { + Assert.assertEquals("VN", ((Encounter) condition.getEncounter().getResource()).getIdentifier().get(0).getType().getCodingFirstRep().getCode()); + Assert.assertEquals("Encounter/123", ((Encounter) condition.getEncounter().getResource()).getIdentifier().get(0).getValue()); + } + + // - name: "status" + if (!second) { + Assert.assertEquals("unconfirmed", condition.getVerificationStatus().getCodingFirstRep().getCode()); + Assert.assertEquals("http://hl7.org/fhir/ValueSet/condition-ver-status", + condition.getVerificationStatus().getCodingFirstRep().getSystem()); + } + + // - name: "date" + final List assertedExtensions = condition.getExtensionsByUrl( + "http://hl7.org/fhir/StructureDefinition/condition-assertedDate"); + Assert.assertEquals(1, assertedExtensions.size()); + final String expectedAssertedTime = second ? "3022-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; + Assert.assertEquals(expectedAssertedTime, + ((DateTimeType) assertedExtensions.get(0).getValue()).getValueAsString()); + + // dateTime, onset + final String expectedOnsetStartTime = second ? "3022-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; + Assert.assertEquals(expectedOnsetStartTime, condition.getOnsetPeriod().getStartElement().getValueAsString()); + + //- name: "clinicalStatus" + Assert.assertEquals((second ? "referenced_" : "") + "Active", condition.getClinicalStatus().getText()); + Assert.assertEquals((second ? "referenced_" : "") + "at0026", + condition.getClinicalStatus().getCodingFirstRep().getCode()); + + // - name: "lebensphase" + Assert.assertEquals((second ? "referenced_" : "") + "43", + ((CodeableConcept) condition.getOnsetPeriod().getStartElement() + .getExtensionsByUrl("http://fhir.de/StructureDefinition/lebensphase") + .get(0).getValue()).getCodingFirstRep().getCode()); + Assert.assertEquals((second ? "referenced_" : "") + "44", + ((CodeableConcept) condition.getOnsetPeriod().getEndElement() + .getExtensionsByUrl("http://fhir.de/StructureDefinition/lebensphase") + .get(0).getValue()).getCodingFirstRep().getCode()); + +// - name: "schweregrad" + Assert.assertEquals((second ? "referenced_" : "") + "42", + condition.getSeverity().getCodingFirstRep().getCode()); + Assert.assertEquals( + (second ? "referenced_" : "") + + "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/condition-severity' available", + condition.getSeverity().getText()); + + // bodySite + final List bodySites = condition.getBodySite(); + Assert.assertEquals(1, bodySites.size()); + final CodeableConcept bodySite = bodySites.get(0); + Assert.assertEquals(1, bodySite.getCoding().size()); + final List snomedBodySiteCodings = bodySite.getCoding().stream() + .filter(bsite -> bsite.getSystem() + .equals((second ? "referenced_" : "") + + "//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/body-site")) + .toList(); + Assert.assertEquals(1, snomedBodySiteCodings.size()); + Assert.assertEquals((second ? "referenced_" : "") + "42", snomedBodySiteCodings.get(0).getCode()); + + // bodySiteCluster; nothing to do here because the cluster is overwritten to be a unidiretional toopenehr only + +// - name: "problemDiagnose", - name: "problemDiagnoseNameCode" + Assert.assertEquals(2, condition.getCode().getCoding().size()); + Coding icd10code = condition.getCode().getCoding().get(0); + Assert.assertEquals((second ? "referenced_" : "") + "kodierte_diagnose value", icd10code.getCode()); +// - name: "problemDiagnoseText" +// Assert.assertEquals((second ? "referenced_" : "") + "freitextbeschreibung value", +// condition.getCode().getText()); +// - name: "icd10ProblemDiagnose" + + icd10code = condition.getCode().getCoding().get(1); + Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", icd10code.getSystem()); + +// - name: "codeIcd10Diagnosesicherheit" + final CodeableConcept diagnosessicherheit = (CodeableConcept) icd10code.getExtensionsByUrl( + "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit").stream() + .map(Extension::getValue).filter(value -> !value.isEmpty()).findAny().orElse(null); + Assert.assertEquals((second ? "referenced_" : "") + "diagnosesicherheit", + diagnosessicherheit.getCodingFirstRep().getCode()); + Assert.assertEquals( + (second ? "referenced_" : "") + + "//fhir.hl7.org//ValueSet/$expand?url=https://fhir.kbv.de/ValueSet/KBV_VS_SFHIR_ICD_DIAGNOSESICHERHEIT", + diagnosessicherheit.getCodingFirstRep().getSystem()); + + // - name: "mehrfachcodierung" + final CodeableConcept mehrfachcodierung = (CodeableConcept) icd10code.getExtensionByUrl( + "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen").getValue(); + Assert.assertEquals("!", mehrfachcodierung.getCodingFirstRep().getCode()); + Assert.assertEquals("http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen", mehrfachcodierung.getCodingFirstRep().getSystem()); + Assert.assertEquals("!", mehrfachcodierung.getCodingFirstRep().getDisplay()); + + // - name: "seitenlokalisation" + final CodeableConcept seitenlokalisation = (CodeableConcept) icd10code.getExtensionByUrl( + "http://fhir.de/StructureDefinition/seitenlokalisation").getValue(); + Assert.assertEquals((second ? "referenced_" : "") + "at0003", seitenlokalisation.getCodingFirstRep().getCode()); + Assert.assertEquals((second ? "referenced_" : "") + "local", + seitenlokalisation.getCodingFirstRep().getSystem()); + Assert.assertEquals((second ? "referenced_" : "") + "Left", + seitenlokalisation.getCodingFirstRep().getDisplay()); + + + Assert.assertEquals(3, icd10code.getExtension().size()); + } + + @Test + public void toFhir() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( + getFile(TEST_FILES_DIR + FLAT_MULTIPLE), new OPTParser(operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allConditions = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Condition).collect(Collectors.toList()); + Assert.assertEquals(2, allConditions.size()); + final Condition condition = (Condition) allConditions.get(0).getResource(); // first condition + final Condition conditionSecond = (Condition) allConditions.get(1).getResource(); // second condition + + assertCondition(condition, false); +// assertCondition(conditionSecond, true); + + final Type referencedExtensionCondition = condition.getExtensionByUrl( + "http://hl7.org/fhir/StructureDefinition/condition-related") + .getValue(); + Assert.assertNotNull(referencedExtensionCondition); + Assert.assertTrue(conditionSecond.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/condition-related") + .getValue().isEmpty()); + + assertCondition((Condition) ((Reference) referencedExtensionCondition).getResource(), true); + + } + + @Test + public void toOpenEhr_single() { + final Bundle testBundle = getTestBundle(TEST_FILES_DIR + BUNDLE_SINGLE); + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + Assert.assertEquals("2022-02-03T01:00:00", jsonObject.get("diagnose/context/start_time").getAsString()); + + + Assert.assertEquals("C34.1", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|code").getAsString()); + Assert.assertEquals("Secondary malignant neoplasm of lymph node", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|terminology").getAsString()); + Assert.assertEquals("G", jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|code").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", + jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|terminology").getAsString()); + Assert.assertEquals("Confirmed diagnosis", + jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|value").getAsString()); + Assert.assertEquals("at0002", jsonObject.get( + "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|code").getAsString()); + Assert.assertEquals("local", jsonObject.get( + "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|terminology").getAsString()); + Assert.assertEquals("†", jsonObject.get( + "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|value").getAsString()); + Assert.assertEquals("321667001", jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|code") + .getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|terminology") + .getAsString()); + Assert.assertEquals("Respiratory tract, Upper lobe, bronchus or lung", + jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|value") + .getAsString()); +// Assert.assertEquals("Secondary malignant neoplasm of lymph node", +// jsonObject.get("diagnose/diagnose:0/freitextbeschreibung").getAsString()); + Assert.assertEquals("Patient confirmed for secondary malignant neoplasm of lymph node.", + jsonObject.get("diagnose/diagnose:0/diagnoseerläuterung").getAsString()); + Assert.assertEquals("2024-12-24T16:13:43", + jsonObject.get("diagnose/diagnose:0/klinisch_relevanter_zeitraum_zeitpunkt_des_auftretens") + .getAsString()); + Assert.assertEquals("424144002", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|terminology").getAsString()); + Assert.assertEquals("Start of adulthood phase", + jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|value").getAsString()); + Assert.assertEquals("367640001", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:0/lebensphase/ende|terminology").getAsString()); + Assert.assertEquals("End of middle age phase", + jsonObject.get("diagnose/diagnose:0/lebensphase/ende|value").getAsString()); + Assert.assertEquals("24484000", jsonObject.get("diagnose/diagnose:0/schweregrad|code").getAsString()); + Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-severity", + jsonObject.get("diagnose/diagnose:0/schweregrad|terminology").getAsString()); + Assert.assertEquals("Severe", jsonObject.get("diagnose/diagnose:0/schweregrad|value").getAsString()); + Assert.assertEquals("encounter-id-1245", + jsonObject.get("diagnose/context/fallidentifikation/fall-kennung").getAsString()); + Assert.assertEquals("2025-02-03T05:05:06", + jsonObject.get("diagnose/diagnose:0/feststellungsdatum").getAsString()); + Assert.assertEquals("active", jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|code") + .getAsString()); + Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-clinical", + jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|terminology") + .getAsString()); + + + } + + public JsonObject toOpenEhr() { + + final Bundle testBundle = getTestBundle(TEST_FILES_DIR + BUNDLE); + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + Assert.assertEquals("2022-02-03T01:00:00", jsonObject.get("diagnose/context/start_time").getAsString()); + Assert.assertEquals("C34.1", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|code").getAsString()); + Assert.assertEquals("Secondary malignant neoplasm of lymph node", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|terminology").getAsString()); + Assert.assertEquals("G", jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|code").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", + jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|terminology").getAsString()); + Assert.assertEquals("Confirmed diagnosis", + jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|value").getAsString()); + Assert.assertEquals("at0002", jsonObject.get( + "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|code").getAsString()); + Assert.assertEquals("local", jsonObject.get( + "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|terminology").getAsString()); + Assert.assertEquals("†", jsonObject.get( + "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|value").getAsString()); + Assert.assertEquals("321667001", jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|code") + .getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|terminology") + .getAsString()); + Assert.assertEquals("Respiratory tract, Upper lobe, bronchus or lung", + jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|value") + .getAsString()); +// Assert.assertEquals("Secondary malignant neoplasm of lymph node", +// jsonObject.get("diagnose/diagnose:0/freitextbeschreibung").getAsString()); + Assert.assertEquals("Patient confirmed for secondary malignant neoplasm of lymph node.", + jsonObject.get("diagnose/diagnose:0/diagnoseerläuterung").getAsString()); + Assert.assertEquals("424144002", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|terminology").getAsString()); + Assert.assertEquals("Start of adulthood phase", + jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|value").getAsString()); + Assert.assertEquals("367640001", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:0/lebensphase/ende|terminology").getAsString()); + Assert.assertEquals("End of middle age phase", + jsonObject.get("diagnose/diagnose:0/lebensphase/ende|value").getAsString()); + Assert.assertEquals("24484000", jsonObject.get("diagnose/diagnose:0/schweregrad|code").getAsString()); + Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-severity", + jsonObject.get("diagnose/diagnose:0/schweregrad|terminology").getAsString()); + Assert.assertEquals("Severe", jsonObject.get("diagnose/diagnose:0/schweregrad|value").getAsString()); + Assert.assertEquals("encounter-id-1245", + jsonObject.get("diagnose/context/fallidentifikation/fall-kennung").getAsString()); + Assert.assertEquals("2025-02-03T05:05:06", + jsonObject.get("diagnose/diagnose:0/feststellungsdatum").getAsString()); + Assert.assertEquals("active", jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|code") + .getAsString()); + Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-clinical", + jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|terminology") + .getAsString()); + Assert.assertEquals("active", jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|value") + .getAsString()); +// +// Assert.assertEquals("L", +// jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/laterality|code").getAsString()); +// Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/seitenlokalisation", +// jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/laterality|terminology") +// .getAsString()); +// Assert.assertEquals("Left side", +// jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/laterality|value").getAsString()); + + Assert.assertEquals("ref_C34.1", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|code").getAsString()); + Assert.assertEquals("Malignant neoplasm of upper lobe, bronchus or lung", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|terminology").getAsString()); + Assert.assertEquals("ref_S", jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|code").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", + jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|terminology").getAsString()); + Assert.assertEquals("ref_Suspected diagnosis", + jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|value").getAsString()); + Assert.assertEquals("at0003", jsonObject.get( + "diagnose/diagnose:1/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|code").getAsString()); + Assert.assertEquals("local", jsonObject.get( + "diagnose/diagnose:1/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|terminology").getAsString()); + Assert.assertEquals("*", jsonObject.get( + "diagnose/diagnose:1/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|value").getAsString()); + Assert.assertEquals("ref_368209003", jsonObject.get("diagnose/diagnose:1/anatomische_lokalisation/name_der_körperstelle|code") + .getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:1/anatomische_lokalisation/name_der_körperstelle|terminology") + .getAsString()); + Assert.assertEquals("Entire cardiovascular system", + jsonObject.get("diagnose/diagnose:1/anatomische_lokalisation/name_der_körperstelle|value") + .getAsString()); +// Assert.assertEquals("Malignant neoplasm of upper lobe, bronchus or lung", +// jsonObject.get("diagnose/diagnose:1/freitextbeschreibung").getAsString()); + Assert.assertEquals( + "ref_The patient has a history of high blood pressure, now presenting with severe hypertension.", + jsonObject.get("diagnose/diagnose:1/diagnoseerläuterung").getAsString()); + Assert.assertEquals("ref_424144002", + jsonObject.get("diagnose/diagnose:1/lebensphase/beginn|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:1/lebensphase/beginn|terminology").getAsString()); + Assert.assertEquals("ref_Start of adulthood phase", + jsonObject.get("diagnose/diagnose:1/lebensphase/beginn|value").getAsString()); + Assert.assertEquals("ref_367640001", jsonObject.get("diagnose/diagnose:1/lebensphase/ende|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:1/lebensphase/ende|terminology").getAsString()); + Assert.assertEquals("ref_End of middle age phase", + jsonObject.get("diagnose/diagnose:1/lebensphase/ende|value").getAsString()); + Assert.assertEquals("ref_24484000", jsonObject.get("diagnose/diagnose:1/schweregrad|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.get("diagnose/diagnose:1/schweregrad|terminology").getAsString()); + Assert.assertEquals("ref_Severe", jsonObject.get("diagnose/diagnose:1/schweregrad|value").getAsString()); + Assert.assertEquals("2125-02-03T05:05:06", + jsonObject.get("diagnose/diagnose:1/feststellungsdatum").getAsString()); + Assert.assertEquals("ref_active", jsonObject.get("diagnose/diagnose:1/klinischer_status/klinischer_status|code") + .getAsString()); + Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-clinical", + jsonObject.get("diagnose/diagnose:1/klinischer_status/klinischer_status|terminology") + .getAsString()); + Assert.assertEquals("ref_active", + jsonObject.get("diagnose/diagnose:1/klinischer_status/klinischer_status|value") + .getAsString()); + + Assert.assertEquals("at0064", + jsonObject.get("diagnose/diagnose:1/klinischer_status/diagnoserolle|code") + .getAsString()); + Assert.assertEquals("at0066", + jsonObject.get("diagnose/diagnose:0/klinischer_status/diagnoserolle|code") + .getAsString()); + Assert.assertEquals("local", + jsonObject.get("diagnose/diagnose:0/klinischer_status/diagnoserolle|terminology") + .getAsString()); + Assert.assertEquals("local", + jsonObject.get("diagnose/diagnose:1/klinischer_status/diagnoserolle|terminology") + .getAsString()); + Assert.assertEquals("Nebendiagnose", + jsonObject.get("diagnose/diagnose:0/klinischer_status/diagnoserolle|value") + .getAsString()); + Assert.assertEquals("Hauptdiagnose", + jsonObject.get("diagnose/diagnose:1/klinischer_status/diagnoserolle|value") + .getAsString()); + + return jsonObject; + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/fall/FallTest.java b/src/test/java/com/medblocks/openfhir/kds/fall/FallTest.java new file mode 100644 index 00000000..b4cc33b0 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/fall/FallTest.java @@ -0,0 +1,235 @@ +package com.medblocks.openfhir.kds.fall; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import java.util.List; +import java.util.stream.Collectors; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Condition; +import org.hl7.fhir.r4.model.Encounter; +import org.hl7.fhir.r4.model.Encounter.DiagnosisComponent; +import org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Organization; +import org.junit.Assert; +import org.junit.Test; + +public class FallTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT_MAPPING = "/kds_new/projects/org.highmed/KDS/fall/KDS_fall_einfach.context.yaml"; + final String HELPER_LOCATION = "/kds/fall/"; + final String OPT = "KDS_Fall_einfach.opt"; + final String FLAT = "KDS_Fall_einfach.flat.json"; + final String BUNDLE = "KDS_Fall_einfach_Bundle.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT_MAPPING); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void toFhir() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( + getFile(HELPER_LOCATION + FLAT), new OPTParser(operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allEncounters = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Encounter).collect(Collectors.toList()); + Assert.assertEquals(1, allEncounters.size()); + + final Encounter encounter = (Encounter) allEncounters.get(0).getResource(); + + // falltyp + Assert.assertEquals("42", encounter.getTypeFirstRep().getCodingFirstRep().getCode()); + Assert.assertEquals("No example for termínology 'http://fhir.de/ValueSet/kontaktebene-de?subset=' available", + encounter.getTypeFirstRep().getCodingFirstRep().getDisplay()); + Assert.assertEquals("http://fhir.de/ValueSet/kontaktebene-de?subset=", + encounter.getTypeFirstRep().getCodingFirstRep().getSystem()); + + // fallklasse + Assert.assertEquals("43", encounter.getClass_().getCode()); + Assert.assertEquals("No example for termínology 'http://fhir.de/ValueSet/EncounterClassDE?subset=' available", + encounter.getClass_().getDisplay()); + Assert.assertEquals("http://fhir.de/ValueSet/EncounterClassDE?subset=", encounter.getClass_().getSystem()); + + // fallart + Assert.assertEquals("42", encounter.getStatusElement().getValueAsString()); + + // fallId + Assert.assertEquals("FallId-Id", encounter.getIdentifier().stream() + .filter(id -> id.getType().getCodingFirstRep().getCode().equals("VN")) + .map(id -> id.getValue()) + .findFirst().orElse(null)); + + // serviceProvider + final Organization serviceProvider = (Organization) encounter.getServiceProvider().getResource(); + Assert.assertEquals("Org Name", serviceProvider.getName()); + Assert.assertEquals("Org Id", serviceProvider.getIdentifierFirstRep().getValue()); + + // aufnahmegrundExtension + final List aufnahmegrundExtension = encounter.getExtensionsByUrl( + "http://fhir.de/StructureDefinition/Aufnahmegrund"); + Assert.assertEquals(1, aufnahmegrundExtension.size()); + Assert.assertEquals(3, aufnahmegrundExtension.get(0).getExtension().size()); + + final Extension firstAndSecond = aufnahmegrundExtension.get(0).getExtensionByUrl("ErsteUndZweiteStelle"); + final Extension third = aufnahmegrundExtension.get(0).getExtensionByUrl("DritteStelle"); + final Extension fourth = aufnahmegrundExtension.get(0).getExtensionByUrl("VierteStelle"); + Assert.assertEquals("12", ((Coding) firstAndSecond.getValue()).getCode()); + Assert.assertEquals("3", ((Coding) third.getValue()).getCode()); + Assert.assertEquals("4", ((Coding) fourth.getValue()).getCode()); + + final CodeableConcept admitSource = encounter.getHospitalization().getAdmitSource(); + Assert.assertEquals("admitSource", admitSource.getCodingFirstRep().getCode()); + + final Extension entlassungsgrundExtension = encounter.getHospitalization().getDischargeDisposition() + .getExtensionByUrl("http://fhir.de/StructureDefinition/Entlassungsgrund"); + Assert.assertEquals("outcome", ((Coding) entlassungsgrundExtension.getValue()).getCode()); + + final DiagnosisComponent diagnosisComponent = encounter.getDiagnosisFirstRep(); + final Condition condition = (Condition) diagnosisComponent.getCondition().getResource(); + Assert.assertEquals("diagnos coding", condition.getCode().getCodingFirstRep().getCode()); + + Assert.assertEquals(2, diagnosisComponent.getUse().getCoding().size()); + Assert.assertEquals("type", diagnosisComponent.getUse().getCoding().stream() + .filter(cod -> cod.getSystem().equals("http://fhir.de/CodeSystem/dki-diagnosetyp")) + .map(Coding::getCode) + .findFirst().orElse(null)); + Assert.assertEquals("subtype", diagnosisComponent.getUse().getCoding().stream() + .filter(cod -> cod.getSystem().equals("http://fhir.de/CodeSystem/dki-diagnosesubtyp")) + .map(Coding::getCode) + .findFirst().orElse(null)); + + // - name: "period" + Assert.assertEquals("2020-02-03T04:05:06+01:00", encounter.getPeriod().getStartElement().getValueAsString()); + Assert.assertEquals("2022-02-03T04:05:06+01:00", encounter.getPeriod().getEndElement().getValueAsString()); + + final List locations = encounter.getLocation(); + Assert.assertEquals(3, locations.size()); + + final List roomLocationIds = locations.stream() + .filter(loc -> "ro".equals(loc.getPhysicalType().getCodingFirstRep().getCode())) + .map(el -> el.getLocation().getIdentifier()) + .toList(); + final List bedLocationIds = locations.stream() + .filter(loc -> "bd".equals(loc.getPhysicalType().getCodingFirstRep().getCode())) + .map(el -> el.getLocation().getIdentifier()) + .toList(); + final List wardLocationIds = locations.stream() + .filter(loc -> "wa".equals(loc.getPhysicalType().getCodingFirstRep().getCode())) + .map(el -> el.getLocation().getIdentifier()) + .toList(); + + Assert.assertTrue(locations.stream().allMatch(loc -> loc.getPhysicalType().getCodingFirstRep().getSystem() + .equals("http://terminology.hl7.org/CodeSystem/location-physical-type"))); + + Assert.assertEquals(1, roomLocationIds.size()); + Assert.assertEquals(1, bedLocationIds.size()); + Assert.assertEquals(1, wardLocationIds.size()); + + Assert.assertEquals("zimmer-1", roomLocationIds.get(0).getValue()); + Assert.assertEquals("bett-1", bedLocationIds.get(0).getValue()); + Assert.assertEquals("station-1", wardLocationIds.get(0).getValue()); + } + + + public JsonObject toOpenEhr() { + final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); + + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + Assert.assertEquals("einrichtungskontakt", + jsonObject.get("kds_fall_einfach/context/falltyp|code").getAsString()); + Assert.assertEquals("local_terms", + jsonObject.get("kds_fall_einfach/context/falltyp|terminology").getAsString()); + Assert.assertEquals("AMB", jsonObject.get("kds_fall_einfach/context/fallklasse|code").getAsString()); + Assert.assertEquals("ambulatory", jsonObject.get("kds_fall_einfach/context/fallklasse|value").getAsString()); + Assert.assertEquals("http://terminology.hl7.org/CodeSystem/v3-ActCode", + jsonObject.get("kds_fall_einfach/context/fallklasse|terminology").getAsString()); + Assert.assertEquals("finished", jsonObject.get("kds_fall_einfach/context/fallart|code").getAsString()); + Assert.assertEquals("VN-encounter-id-12345", jsonObject.get("kds_fall_einfach/context/fall-id").getAsString()); + Assert.assertEquals("Example Hospital", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/überweiser/namenszeile") + .getAsString()); + Assert.assertEquals("ORG-001", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/überweiser/identifier:0/identifier_value|id").getAsString()); + Assert.assertEquals("01", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_ersteundzweitestelle|code").getAsString()); + Assert.assertEquals("Krankenhausbehandlung, vollstationär", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_ersteundzweitestelle|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dkgev/AufnahmegrundErsteUndZweiteStelle", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_ersteundzweitestelle|terminology") + .getAsString()); + Assert.assertEquals("0", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_dritte_stelle|code") + .getAsString()); + Assert.assertEquals("Anderes", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_dritte_stelle|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dkgev/AufnahmegrundDritteStelle", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_dritte_stelle|terminology").getAsString()); + Assert.assertEquals("1", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_vierte_stelle|code") + .getAsString()); + Assert.assertEquals("Normalfall", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_vierte_stelle|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dkgev/AufnahmegrundVierteStelle", jsonObject.get( + "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_vierte_stelle|terminology").getAsString()); + Assert.assertEquals("E", jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmekategorie|code") + .getAsString()); + Assert.assertEquals("Einweisung durch einen Arzt", jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmekategorie|value") + .getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dgkev/Aufnahmeanlass", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmekategorie|terminology") + .getAsString()); + Assert.assertEquals("01", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/outcome:0|code").getAsString()); + Assert.assertEquals("Reguläre Entlassung", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/outcome:0|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/entlassungsgrund", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/outcome:0|terminology") + .getAsString()); + Assert.assertEquals("referral-diagnosis", + jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosetyp|code").getAsString()); + Assert.assertEquals("Einweisungs-/Überweisungsdiagnos", + jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosetyp|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dki-diagnosetyp", + jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosetyp|terminology").getAsString()); + Assert.assertEquals("surgery-diagnosis", + jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosesubtyp|code").getAsString()); + Assert.assertEquals("Operationsdiagnose", + jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosesubtyp|value").getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/dki-diagnosesubtyp", + jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosesubtyp|terminology") + .getAsString()); +// Assert.assertEquals("Organization", +// jsonObject.get("kds_fall_einfach/context/_health_care_facility|name").getAsString()); + Assert.assertEquals("2022-02-03T05:05:06", jsonObject.get("kds_fall_einfach/context/start_time").getAsString()); + Assert.assertEquals("2022-04-03T06:05:06", jsonObject.get("kds_fall_einfach/context/_end_time").getAsString()); +// Assert.assertEquals("Organization", jsonObject.get("kds_fall_einfach/composer|name").getAsString()); + Assert.assertEquals("2022-02-03T05:05:06", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmedatum").getAsString()); + Assert.assertEquals("2022-04-03T06:05:06", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/entlassungsdatum").getAsString()); + Assert.assertEquals("zimmer-1-identifier", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/standort:0/zimmer").getAsString()); + Assert.assertEquals("station-1-identifier", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/standort:0/station").getAsString()); + Assert.assertEquals("bett-1-identifier", + jsonObject.get("kds_fall_einfach/institutionsaufenthalt/standort:0/bett").getAsString()); + + return jsonObject; + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/laborauftrag/LaborauftragTest.java b/src/test/java/com/medblocks/openfhir/kds/laborauftrag/LaborauftragTest.java new file mode 100644 index 00000000..0c65226a --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/laborauftrag/LaborauftragTest.java @@ -0,0 +1,193 @@ +package com.medblocks.openfhir.kds.laborauftrag; + +import static org.junit.Assert.assertEquals; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Organization; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.ServiceRequest; +import org.hl7.fhir.r4.model.Specimen; +import org.junit.Assert; +import org.junit.Test; + +public class LaborauftragTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/laborauftrag/KDS_laborauftrag.context.yaml"; + final String HELPER_LOCATION = "/kds/laborauftrag/"; + final String OPT = "KDS_Laborauftrag.opt"; + final String FLAT = "KDS_Laborauftrag.flat.json"; + + final String BUNDLE = "KDS_Laborauftrag_bundle.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void kdsServiceRequest_toFhir_toOpenEhr() throws IOException { + + // openEHR to FHIR + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFile(HELPER_LOCATION + FLAT), + webTemplate); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + + final List requests = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof ServiceRequest) + .map(en -> (ServiceRequest) en.getResource()) + .collect(Collectors.toList()); + + Assert.assertEquals(1, requests.size()); + final ServiceRequest serviceRequest = requests.get(0); + + assertServiceRequest(serviceRequest); + + + final Bundle toRunMappingOn = new Bundle(); + for (Bundle.BundleEntryComponent bundleEntryComponent : bundle.getEntry()) { + final Resource resource = bundleEntryComponent.getResource(); + if (resource instanceof ServiceRequest) { + final Reference requesterReference = ((ServiceRequest) resource).getRequester(); + final IBaseResource requester = requesterReference.getResource(); + if (requester != null) { + final String reqId = UUID.randomUUID().toString(); + requesterReference.setReference(reqId); + requester.setId(reqId); + toRunMappingOn.addEntry( + new Bundle.BundleEntryComponent().setFullUrl(reqId).setResource((Resource) requester)); + } + } + toRunMappingOn.addEntry(bundleEntryComponent); + } + + final JsonObject jsonObject2 = fhirToOpenEhr.fhirToFlatJsonObject(context, toRunMappingOn, operationaltemplate); + + + final JsonObject expected = new Gson().fromJson(IOUtils.toString( + getClass().getResourceAsStream(HELPER_LOCATION + "Laborauftrag_expected-jsonobject-from-flat.json")), + JsonObject.class); + + + // todo: enable comaprison once https://github.com/medblocks/openFHIR/pull/79/files#r1956650118 is solved +// compareJsonObjects(jsonObject2, expected); +// compareJsonObjects(expected, jsonObject2); + + // do this just to assert all flat paths are legit + new FlatJsonUnmarshaller().unmarshal(new Gson().toJson(jsonObject2), webTemplate); + + } + + @SneakyThrows + public JsonObject toOpenEhr() { + final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + + Assert.assertEquals("123456-0_KH", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/auftrags-id_des_anfordernden_einsendenden_systems_plac|id").getAsString()); + Assert.assertEquals("completed", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/status_der_anfrage|code").getAsString()); + Assert.assertEquals("2345-7", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/name_der_laborleistung|code").getAsString()); + Assert.assertEquals("http://loinc.org", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/name_der_laborleistung|terminology").getAsString()); + Assert.assertEquals("Blood Glucose Test", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/name_der_laborleistung|value").getAsString()); +// Assert.assertEquals("order", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/art_der_laborleistung_kategorie|code").getAsString()); +// Assert.assertEquals("http://terminology.hl7.org/ValueSet/observation-category", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/art_der_laborleistung_kategorie|terminology").getAsString()); +// Assert.assertEquals("Laboratory", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/art_der_laborleistung_kategorie|value").getAsString()); + Assert.assertEquals("order", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/intention|code").getAsString()); + Assert.assertEquals("Sample collected in the morning.", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/kommentar").getAsString()); + Assert.assertEquals("Example Hospital", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/einsender/namenszeile").getAsString()); + Assert.assertEquals("ORG-001", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/einsender/identifier|id").getAsString()); + + Assert.assertEquals("SP-987654", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/probe:0/laborprobenidentifikator|id").getAsString()); + Assert.assertEquals("2024-08-24T11:00:00", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/probe:0/zeitpunkt_der_probenentnahme/date_time_value").getAsString()); + Assert.assertEquals("example-practitioner", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/probe:0/identifikator_des_probenehmers|id").getAsString()); + + + return jsonObject; + } + + @Test + public void toFhir() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFile(HELPER_LOCATION + FLAT), + new OPTParser( + operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allServiceRequests = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof ServiceRequest).collect(Collectors.toList()); + assertEquals(1, allServiceRequests.size()); + + final ServiceRequest serviceRequest = (ServiceRequest) allServiceRequests.get(0).getResource(); + + assertServiceRequest(serviceRequest); + } + + private void assertServiceRequest(final ServiceRequest serviceRequest) { + + // - name: "identifier" + Assert.assertEquals("Medical record identifier", serviceRequest.getIdentifierFirstRep().getValue()); + + // - name: "status" + Assert.assertEquals("completed", serviceRequest.getStatusElement().getValueAsString()); + + // - name: "code" + Assert.assertEquals("2345-7", serviceRequest.getCode().getCodingFirstRep().getCode()); + Assert.assertEquals("Blood Glucose Test", serviceRequest.getCode().getText()); + + // - name: "category" + Assert.assertEquals("laboratory", serviceRequest.getCategoryFirstRep().getCodingFirstRep().getCode()); + + // - name: "intent" + Assert.assertEquals("order", serviceRequest.getIntentElement().getValueAsString()); + + // - name: "note" + Assert.assertEquals("Sample collected in the morning.", serviceRequest.getNoteFirstRep().getText()); + + // - name: "organisation" + // - name: "org name" + // - name: "org id" + final Organization org = (Organization) serviceRequest.getRequester().getResource(); + Assert.assertEquals("Einsender name", org.getName()); + Assert.assertEquals("Example Hospital", org.getIdentifierFirstRep().getValue()); + + // - name: "specimen" + final List specimenReferences = serviceRequest.getSpecimen(); + Assert.assertEquals(2, specimenReferences.size()); + final List specimens = specimenReferences.stream().map(spec -> (Specimen) spec.getResource()) + .toList(); + + // - name: "specimen identifier" + // - name: "specimen collection date time" + // - name: "specimen collector" + final Specimen specimen1 = specimens.get(0); + Assert.assertEquals("spec1", specimen1.getAccessionIdentifier().getValue()); +// Assert.assertEquals("2022-02-03T04:05:06+01:00", +// specimen1.getCollection().getCollectedPeriod().getStartElement().getValueAsString()); + Assert.assertEquals("probenehmers_id1", specimen1.getCollection().getCollector().getIdentifier().getValue()); + + final Specimen specimen2 = specimens.get(1); + Assert.assertEquals("spec2", specimen2.getAccessionIdentifier().getValue()); +// Assert.assertEquals("3022-02-03T04:05:06+01:00", +// specimen2.getCollection().getCollectedDateTimeType().getValueAsString()); + Assert.assertEquals("probenehmers_id2", specimen2.getCollection().getCollector().getIdentifier().getValue()); + + } + +} diff --git a/src/test/java/com/medblocks/openfhir/kds/laborbericht/LaborberichtTest.java b/src/test/java/com/medblocks/openfhir/kds/laborbericht/LaborberichtTest.java new file mode 100644 index 00000000..a7e53856 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/laborbericht/LaborberichtTest.java @@ -0,0 +1,451 @@ +package com.medblocks.openfhir.kds.laborbericht; + +import static org.junit.Assert.assertEquals; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import java.util.List; +import java.util.stream.Collectors; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.DiagnosticReport; +import org.hl7.fhir.r4.model.Observation; +import org.hl7.fhir.r4.model.Specimen; +import org.junit.Assert; +import org.junit.Test; + +public class LaborberichtTest extends KdsBidirectionalTest { + + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/laborbericht/KDS_laborbericht.context.yaml"; + final String HELPER_LOCATION = "/kds/laborbericht/"; + final String OPT = "KDS_Laborbericht.opt"; + final String FLAT = "KDS_Laborbericht.flat.json"; + + final String BUNDLE = "KDS_Laborbericht_bundle.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + public JsonObject toOpenEhr() { + final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + +// Assert.assertEquals("Example Lab Organization", +// jsonObject.getAsJsonPrimitive("laborbericht/context/_health_care_facility|name") +// .getAsString()); +// Assert.assertEquals("Example Lab Organization", +// jsonObject.getAsJsonPrimitive("laborbericht/composer|name").getAsString()); + Assert.assertEquals("26436-6", + jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/labortest-kategorie|code") + .getAsString()); + Assert.assertEquals("LOINC", + jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/labortest-kategorie|terminology") + .getAsString()); + Assert.assertEquals("registered", jsonObject.getAsJsonPrimitive("laborbericht/context/status|code").getAsString()); + Assert.assertEquals("Normal blood count", + jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/conclusion").getAsString()); + Assert.assertEquals("2022-02-03T05:05:06", + jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/time").getAsString()); + Assert.assertEquals("SP-987654", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/probenmaterial:0/external_identifier/identifier_value|id").getAsString()); + Assert.assertEquals("2024-08-24T11:00:00", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/probenmaterial:0/collection_date_time/date_time_value") + .getAsString()); + Assert.assertEquals("1234567", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_collector_identifier|id").getAsString()); +// Assert.assertEquals("Aspiration", jsonObject.getAsJsonPrimitive( +// "laborbericht/laborbefund/any_event:0/probenmaterial:0/probenentnahmemethode").getAsString()); +// Assert.assertEquals("Right arm", +// jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/körperstelle") +// .getAsString()); + Assert.assertEquals("122555007", + jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_type|code") + .getAsString()); + Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_type|terminology").getAsString()); + Assert.assertEquals("Venous blood specimen", + jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_type|value") + .getAsString()); + Assert.assertEquals("Sample collected in the morning.", + jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/comment") + .getAsString()); + Assert.assertEquals("2022-02-03T05:05:06", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/probenmaterial:0/date_time_received").getAsString()); + Assert.assertEquals("at0062", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/probenmaterial:0/adequacy_for_testing|code").getAsString()); +// Assert.assertEquals("at0018", jsonObject.getAsJsonPrimitive( +// "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/ergebnis-status|code").getAsString()); + Assert.assertEquals("2022-02-03T05:05:06", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/result_status_time").getAsString()); + Assert.assertEquals("7.4", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/messwert:0/quantity_value|magnitude").getAsString()); + Assert.assertEquals("g/dL", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/messwert:0/quantity_value|unit").getAsString()); + Assert.assertEquals("718-7", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/analyte_name|code").getAsString()); + Assert.assertEquals("http://loinc.org", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/analyte_name|terminology").getAsString()); + Assert.assertEquals("Hemoglobin [Mass/volume] in Blood", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/analyte_name|value").getAsString()); + Assert.assertEquals("H", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/interpretation|code").getAsString()); + Assert.assertEquals("http://hl7.org/fhir/ValueSet/observation-interpretation", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/interpretation|terminology").getAsString()); + Assert.assertEquals("Interpretation description", jsonObject.getAsJsonPrimitive( + "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/interpretation|value").getAsString()); +// Assert.assertEquals("Blood test using standard laboratory methods", jsonObject.getAsJsonPrimitive( +// "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/testmethode|other").getAsString()); + Assert.assertEquals("FILL-12345", + jsonObject.getAsJsonPrimitive("laborbericht/context/id").getAsString()); + + return jsonObject; + } + + @Test + public void toFhir() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFile(HELPER_LOCATION + FLAT), + new OPTParser( + operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allDiagnosticReports = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof DiagnosticReport).collect(Collectors.toList()); + assertEquals(1, allDiagnosticReports.size()); + + final DiagnosticReport diagnosticReport = (DiagnosticReport) allDiagnosticReports.get(0).getResource(); + + //- name: "healthCareFacility" +// - name: "composer" +// Assert.assertEquals(2, diagnosticReport.getPerformer().size()); // commented out with the comment out of mapping of this field +// Assert.assertEquals("DOE, John", diagnosticReport.getPerformer().get(0).getDisplay()); +// Assert.assertEquals("Max Mustermann", diagnosticReport.getPerformer().get(1).getDisplay()); + + // - name: "Effective" +// assertEquals("2020-02-03T04:05:06+01:00", // commented out with the comment out of mapping of this field +// diagnosticReport.getEffectivePeriod().getStartElement().getValueAsString()); +// assertEquals("2022-02-03T04:05:06+01:00", +// diagnosticReport.getEffectivePeriod().getEndElement().getValueAsString()); + + // - name: "Category" + assertEquals(1, diagnosticReport.getCategory().size()); + assertEquals("LOINC", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getSystem()); + assertEquals("26436-6", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getCode()); + assertEquals("laboratory", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getDisplay()); + + // - name: "Status" + assertEquals("at0107", diagnosticReport.getStatusElement().getValueAsString()); + + // - name: "Conclusion" + assertEquals("Normal blood count", diagnosticReport.getConclusion()); + + // - name: "issued" + assertEquals("2022-02-03T04:05:06.000+01:00", diagnosticReport.getIssuedElement().getValueAsString()); + + // - name: "berichtId" + assertEquals(1, diagnosticReport.getIdentifierFirstRep().getType().getCoding().size()); + assertEquals("FILL", diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getCode()); + assertEquals("http://terminology.hl7.org/CodeSystem/v2-0203", + diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getSystem()); + assertEquals("bericht_id", diagnosticReport.getIdentifierFirstRep().getValue()); + + // Assert Specimen - name: "specimen" + Specimen specimen = (Specimen) diagnosticReport.getSpecimenFirstRep().getResource(); + + // - name: "identifier" + assertEquals("SP-987654", specimen.getIdentifierFirstRep().getValue()); + + // - name: "collected" +// assertEquals("2022-02-03T04:05:06+01:00", +// specimen.getCollection().getCollectedDateTimeType().getValueAsString()); + + // - name: "collector" + assertEquals("collectorId", specimen.getCollection().getCollector().getIdentifier().getValue()); + + // - name: "specimen type" + assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); + assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", + specimen.getType().getText()); + + // - name: "specimenCollectionMethod" +// assertEquals("Aspiration - action", specimen.getCollection().getMethod().getCodingFirstRep().getCode()); + + // specimenCollectionBodySite +// assertEquals("Arm", specimen.getCollection().getBodySite().getCodingFirstRep().getCode()); + + // - name: "samplingContext" +// assertEquals("Lorem ipsum", specimen.getCollection().getFastingStatusCodeableConcept().getCodingFirstRep().getCode()); + + // - name: "type" + Assert.assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", + specimen.getType().getText()); + Assert.assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); + + // - name: "note" + assertEquals("Sample collected in the morning.", specimen.getNoteFirstRep().getText()); + + // - name: "descriptionOfSpecimen" + Assert.assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0493' available", + specimen.getConditionFirstRep().getText()); + Assert.assertEquals("conditionCode", specimen.getConditionFirstRep().getCodingFirstRep().getCode()); + + // - name: "identifierOfSpecimen" + assertEquals("identifierOfSpecimen", specimen.getAccessionIdentifier().getValue()); + + // - name: "dateReceived" + assertEquals("2022-02-03T04:05:06+01:00", specimen.getReceivedTimeElement().getValueAsString()); + + // specimen - name: "status" + assertEquals("available", specimen.getStatusElement().getValueAsString()); + + // basedOn, identifierInReference + assertEquals("identifikation_der_laboranforderung", + diagnosticReport.getBasedOnFirstRep().getIdentifier().getValue()); + + + // Assert Observation - name: "result" + Observation observation = (Observation) diagnosticReport.getResultFirstRep().getResource(); + + // - name: "status" +// Assert.assertEquals("registered", observation.getStatusElement().getValueAsString()); + + // - name: "issued" + Assert.assertEquals("2022-02-03T04:05:06.000+01:00", observation.getIssuedElement().getValueAsString()); + + // - name: "analyteMeasurement" + assertEquals(7.4, observation.getValueQuantity().getValue().doubleValue(), 0); + assertEquals("mm", observation.getValueQuantity().getUnit()); + + // laboryte name + assertEquals("718-7", observation.getCode().getCodingFirstRep().getCode()); + assertEquals( + "//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/uv/ips/ValueSet/results-laboratory-observations-uv-ips", + observation.getCode().getCodingFirstRep().getSystem()); + assertEquals("Hemoglobin [Mass/volume] in Blood", observation.getCode().getText()); + + // - name: "interpretation" + assertEquals("142", observation.getInterpretationFirstRep().getCodingFirstRep().getCode()); + assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/observation-interpretation' available", + observation.getInterpretationFirstRep().getText()); + + // - name: "testmethod" +// assertEquals("testmethode", observation.getMethod().getText()); + } + + @Test + public void toFhir_multiples() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( + getFile(HELPER_LOCATION + "KDS_Laborbericht_multiples.flat.json"), + new OPTParser(operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allDiagnosticReports = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof DiagnosticReport).collect(Collectors.toList()); + assertEquals(1, allDiagnosticReports.size()); + + final DiagnosticReport diagnosticReport = (DiagnosticReport) allDiagnosticReports.get(0).getResource(); + + Assert.assertEquals(2, diagnosticReport.getSpecimen().size()); + Assert.assertEquals(2, diagnosticReport.getResult().size()); + + + //- name: "healthCareFacility" +// - name: "composer" +// Assert.assertEquals(2, diagnosticReport.getPerformer().size()); // commented out with the comment out of mapping of this field +// Assert.assertEquals("DOE, John", diagnosticReport.getPerformer().get(0).getDisplay()); +// Assert.assertEquals("Max Mustermann", diagnosticReport.getPerformer().get(1).getDisplay()); + + // - name: "Effective" +// assertEquals("2020-02-03T04:05:06+01:00", // commented out with the comment out of mapping of this field +// diagnosticReport.getEffectivePeriod().getStartElement().getValueAsString()); +// assertEquals("2022-02-03T04:05:06+01:00", +// diagnosticReport.getEffectivePeriod().getEndElement().getValueAsString()); + + // - name: "Category" + assertEquals(1, diagnosticReport.getCategory().size()); + assertEquals("LOINC", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getSystem()); + assertEquals("26436-6", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getCode()); + assertEquals("laboratory", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getDisplay()); + + // - name: "Status" + assertEquals("at0107", diagnosticReport.getStatusElement().getValueAsString()); + + // - name: "Conclusion" + assertEquals("Normal blood count", diagnosticReport.getConclusion()); + + // - name: "issued" + assertEquals("2022-02-03T04:05:06.000+01:00", diagnosticReport.getIssuedElement().getValueAsString()); + + // - name: "berichtId" + assertEquals(1, diagnosticReport.getIdentifierFirstRep().getType().getCoding().size()); + assertEquals("FILL", diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getCode()); + assertEquals("http://terminology.hl7.org/CodeSystem/v2-0203", + diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getSystem()); + assertEquals("bericht_id", diagnosticReport.getIdentifierFirstRep().getValue()); + + // Assert Specimen - name: "specimen" + Specimen specimen = (Specimen) diagnosticReport.getSpecimenFirstRep().getResource(); + + // - name: "identifier" + assertEquals("SP-987654", specimen.getIdentifierFirstRep().getValue()); + + // - name: "collected" +// assertEquals("2022-02-03T04:05:06+01:00", +// specimen.getCollection().getCollectedPeriod().getStartElement().getValueAsString()); + + // - name: "collector" + assertEquals("collectorId", specimen.getCollection().getCollector().getIdentifier().getValue()); + + // - name: "specimen type" + assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); + assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", + specimen.getType().getText()); + + // - name: "specimenCollectionMethod" +// assertEquals("Aspiration - action", specimen.getCollection().getMethod().getCodingFirstRep().getCode()); + + // specimenCollectionBodySite +// assertEquals("Arm", specimen.getCollection().getBodySite().getCodingFirstRep().getCode()); + + // - name: "samplingContext" +// assertEquals("Lorem ipsum", specimen.getCollection().getFastingStatusCodeableConcept().getCodingFirstRep().getCode()); + + // - name: "type" + Assert.assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", + specimen.getType().getText()); + Assert.assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); + + // - name: "note" + assertEquals("Sample collected in the morning.", specimen.getNoteFirstRep().getText()); + + // - name: "descriptionOfSpecimen" + Assert.assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0493' available", + specimen.getConditionFirstRep().getText()); + Assert.assertEquals("conditionCode", specimen.getConditionFirstRep().getCodingFirstRep().getCode()); + + // - name: "identifierOfSpecimen" + assertEquals("identifierOfSpecimen", specimen.getAccessionIdentifier().getValue()); + + // - name: "dateReceived" + assertEquals("2022-02-03T04:05:06+01:00", specimen.getReceivedTimeElement().getValueAsString()); + + // specimen - name: "status" + assertEquals("available", specimen.getStatusElement().getValueAsString()); + + Specimen specimen1 = (Specimen) diagnosticReport.getSpecimen().get(1).getResource(); + + // - name: "identifier" + assertEquals("1_SP-987654", specimen1.getIdentifierFirstRep().getValue()); + + // - name: "collected" +// assertEquals("3022-02-03T04:05:06+01:00", +// specimen1.getCollection().getCollectedDateTimeType().getValueAsString()); + + // - name: "collector" + assertEquals("1_collectorId", specimen1.getCollection().getCollector().getIdentifier().getValue()); + + // - name: "specimen type" + assertEquals("1_probenartcode", specimen1.getType().getCodingFirstRep().getCode()); + + // - name: "specimenCollectionMethod" +// assertEquals("1_Aspiration - action", specimen1.getCollection().getMethod().getCodingFirstRep().getCode()); + + // specimenCollectionBodySite +// assertEquals("1_Arm", specimen1.getCollection().getBodySite().getCodingFirstRep().getCode()); + + // - name: "samplingContext" +// assertEquals("1_Lorem ipsum", specimen1.getCollection().getFastingStatusCodeableConcept().getCodingFirstRep().getCode()); + + // - name: "type" + Assert.assertEquals("1_probenartcode", specimen1.getType().getCodingFirstRep().getCode()); + + // - name: "note" + assertEquals("1_Sample collected in the morning.", specimen1.getNoteFirstRep().getText()); + + // - name: "descriptionOfSpecimen" + Assert.assertEquals("1_conditionCode", specimen1.getConditionFirstRep().getCodingFirstRep().getCode()); + + // - name: "identifierOfSpecimen" + assertEquals("1_identifierOfSpecimen", specimen1.getAccessionIdentifier().getValue()); + + // - name: "dateReceived" + assertEquals("3022-02-03T04:05:06+01:00", specimen1.getReceivedTimeElement().getValueAsString()); + + // specimen - name: "status" + assertEquals("unsatisfactory", specimen1.getStatusElement().getValueAsString()); + + + // basedOn, identifierInReference + assertEquals("identifikation_der_laboranforderung", + diagnosticReport.getBasedOnFirstRep().getIdentifier().getValue()); + + + // Assert Observation - name: "result" + Observation observation = (Observation) diagnosticReport.getResultFirstRep().getResource(); + + // - name: "status" +// Assert.assertEquals("registered", observation.getStatusElement().getValueAsString()); todo: where in flat? why not in flat? :o ergebniss-status is gone + + // - name: "issued" + Assert.assertEquals("2022-02-03T04:05:06.000+01:00", observation.getIssuedElement().getValueAsString()); + + // - name: "analyteMeasurement" + assertEquals(7.4, observation.getValueQuantity().getValue().doubleValue(), 0); + assertEquals("mm", observation.getValueQuantity().getUnit()); + + // laboryte name + assertEquals("718-7", observation.getCode().getCodingFirstRep().getCode()); + assertEquals( + "//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/uv/ips/ValueSet/results-laboratory-observations-uv-ips", + observation.getCode().getCodingFirstRep().getSystem()); + assertEquals("Hemoglobin [Mass/volume] in Blood", observation.getCode().getText()); + + // - name: "interpretation" + assertEquals("142", observation.getInterpretationFirstRep().getCodingFirstRep().getCode()); + assertEquals( + "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/observation-interpretation' available", + observation.getInterpretationFirstRep().getText()); + + // - name: "testmethod" +// assertEquals("testmethode", observation.getMethod().getText()); + + Observation observation1 = (Observation) diagnosticReport.getResult().get(1).getResource(); + + // - name: "status" +// Assert.assertEquals("partial", observation1.getStatusElement().getValueAsString()); todo: where in flat? why not in flat? :o ergebniss-status is gone + + // - name: "issued" + Assert.assertEquals("3022-02-03T04:05:06.000+01:00", observation1.getIssuedElement().getValueAsString()); + + // - name: "analyteMeasurement" + assertEquals(8.4, observation1.getValueQuantity().getValue().doubleValue(), 0); + assertEquals("1_mm", observation1.getValueQuantity().getUnit()); + + // laboryte name + assertEquals("1_718-7", observation1.getCode().getCodingFirstRep().getCode()); + assertEquals("1_Hemoglobin [Mass/volume] in Blood", observation1.getCode().getText()); + + // - name: "interpretation" + assertEquals("1_142", observation1.getInterpretationFirstRep().getCodingFirstRep().getCode()); + + // - name: "testmethod" +// assertEquals("1_testmethode", observation1.getMethod().getText()); + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/medikationseintrag/DebugMedikationseintragPrintTest.java b/src/test/java/com/medblocks/openfhir/kds/medikationseintrag/DebugMedikationseintragPrintTest.java new file mode 100644 index 00000000..bb4f0984 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/medikationseintrag/DebugMedikationseintragPrintTest.java @@ -0,0 +1,54 @@ +package com.medblocks.openfhir.kds.medikationseintrag; + +import ca.uhn.fhir.context.FhirContext; +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import org.hl7.fhir.r4.model.Bundle; +import org.junit.Test; + +import java.io.InputStream; +import java.util.SortedSet; +import java.util.TreeSet; + +public class DebugMedikationseintragPrintTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml"; + final String HELPER_LOCATION = "/kds/medikationseintrag/"; + final String BUNDLE = "KDS_Medikationseintrag_v1-Fhir-Bundle-input.json"; + + @Override + public void prepareState() { + context = getContext(CONTEXT); + try { + operationaltemplateSerialized = new String( + getClass().getResourceAsStream(HELPER_LOCATION + "KDS_Medikationseintrag.opt").readAllBytes(), + java.nio.charset.StandardCharsets.UTF_8); + } catch (Exception e) { + throw new RuntimeException(e); + } + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + } + + @Test + public void printFlatForDebug() { + InputStream is = getClass().getResourceAsStream(HELPER_LOCATION + BUNDLE); + Bundle bundle = FhirContext.forR4().newJsonParser().parseResource(Bundle.class, is); + + JsonObject flat = fhirToOpenEhr.fhirToFlatJsonObject(context, bundle, operationaltemplate); + + SortedSet keys = new TreeSet<>(); + flat.entrySet().forEach(e -> keys.add(e.getKey() + " = " + e.getValue().toString())); + + // Print only medication-related paths for brevity + keys.stream() + .filter(k -> k.contains("/arzneimittel/")) + .forEach(System.out::println); + } + + @Override + public JsonObject toOpenEhr() { + return null; // not used in this debug test + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/medikationseintrag/MedikationseintragTest.java b/src/test/java/com/medblocks/openfhir/kds/medikationseintrag/MedikationseintragTest.java new file mode 100644 index 00000000..76ace873 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/medikationseintrag/MedikationseintragTest.java @@ -0,0 +1,234 @@ +package com.medblocks.openfhir.kds.medikationseintrag; + +import ca.uhn.fhir.context.FhirContext; +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.*; +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; +import java.util.List; +import java.util.stream.Collectors; + +public class MedikationseintragTest extends KdsBidirectionalTest { + + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml"; + final String HELPER_LOCATION = "/kds/medikationseintrag/"; + final String OPT = "KDS_Medikationseintrag.opt"; + final String FLAT = "KDS_Medikationseintrag.flat.json"; + + final String BUNDLE = "KDS_Medikationseintrag_v1-Fhir-Bundle-input.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void kdsMedicationList_toFhir() throws IOException { + // openEHR to FHIR + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFile(HELPER_LOCATION + FLAT), webTemplate); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + + final List requests = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof MedicationStatement) + .map(en -> (MedicationStatement) en.getResource()) + .collect(Collectors.toList()); + + Assert.assertEquals(2, requests.size()); + + final MedicationStatement req1 = requests.get(0); + final MedicationStatement req2 = requests.get(1); + + Assert.assertEquals("2022-02-03T04:05:06+01:00", req2.getDateAssertedElement().getValueAsString()); + + + Assert.assertEquals("behandlungsgrund1", req1.getReasonCodeFirstRep().getText()); + Assert.assertEquals("behandlungsgrund", req2.getReasonCodeFirstRep().getText()); + + Assert.assertEquals("hinweis1", req1.getNoteFirstRep().getText()); + Assert.assertEquals("hinweis", req2.getNoteFirstRep().getText()); + + final List req2Dosages = req2.getDosage(); + + Assert.assertEquals(2, req2Dosages.size()); + Assert.assertEquals("structured dosage text", req2Dosages.get(0).getText()); + Assert.assertEquals("mm", req2Dosages.get(0).getDoseAndRateFirstRep().getDoseQuantity().getUnit()); + Assert.assertEquals("22.0", req2Dosages.get(0).getDoseAndRateFirstRep().getDoseQuantity().getValue().toPlainString()); + Assert.assertEquals(22, req2Dosages.get(0).getSequence()); + + Assert.assertEquals("structured dosage 2 text", req2Dosages.get(1).getText()); + Assert.assertEquals("mm1", req2Dosages.get(1).getDoseAndRateFirstRep().getDoseQuantity().getUnit()); + Assert.assertEquals("23.0", req2Dosages.get(1).getDoseAndRateFirstRep().getDoseQuantity().getValue().toPlainString()); + Assert.assertEquals(23, req2Dosages.get(1).getSequence()); + +// Assert.assertEquals(true, req2.getDosageFirstRep().getAsNeededBooleanType().getValue()); + Assert.assertNull(req1.getDosageFirstRep().getAsNeededBooleanType().getValue()); + + final Medication med1 = (Medication) req1.getMedicationReference().getResource(); + final Medication med2 = (Medication) req2.getMedicationReference().getResource(); +// Assert.assertEquals("req0, medication code text", med2.getCode().getCodingFirstRep().getDisplay()); + Assert.assertEquals("42", med2.getForm().getCodingFirstRep().getCode()); + Assert.assertEquals("52", med1.getForm().getCodingFirstRep().getCode()); +// Assert.assertEquals("req1, medication code text", med1.getCode().getCodingFirstRep().getDisplay()); + Assert.assertEquals("25.0", med1.getAmount().getNumerator().getValue().toPlainString()); + Assert.assertEquals("mm", med1.getAmount().getNumerator().getUnit()); + Assert.assertEquals("20.0", med2.getAmount().getNumerator().getValue().toPlainString()); + Assert.assertEquals("mm", med2.getAmount().getNumerator().getUnit()); + + Assert.assertEquals(3, med2.getIngredient().size()); + Assert.assertEquals(2, med1.getIngredient().size()); + Assert.assertEquals("ingridient item 0, 0", + ((Medication) med2.getIngredient().get(0).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); + Assert.assertEquals("ingridient item 0, 1", ((Medication) med2.getIngredient().get(1).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); + + Assert.assertEquals("ingridient item 1, 0", ((Medication) med1.getIngredient().get(0).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); + Assert.assertEquals("ingridient item 1, 1", ((Medication) med1.getIngredient().get(1).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); + + + final Medication.MedicationIngredientComponent ingridient00 = med2.getIngredient().get(0); + + final Medication.MedicationIngredientComponent ingridient01 = med2.getIngredient().get(1); + + final Medication.MedicationIngredientComponent ingridient0Empty = med2.getIngredient().get(2); + + final Medication.MedicationIngredientComponent ingridient10 = med1.getIngredient().get(0); + + final Ratio zerothIngridientStrenght = ingridient00.getStrength(); + final Ratio firstIngridientStrenght = ingridient01.getStrength(); + + final Ratio secondIngridientStrenght = ingridient0Empty.getStrength(); + + Assert.assertEquals("10.0", zerothIngridientStrenght.getNumerator().getValue().toPlainString()); + Assert.assertEquals("11.0", zerothIngridientStrenght.getDenominator().getValue().toPlainString()); + Assert.assertEquals("1mm", zerothIngridientStrenght.getNumerator().getUnit()); + Assert.assertEquals("2mm", zerothIngridientStrenght.getDenominator().getUnit()); + + Assert.assertEquals("20.0", firstIngridientStrenght.getNumerator().getValue().toPlainString()); + Assert.assertEquals("21.0", firstIngridientStrenght.getDenominator().getValue().toPlainString()); + Assert.assertEquals("3mm", firstIngridientStrenght.getNumerator().getUnit()); + Assert.assertEquals("4mm", firstIngridientStrenght.getDenominator().getUnit()); + + Assert.assertEquals("30.0", secondIngridientStrenght.getNumerator().getValue().toPlainString()); + Assert.assertEquals("31.0", secondIngridientStrenght.getDenominator().getValue().toPlainString()); + Assert.assertEquals("5mm", secondIngridientStrenght.getNumerator().getUnit()); + Assert.assertEquals("6mm", secondIngridientStrenght.getDenominator().getUnit()); + + final Ratio firstZerothIngridientStrenght = ingridient10.getStrength(); + + final Ratio firstFirstIngridientStrenght = med1.getIngredient().get(1).getStrength(); + + Assert.assertEquals("40.0", firstZerothIngridientStrenght.getDenominator().getValue().toPlainString()); + Assert.assertEquals("mm", firstZerothIngridientStrenght.getDenominator().getUnit()); + + Assert.assertEquals("41.0", firstFirstIngridientStrenght.getDenominator().getValue().toPlainString()); + Assert.assertEquals("mm", firstFirstIngridientStrenght.getDenominator().getUnit()); + +// Assert.assertEquals("at0143", ingridient00.getItemCodeableConcept().getCodingFirstRep().getCode()); +// Assert.assertEquals("Ad-hoc Mixtur", ingridient00.getItemCodeableConcept().getCodingFirstRep().getDisplay()); +// +// Assert.assertEquals("at3143", ingridient0Empty.getItemCodeableConcept().getCodingFirstRep().getCode()); +// Assert.assertEquals("3Ad-hoc Mixtur", ingridient0Empty.getItemCodeableConcept().getCodingFirstRep().getDisplay()); +// +// Assert.assertEquals("at0243", ingridient10.getItemCodeableConcept().getCodingFirstRep().getCode()); +// Assert.assertEquals("2Ad-hoc Mixtur", ingridient10.getItemCodeableConcept().getCodingFirstRep().getDisplay()); + } + + @Test + public void kdsMedicationList_toFhir_testOpenEhrCondition() throws IOException { + // openEHR to FHIR + final String flat = getFile(HELPER_LOCATION + FLAT); + final Gson gson = new Gson(); + final JsonObject flatJsonObject = gson.fromJson(flat, JsonObject.class); + +// flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|value"); +// flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|code"); +// flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|terminology"); + flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/wirkstärke_konzentration|magnitude"); + flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/wirkstärke_konzentration|unit"); + + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(gson.toJson(flatJsonObject), webTemplate); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + + final List requests = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof MedicationStatement) + .map(en -> (MedicationStatement) en.getResource()) + .collect(Collectors.toList()); + + Assert.assertEquals(2, requests.size()); + + final MedicationStatement theOneWithMedicationReference = requests.stream() + .filter(req -> req.getReasonCodeFirstRep().getText().equals("behandlungsgrund")) + .findFirst().orElse(null); + + final MedicationStatement theOneWithMedicationCodeableConcept = requests.stream() + .filter(req -> req.getReasonCodeFirstRep().getText().equals("behandlungsgrund1")) + .findFirst().orElse(null); + + final Medication med1 = (Medication) theOneWithMedicationReference.getMedicationReference().getResource(); +// final CodeableConcept med2 = theOneWithMedicationCodeableConcept.getMedicationCodeableConcept(); +// +// Assert.assertEquals("req1, medication code text", med2.getText()); +// +// Assert.assertEquals("req0, medication code text", med1.getCode().getCodingFirstRep().getDisplay()); + Assert.assertEquals("20.0", med1.getAmount().getNumerator().getValue().toPlainString()); + Assert.assertEquals("mm", med1.getAmount().getNumerator().getUnit()); + + } + + + public JsonObject toOpenEhr() { + final Bundle testBundle = FhirContext.forR4().newJsonParser().parseResource(Bundle.class, getClass().getResourceAsStream(HELPER_LOCATION + BUNDLE)); + + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + Assert.assertEquals("Take 1 tablet every 6 hours as needed for pain", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/dosierung:0/dosierung_freitext").getAsString()); + Assert.assertEquals("500.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/dosierung:0/dosis/quantity_value|magnitude").getAsString()); + Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/dosierung:0/dosis/quantity_value|unit").getAsString()); + Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/arzneimittel-name|code").getAsString()); + Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/arzneimittel-name|terminology").getAsString()); + Assert.assertEquals("Paracetamol 500mg tablet", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/arzneimittel-name|value").getAsString()); + Assert.assertEquals("385055001", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|terminology").getAsString()); + Assert.assertEquals("Paracetamol", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil").getAsString()); + Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/wirkstofftyp|code").getAsString()); + Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/wirkstofftyp|terminology").getAsString()); + Assert.assertEquals("500.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/zähler|magnitude").getAsString()); + Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/zähler|unit").getAsString()); + Assert.assertEquals("1.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/nenner|magnitude").getAsString()); + Assert.assertEquals("tablet", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/nenner|unit").getAsString()); + Assert.assertEquals("11Paracetamol", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil").getAsString()); + Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/wirkstofftyp|code").getAsString()); + Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/wirkstofftyp|terminology").getAsString()); + Assert.assertEquals("1500.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/zähler|magnitude").getAsString()); + Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/zähler|unit").getAsString()); + Assert.assertEquals("11.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/nenner|magnitude").getAsString()); + Assert.assertEquals("tablet", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/nenner|unit").getAsString()); + Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:2/wirkstofftyp|code").getAsString()); + Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:2/wirkstofftyp|terminology").getAsString()); + Assert.assertEquals("Take 1 capsule daily", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/dosierung:0/dosierung_freitext").getAsString()); + Assert.assertEquals("5.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/dosierung:0/dosis/quantity_value|magnitude").getAsString()); + Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/dosierung:0/dosis/quantity_value|unit").getAsString()); + Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/arzneimittel-name|terminology").getAsString()); + Assert.assertEquals("C09AA05", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/arzneimittel-name|code").getAsString()); + Assert.assertEquals("Ramipril 5mg capsule", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/arzneimittel-name|value").getAsString()); + + Assert.assertEquals("High cholesterol", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/behandlungsgrund:0").getAsString()); + + return jsonObject; + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/medikationsverabreichung/MedikamentenverabreichungenTest.java b/src/test/java/com/medblocks/openfhir/kds/medikationsverabreichung/MedikamentenverabreichungenTest.java new file mode 100644 index 00000000..2ce41754 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/medikationsverabreichung/MedikamentenverabreichungenTest.java @@ -0,0 +1,133 @@ +package com.medblocks.openfhir.kds.medikationsverabreichung; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.MedicationAdministration; +import org.hl7.fhir.r4.model.MedicationRequest; +import org.hl7.fhir.r4.model.Period; +import org.junit.Assert; +import org.junit.Test; + +import java.util.List; +import java.util.stream.Collectors; + +public class MedikamentenverabreichungenTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/medikationsverabreichung/KDS_medikationsverabreichung.context.yaml"; + final String HELPER_LOCATION = "/kds/medikationsverabreichung/"; + final String OPT = "KDS_Medikamentenverabreichungen.opt"; + final String FLAT = "KDS_Medikamentenverabreichungen.flat.json"; + + final String BUNDLE = "KDS_Medikamentenverabreichungen_Bundle.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void toFhir() { + // openEHR to FHIR + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFile(HELPER_LOCATION + FLAT), webTemplate); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + + final List administrations = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof MedicationAdministration) + .map(en -> (MedicationAdministration) en.getResource()) + .collect(Collectors.toList()); + + Assert.assertEquals(1, administrations.size()); + + final MedicationAdministration medicationAdministration = administrations.get(0); + final CodeableConcept medicationResource = (CodeableConcept) medicationAdministration.getMedicationCodeableConcept(); + + Assert.assertEquals("arzneimittel-name", medicationResource.getCodingFirstRep().getDisplay()); + +// Assert.assertEquals("in-progress", medicationAdministration.getStatusElement().getValueAsString()); +// Assert.assertEquals("context reference encounter 123", medicationAdministration.getContext().getReference()); + + final Period effectivePeriod = medicationAdministration.getEffectivePeriod(); + Assert.assertEquals("2022-02-03T04:05:06+01:00", effectivePeriod.getStartElement().getValueAsString()); + Assert.assertEquals("2022-02-03T04:05:06+01:00", effectivePeriod.getEndElement().getValueAsString()); + + Assert.assertEquals("Admin note comment", medicationAdministration.getNoteFirstRep().getText()); + + final MedicationAdministration.MedicationAdministrationDosageComponent dosage = medicationAdministration.getDosage(); + Assert.assertEquals("20 mg orally once daily", dosage.getText()); +// Assert.assertEquals("1", dosage.getDose().getUnit()); + Assert.assertEquals("22.0", dosage.getDose().getValue().toPlainString()); + + Assert.assertEquals("route42", dosage.getRoute().getCodingFirstRep().getCode()); + + Assert.assertEquals("SiteDisplay", dosage.getSite().getText()); + Assert.assertEquals("siteCode", dosage.getSite().getCodingFirstRep().getCode()); + Assert.assertEquals("//snomed.info/sct", dosage.getSite().getCodingFirstRep().getSystem()); + + Assert.assertEquals("21.0", dosage.getRateQuantity().getValue().toPlainString()); + Assert.assertEquals("l/h", dosage.getRateQuantity().getUnit()); + + Assert.assertEquals("Reason code", medicationAdministration.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()); + Assert.assertEquals("dev/null", ((MedicationRequest) medicationAdministration.getRequest().getResource()).getIdentifierFirstRep().getValue()); + } + + + + public JsonObject toOpenEhr() { + final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + // status +// Assert.assertEquals("completed", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/status|code").getAsString()); + + // berichtId + Assert.assertEquals("MA123456", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/bericht_id").getAsString()); + + // reason code + Assert.assertEquals("Hypertensive disorder, systemic arterial", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/klinische_indikation").getAsString()); + + // route + Assert.assertEquals("26643006", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/details_zur_verabreichung/verabreichungsweg|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/details_zur_verabreichung/verabreichungsweg|terminology").getAsString()); + Assert.assertEquals("Oral", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/details_zur_verabreichung/verabreichungsweg|value").getAsString()); + + // - name: "category" + Assert.assertEquals("232", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/setting|code").getAsString()); + Assert.assertEquals("openehr", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/setting|terminology").getAsString()); + Assert.assertEquals("secondary medical care", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/setting|value").getAsString()); + + // - name: "note" + Assert.assertEquals("textab", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/kommentar").getAsString()); + + // dosage text + Assert.assertEquals("20 mg orally once daily", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/dosierung/dosierung_freitext").getAsString()); + + // dose value + Assert.assertEquals(250.0, jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/dosierung/dosis|magnitude").getAsDouble(), 0); + Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/dosierung/dosis|unit").getAsString()); + + // name +// Assert.assertEquals("Paracetamol 500mg tablet", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/arzneimittel/arzneimittel-name").getAsString()); + + // form + Assert.assertEquals("UTA", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/arzneimittel/darreichungsform|code").getAsString()); + Assert.assertEquals("https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_BMP_DARREICHUNGSFORM", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/arzneimittel/darreichungsform|terminology").getAsString()); + + //- name: "klinischeIndikation" + Assert.assertEquals("Hypertensive disorder, systemic arterial", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/klinische_indikation").getAsString()); + + return jsonObject; + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/person/PersonTest.java b/src/test/java/com/medblocks/openfhir/kds/person/PersonTest.java new file mode 100644 index 00000000..d742f347 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/person/PersonTest.java @@ -0,0 +1,341 @@ +package com.medblocks.openfhir.kds.person; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import java.util.List; +import java.util.stream.Collectors; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Address; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Condition; +import org.hl7.fhir.r4.model.HumanName; +import org.hl7.fhir.r4.model.Observation; +import org.hl7.fhir.r4.model.Organization; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.StringType; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +@Ignore +public class PersonTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/person/KDS_medikationsverabreichung.context.yaml"; + final String HELPER_LOCATION = "/kds/person/"; + final String OPT = "KDS_Person.opt"; + final String FLAT = "KDS_Person.flat.json"; + + final String BUNDLE = "kds_person_bundle.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void kdsPerson_toFhir() { + // openEHR to FHIR + final String initialFlat = getFile(HELPER_LOCATION + FLAT); + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(initialFlat, webTemplate); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + + final List patients = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Patient) + .map(en -> (Patient) en.getResource()) + .collect(Collectors.toList()); + + final List conditions = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Condition) + .map(en -> (Condition) en.getResource()) + .collect(Collectors.toList()); + + final List observations = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Observation) + .map(en -> (Observation) en.getResource()) + .collect(Collectors.toList()); + + Assert.assertEquals(1, patients.size()); + final Patient thePatient = patients.get(0); + + final Address strasseAddress = thePatient.getAddress().get(0); + final Address postfachAddress = thePatient.getAddress().get(1); + final List strasseLines = strasseAddress.getLine(); + Assert.assertEquals(1, strasseLines.size()); + Assert.assertEquals(3, strasseLines.get(0).getExtension().size()); + Assert.assertEquals("123 Main St", ((StringType) strasseLines.get(0) + .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-streetName") + .getValue()).getValue()); + Assert.assertEquals("Apt 4B", ((StringType) strasseLines.get(0) + .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-houseNumber") + .getValue()).getValue()); + Assert.assertEquals("Wohnung 3", ((StringType) strasseLines.get(0) + .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-additionalLocator") + .getValue()).getValue()); + Assert.assertEquals("Hamburg", ((StringType) strasseAddress.getCityElement().getExtensionFirstRep() + .getValue()).getValue()); + Assert.assertEquals("Mitte", ((StringType) strasseAddress.getExtensionFirstRep().getValue()).getValue()); + Assert.assertEquals("postal", strasseAddress.getTypeElement().getValueAsString()); + Assert.assertEquals("20095", strasseAddress.getPostalCode()); + Assert.assertEquals("DE", strasseAddress.getCountry()); + + final List postfachLines = postfachAddress.getLine(); + Assert.assertEquals(0, postfachLines.size()); + Assert.assertEquals("Berlin", ((StringType) postfachAddress.getCityElement().getExtensionFirstRep() + .getValue()).getValue()); + Assert.assertEquals("Kreuzberg", ((StringType) postfachAddress.getExtensionFirstRep().getValue()).getValue()); + Assert.assertEquals("postal", postfachAddress.getTypeElement().getValueAsString()); + Assert.assertEquals("10997", postfachAddress.getPostalCode()); + Assert.assertEquals(" DE", postfachAddress.getCountry()); + Assert.assertEquals("Berlin", postfachAddress.getState()); + + Assert.assertEquals("D", ((Coding) thePatient.getExtensionByUrl("extension_url_to_be_defined") + .getValue()).getCode()); + Assert.assertEquals("divers", ((Coding) thePatient.getExtensionByUrl("extension_url_to_be_defined") + .getValue()).getDisplay()); + Assert.assertEquals("http://fhir.de/ValueSet/gender-other-de", + ((Coding) thePatient.getExtensionByUrl("extension_url_to_be_defined") + .getValue()).getSystem()); + Assert.assertEquals("male", thePatient.getGenderElement().getValueAsString()); + final List names = thePatient.getName(); + Assert.assertEquals(2, names.size()); + final List maidenNames = names.stream() + .filter(name -> name.getUseElement().getCode().equals("maiden")).collect(Collectors.toList()); + final List officialNames = names.stream() + .filter(name -> name.getUseElement().getCode().equals("official")).collect(Collectors.toList()); + Assert.assertEquals(1, maidenNames.size()); + Assert.assertEquals(1, officialNames.size()); + final HumanName maidenName = maidenNames.get(0); + final HumanName officialName = officialNames.get(0); + + Assert.assertEquals("Doe", officialName.getText()); + Assert.assertEquals("John", ((StringType) officialName.getFamilyElement() + .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-name") + .getValue()).getValue()); + Assert.assertEquals("Doe", ((StringType) officialName.getFamilyElement() + .getExtensionByUrl("http://fhir.de/StructureDefinition/humanname-namenszusatz").getValue()).getValue()); + Assert.assertEquals("zu", ((StringType) officialName.getFamilyElement() + .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-prefix") + .getValue()).getValue()); + + Assert.assertNull(maidenName.getText()); + Assert.assertEquals("Smith", ((StringType) maidenName.getFamilyElement() + .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-name") + .getValue()).getValue()); + Assert.assertEquals("Von", ((StringType) maidenName.getFamilyElement() + .getExtensionByUrl("http://fhir.de/StructureDefinition/humanname-namenszusatz").getValue()).getValue()); + Assert.assertEquals("zu", ((StringType) maidenName.getFamilyElement() + .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-prefix") + .getValue()).getValue()); + + Assert.assertEquals(3, thePatient.getIdentifier().size()); + Assert.assertEquals("PID987654321", thePatient.getIdentifier().stream() + .filter(id -> id.getSystem().equals("http://hospital.smarthealthit.org")).findFirst().orElse(null) + .getValue()); + Assert.assertEquals("GKV123456789", thePatient.getIdentifier().stream() + .filter(id -> id.getSystem().equals("http://fhir.de/NamingSystem/gkv/patient")).findFirst().orElse(null) + .getValue()); + Assert.assertEquals("PKV543210987", thePatient.getIdentifier().stream() + .filter(id -> id.getSystem().equals("http://fhir.de/NamingSystem/pkv/patient")).findFirst().orElse(null) + .getValue()); + + + final Organization org = (Organization) thePatient.getManagingOrganization().getResource(); + Assert.assertEquals("Example Administrative Organization", org.getName()); + Assert.assertEquals("ORG-98765", org.getIdentifierFirstRep().getValue()); + + Assert.assertEquals("Tue Jan 01 00:00:00 CET 1980", thePatient.getBirthDate().toString()); + Assert.assertEquals(true, ((BooleanType) thePatient.getBirthDateElement().getExtensionByUrl("isdeceased") + .getValue()).getValue()); + + Assert.assertEquals("2022-02-03T04:05:06+01:00", thePatient.getDeceasedDateTimeType().getValueAsString()); + + Assert.assertEquals(1, conditions.size()); + Assert.assertEquals( + "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://fhir.de/ValueSet/bfarm/icd-10-gm' available", + conditions.get(0).getCode().getText()); + Assert.assertEquals("42", conditions.get(0).getCode().getCodingFirstRep().getCode()); + + final Patient.ContactComponent zerothContact = thePatient.getContact().get(0); + final CodeableConcept firstRelationshipCodeable = zerothContact.getRelationship().get(0); + final CodeableConcept secondRelationshipCodeable = zerothContact.getRelationship().get(1); + + Assert.assertEquals("contact person name", zerothContact.getName().getText()); + + Assert.assertEquals( + "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/patient-contactrelationship' available", + firstRelationshipCodeable.getText()); + Assert.assertEquals("42", firstRelationshipCodeable.getCodingFirstRep().getCode()); + + + Assert.assertEquals("another contact person role relationship", secondRelationshipCodeable.getText()); + Assert.assertEquals("43", secondRelationshipCodeable.getCodingFirstRep().getCode()); + + + Assert.assertEquals("contact person address", zerothContact.getAddress().getText()); + Assert.assertEquals("+1-555-1234", zerothContact.getTelecomFirstRep().getValue()); + + Assert.assertEquals(1, observations.size()); + Assert.assertEquals("vital status text", observations.get(0).getNoteFirstRep().getText()); + Assert.assertEquals("final", observations.get(0).getStatusElement().getCode()); + Assert.assertEquals("2022-02-03T04:05:06+01:00", + observations.get(0).getEffectiveDateTimeType().getValueAsString()); + +// ??? +// final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, bundle, operationaltemplate); + + } + + public JsonObject toOpenEhr() { + final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); + + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + Assert.assertEquals("PID987654321", + jsonObject.getAsJsonPrimitive("person/personendaten/person/pid:0|id").getAsString()); + Assert.assertEquals("Von Smith", + jsonObject.getAsJsonPrimitive("person/personendaten/person/geburtsname/vollständiger_name") + .getAsString()); + Assert.assertEquals("maiden", + jsonObject.getAsJsonPrimitive("person/personendaten/person/geburtsname/namensart|code") + .getAsString()); + Assert.assertEquals("Von Smith", + jsonObject.getAsJsonPrimitive("person/personendaten/person/geburtsname/familienname") + .getAsString()); + Assert.assertEquals("Smith", jsonObject.getAsJsonPrimitive( + "person/personendaten/person/geburtsname/familienname-nachname").getAsString()); + Assert.assertEquals("Von", jsonObject.getAsJsonPrimitive( + "person/personendaten/person/geburtsname/familienname-namenszusatz").getAsString()); + Assert.assertEquals("zu", jsonObject.getAsJsonPrimitive( + "person/personendaten/person/geburtsname/familienname-vorsatzwort").getAsString()); + Assert.assertEquals("John Doe", + jsonObject.getAsJsonPrimitive("person/personendaten/person/name/vollständiger_name") + .getAsString()); + Assert.assertEquals("official", jsonObject.getAsJsonPrimitive("person/personendaten/person/name/namensart|code") + .getAsString()); + Assert.assertEquals("John", + jsonObject.getAsJsonPrimitive("person/personendaten/person/name/vorname:0").getAsString()); + Assert.assertEquals("John Doe", jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname") + .getAsString()); + Assert.assertEquals("John", + jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname-nachname") + .getAsString()); + Assert.assertEquals("Doe", + jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname-namenszusatz") + .getAsString()); + Assert.assertEquals("zu", + jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname-vorsatzwort") + .getAsString()); + + Assert.assertEquals("Hamburg", jsonObject.getAsJsonPrimitive( + "person/personendaten/person/straßenanschrift:0/gemeindeschlüssel").getAsString()); + Assert.assertEquals("Hamburg", jsonObject.getAsJsonPrimitive( + "person/personendaten/person/straßenanschrift:0/bundesland|value").getAsString()); + Assert.assertEquals("20095", + jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/postleitzahl") + .getAsString()); + Assert.assertEquals("Mitte", + jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/stadtteil") + .getAsString()); + Assert.assertEquals("Hamburg", + jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/stadt") + .getAsString()); + Assert.assertEquals("Germany", + jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/land|value") + .getAsString()); + Assert.assertEquals("both", + jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/art|value") + .getAsString()); + Assert.assertEquals("123 Main St", + jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/straße:0") + .getAsString()); + Assert.assertEquals("Apt 4B", + jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/hausnummer:0") + .getAsString()); + Assert.assertEquals("Wohnung 3", jsonObject.getAsJsonPrimitive( + "person/personendaten/person/straßenanschrift:0/adresszusatz:0").getAsString()); + + Assert.assertEquals("Berlin", + jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/gemeindeschlüssel") + .getAsString()); + Assert.assertEquals("Berlin", + jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/bundesland|value") + .getAsString()); + Assert.assertEquals("Berlin", + jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/stadt").getAsString()); + Assert.assertEquals("10997", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/postleitzahl") + .getAsString()); + Assert.assertEquals("Kreuzberg", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/stadtteil") + .getAsString()); + Assert.assertEquals("Germany", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/land|value") + .getAsString()); + Assert.assertEquals("postal", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/art|value") + .getAsString()); + + Assert.assertEquals("GKV123456789", + jsonObject.getAsJsonPrimitive("person/personendaten/person/versicherten_id_gkv|id") + .getAsString()); + Assert.assertEquals("PKV543210987", + jsonObject.getAsJsonPrimitive("person/personendaten/person/versicherungsnummer_pkv|id") + .getAsString()); + + Assert.assertEquals("1980-01-01", + jsonObject.getAsJsonPrimitive("person/personendaten/daten_zur_geburt/geburtsdatum") + .getAsString()); + + Assert.assertEquals("emergency", jsonObject.getAsJsonPrimitive( + "person/personendaten/kontaktperson/rolle_relationship:0|code").getAsString()); + Assert.assertEquals("http://hl7.org/fhir/ValueSet/contact-relationship", jsonObject.getAsJsonPrimitive( + "person/personendaten/kontaktperson/rolle_relationship:0|terminology").getAsString()); + Assert.assertEquals("Emergency Contact", jsonObject.getAsJsonPrimitive( + "person/personendaten/kontaktperson/rolle_relationship:0|value").getAsString()); + + Assert.assertEquals("+1-555-1234", jsonObject.getAsJsonPrimitive( + "person/personendaten/kontaktperson/elektronische_kommunikation:0/daten/text_value").getAsString()); + Assert.assertEquals("jane.doe@example.com", jsonObject.getAsJsonPrimitive( + "person/personendaten/kontaktperson/elektronische_kommunikation:1/daten/text_value").getAsString()); + + Assert.assertEquals("Example Health Clinic", + jsonObject.getAsJsonPrimitive("person/personendaten/kontaktperson/organisation/namenszeile") + .getAsString()); + Assert.assertEquals("ORG-12345", jsonObject.getAsJsonPrimitive( + "person/personendaten/kontaktperson/organisation/identifier:0/identifier_value|id").getAsString()); + + Assert.assertEquals("16100001", jsonObject.getAsJsonPrimitive( + "person/personendaten/angaben_zum_tod/angaben_zum_tod/todesdiagnose|code").getAsString()); + Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive( + "person/personendaten/angaben_zum_tod/angaben_zum_tod/todesdiagnose|terminology").getAsString()); + Assert.assertEquals("Cause of death", jsonObject.getAsJsonPrimitive( + "person/personendaten/angaben_zum_tod/angaben_zum_tod/todesdiagnose|value").getAsString()); + Assert.assertEquals("2024-08-24T02:00:00", jsonObject.getAsJsonPrimitive( + "person/personendaten/angaben_zum_tod/angaben_zum_tod/sterbedatum").getAsString()); + + Assert.assertEquals("The patient is recorded Dead. Cause of death is based on the patient's medical history.", + jsonObject.getAsJsonPrimitive("person/vitalstatus/vitalstatus").getAsString()); + Assert.assertEquals("final", + jsonObject.getAsJsonPrimitive("person/vitalstatus/fhir_status_der_beobachtung/status") + .getAsString()); + Assert.assertEquals("2024-08-21T16:30:00", + jsonObject.getAsJsonPrimitive("person/vitalstatus/zeitpunkt_der_feststellung") + .getAsString()); + + Assert.assertEquals("male", jsonObject.getAsJsonPrimitive("person/geschlecht/administratives_geschlecht|code") + .getAsString()); + + + return jsonObject; + + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/procedure/ProcedureTest.java b/src/test/java/com/medblocks/openfhir/kds/procedure/ProcedureTest.java new file mode 100644 index 00000000..0f544ad2 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/procedure/ProcedureTest.java @@ -0,0 +1,134 @@ +package com.medblocks.openfhir.kds.procedure; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import java.util.List; +import java.util.stream.Collectors; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Procedure; +import org.junit.Assert; +import org.junit.Test; + +public class ProcedureTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/procedure/procedure.context.yaml"; + final String HELPER_LOCATION = "/kds/procedure/"; + final String OPT = "KDS_Prozedur.opt"; + final String FLAT = "KDS_Prozedur.flat.json"; + + final String BUNDLE = "KDS_Prozedur_bundle.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void toFhir() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFile(HELPER_LOCATION + FLAT), + new OPTParser( + operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allProcedures = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Procedure).collect(Collectors.toList()); + Assert.assertEquals(1, allProcedures.size()); + + final Procedure theProcedure = (Procedure) allProcedures.get(0).getResource(); + + // -performed + Assert.assertEquals("2022-02-03T04:05:06+01:00", + theProcedure.getPerformedDateTimeType().getValueAsString()); + +// - name: "ISM Transition" +// Assert.assertEquals("530", theProcedure.getStatusElement().getValueAsString()); + +// - name: "Name" + Assert.assertEquals("80146002", theProcedure.getCode().getCodingFirstRep().getCode()); + Assert.assertEquals("//fhir.hl7.org/ValueSet/$expand?url=http://fhir.de/ValueSet/bfarm/ops", + theProcedure.getCode().getCodingFirstRep().getSystem()); + +// - name: "Comment" + Assert.assertEquals("Procedure completed successfully with no complications.", + theProcedure.getNoteFirstRep().getText()); + +// - name: "Kategorie" + Assert.assertEquals("Diagnostic procedure", theProcedure.getCategory().getText()); + Assert.assertEquals("103693007", theProcedure.getCategory().getCodingFirstRep().getCode()); + +// - name: "Body site" + Assert.assertEquals("Abdomen", theProcedure.getBodySite().get(0).getText()); + Assert.assertEquals("818981001", theProcedure.getBodySite().get(0).getCodingFirstRep().getCode()); + + // - name: "berichtId" + Assert.assertEquals("bericht_idqa", theProcedure.getIdentifierFirstRep().getValue()); + +// - name: "Durchführungsabsicht" + final Extension durchuhrungsabsicht = theProcedure.getExtensionByUrl( + "https://www.medizininformatik-initiative.de/fhir/core/modul-prozedur/StructureDefinition/Durchfuehrungsabsicht"); + Assert.assertNotNull(durchuhrungsabsicht); + Assert.assertEquals("durchführungsabsicht", ((Coding) durchuhrungsabsicht.getValue()).getCode()); + Assert.assertEquals("valuedurchführungsabsicht", ((Coding) durchuhrungsabsicht.getValue()).getDisplay()); + + } + + public JsonObject toOpenEhr() { + final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + +// Assert.assertEquals("completed", +// jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/ism_transition/current_state") +// .getAsString()); + Assert.assertEquals("5-470", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/name_der_prozedur|code") + .getAsString()); + Assert.assertEquals("Interventional neurovascular procedures,", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/name_der_prozedur|value") + .getAsString()); + Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/ops", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/name_der_prozedur|terminology") + .getAsString()); + + Assert.assertEquals("Procedure completed successfully with no complications.", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kommentar").getAsString()); + Assert.assertEquals("103693007", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kategorie_der_prozedur|code") + .getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kategorie_der_prozedur|terminology") + .getAsString()); + Assert.assertEquals("Diagnostic procedure", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kategorie_der_prozedur|value") + .getAsString()); + Assert.assertEquals("durchführungsabsicht", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/durchführungsabsicht|code") + .getAsString()); + Assert.assertEquals("valuedurchführungsabsicht", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/durchführungsabsicht|value") + .getAsString()); + Assert.assertEquals("Durchfuehrungsabsicht", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/durchführungsabsicht|terminology") + .getAsString()); + Assert.assertEquals("818981001", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/körperstelle:0|code") + .getAsString()); + Assert.assertEquals("http://snomed.info/sct", + jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/körperstelle:0|terminology") + .getAsString()); + Assert.assertEquals("Abdomen", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/körperstelle:0|value") + .getAsString()); + + + return jsonObject; + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/studienteilnahme/StudienteilnahmeTest.java b/src/test/java/com/medblocks/openfhir/kds/studienteilnahme/StudienteilnahmeTest.java new file mode 100644 index 00000000..ba82f578 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/studienteilnahme/StudienteilnahmeTest.java @@ -0,0 +1,82 @@ +package com.medblocks.openfhir.kds.studienteilnahme; + +import static org.junit.Assert.assertEquals; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.nedap.archie.rm.composition.Composition; +import java.util.List; +import java.util.stream.Collectors; +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Consent; +import org.hl7.fhir.r4.model.DateTimeType; +import org.junit.Assert; +import org.junit.Test; + +public class StudienteilnahmeTest extends KdsBidirectionalTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT = "/kds_new/projects/org.highmed/KDS/studienteilnahme/studienteilnahme.context.yaml"; + final String HELPER_LOCATION = "/kds/studienteilnahme/"; + final String OPT = "Studienteilnahme.opt"; + final String FLAT = "studienteilnahme.flat.json"; + final String BUNDLE = "studienteilnahme_bundle.json"; + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @Test + public void toFhir() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFile(HELPER_LOCATION + FLAT), + new OPTParser( + operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allConsents = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Consent).collect(Collectors.toList()); + assertEquals(1, allConsents.size()); + + final Consent consent = (Consent) allConsents.get(0).getResource(); + + Assert.assertEquals("entered-in-error", consent.getStatusElement().getValueAsString()); + + // - name: "period" + final DateTimeType periodStart = consent.getProvision().getPeriod().getStartElement(); + final DateTimeType periodEnd = consent.getProvision().getPeriod().getEndElement(); + Assert.assertEquals("2020-02-03T04:05:06+01:00", periodStart.getValueAsString()); + Assert.assertEquals("2024-02-03T04:05:06+01:00", periodEnd.getValueAsString()); + } + + + public JsonObject toOpenEhr() { + final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); + final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); + + Assert.assertEquals("245", jsonObject.getAsJsonPrimitive( + "studienteilnahme/einwilligungserklärung/ism_transition/current_state|code") + .getAsString()); + + Assert.assertEquals("2024-08-22T10:30:00", jsonObject.getAsJsonPrimitive( + "studienteilnahme/context/start_time").getAsString()); + Assert.assertEquals("2023-07-22T10:30:00", jsonObject.getAsJsonPrimitive( + "studienteilnahme/einwilligungserklärung/studienteilnahme/beginn_der_teilnahme").getAsString()); + Assert.assertEquals("2024-08-22T10:30:00", jsonObject.getAsJsonPrimitive( + "studienteilnahme/einwilligungserklärung/studienteilnahme/ende_der_teilnahme").getAsString()); + +// return jsonObject; + return null; // returning null so tests dont fail against ehrbase; missing mapping data points + // /content[openEHR-EHR-ACTION.informed_consent.v0]/description[at0001]/items[at0002 and name/value='Studie'] + // /content[openEHR-EHR-ACTION.informed_consent.v0]/description[at0001]/items[openEHR-EHR-CLUSTER.study_participation.v1]/items[at0005 and name/value='Status der Teilnahme'] + // /content[openEHR-EHR-ACTION.informed_consent.v0]/description[at0001]/items[openEHR-EHR-CLUSTER.study_participation.v1]/items[at0016 and name/value='Subjekt Identifizierungscode'] + } +} diff --git a/src/test/resources/file_generator.sh b/src/test/resources/file_generator.sh new file mode 100644 index 00000000..ad3f9d6d --- /dev/null +++ b/src/test/resources/file_generator.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -euo pipefail + +URL="http://localhost:8080/openfhir/toopenehr" +ROOT="${1:-.}" + +tmp_resp="$(mktemp)" + +cleanup() { + rm -f "$tmp_resp" +} +trap cleanup EXIT + +find "$ROOT" -type d -name kds -print0 | while IFS= read -r -d '' kds_dir; do + find "$kds_dir" -type f -name "*.json" ! -name "Composition-*.json" -print0 \ + | while IFS= read -r -d '' f; do + dir="$(dirname "$f")" + base="$(basename "$f")" + out_file="$dir/Composition-${base#*-}" + + echo "POST: $f" + + code="$( + curl -sS \ + -o "$tmp_resp" \ + -w '%{http_code}' \ + -H 'Content-Type: application/json' \ + --data-binary "@$f" \ + "$URL" \ + || echo "000" + )" + + if [[ "$code" == "200" ]]; then + mv "$tmp_resp" "$out_file" + echo " ✔ wrote $out_file" + else + echo " ✘ skipped (HTTP $code)" + fi + done +done diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json new file mode 100644 index 00000000..d3f6b903 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json @@ -0,0 +1,277 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2024-02-21T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I29578", + "preferred_term" : "Masern mit Otitis" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "13420004", + "preferred_term" : "Post measles otitis media (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "B05.3" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Middle ear structure (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "25342003" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinisch relevanter Zeitraum (Zeitpunkt des Auftretens)" + }, + "value" : { + "_type" : "DV_DATE_TIME", + "value" : "2024-02-21T00:00:00" + }, + "archetype_node_id" : "at0077" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnosesicherheit" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "gesicherte Diagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_DIAGNOSESICHERHEIT" + }, + "code_string" : "G" + } + }, + "archetype_node_id" : "at0073" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Masernotitis" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-10-diagnose-1.json new file mode 100644 index 00000000..c172ba96 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-10-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2019-05-14T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I18412", + "preferred_term" : "Migräne" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "37796009", + "preferred_term" : "Migraine (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "G43.9" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Vascular structure of head (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "281231009" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Migräne, nicht näher bezeichnet" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-2-diagnose-1.json new file mode 100644 index 00000000..5cee10a6 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-2-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2024-03-02T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I30011", + "preferred_term" : "Bösartige Neubildung des Lungenoberlappens" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "254637007", + "preferred_term" : "Non-small cell lung cancer (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "C34.1" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Structure of upper lobe of lung (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "45653009" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Bösartige Neubildung: Oberlappen-Bronchus" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-3-diagnose-1.json new file mode 100644 index 00000000..e21be7b4 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-3-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2022-04-02T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I29975", + "preferred_term" : "Bösartige anorektale Neubildung" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "447886005", + "preferred_term" : "Adenocarcinoma of anorectum (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "C21.8" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Structure of anus and/or rectum (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "281088000" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Bösartige anorektale Neubildung" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-4-diagnose-1.json new file mode 100644 index 00000000..97ae35b7 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-4-diagnose-1.json @@ -0,0 +1,189 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2022-11-30T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "C16.9" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Bösartige Neubildung des Magens nicht näher bezeichnet" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-5-diagnose-1.json new file mode 100644 index 00000000..263a10a2 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-5-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2023-07-10T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I133980", + "preferred_term" : "Endometriose des Ovars" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "129103003", + "preferred_term" : "Endometriosis (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "N80.1" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Ovarian structure (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "15497006" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Endometriose des Ovars" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-6-diagnose-1.json new file mode 100644 index 00000000..ca7f5097 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-6-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2022-03-12T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I30016", + "preferred_term" : "Chronische Gastritis" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "4556007", + "preferred_term" : "Gastritis (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "K29.5" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Stomach structure (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "69695003" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Chronische Gastritis, nicht näher bezeichnet" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-7-diagnose-1.json new file mode 100644 index 00000000..3de21f13 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-7-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2024-01-08T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I25780", + "preferred_term" : "Akute Bronchitis" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "10509002", + "preferred_term" : "Acute bronchitis (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "J20.9" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Bronchial structure (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "955009" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Akute Bronchitis, nicht näher bezeichnet" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-8-diagnose-1.json new file mode 100644 index 00000000..2b06cd74 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-8-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2023-11-10T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I26852", + "preferred_term" : "Chronische ischämische Herzkrankheit" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "413838009", + "preferred_term" : "Chronic ischemic heart disease (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "I25.9" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Heart structure (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "80891009" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Chronische ischämische Herzkrankheit, nicht näher bezeichnet" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-9-diagnose-1.json new file mode 100644 index 00000000..0668da27 --- /dev/null +++ b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-9-diagnose-1.json @@ -0,0 +1,247 @@ +{ + "_type" : "COMPOSITION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id" : { + "value" : "KDS_Diagnose" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "territory" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_3166-1" + }, + "code_string" : "DE" + }, + "category" : { + "_type" : "DV_CODED_TEXT", + "value" : "event", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "433" + } + }, + "composer" : { + "_type" : "PARTY_SELF" + }, + "context" : { + "_type" : "EVENT_CONTEXT", + "start_time" : { + "_type" : "DV_DATE_TIME", + "value" : "2024-02-20T00:00:00" + }, + "setting" : { + "_type" : "DV_CODED_TEXT", + "value" : "other care", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "openehr" + }, + "code_string" : "238" + } + } + }, + "content" : [ { + "_type" : "EVALUATION", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnose" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version" : "1.0.4" + }, + "language" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "ISO_639-1" + }, + "code_string" : "de" + }, + "encoding" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "IANA_character-sets" + }, + "code_string" : "UTF-8" + }, + "subject" : { + "_type" : "PARTY_SELF" + }, + "data" : { + "_type" : "ITEM_TREE", + "name" : { + "_type" : "DV_TEXT", + "value" : "Structure" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Kodierte Diagnose" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "mappings" : [ { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string" : "I20743", + "preferred_term" : "Ovarialzyste" + } + }, { + "_type" : "TERM_MAPPING", + "match" : "?", + "target" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "79883001", + "preferred_term" : "Cyst of ovary (disorder)" + } + } ], + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string" : "N83.2" + } + }, + "archetype_node_id" : "at0002" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Anatomische Lokalisation" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Name der Körperstelle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Ovarian structure (body structure)", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://snomed.info/sct" + }, + "code_string" : "15497006" + } + }, + "archetype_node_id" : "at0001" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, { + "_type" : "CLUSTER", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "archetype_details" : { + "archetype_id" : { + "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version" : "1.0.4" + }, + "items" : [ { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Klinischer Status" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string" : "active" + } + }, + "archetype_node_id" : "at0003" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoserolle" + }, + "value" : { + "_type" : "DV_CODED_TEXT", + "value" : "Hauptdiagnose", + "defining_code" : { + "_type" : "CODE_PHRASE", + "terminology_id" : { + "_type" : "TERMINOLOGY_ID", + "value" : "local" + }, + "code_string" : "at0064" + } + }, + "archetype_node_id" : "at0063" + } ], + "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, { + "_type" : "ELEMENT", + "name" : { + "_type" : "DV_TEXT", + "value" : "Diagnoseerläuterung" + }, + "value" : { + "_type" : "DV_TEXT", + "value" : "Sonstige und nicht näher bezeichnete Ovarialzysten" + }, + "archetype_node_id" : "at0069" + } ], + "archetype_node_id" : "at0001" + }, + "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } ], + "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-1-diagnose-1.json new file mode 100644 index 00000000..f5160294 --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-1-diagnose-1.json @@ -0,0 +1,124 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:51:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-1-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-1-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", + "valueCoding": { + "code": "†", + "system": "http://fhir.de/CodeSystem/icd-10-gm-mehrfachcodierungs-kennzeichen" + } + }, + { + "url": "http://fhir.de/StructureDefinition/seitenlokalisation", + "valueCoding": { + "code": "B", + "system": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_SEITENLOKALISATION", + "display": "beiderseits" + } + }, + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", + "valueCoding": { + "code": "G", + "system": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_DIAGNOSESICHERHEIT", + "display": "gesicherte Diagnose" + } + } + ], + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "B05.3", + "version": "2023" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I29578", + "version": "2023", + "display": "Masern mit Otitis" + }, + { + "system": "http://snomed.info/sct", + "code": "13420004", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Post measles otitis media (disorder)" + } + ] + }, + "note": [ + { + "text": "Masernotitis" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "25342003", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Middle ear structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-1" + }, + "recordedDate": "2024-02-21", + "onsetDateTime": "2024-02-21" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-10-diagnose-1.json new file mode 100644 index 00000000..5bb562dc --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-10-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-10", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T14:00:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-10-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-10-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "G43.9", + "version": "2019" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I18412", + "version": "2019", + "display": "Migräne" + }, + { + "system": "http://snomed.info/sct", + "code": "37796009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Migraine (disorder)" + } + ] + }, + "note": [ + { + "text": "Migräne, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "281231009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Vascular structure of head (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-10" + }, + "recordedDate": "2019-05-14" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-2-diagnose-1.json new file mode 100644 index 00000000..3360647c --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-2-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-2", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:53:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-2-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-2-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C34.1", + "version": "2024" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I30011", + "version": "2024", + "display": "Bösartige Neubildung des Lungenoberlappens" + }, + { + "system": "http://snomed.info/sct", + "code": "254637007", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Non-small cell lung cancer (disorder)" + } + ] + }, + "note": [ + { + "text": "Bösartige Neubildung: Oberlappen-Bronchus" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "45653009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Structure of upper lobe of lung (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-2" + }, + "recordedDate": "2024-03-02" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-3-diagnose-1.json new file mode 100644 index 00000000..0640e64d --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-3-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-3", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:51:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-3-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-3-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C21.8", + "version": "2022" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I29975", + "version": "2022", + "display": "Bösartige anorektale Neubildung" + }, + { + "system": "http://snomed.info/sct", + "code": "447886005", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Adenocarcinoma of anorectum (disorder)" + } + ] + }, + "note": [ + { + "text": "Bösartige anorektale Neubildung" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "281088000", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Structure of anus and/or rectum (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-3" + }, + "recordedDate": "2022-04-02" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-4-diagnose-1.json new file mode 100644 index 00000000..15b3eac4 --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-4-diagnose-1.json @@ -0,0 +1,74 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-4", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:54:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-4-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-4-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C16.9", + "version": "2022" + } + ] + }, + "note": [ + { + "text": "Bösartige Neubildung des Magens nicht näher bezeichnet" + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-4" + }, + "recordedDate": "2022-11-30" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-5-diagnose-1.json new file mode 100644 index 00000000..296975cc --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-5-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-5", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:55:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-5-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-5-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "N80.1", + "version": "2023" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I133980", + "version": "2023", + "display": "Endometriose des Ovars" + }, + { + "system": "http://snomed.info/sct", + "code": "129103003", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Endometriosis (disorder)" + } + ] + }, + "note": [ + { + "text": "Endometriose des Ovars" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "15497006", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Ovarian structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-5" + }, + "recordedDate": "2023-07-10" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-6-diagnose-1.json new file mode 100644 index 00000000..14f9a6f0 --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-6-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-6", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:56:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-6-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-6-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "K29.5", + "version": "2022" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I30016", + "version": "2022", + "display": "Chronische Gastritis" + }, + { + "system": "http://snomed.info/sct", + "code": "4556007", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Gastritis (disorder)" + } + ] + }, + "note": [ + { + "text": "Chronische Gastritis, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "69695003", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Stomach structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-6" + }, + "recordedDate": "2022-03-12" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-7-diagnose-1.json new file mode 100644 index 00000000..e9c6ca4e --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-7-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-7", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:57:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-7-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-7-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "J20.9", + "version": "2024" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I25780", + "version": "2024", + "display": "Akute Bronchitis" + }, + { + "system": "http://snomed.info/sct", + "code": "10509002", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Acute bronchitis (disorder)" + } + ] + }, + "note": [ + { + "text": "Akute Bronchitis, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "955009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Bronchial structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-7" + }, + "recordedDate": "2024-01-08" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-8-diagnose-1.json new file mode 100644 index 00000000..0678da28 --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-8-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-8", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:58:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-8-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-8-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "I25.9", + "version": "2023" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I26852", + "version": "2023", + "display": "Chronische ischämische Herzkrankheit" + }, + { + "system": "http://snomed.info/sct", + "code": "413838009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Chronic ischemic heart disease (disorder)" + } + ] + }, + "note": [ + { + "text": "Chronische ischämische Herzkrankheit, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "80891009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Heart structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-8" + }, + "recordedDate": "2023-11-10" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-9-diagnose-1.json new file mode 100644 index 00000000..74fa0fb5 --- /dev/null +++ b/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-9-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-9", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:59:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-9-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-9-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "N83.2", + "version": "2024" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I20743", + "version": "2024", + "display": "Ovarialzyste" + }, + { + "system": "http://snomed.info/sct", + "code": "79883001", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Cyst of ovary (disorder)" + } + ] + }, + "note": [ + { + "text": "Sonstige und nicht näher bezeichnete Ovarialzysten" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "15497006", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Ovarian structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-9" + }, + "recordedDate": "2024-02-20" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle.json b/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle.json new file mode 100644 index 00000000..bb5ff95d --- /dev/null +++ b/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle.json @@ -0,0 +1,907 @@ +{ + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id": { + "value": "KDS_Diagnose" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" + }, + "code_string": "DE" + }, + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" + }, + "code_string": "433" + } + }, + "composer": { + "_type": "PARTY_SELF" + }, + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2022-02-03T01:00:00" + }, + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" + }, + "code_string": "238" + } + }, + "other_context": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Tree" + }, + "items": [ + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Fallidentifikation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.case_identification.v0" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Fall-Kennung" + }, + "value": { + "_type": "DV_TEXT", + "value": "encounter-id-1245" + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.case_identification.v0" + } + ], + "archetype_node_id": "at0001" + } + }, + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" + }, + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Secondary malignant neoplasm of lymph node", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "C77.0", + "preferred_term": "Malignant neoplasm of lymph nodes" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "057E3", + "preferred_term": "secondary malignant neoplasm of lymph nodes" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://www.orpha.net" + }, + "code_string": "1777", + "preferred_term": "lung cancer associated with hereditary syndromes" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "128462008", + "preferred_term": "Secondary malignant neoplasm of lymph node" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "C34.1" + } + }, + "archetype_node_id": "at0002" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Respiratory tract, Upper lobe, bronchus or lung", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "C34.1", + "preferred_term": "Upper lobe, bronchus or lung" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "321667001" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Lateralität" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Left side", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation" + }, + "code_string": "L" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Feststellungsdatum" + }, + "value": { + "_type": "DV_DATE_TIME", + "value": "2025-02-03T05:05:06" + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Schweregrad" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Severe", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-severity" + }, + "code_string": "24484000" + } + }, + "archetype_node_id": "at0005" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Lebensphase" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Beginn" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Start of adulthood phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "424144002" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Ende" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "End of middle age phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "367640001" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungskennzeichen_ICD-10-GM" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungkennzeichen" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "†", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0002" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "active", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Nebendiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0066" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosesicherheit" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Confirmed diagnosis", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit" + }, + "code_string": "G" + } + }, + "archetype_node_id": "at0073" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Patient confirmed for secondary malignant neoplasm of lymph node." + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" + }, + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Malignant neoplasm of upper lobe, bronchus or lung", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "ref_C34.1", + "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "ref_098H5", + "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung, unspecified" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_254626006", + "preferred_term": "ref_Malignant neoplasm of the upper lobe of lung" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://www.orpha.net" + }, + "code_string": "ref_830", + "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "ref_C34.1" + } + }, + "archetype_node_id": "at0002" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Entire cardiovascular system", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "ref_C34.1", + "preferred_term": "ref_Upper lobe, bronchus or lung" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_368209003" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Lateralität" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Upper lobe", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation" + }, + "code_string": "ref_U" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Feststellungsdatum" + }, + "value": { + "_type": "DV_DATE_TIME", + "value": "2125-02-03T05:05:06" + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Schweregrad" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Severe", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_24484000" + } + }, + "archetype_node_id": "at0005" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Lebensphase" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Beginn" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Start of adulthood phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_424144002" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Ende" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_End of middle age phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_367640001" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungskennzeichen_ICD-10-GM" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungkennzeichen" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "*", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0003" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_active", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "ref_active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosesicherheit" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Suspected diagnosis", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit" + }, + "code_string": "ref_S" + } + }, + "archetype_node_id": "at0073" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "ref_The patient has a history of high blood pressure, now presenting with severe hypertension." + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle_whole.json b/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle_whole.json new file mode 100644 index 00000000..bb5ff95d --- /dev/null +++ b/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle_whole.json @@ -0,0 +1,907 @@ +{ + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id": { + "value": "KDS_Diagnose" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" + }, + "code_string": "DE" + }, + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" + }, + "code_string": "433" + } + }, + "composer": { + "_type": "PARTY_SELF" + }, + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2022-02-03T01:00:00" + }, + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" + }, + "code_string": "238" + } + }, + "other_context": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Tree" + }, + "items": [ + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Fallidentifikation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.case_identification.v0" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Fall-Kennung" + }, + "value": { + "_type": "DV_TEXT", + "value": "encounter-id-1245" + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.case_identification.v0" + } + ], + "archetype_node_id": "at0001" + } + }, + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" + }, + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Secondary malignant neoplasm of lymph node", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "C77.0", + "preferred_term": "Malignant neoplasm of lymph nodes" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "057E3", + "preferred_term": "secondary malignant neoplasm of lymph nodes" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://www.orpha.net" + }, + "code_string": "1777", + "preferred_term": "lung cancer associated with hereditary syndromes" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "128462008", + "preferred_term": "Secondary malignant neoplasm of lymph node" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "C34.1" + } + }, + "archetype_node_id": "at0002" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Respiratory tract, Upper lobe, bronchus or lung", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "C34.1", + "preferred_term": "Upper lobe, bronchus or lung" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "321667001" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Lateralität" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Left side", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation" + }, + "code_string": "L" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Feststellungsdatum" + }, + "value": { + "_type": "DV_DATE_TIME", + "value": "2025-02-03T05:05:06" + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Schweregrad" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Severe", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-severity" + }, + "code_string": "24484000" + } + }, + "archetype_node_id": "at0005" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Lebensphase" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Beginn" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Start of adulthood phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "424144002" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Ende" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "End of middle age phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "367640001" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungskennzeichen_ICD-10-GM" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungkennzeichen" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "†", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0002" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "active", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Nebendiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0066" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosesicherheit" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Confirmed diagnosis", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit" + }, + "code_string": "G" + } + }, + "archetype_node_id": "at0073" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Patient confirmed for secondary malignant neoplasm of lymph node." + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" + }, + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Malignant neoplasm of upper lobe, bronchus or lung", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "ref_C34.1", + "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "ref_098H5", + "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung, unspecified" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_254626006", + "preferred_term": "ref_Malignant neoplasm of the upper lobe of lung" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://www.orpha.net" + }, + "code_string": "ref_830", + "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "ref_C34.1" + } + }, + "archetype_node_id": "at0002" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Entire cardiovascular system", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" + }, + "code_string": "ref_C34.1", + "preferred_term": "ref_Upper lobe, bronchus or lung" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_368209003" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Lateralität" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Upper lobe", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation" + }, + "code_string": "ref_U" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Feststellungsdatum" + }, + "value": { + "_type": "DV_DATE_TIME", + "value": "2125-02-03T05:05:06" + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Schweregrad" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Severe", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_24484000" + } + }, + "archetype_node_id": "at0005" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Lebensphase" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Beginn" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Start of adulthood phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_424144002" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Ende" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_End of middle age phase", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "ref_367640001" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.lebensphase.v0" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungskennzeichen_ICD-10-GM" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungkennzeichen" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "*", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0003" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_active", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "ref_active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosesicherheit" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "ref_Suspected diagnosis", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit" + }, + "code_string": "ref_S" + } + }, + "archetype_node_id": "at0073" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "ref_The patient has a history of high blood pressure, now presenting with severe hypertension." + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_bundle.json b/src/test/resources/kds/diagnose/KDS_Diagnose_bundle.json index 8c51be15..bd98b3e9 100644 --- a/src/test/resources/kds/diagnose/KDS_Diagnose_bundle.json +++ b/src/test/resources/kds/diagnose/KDS_Diagnose_bundle.json @@ -121,41 +121,26 @@ "extension": [ { "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", - "valueCodeableConcept": { - "coding": [ - { + "valueCoding": { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm-mc", "code": "†", "display": "Primary code in multiple coding" - } - ], - "text": "Primary code in multiple coding" } }, { "url": "http://fhir.de/StructureDefinition/seitenlokalisation", - "valueCodeableConcept": { - "coding": [ - { + "valueCoding": { "system": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation", "code": "L", "display": "Left side" } - ], - "text": "Left side" - } - }, + }, { "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", - "valueCodeableConcept": { - "coding": [ - { + "valueCoding": { "system": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", "code": "G", "display": "Confirmed diagnosis" - } - ], - "text": "Confirmed diagnosis" } } ] diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_bundle_whole.json b/src/test/resources/kds/diagnose/KDS_Diagnose_bundle_whole.json index 06cd3440..79c6e198 100644 --- a/src/test/resources/kds/diagnose/KDS_Diagnose_bundle_whole.json +++ b/src/test/resources/kds/diagnose/KDS_Diagnose_bundle_whole.json @@ -121,41 +121,27 @@ "extension": [ { "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", - "valueCodeableConcept": { - "coding": [ + "valueCoding": { "system": "local", "code": "†", "display": "Primary code in multiple coding" } - ], - "text": "Primary code in multiple coding" - } }, { "url": "http://fhir.de/StructureDefinition/seitenlokalisation", - "valueCodeableConcept": { - "coding": [ - { + "valueCoding": { "system": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation", "code": "L", "display": "Left side" } - ], - "text": "Left side" - } }, { "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", - "valueCodeableConcept": { - "coding": [ - { - "system": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", - "code": "G", - "display": "Confirmed diagnosis" - } - ], - "text": "Confirmed diagnosis" + "valueCoding": { + "system": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", + "code": "G", + "display": "Confirmed diagnosis" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-1-diagnose-1.json new file mode 100644 index 00000000..11c4af28 --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-1-diagnose-1.json @@ -0,0 +1,87 @@ +{ + "resourceType": "Bundle", + "type": "collection", + "entry": [ + { + "resource": { + "resourceType": "Condition", + "clinicalStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical", + "code": "active" + } + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "B05.3" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I29578", + "display": "Masern mit Otitis" + }, + { + "system": "http://snomed.info/sct", + "code": "13420004", + "display": "Post measles otitis media (disorder)" + }, + { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_DIAGNOSESICHERHEIT", + "code": "G", + "display": "gesicherte Diagnose" + } + ], + "text": "gesicherte Diagnose" + } + }, + { + "url": "http://fhir.de/StructureDefinition/seitenlokalisation", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "25342003", + "display": "Middle ear structure (body structure)" + } + ], + "text": "Middle ear structure (body structure)" + } + } + ], + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + } + ] + }, + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "25342003", + "display": "Middle ear structure (body structure)" + } + ], + "text": "Middle ear structure (body structure)" + } + ], + "onsetDateTime": "2024-02-21T00:00:00+01:00", + "recordedDate": "2024-02-21T00:00:00+01:00", + "note": [ + { + "text": "Masernotitis" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-10-diagnose-1.json new file mode 100644 index 00000000..5bb562dc --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-10-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-10", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T14:00:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-10-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-10-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "G43.9", + "version": "2019" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I18412", + "version": "2019", + "display": "Migräne" + }, + { + "system": "http://snomed.info/sct", + "code": "37796009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Migraine (disorder)" + } + ] + }, + "note": [ + { + "text": "Migräne, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "281231009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Vascular structure of head (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-10" + }, + "recordedDate": "2019-05-14" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-2-diagnose-1.json new file mode 100644 index 00000000..3360647c --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-2-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-2", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:53:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-2-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-2-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C34.1", + "version": "2024" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I30011", + "version": "2024", + "display": "Bösartige Neubildung des Lungenoberlappens" + }, + { + "system": "http://snomed.info/sct", + "code": "254637007", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Non-small cell lung cancer (disorder)" + } + ] + }, + "note": [ + { + "text": "Bösartige Neubildung: Oberlappen-Bronchus" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "45653009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Structure of upper lobe of lung (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-2" + }, + "recordedDate": "2024-03-02" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-3-diagnose-1.json new file mode 100644 index 00000000..0640e64d --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-3-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-3", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:51:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-3-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-3-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C21.8", + "version": "2022" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I29975", + "version": "2022", + "display": "Bösartige anorektale Neubildung" + }, + { + "system": "http://snomed.info/sct", + "code": "447886005", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Adenocarcinoma of anorectum (disorder)" + } + ] + }, + "note": [ + { + "text": "Bösartige anorektale Neubildung" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "281088000", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Structure of anus and/or rectum (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-3" + }, + "recordedDate": "2022-04-02" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-4-diagnose-1.json new file mode 100644 index 00000000..15b3eac4 --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-4-diagnose-1.json @@ -0,0 +1,74 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-4", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:54:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-4-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-4-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C16.9", + "version": "2022" + } + ] + }, + "note": [ + { + "text": "Bösartige Neubildung des Magens nicht näher bezeichnet" + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-4" + }, + "recordedDate": "2022-11-30" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-5-diagnose-1.json new file mode 100644 index 00000000..296975cc --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-5-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-5", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:55:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-5-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-5-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "N80.1", + "version": "2023" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I133980", + "version": "2023", + "display": "Endometriose des Ovars" + }, + { + "system": "http://snomed.info/sct", + "code": "129103003", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Endometriosis (disorder)" + } + ] + }, + "note": [ + { + "text": "Endometriose des Ovars" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "15497006", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Ovarian structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-5" + }, + "recordedDate": "2023-07-10" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-6-diagnose-1.json new file mode 100644 index 00000000..14f9a6f0 --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-6-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-6", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:56:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-6-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-6-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "K29.5", + "version": "2022" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I30016", + "version": "2022", + "display": "Chronische Gastritis" + }, + { + "system": "http://snomed.info/sct", + "code": "4556007", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Gastritis (disorder)" + } + ] + }, + "note": [ + { + "text": "Chronische Gastritis, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "69695003", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Stomach structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-6" + }, + "recordedDate": "2022-03-12" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-7-diagnose-1.json new file mode 100644 index 00000000..e9c6ca4e --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-7-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-7", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:57:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-7-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-7-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "J20.9", + "version": "2024" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I25780", + "version": "2024", + "display": "Akute Bronchitis" + }, + { + "system": "http://snomed.info/sct", + "code": "10509002", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Acute bronchitis (disorder)" + } + ] + }, + "note": [ + { + "text": "Akute Bronchitis, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "955009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Bronchial structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-7" + }, + "recordedDate": "2024-01-08" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-8-diagnose-1.json new file mode 100644 index 00000000..0678da28 --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-8-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-8", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:58:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-8-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-8-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "I25.9", + "version": "2023" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I26852", + "version": "2023", + "display": "Chronische ischämische Herzkrankheit" + }, + { + "system": "http://snomed.info/sct", + "code": "413838009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Chronic ischemic heart disease (disorder)" + } + ] + }, + "note": [ + { + "text": "Chronische ischämische Herzkrankheit, nicht näher bezeichnet" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "80891009", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Heart structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-8" + }, + "recordedDate": "2023-11-10" + } + } + ] +} diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-9-diagnose-1.json new file mode 100644 index 00000000..74fa0fb5 --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-9-diagnose-1.json @@ -0,0 +1,98 @@ +{ + "resourceType": "Bundle", + "id": "mii-exa-test-data-bundle-pat-9", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ] + }, + "type": "transaction", + "timestamp": "2025-06-18T13:59:00+02:00", + "entry": [ + { + "request": { + "method": "POST", + "url": "Condition" + }, + "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-9-diagnose-1", + "resource": { + "resourceType": "Condition", + "id": "mii-exa-test-data-patient-9-diagnose-1", + "meta": { + "security": [ + { + "code": "HTEST", + "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", + "display": "test health data" + } + ], + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "N83.2", + "version": "2024" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "I20743", + "version": "2024", + "display": "Ovarialzyste" + }, + { + "system": "http://snomed.info/sct", + "code": "79883001", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Cyst of ovary (disorder)" + } + ] + }, + "note": [ + { + "text": "Sonstige und nicht näher bezeichnete Ovarialzysten" + } + ], + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "15497006", + "version": "http://snomed.info/sct/900000000000207008/version/20230731", + "display": "Ovarian structure (body structure)" + } + ] + } + ], + "clinicalStatus": { + "coding": [ + { + "code": "active", + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical" + } + ] + }, + "verificationStatus": { + "coding": [ + { + "code": "confirmed", + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + } + ] + }, + "subject": { + "reference": "Patient/mii-exa-test-data-patient-9" + }, + "recordedDate": "2024-02-20" + } + } + ] +} diff --git a/src/test/resources/kds/medikationseintrag/old/Composition-Fhir-Bundle-input.json b/src/test/resources/kds/medikationseintrag/old/Composition-Fhir-Bundle-input.json new file mode 100644 index 00000000..acb02c40 --- /dev/null +++ b/src/test/resources/kds/medikationseintrag/old/Composition-Fhir-Bundle-input.json @@ -0,0 +1 @@ +Couldn't find any Context mapper for the given Resource. Make sure at least one Context mapper exists where fhir.resourceType is of this type (Bundle) and condition within the context mapper allows for it to be applied on this specific resource. \ No newline at end of file diff --git a/src/test/resources/kds/medikationseintrag/old/Composition-KDSMedicationRequest.flat.json b/src/test/resources/kds/medikationseintrag/old/Composition-KDSMedicationRequest.flat.json new file mode 100644 index 00000000..6cde70e6 --- /dev/null +++ b/src/test/resources/kds/medikationseintrag/old/Composition-KDSMedicationRequest.flat.json @@ -0,0 +1 @@ +{"timestamp":1769173414511,"status":500,"error":"Internal Server Error","message":"HAPI-1838: Invalid JSON content detected, missing required element: 'resourceType'","path":"/openfhir/toopenehr"} \ No newline at end of file diff --git a/src/test/resources/kds/medikationseintrag/old/Composition-jsonobject-from-flat.json b/src/test/resources/kds/medikationseintrag/old/Composition-jsonobject-from-flat.json new file mode 100644 index 00000000..5583ccac --- /dev/null +++ b/src/test/resources/kds/medikationseintrag/old/Composition-jsonobject-from-flat.json @@ -0,0 +1 @@ +{"timestamp":1769173414487,"status":500,"error":"Internal Server Error","message":"HAPI-1838: Invalid JSON content detected, missing required element: 'resourceType'","path":"/openfhir/toopenehr"} \ No newline at end of file diff --git a/src/test/resources/kds_new/model/admin_entry/org.highmed/person_data.v0.yml b/src/test/resources/kds_new/model/admin_entry/org.highmed/person_data.v0.yml index 002d04fa..93362057 100644 --- a/src/test/resources/kds_new/model/admin_entry/org.highmed/person_data.v0.yml +++ b/src/test/resources/kds_new/model/admin_entry/org.highmed/person_data.v0.yml @@ -12,12 +12,17 @@ spec: fhirConfig: structureDefinition: http://hl7.org/fhir/StructureDefinition/Patient -preprocessor: - fhirCondition: - targetRoot: "$resource" - targetAttribute: "active" # exclude non-active patients - operator: "one of" - criteria: "false" +#preprocessor: Logic not supported yet +# fhirCondition: +# - targetRoot: "$resource" +# targetAttribute: "active" # exclude non-active patients +# operator: "not empty" +# if yes: +# fhirCondition: +# targetRoot: "$resource" +# targetAttribute: "active" # exclude non-active patients +# operator: "one of" +# criteria: "true" mappings: - name: "personData" @@ -30,7 +35,7 @@ mappings: with: fhir: "$resource.deceased.as(Boolean)" openehr: "$archetype/data[at0001]/items[at0024]/items[at0025]" - + - name: "deathDateTime" with: @@ -39,7 +44,7 @@ mappings: manual: - name: "deathboolean" openehr: - - path: "items[at0025]/value" + - path: "items[at0025]" value: "True" fhirCondition: targetRoot: "$resource" diff --git a/src/test/resources/kds_new/model/admin_entry/org.highmed/versicherungsinformationen.v0.yml b/src/test/resources/kds_new/model/admin_entry/org.highmed/versicherungsinformationen.v0.yml index d7775f20..203729a6 100644 --- a/src/test/resources/kds_new/model/admin_entry/org.highmed/versicherungsinformationen.v0.yml +++ b/src/test/resources/kds_new/model/admin_entry/org.highmed/versicherungsinformationen.v0.yml @@ -1,16 +1,16 @@ grammar: FHIRConnect/v0.9.0 type: model metadata: - name: ADMIN_ENTRY.versicherungsinformationen.v0 - version: 0.0.1-alpha -spec: + name: ADMIN_ENTRY.versicherungsinformationen.v0 + version: 0.0.1-alpha +spec: system: FHIR version: R4 openEhrConfig: archetype: openEHR-EHR-ADMIN_ENTRY.versicherungsinformationen.v0 revision: 0.0.1-alpha fhirConfig: - structureDefinition: http://hl7.org/fhir/StructureDefinition/BackboneElement + structureDefinition: http://hl7.org/fhir/StructureDefinition/Identifier mappings: - name: "versicherungsId" diff --git a/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml b/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml index 5eb2c0ee..931406e0 100644 --- a/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml +++ b/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml @@ -13,37 +13,59 @@ spec: structureDefinition: http://hl7.org/fhir/StructureDefinition/Coding mappings: - - name: "mehrfachcodierung" + - name: "mehrfachcodierungManifestation" with: - fhir: "$fhirRoot.value.as(CodeableConcept).coding" #fhir.extension + fhir: "$fhirRoot.value" #fhir.extension openehr: "$archetype/items[at0001]" - manual: - - name: "manifestation" - openehr: - - path: "defining_code/terminology_id" - value: "local" - - path: "defining_code/code_string" - value: "at0003" - - path: "value" - value: "*" - fhirCondition: - targetRoot: "$fhirRoot.value.as(CodeableConcept).coding" - targetAttribute: "code" - operator: "one of" - criteria: "*" - fhir: - - path: "code" - value: "*" - - path: "display" - value: "*" - - path: "system" - value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" - openehrCondition: - targetRoot: "$openehrRoot" - targetAttribute: "defining_code/code_string" - operator: "one of" - criteria: "at0003" + type: "$NONE" + openehrCondition: + targetRoot: "$archetype/items[at0001]" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0003" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "*" + followedBy: + mapping: + with: + fhir: "$fhirRoot" + openehr: "$openehrRoot" + type: "$NONE" + manual: + - name: "manifestation" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0003" + - path: "value" + value: "*" + fhir: + - path: "code" + value: "*" + - path: "display" + value: "*" + - path: "system" + value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" + - name: "mehrfachcodierungAtiology" + with: + fhir: "$fhirRoot.value" #fhir.extension + openehr: "$archetype/items[at0001]" + openehrCondition: + targetRoot: "$archetype/items[at0001]" + targetAttribute: "value/defining_code/code_string" + operator: "one of" + criteria: "at0002" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "†" + manual: - name: "ätiology" openehr: - path: "defining_code/terminology_id" @@ -52,11 +74,6 @@ mappings: value: "at0002" - path: "value" value: "†" - fhirCondition: - targetRoot: "$fhirRoot.value.as(CodeableConcept).coding" - targetAttribute: "code" - operator: "one of" - criteria: "†" fhir: - path: "code" value: "†" @@ -64,12 +81,22 @@ mappings: value: "†" - path: "system" value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" - openehrCondition: - targetRoot: "$openehrRoot" - targetAttribute: "defining_code/code_string" - operator: "one of" - criteria: "at0002" + - name: "mehrfachcodierungAdditionalInformation" + with: + fhir: "$fhirRoot.value" #fhir.extension + openehr: "$archetype/items[at0001]" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "!" + openehrCondition: + targetRoot: "$archetype/items[at0001]" + targetAttribute: "value/defining_code/code_string" + operator: "one of" + criteria: "at0004" + manual: - name: "additionalInformation" openehr: - path: "defining_code/terminology_id" @@ -78,20 +105,10 @@ mappings: value: "at0004" - path: "value" value: "!" - fhirCondition: - targetRoot: "$fhirRoot.value.as(CodeableConcept).coding" - targetAttribute: "code" - operator: "one of" - criteria: "!" fhir: - path: "code" value: "!" - path: "display" value: "!" - path: "system" - value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" - openehrCondition: - targetRoot: "$openehrRoot" - targetAttribute: "defining_code/code_string" - operator: "one of" - criteria: "at0004" + value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" \ No newline at end of file diff --git a/src/test/resources/kds_new/model/cluster/org.openehr/anatomical_location.v1.yml b/src/test/resources/kds_new/model/cluster/org.openehr/anatomical_location.v1.yml index d575d9bb..c5d46690 100644 --- a/src/test/resources/kds_new/model/cluster/org.openehr/anatomical_location.v1.yml +++ b/src/test/resources/kds_new/model/cluster/org.openehr/anatomical_location.v1.yml @@ -13,33 +13,33 @@ spec: structureDefinition: http://hl7.org/fhir/StructureDefinition/CodeableConcept mappings: - - name: "bodySiteCoding" # parent only used to condition on a certain fhir type - with: - fhir: "$resource" - openehr: "$archetype" - type: "NONE" - fhirCondition: - targetRoot: "$fhirRoot" - operator: "type" - criteria: "CodeableConcept" - followedBy: - mappings: - - name: "bodySiteText" - with: - fhir: "text" - openehr: "items[at0001]" #Name of body site - fhirCondition: - targetRoot: "$fhirRoot" - targetAttribute: "coding" - operator: "empty" - # +# - name: "bodySiteCoding" # parent only used to condition on a certain fhir type +# with: +# fhir: "$resource" +# openehr: "$archetype" +# type: "NONE" +# openehrCondition: +# targetRoot: "$archetype" +# targetAttribute: "items[at0001]" +# operator: "type" +# criteria: "CodeableConcept" +# followedBy: +# mappings: +# - name: "bodySiteText" +# with: +# fhir: "text" +# openehr: "items[at0001]" #Name of body site +# fhirCondition: +# targetRoot: "$fhirRoot" +# targetAttribute: "coding" +# operator: "empty" + - name: "bodySiteCoded" with: fhir: "$fhirRoot" openehr: "$archetype/items[at0001]" #Name of body site - - openehrCondition: - targetRoot: "$archetype" - targetAttribute: "items[at0001]" - operator: "type" - criteria: "DV_CODED_TEXT" +# openehrCondition: +# targetRoot: "$archetype" +# targetAttribute: "items[at0001]" +# operator: "type" +# criteria: "DV_CODED_TEXT" diff --git a/src/test/resources/kds_new/model/evaluation/org.openehr/gender.v1.yml b/src/test/resources/kds_new/model/evaluation/org.openehr/gender.v1.yml index db5db9fb..99103833 100644 --- a/src/test/resources/kds_new/model/evaluation/org.openehr/gender.v1.yml +++ b/src/test/resources/kds_new/model/evaluation/org.openehr/gender.v1.yml @@ -2,21 +2,22 @@ grammar: FHIRConnect/v0.9.0 type: model metadata: name: EVALUATION.gender.v1 - version: 0.0.1-alpha -spec: + version: 0.0.1-alpha +spec: system: FHIR version: R4 openEhrConfig: archetype: openEHR-EHR-EVALUATION.gender.v1 revision: 1.1.1 + fhirConfig: + structureDefinition: "http://hl7.org/fhir/StructureDefinition/Code" mappings: - name: "gender" with: - fhir: "$fhirRoot" + fhir: "$resource.gender" openehr: "$archetype/data[at0002]/items[at0022]" - # # - name: "sex" # with: diff --git a/src/test/resources/kds_new/model/evaluation/org.openehr/vital_status.v1.yml b/src/test/resources/kds_new/model/evaluation/org.openehr/vital_status.v1.yml index 479ab4e1..cfe89dc1 100644 --- a/src/test/resources/kds_new/model/evaluation/org.openehr/vital_status.v1.yml +++ b/src/test/resources/kds_new/model/evaluation/org.openehr/vital_status.v1.yml @@ -73,7 +73,7 @@ mappings: # with: # fhir: "$fhirRoot" # openehr: "$openEHRRoot" # reference to party_identified NOT SUPPORTED since 1..1 whole mapping is commented out - - + - name: "effective" with: fhir: "$resource.effective" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_anatomical_location.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_anatomical_location.yml index cad41f95..4541f558 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_anatomical_location.yml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_anatomical_location.yml @@ -12,7 +12,7 @@ mappings: - name: "seitenlokalisation" extension: "add" with: - fhir: "$fhirRoot.value.as(CodeableConcept)" + fhir: "$fhirRoot.value.as(Coding)" openehr: "items[at0002]" fhirCondition: diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml index 64afccf2..b4ff652e 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml @@ -65,38 +65,99 @@ mappings: - path: "url" value: "http://hl7.org/fhir/StructureDefinition/condition-assertedDate" - - name: "bodySiteCluster" - extension: "overwrite" - with: - fhir: "$resource" - openehr: "$archetype/data[at0001]/items[openEHR-EHR-CLUSTER.anatomical_location.v1]" - unidirectional: "fhir->openehr" # only if importing, for fhir export openEHR wont check for icd-10 and will just use the archetypes where the icd-10 was mapped to. - slotArchetype: "CLUSTER.anatomical_location.v1" - fhirCondition: - targetRoot: "$resource.code.coding" - targetAttribute: "system" - operator: "not contains" - criteria: "http://fhir.de/CodeSystem/bfarm/icd-10-gm" # execute cluster here if no icd-10 code is provided, otherwise the cluster is below specified - - # because we're overwriting bodySiteCluster altogether above, meaning when going to openehr to fhir, we're missing out on bodySite mappings - - name: "bodySiteClusterToFhir" - extension: "add" - with: - fhir: "$resource.bodySite" - openehr: "$archetype/data[at0001]/items[openEHR-EHR-CLUSTER.anatomical_location.v1]" - unidirectional: "openEHR->fhir" - slotArchetype: "CLUSTER.anatomical_location.v1" + #/data[at0001]/items[at0073] -> - # - name: "problemDiagnoseNameCode" - # extension: "overwrite" - # with: - # fhir: "$fhirRoot" - # openehr: "$archetype/data[at0001]/items[at0002]" - # +# - name: "problemDiagnose2" # THIS SHOULD be for the export from openehr->fhir but it does not work since i cannot work on the codings since the transformation does not allow it +# extension: "add" +# unidirectional: "openEHR->fhir" +# with: +# fhir: "$resource.code.coding" +# openehr: "$archetype/data[at0001]/items[at0002]" +# followedBy: +# mappings: +# - name: "multipleCoding" +# with: +# fhir: "extension" +# openehr: "$archetype" +# type: "NONE" +# followedBy: +# mappings: +# - name: "extensionValue" +# with: +# fhir: "$fhirRoot" +# openehr: "data[at0001]/items[openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1]" +# slotArchetype: "CLUSTER.multiple_coding_icd10gm.v1" +# - name: "extensionUrl" +# with: +# fhir: "$fhirRoot" #since we want to access extension here +# manual: +# - name: "extensionUrl" +# fhir: +# - path: "url" +# value: "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen" +# +# - name: "bodySiteClusterIcd10" # is here added too, in case the icd-10 is present in fhir so we map the localization +# with: +# fhir: "extension" +# openehr: "$archetype" +# type: "NONE" +# followedBy: +# mappings: +# - name: "extensionValue" +# with: +# fhir: "$fhirRoot" +# openehr: "data[at0001]/items[openEHR-EHR-CLUSTER.anatomical_location.v1]" +# slotArchetype: "CLUSTER.anatomical_location.v1" +# - name: "extension" +# with: +# fhir: "$fhirRoot" +# manual: +# - name: "extensionUrl" +# fhir: +# - path: "url" +# value: "http://fhir.de/StructureDefinition/seitenlokalisation" +# +# - name: "codeIcd10Diagnosesicherheit" +# with: +# fhir: "extension" +# openehr: "$archetype" +# type: "NONE" +# fhirCondition: +# targetRoot: "extension" +# targetAttribute: "url" +# operator: "one of" +# criteria: "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit" +# followedBy: +# mappings: +# - name: "extensionValue" +# with: +# fhir: "value" +# openehr: "data[at0001]/items[at0073]" +# type: "CODING" +# - name: "extensionUrl" +# with: +# fhir: "$fhirRoot" #since we want to access extension here +# manual: +# - name: "extensionUrl" +# fhir: +# - path: "url" +# value: "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit" +# +# - name: "extensionValue" +# with: +# fhir: "value" +# openehr: "data[at0001]/items[at0073]" +# type: "CODING" +# - - name: "icd10ProblemDiagnose" - extension: "append" - appendTo: "problemDiagnose" +# - name: "icd10ProblemDiagnose" +# extension: "append" +# appendTo: "problemDiagnose" + - name: "problemDiagnose" + with: + fhir: "$resource.code" + openehr: "$archetype/data[at0001]/items[at0002]" + extension: "overwrite" followedBy: mappings: - name: "coding" @@ -136,7 +197,7 @@ mappings: with: fhir: "value" openehr: "data[at0001]/items[at0073]" - + - name: "extensionUrl" with: fhir: "$fhirRoot" #since we want to access extension here diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml b/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml index e76fa5ad..615b9230 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml @@ -2,14 +2,14 @@ grammar: FHIRConnect/v0.9.0 type: context metadata: name: KDS_medikationseintrag.context - version: 0.0.1a -spec: + version: 0.0.1a +spec: system: FHIR version: R4 context: profile: - url: "https://www.medizininformatik-initiative.de/fhir/core/modul-labor/StructureDefinition/MedicationStatement" + url: "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" version: "2025.0.0" template: id: "KDS_Medikationseintrag" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.yml index 44b6dc14..53a3a784 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.yml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.yml @@ -9,18 +9,18 @@ spec: extends: OBSERVATION.medication_statement.v0 mappings: - #todo: where is this supposed to be mapped to? No encounter on MedicationStatement + # Dokumentationsdatum - name: "fallIdentifikationIdentifier" extension: "add" with: - fhir: "$resource.context.as(Reference).identifier" - openehr: "$composition/context/other_context[at0005]/items[openEHR-EHR-CLUSTER.case_identification.v0]" + fhir: "$resource.encounter.identifier" + openehr: "$composition/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]" slotArchetype: "CLUSTER.case_identification.v0" - name: "fallIdentifikationReference" # if reference is accessible overwrite fallIdentifikationIdentifier extension: "add" with: - fhir: "$resource.context.as(Encounter)" + fhir: "$resource.encounter" openehr: "$reference" reference: resourceType: "Encounter" @@ -28,15 +28,15 @@ mappings: - name: "identifierInReference" with: fhir: "$fhirRoot.identifier" - openehr: "$composition/context/other_context[at0005]/items[openEHR-EHR-CLUSTER.case_identification.v0]" + openehr: "$composition/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]" slotArchetype: "CLUSTER.case_identification.v0" -# - name: "encounterMapping" -# with: -# fhir: "$fhirRoot" -# openehr: "$composition/context/other_context[at0005]/items[openEHR-EHR-CLUSTER.case_identification.v0]/links" # will use link -# openehrLink: -# meaning: "the case this composition relates to" -# type: "case" + # - name: "encounterMapping" + # with: + # fhir: "$fhirRoot" + # openehr: "$composition/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]/links" # will use link + # openehrLink: + # meaning: "the case this composition relates to" + # type: "case" - name: "protocol0004Parent" extension: "add" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/medikationsverabreichung/KDS_medikamentenverabreichung.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/medikationsverabreichung/KDS_medikamentenverabreichung.yml index e9a23f15..9d79fe59 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/medikationsverabreichung/KDS_medikamentenverabreichung.yml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/medikationsverabreichung/KDS_medikamentenverabreichung.yml @@ -23,33 +23,35 @@ mappings: openehr: "$composition/context/other_context[at0001]/items[at0005]" # this status is mandatory, because it's 1...1 in the template + # Dokumentationsdatum - name: "fallIdentifikationIdentifier" extension: "add" with: - fhir: "$resource.context.as(Reference).identifier" + fhir: "$resource.context.identifier" openehr: "$composition/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]" slotArchetype: "CLUSTER.case_identification.v0" - name: "fallIdentifikationReference" # if reference is accessible overwrite fallIdentifikationIdentifier extension: "add" with: - fhir: "$resource.encounter" + fhir: "$resource.context" openehr: "$reference" - reference: #type None + reference: resourceType: "Encounter" mappings: - name: "identifierInReference" with: fhir: "$fhirRoot.identifier" - openehr: "$archetype/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]" + openehr: "$composition/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]" slotArchetype: "CLUSTER.case_identification.v0" -# - name: "encounterMapping" -# with: -# fhir: "$fhirRoot" -# openehr: "$archetype/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]/links" # will use link -# openehrLink: -# meaning: "the case this composition relates to" -# type: "case" + # - name: "encounterMapping" + # with: + # fhir: "$fhirRoot" + # openehr: "$composition/context/other_context[at0001]/items[openEHR-EHR-CLUSTER.case_identification.v0]/links" # will use link + # openehrLink: + # meaning: "the case this composition relates to" + # type: "case" + - name: "medicationCode" extension: "overwrite" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_address.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_address.yml new file mode 100644 index 00000000..ef1ebd46 --- /dev/null +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_address.yml @@ -0,0 +1,104 @@ +grammar: FHIRConnect/v0.9.0 +type: extension +metadata: + name: KDS_address + version: 0.0.1-alpha +spec: + system: FHIR + version: R4 + extends: CLUSTER.address.v1 + +mappings: + - name: "streetaddress" + extension: "overwrite" + with: + fhir: "$fhirRoot" + openehr: "$archetype" + followedBy: + mappings: + - name: "city" + with: + fhir: "city" + openehr: "items[at0002]" + + - name: "postalCode" + with: + fhir: "postalCode" + openehr: "items[at0005]" + + - name: "line" + with: + fhir: "line" + openehr: "items[at0001]" + + - name: "type" + with: + fhir: "type" + openehr: "items[at0010]" + manual: + - name: "physical" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0011" + - path: "value" + value: "Physical" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "physical" + + fhir: + - path: "code" + value: "physical" + openehrCondition: + targetRoot: "$openehrRoot" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0011" + + - name: "postal" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0012" + - path: "value" + value: "Postal" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "postal" + fhir: + - path: "code" + value: "postal" + openehrCondition: + targetRoot: "$openehrRoot" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0012" + + - name: "both" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0013" + - path: "value" + value: "Both" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "both" + fhir: + - path: "code" + value: "both" + openehrCondition: + targetRoot: "$openehrRoot" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0013" \ No newline at end of file diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_admin_entry_person.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_admin_entry_person.yml index bd5298c6..8fb985d1 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_admin_entry_person.yml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/person/KDS_admin_entry_person.yml @@ -14,7 +14,7 @@ mappings: with: fhir: "$resource.identifier" openehr: "$composition/context/other_context[at0003]/items[at0004]" - + fhirCondition: targetRoot: "$resource.identifier" targetAttribute: "type.coding.code" @@ -34,6 +34,7 @@ mappings: value: "MR" - name: "versicherungsInformationen" + extension: "add" with: fhir: "$resource.identifier" openehr: "$composition/content[openEHR-EHR-ADMIN_ENTRY.versicherungsinformationen.v0]" @@ -42,7 +43,7 @@ mappings: - name: "gender" extension: "add" with: - fhir: "$resource.gender" + fhir: "$resource" openehr: "$composition/content[openEHR-EHR-EVALUATION.gender.v1]" slotArchetype: "EVALUATION.gender.v1" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/person/person.context.yaml b/src/test/resources/kds_new/projects/org.highmed/KDS/person/person.context.yaml index f6406dc5..93e825f4 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/person/person.context.yaml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/person/person.context.yaml @@ -2,8 +2,8 @@ grammar: FHIRConnect/v0.9.0 type: context metadata: name: KDS_Person.context - version: 0.0.1a -spec: + version: 0.0.1a +spec: system: FHIR version: R4 @@ -20,13 +20,15 @@ context: - "CLUSTER.person.v1" - "CLUSTER.structured_name.v1" - "CLUSTER.address.v1" + - "CLUSTER.organisation.v1" - "CLUSTER.person_birth_data_iso.v0" - "CLUSTER.death_details.v1" - - "CLUSTER.observation_status_fhir.v1" + - "ADMIN_ENTRY.versicherungsinformationen.v0" extensions: - "KDS_person_data.v0" - "KDS_gender.v1" - "KDS_cluster_person.v1" + - "KDS_address" - "KDS_structured_name.v1.person_name-structured_name" - "KDS_admin_entry_person.v0" start: "ADMIN_ENTRY.person_data.v0" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_address.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_address.yml new file mode 100644 index 00000000..86d73c0d --- /dev/null +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_address.yml @@ -0,0 +1,105 @@ +grammar: FHIRConnect/v0.9.0 +type: extension +metadata: + name: KDS_address_pseudo + version: 0.0.1-alpha +spec: + system: FHIR + version: R4 + extends: CLUSTER.address.v1 + +mappings: + - name: "streetaddress" + extension: "overwrite" + with: + fhir: "$fhirRoot" + openehr: "$archetype" + followedBy: + mappings: + - name: "city" + with: + fhir: "city" + openehr: "items[at0002]" + + - name: "postalCode" + with: + fhir: "postalCode" + openehr: "items[at0005]" + + - name: "line" + with: + fhir: "line" + openehr: "items[at0001]" + + + - name: "type" + with: + fhir: "type" + openehr: "items[at0010]" + manual: + - name: "physical" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0011" + - path: "value" + value: "Physical" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "physical" + + fhir: + - path: "code" + value: "physical" + openehrCondition: + targetRoot: "$openehrRoot" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0011" + + - name: "postal" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0012" + - path: "value" + value: "Postal" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "postal" + fhir: + - path: "code" + value: "postal" + openehrCondition: + targetRoot: "$openehrRoot" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0012" + + - name: "both" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0013" + - path: "value" + value: "Both" + fhirCondition: + targetRoot: "$fhirRoot" + targetAttribute: "code" + operator: "one of" + criteria: "both" + fhir: + - path: "code" + value: "both" + openehrCondition: + targetRoot: "$openehrRoot" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0013" \ No newline at end of file diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_gender.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_gender.yml index 1022bbe9..a088bcff 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_gender.yml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/KDS_gender.yml @@ -1,7 +1,7 @@ grammar: FHIRConnect/v0.9.0 type: extension metadata: - name: KDS_gender.v1 + name: KDS_gender_pseudo.v1 version: 0.0.1-alpha spec: system: FHIR @@ -14,7 +14,7 @@ mappings: with: fhir: "$fhirRoot.extension" openehr: "$archetype/data[at0002]/items[at0014]" - + fhirCondition: targetRoot: "$fhirRoot.extension" targetAttribute: "url" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/pseudo_person.context.yaml b/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/pseudo_person.context.yaml index df8f489e..4167dc95 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/pseudo_person.context.yaml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/person_pseudo/pseudo_person.context.yaml @@ -21,6 +21,7 @@ context: - "CLUSTER.address.v1" - "CLUSTER.person_birth_data_iso.v0" extensions: + - "KDS_address_pseudo" - "KDS_admin_entry_perso_pseudo" - "KDS_person_pseudo_cluster.v1" - "KDS_gender.v1" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/vitalstatus/KDS_Vitalstatus.context.yaml b/src/test/resources/kds_new/projects/org.highmed/KDS/vitalstatus/KDS_Vitalstatus.context.yaml index facfc1e9..ef9c9d04 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/vitalstatus/KDS_Vitalstatus.context.yaml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/vitalstatus/KDS_Vitalstatus.context.yaml @@ -2,8 +2,8 @@ grammar: FHIRConnect/v0.9.0 type: context metadata: name: KDS_Vitalstatus.context - version: 0.0.1a -spec: + version: 0.0.1a +spec: system: FHIR version: R4 @@ -17,7 +17,6 @@ context: archetypes: - "EVALUATION.vital_status.v1" - "CLUSTER.case_identification.v0" - - "CLUSTER.observation_status_fhir.v1" extensions: - "KDS_vital_status" start: "EVALUATION.vital_status.v1" From 3eddf876e1ea0749475022b5894b9f88bbb1a274 Mon Sep 17 00:00:00 2001 From: Severin Date: Mon, 26 Jan 2026 15:51:55 +0100 Subject: [PATCH 2/5] refactored tests and started biirectional testing --- .../medblocks/openfhir/StandardsAsserter.java | 146 +----- .../kds/DebugMedikationseintragPrintTest.java | 53 -- .../medblocks/openfhir/kds/DiagnoseTest.java | 385 --------------- .../com/medblocks/openfhir/kds/FallTest.java | 234 --------- .../com/medblocks/openfhir/kds/KdsTest.java | 182 +++++++ .../openfhir/kds/LaborauftragTest.java | 192 -------- .../openfhir/kds/LaborberichtTest.java | 451 ------------------ .../kds/MedikamentenverabreichungenTest.java | 133 ------ .../openfhir/kds/MedikationseintragTest.java | 243 ---------- .../medblocks/openfhir/kds/PersonTest.java | 340 ------------- .../medblocks/openfhir/kds/ProcedureTest.java | 133 ------ .../openfhir/kds/StudienteilnahmeTest.java | 81 ---- .../kds/diagnose/DiagnoseToFHIRTest.java | 305 ++++++++++++ ...seTest.java => DiagnoseToOpenEHRTest.java} | 158 ++---- ...ii-exa-test-data-patient-1-diagnose-1.json | 277 ----------- ...ii-exa-test-data-patient-1-diagnose-1.json | 48 +- ...i-exa-test-data-patient-10-diagnose-1.json | 0 ...ii-exa-test-data-patient-2-diagnose-1.json | 40 +- ...ii-exa-test-data-patient-3-diagnose-1.json | 0 ...ii-exa-test-data-patient-4-diagnose-1.json | 0 ...ii-exa-test-data-patient-5-diagnose-1.json | 0 ...ii-exa-test-data-patient-6-diagnose-1.json | 0 ...ii-exa-test-data-patient-7-diagnose-1.json | 0 ...ii-exa-test-data-patient-8-diagnose-1.json | 0 ...ii-exa-test-data-patient-9-diagnose-1.json | 0 ...ii-exa-test-data-patient-1-diagnose-1.json | 0 ...i-exa-test-data-patient-10-diagnose-1.json | 0 ...ii-exa-test-data-patient-2-diagnose-1.json | 0 ...ii-exa-test-data-patient-3-diagnose-1.json | 0 ...ii-exa-test-data-patient-4-diagnose-1.json | 0 ...ii-exa-test-data-patient-5-diagnose-1.json | 0 ...ii-exa-test-data-patient-6-diagnose-1.json | 0 ...ii-exa-test-data-patient-7-diagnose-1.json | 0 ...ii-exa-test-data-patient-8-diagnose-1.json | 0 ...ii-exa-test-data-patient-9-diagnose-1.json | 0 .../input}/KDS_Diagnose_bundle.json | 0 .../input}/KDS_Diagnose_bundle_whole.json | 33 +- ...ii-exa-test-data-patient-1-diagnose-1.json | 350 ++++++++++++++ ...i-exa-test-data-patient-10-diagnose-1.json | 0 ...ii-exa-test-data-patient-2-diagnose-1.json | 0 ...ii-exa-test-data-patient-3-diagnose-1.json | 0 ...ii-exa-test-data-patient-4-diagnose-1.json | 0 ...ii-exa-test-data-patient-5-diagnose-1.json | 0 ...ii-exa-test-data-patient-6-diagnose-1.json | 0 ...ii-exa-test-data-patient-7-diagnose-1.json | 0 ...ii-exa-test-data-patient-8-diagnose-1.json | 0 ...ii-exa-test-data-patient-9-diagnose-1.json | 0 .../KDS_Diagnose_Composition.flat.json | 0 .../KDS_Diagnose_Composition_bundle.json | 414 +--------------- ...KDS_Diagnose_Composition_bundle_whole.json | 8 +- ...DS_Diagnose_multiple_Composition.flat.json | 0 .../multiple_coding_icd10gm.v1.yml | 128 +++-- .../org.openehr/problem_qualifier.v2.yml | 18 +- .../KDS/diagnose/KDS_problem_diagnose.yml | 28 +- 54 files changed, 1050 insertions(+), 3330 deletions(-) delete mode 100644 src/test/java/com/medblocks/openfhir/kds/DebugMedikationseintragPrintTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/DiagnoseTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/FallTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/KdsTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/LaborauftragTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/LaborberichtTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/MedikamentenverabreichungenTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/MedikationseintragTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/PersonTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/ProcedureTest.java delete mode 100644 src/test/java/com/medblocks/openfhir/kds/StudienteilnahmeTest.java create mode 100644 src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java rename src/test/java/com/medblocks/openfhir/kds/diagnose/{DiagnoseTest.java => DiagnoseToOpenEHRTest.java} (78%) delete mode 100644 src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json rename src/test/resources/kds/diagnose/toFHIR/{ => output}/Condition-mii-exa-test-data-patient-1-diagnose-1.json (62%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-10-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/toFHIR/{ => output}/Condition-mii-exa-test-data-patient-2-diagnose-1.json (58%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-3-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-4-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-5-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-6-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-7-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-8-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toFHIR/output}/Condition-mii-exa-test-data-patient-9-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/input}/Condition-mii-exa-test-data-patient-1-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-10-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/input}/Condition-mii-exa-test-data-patient-2-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-3-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-4-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-5-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-6-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-7-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-8-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{toFHIR => toOpenEHR/input}/Condition-mii-exa-test-data-patient-9-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/input}/KDS_Diagnose_bundle.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/input}/KDS_Diagnose_bundle_whole.json (95%) create mode 100644 src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-10-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-2-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-3-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-4-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-5-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-6-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-7-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-8-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/Composition-mii-exa-test-data-patient-9-diagnose-1.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/KDS_Diagnose_Composition.flat.json (100%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/KDS_Diagnose_Composition_bundle.json (54%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/KDS_Diagnose_Composition_bundle_whole.json (99%) rename src/test/resources/kds/diagnose/{ => toOpenEHR/output}/KDS_Diagnose_multiple_Composition.flat.json (100%) diff --git a/src/test/java/com/medblocks/openfhir/StandardsAsserter.java b/src/test/java/com/medblocks/openfhir/StandardsAsserter.java index ec8d0462..f8d99021 100644 --- a/src/test/java/com/medblocks/openfhir/StandardsAsserter.java +++ b/src/test/java/com/medblocks/openfhir/StandardsAsserter.java @@ -2,154 +2,48 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.parser.IParser; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; +import com.google.gson.*; import com.nedap.archie.rm.composition.Composition; import org.ehrbase.openehr.sdk.serialisation.jsonencoding.CanonicalJson; import org.hl7.fhir.r4.model.Bundle; +import org.json.JSONObject; import org.junit.Assert; +import org.skyscreamer.jsonassert.JSONAssert; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.TreeSet; -import java.util.function.Predicate; -import java.util.regex.Pattern; +import java.util.*; public class StandardsAsserter { private static final Gson GSON = new Gson(); - // sensible defaults (tune these once) - private static final Set DEFAULT_IGNORE_KEYS = Set.of( - "id", - "meta", - "type", - "timestamp" - ); - - private static final List DEFAULT_IGNORE_PATTERNS = List.of( - // NOTE: These patterns apply to *flat keys* in your JsonObject. - // Keep/adjust only if your keys really look like this. - Pattern.compile("^entry\\[\\d+\\]\\.resource\\.id$"), - Pattern.compile("^.*\\|time$"), - Pattern.compile("^.*\\|date_time$") - ); - - JsonObject loadJsonObject(String classpathLocation) { - InputStream is = getClass().getResourceAsStream(classpathLocation); - if (is == null) { - throw new IllegalArgumentException("File not found on classpath: " + classpathLocation); - } - return GSON.fromJson(new InputStreamReader(is, StandardCharsets.UTF_8), JsonObject.class); + public void assertComposition(Composition composition, String expectedClasspathJson) { + JSONObject actual = new JSONObject(new CanonicalJson().marshal(composition)); + JSONObject expected = loadJsonObject(expectedClasspathJson); + JSONAssert.assertEquals(expected, actual, true); } - public void assertFlatComposition(Composition composition, String filePath) { - JsonObject actual = GSON.fromJson(new CanonicalJson().marshal(composition), JsonObject.class); - JsonObject expected = loadJsonObject(filePath); - assertFlatJsonReadable(actual, expected); // defaults - } - - public void assertBundle(Bundle bundle, String filePath) { + public void assertBundle(Bundle bundle, String expectedClasspathJson) { FhirContext ctx = FhirContext.forR4(); IParser parser = ctx.newJsonParser(); - String serialized = parser.encodeResourceToString(bundle); - - JsonObject actual = GSON.fromJson(serialized, JsonObject.class); - JsonObject expected = loadJsonObject(filePath); - - assertFlatJsonReadable(actual, expected); // defaults - } - - // ------------------------- - // Overloads (clean API) - // ------------------------- + JSONObject actual = new JSONObject(parser.encodeResourceToString(bundle)); - /** Default ignores, extra keys allowed (recommended for bidirectional tests). */ - public void assertFlatJsonReadable(JsonObject actual, JsonObject expected) { - assertFlatJsonReadable(actual, expected, DEFAULT_IGNORE_KEYS, DEFAULT_IGNORE_PATTERNS, false); - } + JSONObject expected = loadJsonObject(expectedClasspathJson); - /** Default ignores, choose whether extra keys should fail. */ - public void assertFlatJsonReadable(JsonObject actual, JsonObject expected, boolean strictExtras) { - assertFlatJsonReadable(actual, expected, DEFAULT_IGNORE_KEYS, DEFAULT_IGNORE_PATTERNS, strictExtras); - } + JSONAssert.assertEquals(expected, actual, true); - /** Custom ignores, extra keys allowed. */ - public void assertFlatJsonReadable(JsonObject actual, - JsonObject expected, - Set ignoreKeys, - List ignoreKeyPatterns) { - assertFlatJsonReadable(actual, expected, ignoreKeys, ignoreKeyPatterns, false); } - public void assertFlatJsonReadable(JsonObject actual, - JsonObject expected, - Set ignoreKeys, - List ignoreKeyPatterns, - boolean strictExtras) { - - Objects.requireNonNull(actual, "actual JsonObject must not be null"); - Objects.requireNonNull(expected, "expected JsonObject must not be null"); - - Set ignoreKeySet = (ignoreKeys == null) ? Collections.emptySet() : ignoreKeys; - List ignorePatterns = (ignoreKeyPatterns == null) ? Collections.emptyList() : ignoreKeyPatterns; - - Predicate ignored = k -> - ignoreKeySet.contains(k) || - ignorePatterns.stream().anyMatch(p -> p.matcher(k).matches()); - - // filter keys first (so missing/extra logic respects ignores) - Set aKeys = new TreeSet<>(actual.keySet()); - Set eKeys = new TreeSet<>(expected.keySet()); - aKeys.removeIf(ignored); - eKeys.removeIf(ignored); - - Set missing = new TreeSet<>(eKeys); - missing.removeAll(aKeys); - - Set extra = new TreeSet<>(aKeys); - extra.removeAll(eKeys); - - StringBuilder sb = new StringBuilder(); - - Set common = new TreeSet<>(aKeys); - common.retainAll(eKeys); - - for (String key : common) { - JsonElement av = actual.get(key); - JsonElement ev = expected.get(key); - - boolean mismatch = - (av == null && ev != null) || - (av != null && ev == null) || - (av != null && ev != null && !av.equals(ev)); - - if (mismatch) { - sb.append("\nValue mismatch:\n") - .append(" key: ").append(key).append("\n") - .append(" expected: ").append(ev).append("\n") - .append(" actual: ").append(av).append("\n"); - } - } - - if (!missing.isEmpty()) { - sb.append("\nMissing keys (expected but not present):\n"); - missing.forEach(k -> sb.append(" - ").append(k).append("\n")); - } - - if (strictExtras && !extra.isEmpty()) { - sb.append("\nExtra keys (present in actual but not expected):\n"); - extra.forEach(k -> sb.append(" + ").append(k).append("\n")); - } - - if (sb.length() > 0) { - Assert.fail("JSON comparison failed:" + sb); + private JSONObject loadJsonObject(String classpathLocation) { + InputStream is = getClass().getResourceAsStream(classpathLocation); + try { + String json = new String(is.readAllBytes(), StandardCharsets.UTF_8); + return new JSONObject(json); + } catch (Exception e) { + throw new RuntimeException("Failed to parse JSON file", e); } } + } diff --git a/src/test/java/com/medblocks/openfhir/kds/DebugMedikationseintragPrintTest.java b/src/test/java/com/medblocks/openfhir/kds/DebugMedikationseintragPrintTest.java deleted file mode 100644 index 6367cb15..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/DebugMedikationseintragPrintTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.medblocks.openfhir.kds; - -import ca.uhn.fhir.context.FhirContext; -import com.google.gson.JsonObject; -import org.hl7.fhir.r4.model.Bundle; -import org.junit.Test; - -import java.io.InputStream; -import java.util.SortedSet; -import java.util.TreeSet; - -public class DebugMedikationseintragPrintTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml"; - final String HELPER_LOCATION = "/kds/medikationseintrag/"; - final String BUNDLE = "KDS_Medikationseintrag_v1-Fhir-Bundle-input.json"; - - @Override - protected void prepareState() { - context = getContext(CONTEXT); - try { - operationaltemplateSerialized = new String( - getClass().getResourceAsStream(HELPER_LOCATION + "KDS_Medikationseintrag.opt").readAllBytes(), - java.nio.charset.StandardCharsets.UTF_8); - } catch (Exception e) { - throw new RuntimeException(e); - } - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - } - - @Test - public void printFlatForDebug() { - InputStream is = getClass().getResourceAsStream(HELPER_LOCATION + BUNDLE); - Bundle bundle = FhirContext.forR4().newJsonParser().parseResource(Bundle.class, is); - - JsonObject flat = fhirToOpenEhr.fhirToFlatJsonObject(context, bundle, operationaltemplate); - - SortedSet keys = new TreeSet<>(); - flat.entrySet().forEach(e -> keys.add(e.getKey() + " = " + e.getValue().toString())); - - // Print only medication-related paths for brevity - keys.stream() - .filter(k -> k.contains("/arzneimittel/")) - .forEach(System.out::println); - } - - @Override - protected JsonObject toOpenEhr() { - return null; // not used in this debug test - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/DiagnoseTest.java b/src/test/java/com/medblocks/openfhir/kds/DiagnoseTest.java deleted file mode 100644 index 7f32e83c..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/DiagnoseTest.java +++ /dev/null @@ -1,385 +0,0 @@ -package com.medblocks.openfhir.kds; - -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.util.List; -import java.util.stream.Collectors; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Condition; -import org.hl7.fhir.r4.model.DateTimeType; -import org.hl7.fhir.r4.model.Encounter; -import org.hl7.fhir.r4.model.Extension; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.Type; -import org.junit.Assert; -import org.junit.Test; - -public class DiagnoseTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT_MAPPING = "/kds_new/projects/org.highmed/KDS/diagnose/KDS_diagnose.context.yaml"; - final String HELPER_LOCATION = "/kds/diagnose/"; - final String OPT = "KDS_Diagnose.opt"; - final String FLAT = "KDS_Diagnose_Composition.flat.json"; - final String FLAT_MULTIPLE = "KDS_Diagnose_multiple_Composition.flat.json"; // todo change to multiple - final String BUNDLE = "KDS_Diagnose_bundle_whole.json"; - final String BUNDLE_SINGLE = "KDS_Diagnose_bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT_MAPPING); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - private void assertCondition(final Condition condition, final boolean second) { - // - name: "contextStartTime" - final String expectedTime = second ? "2023-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; -// Assert.assertEquals(expectedTime, condition.getRecordedDateElement().getValueAsString()); - - - // - name: "fallIdentifikationIdentifier" - if (!second) { - Assert.assertEquals("VN", ((Encounter) condition.getEncounter().getResource()).getIdentifier().get(0).getType().getCodingFirstRep().getCode()); - Assert.assertEquals("Encounter/123", ((Encounter) condition.getEncounter().getResource()).getIdentifier().get(0).getValue()); - } - - // - name: "status" - if (!second) { - Assert.assertEquals("unconfirmed", condition.getVerificationStatus().getCodingFirstRep().getCode()); - Assert.assertEquals("http://hl7.org/fhir/ValueSet/condition-ver-status", - condition.getVerificationStatus().getCodingFirstRep().getSystem()); - } - - // - name: "date" - final List assertedExtensions = condition.getExtensionsByUrl( - "http://hl7.org/fhir/StructureDefinition/condition-assertedDate"); - Assert.assertEquals(1, assertedExtensions.size()); - final String expectedAssertedTime = second ? "3022-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; - Assert.assertEquals(expectedAssertedTime, - ((DateTimeType) assertedExtensions.get(0).getValue()).getValueAsString()); - - // dateTime, onset - final String expectedOnsetStartTime = second ? "3022-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; - Assert.assertEquals(expectedOnsetStartTime, condition.getOnsetPeriod().getStartElement().getValueAsString()); - - //- name: "clinicalStatus" - Assert.assertEquals((second ? "referenced_" : "") + "Active", condition.getClinicalStatus().getText()); - Assert.assertEquals((second ? "referenced_" : "") + "at0026", - condition.getClinicalStatus().getCodingFirstRep().getCode()); - - // - name: "lebensphase" - Assert.assertEquals((second ? "referenced_" : "") + "43", - ((CodeableConcept) condition.getOnsetPeriod().getStartElement() - .getExtensionsByUrl("http://fhir.de/StructureDefinition/lebensphase") - .get(0).getValue()).getCodingFirstRep().getCode()); - Assert.assertEquals((second ? "referenced_" : "") + "44", - ((CodeableConcept) condition.getOnsetPeriod().getEndElement() - .getExtensionsByUrl("http://fhir.de/StructureDefinition/lebensphase") - .get(0).getValue()).getCodingFirstRep().getCode()); - -// - name: "schweregrad" - Assert.assertEquals((second ? "referenced_" : "") + "42", - condition.getSeverity().getCodingFirstRep().getCode()); - Assert.assertEquals( - (second ? "referenced_" : "") - + "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/condition-severity' available", - condition.getSeverity().getText()); - - // bodySite - final List bodySites = condition.getBodySite(); - Assert.assertEquals(1, bodySites.size()); - final CodeableConcept bodySite = bodySites.get(0); - Assert.assertEquals(1, bodySite.getCoding().size()); - final List snomedBodySiteCodings = bodySite.getCoding().stream() - .filter(bsite -> bsite.getSystem() - .equals((second ? "referenced_" : "") - + "//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/body-site")) - .toList(); - Assert.assertEquals(1, snomedBodySiteCodings.size()); - Assert.assertEquals((second ? "referenced_" : "") + "42", snomedBodySiteCodings.get(0).getCode()); - - // bodySiteCluster; nothing to do here because the cluster is overwritten to be a unidiretional toopenehr only - -// - name: "problemDiagnose", - name: "problemDiagnoseNameCode" - Assert.assertEquals(2, condition.getCode().getCoding().size()); - Coding icd10code = condition.getCode().getCoding().get(0); - Assert.assertEquals((second ? "referenced_" : "") + "kodierte_diagnose value", icd10code.getCode()); -// - name: "problemDiagnoseText" -// Assert.assertEquals((second ? "referenced_" : "") + "freitextbeschreibung value", -// condition.getCode().getText()); -// - name: "icd10ProblemDiagnose" - - icd10code = condition.getCode().getCoding().get(1); - Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", icd10code.getSystem()); - -// - name: "codeIcd10Diagnosesicherheit" - final CodeableConcept diagnosessicherheit = (CodeableConcept) icd10code.getExtensionsByUrl( - "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit").stream() - .map(Extension::getValue).filter(value -> !value.isEmpty()).findAny().orElse(null); - Assert.assertEquals((second ? "referenced_" : "") + "diagnosesicherheit", - diagnosessicherheit.getCodingFirstRep().getCode()); - Assert.assertEquals( - (second ? "referenced_" : "") - + "//fhir.hl7.org//ValueSet/$expand?url=https://fhir.kbv.de/ValueSet/KBV_VS_SFHIR_ICD_DIAGNOSESICHERHEIT", - diagnosessicherheit.getCodingFirstRep().getSystem()); - - // - name: "mehrfachcodierung" - final CodeableConcept mehrfachcodierung = (CodeableConcept) icd10code.getExtensionByUrl( - "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen").getValue(); - Assert.assertEquals("!", mehrfachcodierung.getCodingFirstRep().getCode()); - Assert.assertEquals("http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen", mehrfachcodierung.getCodingFirstRep().getSystem()); - Assert.assertEquals("!", mehrfachcodierung.getCodingFirstRep().getDisplay()); - - // - name: "seitenlokalisation" - final CodeableConcept seitenlokalisation = (CodeableConcept) icd10code.getExtensionByUrl( - "http://fhir.de/StructureDefinition/seitenlokalisation").getValue(); - Assert.assertEquals((second ? "referenced_" : "") + "at0003", seitenlokalisation.getCodingFirstRep().getCode()); - Assert.assertEquals((second ? "referenced_" : "") + "local", - seitenlokalisation.getCodingFirstRep().getSystem()); - Assert.assertEquals((second ? "referenced_" : "") + "Left", - seitenlokalisation.getCodingFirstRep().getDisplay()); - - - Assert.assertEquals(3, icd10code.getExtension().size()); - } - - @Test - public void toFhir() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( - getFlat(HELPER_LOCATION + FLAT_MULTIPLE), new OPTParser(operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allConditions = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Condition).collect(Collectors.toList()); - Assert.assertEquals(2, allConditions.size()); - final Condition condition = (Condition) allConditions.get(0).getResource(); // first condition - final Condition conditionSecond = (Condition) allConditions.get(1).getResource(); // second condition - - assertCondition(condition, false); -// assertCondition(conditionSecond, true); - - final Type referencedExtensionCondition = condition.getExtensionByUrl( - "http://hl7.org/fhir/StructureDefinition/condition-related") - .getValue(); - Assert.assertNotNull(referencedExtensionCondition); - Assert.assertTrue(conditionSecond.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/condition-related") - .getValue().isEmpty()); - - assertCondition((Condition) ((Reference) referencedExtensionCondition).getResource(), true); - - } - - @Test - public void toOpenEhr_single() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE_SINGLE); - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - Assert.assertEquals("2022-02-03T01:00:00", jsonObject.get("diagnose/context/start_time").getAsString()); - - - Assert.assertEquals("C34.1", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|code").getAsString()); - Assert.assertEquals("Secondary malignant neoplasm of lymph node", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|terminology").getAsString()); - Assert.assertEquals("G", jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|code").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", - jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|terminology").getAsString()); - Assert.assertEquals("Confirmed diagnosis", - jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|value").getAsString()); - Assert.assertEquals("at0002", jsonObject.get( - "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|code").getAsString()); - Assert.assertEquals("local", jsonObject.get( - "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|terminology").getAsString()); - Assert.assertEquals("†", jsonObject.get( - "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|value").getAsString()); - Assert.assertEquals("L", jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|code") - .getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/seitenlokalisation", - jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|terminology") - .getAsString()); - Assert.assertEquals("Left side", - jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|value") - .getAsString()); -// Assert.assertEquals("Secondary malignant neoplasm of lymph node", -// jsonObject.get("diagnose/diagnose:0/freitextbeschreibung").getAsString()); - Assert.assertEquals("Patient confirmed for secondary malignant neoplasm of lymph node.", - jsonObject.get("diagnose/diagnose:0/diagnoseerläuterung").getAsString()); - Assert.assertEquals("2024-12-24T16:13:43", - jsonObject.get("diagnose/diagnose:0/klinisch_relevanter_zeitraum_zeitpunkt_des_auftretens") - .getAsString()); - Assert.assertEquals("424144002", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|terminology").getAsString()); - Assert.assertEquals("Start of adulthood phase", - jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|value").getAsString()); - Assert.assertEquals("367640001", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.get("diagnose/diagnose:0/lebensphase/ende|terminology").getAsString()); - Assert.assertEquals("End of middle age phase", - jsonObject.get("diagnose/diagnose:0/lebensphase/ende|value").getAsString()); - Assert.assertEquals("24484000", jsonObject.get("diagnose/diagnose:0/schweregrad|code").getAsString()); - Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-severity", - jsonObject.get("diagnose/diagnose:0/schweregrad|terminology").getAsString()); - Assert.assertEquals("Severe", jsonObject.get("diagnose/diagnose:0/schweregrad|value").getAsString()); - Assert.assertEquals("encounter-id-1245", - jsonObject.get("diagnose/context/fallidentifikation/fall-kennung").getAsString()); - Assert.assertEquals("2025-02-03T05:05:06", - jsonObject.get("diagnose/diagnose:0/feststellungsdatum").getAsString()); - Assert.assertEquals("active", jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|code") - .getAsString()); - Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-clinical", - jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|terminology") - .getAsString()); - - - } - - public JsonObject toOpenEhr() { - - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - Assert.assertEquals("2022-02-03T01:00:00", jsonObject.get("diagnose/context/start_time").getAsString()); - Assert.assertEquals("C34.1", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|code").getAsString()); - Assert.assertEquals("Secondary malignant neoplasm of lymph node", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", jsonObject.get("diagnose/diagnose:0/kodierte_diagnose|terminology").getAsString()); - Assert.assertEquals("G", jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|code").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", - jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|terminology").getAsString()); - Assert.assertEquals("Confirmed diagnosis", - jsonObject.get("diagnose/diagnose:0/diagnosesicherheit|value").getAsString()); - Assert.assertEquals("at0002", jsonObject.get( - "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|code").getAsString()); - Assert.assertEquals("local", jsonObject.get( - "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|terminology").getAsString()); - Assert.assertEquals("†", jsonObject.get( - "diagnose/diagnose:0/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|value").getAsString()); - Assert.assertEquals("L", jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|code") - .getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/seitenlokalisation", - jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|terminology") - .getAsString()); - Assert.assertEquals("Left side", - jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/name_der_körperstelle|value") - .getAsString()); -// Assert.assertEquals("Secondary malignant neoplasm of lymph node", -// jsonObject.get("diagnose/diagnose:0/freitextbeschreibung").getAsString()); - Assert.assertEquals("Patient confirmed for secondary malignant neoplasm of lymph node.", - jsonObject.get("diagnose/diagnose:0/diagnoseerläuterung").getAsString()); - Assert.assertEquals("424144002", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|terminology").getAsString()); - Assert.assertEquals("Start of adulthood phase", - jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|value").getAsString()); - Assert.assertEquals("367640001", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.get("diagnose/diagnose:0/lebensphase/ende|terminology").getAsString()); - Assert.assertEquals("End of middle age phase", - jsonObject.get("diagnose/diagnose:0/lebensphase/ende|value").getAsString()); - Assert.assertEquals("24484000", jsonObject.get("diagnose/diagnose:0/schweregrad|code").getAsString()); - Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-severity", - jsonObject.get("diagnose/diagnose:0/schweregrad|terminology").getAsString()); - Assert.assertEquals("Severe", jsonObject.get("diagnose/diagnose:0/schweregrad|value").getAsString()); - Assert.assertEquals("encounter-id-1245", - jsonObject.get("diagnose/context/fallidentifikation/fall-kennung").getAsString()); - Assert.assertEquals("2025-02-03T05:05:06", - jsonObject.get("diagnose/diagnose:0/feststellungsdatum").getAsString()); - Assert.assertEquals("active", jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|code") - .getAsString()); - Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-clinical", - jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|terminology") - .getAsString()); - Assert.assertEquals("active", jsonObject.get("diagnose/diagnose:0/klinischer_status/klinischer_status|value") - .getAsString()); -// -// Assert.assertEquals("L", -// jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/laterality|code").getAsString()); -// Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/seitenlokalisation", -// jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/laterality|terminology") -// .getAsString()); -// Assert.assertEquals("Left side", -// jsonObject.get("diagnose/diagnose:0/anatomische_lokalisation/laterality|value").getAsString()); - - Assert.assertEquals("ref_C34.1", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|code").getAsString()); - Assert.assertEquals("Malignant neoplasm of upper lobe, bronchus or lung", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|terminology").getAsString()); - Assert.assertEquals("ref_S", jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|code").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", - jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|terminology").getAsString()); - Assert.assertEquals("ref_Suspected diagnosis", - jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|value").getAsString()); - Assert.assertEquals("at0003", jsonObject.get( - "diagnose/diagnose:1/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|code").getAsString()); - Assert.assertEquals("local", jsonObject.get( - "diagnose/diagnose:1/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|terminology").getAsString()); - Assert.assertEquals("*", jsonObject.get( - "diagnose/diagnose:1/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|value").getAsString()); - Assert.assertEquals("ref_U", jsonObject.get("diagnose/diagnose:1/anatomische_lokalisation/name_der_körperstelle|code") - .getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/seitenlokalisation", - jsonObject.get("diagnose/diagnose:1/anatomische_lokalisation/name_der_körperstelle|terminology") - .getAsString()); - Assert.assertEquals("ref_Upper lobe", - jsonObject.get("diagnose/diagnose:1/anatomische_lokalisation/name_der_körperstelle|value") - .getAsString()); -// Assert.assertEquals("Malignant neoplasm of upper lobe, bronchus or lung", -// jsonObject.get("diagnose/diagnose:1/freitextbeschreibung").getAsString()); - Assert.assertEquals( - "ref_The patient has a history of high blood pressure, now presenting with severe hypertension.", - jsonObject.get("diagnose/diagnose:1/diagnoseerläuterung").getAsString()); - Assert.assertEquals("ref_424144002", - jsonObject.get("diagnose/diagnose:1/lebensphase/beginn|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.get("diagnose/diagnose:1/lebensphase/beginn|terminology").getAsString()); - Assert.assertEquals("ref_Start of adulthood phase", - jsonObject.get("diagnose/diagnose:1/lebensphase/beginn|value").getAsString()); - Assert.assertEquals("ref_367640001", jsonObject.get("diagnose/diagnose:1/lebensphase/ende|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.get("diagnose/diagnose:1/lebensphase/ende|terminology").getAsString()); - Assert.assertEquals("ref_End of middle age phase", - jsonObject.get("diagnose/diagnose:1/lebensphase/ende|value").getAsString()); - Assert.assertEquals("ref_24484000", jsonObject.get("diagnose/diagnose:1/schweregrad|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.get("diagnose/diagnose:1/schweregrad|terminology").getAsString()); - Assert.assertEquals("ref_Severe", jsonObject.get("diagnose/diagnose:1/schweregrad|value").getAsString()); - Assert.assertEquals("2125-02-03T05:05:06", - jsonObject.get("diagnose/diagnose:1/feststellungsdatum").getAsString()); - Assert.assertEquals("ref_active", jsonObject.get("diagnose/diagnose:1/klinischer_status/klinischer_status|code") - .getAsString()); - Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-clinical", - jsonObject.get("diagnose/diagnose:1/klinischer_status/klinischer_status|terminology") - .getAsString()); - Assert.assertEquals("ref_active", - jsonObject.get("diagnose/diagnose:1/klinischer_status/klinischer_status|value") - .getAsString()); - - Assert.assertEquals("at0064", - jsonObject.get("diagnose/diagnose:1/klinischer_status/diagnoserolle|code") - .getAsString()); - Assert.assertEquals("at0066", - jsonObject.get("diagnose/diagnose:0/klinischer_status/diagnoserolle|code") - .getAsString()); - Assert.assertEquals("local", - jsonObject.get("diagnose/diagnose:0/klinischer_status/diagnoserolle|terminology") - .getAsString()); - Assert.assertEquals("local", - jsonObject.get("diagnose/diagnose:1/klinischer_status/diagnoserolle|terminology") - .getAsString()); - Assert.assertEquals("Nebendiagnose", - jsonObject.get("diagnose/diagnose:0/klinischer_status/diagnoserolle|value") - .getAsString()); - Assert.assertEquals("Hauptdiagnose", - jsonObject.get("diagnose/diagnose:1/klinischer_status/diagnoserolle|value") - .getAsString()); - - return jsonObject; - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/FallTest.java b/src/test/java/com/medblocks/openfhir/kds/FallTest.java deleted file mode 100644 index 611fe01b..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/FallTest.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.medblocks.openfhir.kds; - -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.util.List; -import java.util.stream.Collectors; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Condition; -import org.hl7.fhir.r4.model.Encounter; -import org.hl7.fhir.r4.model.Encounter.DiagnosisComponent; -import org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent; -import org.hl7.fhir.r4.model.Extension; -import org.hl7.fhir.r4.model.Identifier; -import org.hl7.fhir.r4.model.Organization; -import org.junit.Assert; -import org.junit.Test; - -public class FallTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT_MAPPING = "/kds_new/projects/org.highmed/KDS/fall/KDS_fall_einfach.context.yaml"; - final String HELPER_LOCATION = "/kds/fall/"; - final String OPT = "KDS_Fall_einfach.opt"; - final String FLAT = "KDS_Fall_einfach.flat.json"; - final String BUNDLE = "KDS_Fall_einfach_Bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT_MAPPING); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - @Test - public void toFhir() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( - getFlat(HELPER_LOCATION + FLAT), new OPTParser(operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allEncounters = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Encounter).collect(Collectors.toList()); - Assert.assertEquals(1, allEncounters.size()); - - final Encounter encounter = (Encounter) allEncounters.get(0).getResource(); - - // falltyp - Assert.assertEquals("42", encounter.getTypeFirstRep().getCodingFirstRep().getCode()); - Assert.assertEquals("No example for termínology 'http://fhir.de/ValueSet/kontaktebene-de?subset=' available", - encounter.getTypeFirstRep().getCodingFirstRep().getDisplay()); - Assert.assertEquals("http://fhir.de/ValueSet/kontaktebene-de?subset=", - encounter.getTypeFirstRep().getCodingFirstRep().getSystem()); - - // fallklasse - Assert.assertEquals("43", encounter.getClass_().getCode()); - Assert.assertEquals("No example for termínology 'http://fhir.de/ValueSet/EncounterClassDE?subset=' available", - encounter.getClass_().getDisplay()); - Assert.assertEquals("http://fhir.de/ValueSet/EncounterClassDE?subset=", encounter.getClass_().getSystem()); - - // fallart - Assert.assertEquals("42", encounter.getStatusElement().getValueAsString()); - - // fallId - Assert.assertEquals("FallId-Id", encounter.getIdentifier().stream() - .filter(id -> id.getType().getCodingFirstRep().getCode().equals("VN")) - .map(id -> id.getValue()) - .findFirst().orElse(null)); - - // serviceProvider - final Organization serviceProvider = (Organization) encounter.getServiceProvider().getResource(); - Assert.assertEquals("Org Name", serviceProvider.getName()); - Assert.assertEquals("Org Id", serviceProvider.getIdentifierFirstRep().getValue()); - - // aufnahmegrundExtension - final List aufnahmegrundExtension = encounter.getExtensionsByUrl( - "http://fhir.de/StructureDefinition/Aufnahmegrund"); - Assert.assertEquals(1, aufnahmegrundExtension.size()); - Assert.assertEquals(3, aufnahmegrundExtension.get(0).getExtension().size()); - - final Extension firstAndSecond = aufnahmegrundExtension.get(0).getExtensionByUrl("ErsteUndZweiteStelle"); - final Extension third = aufnahmegrundExtension.get(0).getExtensionByUrl("DritteStelle"); - final Extension fourth = aufnahmegrundExtension.get(0).getExtensionByUrl("VierteStelle"); - Assert.assertEquals("12", ((Coding) firstAndSecond.getValue()).getCode()); - Assert.assertEquals("3", ((Coding) third.getValue()).getCode()); - Assert.assertEquals("4", ((Coding) fourth.getValue()).getCode()); - - final CodeableConcept admitSource = encounter.getHospitalization().getAdmitSource(); - Assert.assertEquals("admitSource", admitSource.getCodingFirstRep().getCode()); - - final Extension entlassungsgrundExtension = encounter.getHospitalization().getDischargeDisposition() - .getExtensionByUrl("http://fhir.de/StructureDefinition/Entlassungsgrund"); - Assert.assertEquals("outcome", ((Coding) entlassungsgrundExtension.getValue()).getCode()); - - final DiagnosisComponent diagnosisComponent = encounter.getDiagnosisFirstRep(); - final Condition condition = (Condition) diagnosisComponent.getCondition().getResource(); - Assert.assertEquals("diagnos coding", condition.getCode().getCodingFirstRep().getCode()); - - Assert.assertEquals(2, diagnosisComponent.getUse().getCoding().size()); - Assert.assertEquals("type", diagnosisComponent.getUse().getCoding().stream() - .filter(cod -> cod.getSystem().equals("http://fhir.de/CodeSystem/dki-diagnosetyp")) - .map(Coding::getCode) - .findFirst().orElse(null)); - Assert.assertEquals("subtype", diagnosisComponent.getUse().getCoding().stream() - .filter(cod -> cod.getSystem().equals("http://fhir.de/CodeSystem/dki-diagnosesubtyp")) - .map(Coding::getCode) - .findFirst().orElse(null)); - - // - name: "period" - Assert.assertEquals("2020-02-03T04:05:06+01:00", encounter.getPeriod().getStartElement().getValueAsString()); - Assert.assertEquals("2022-02-03T04:05:06+01:00", encounter.getPeriod().getEndElement().getValueAsString()); - - final List locations = encounter.getLocation(); - Assert.assertEquals(3, locations.size()); - - final List roomLocationIds = locations.stream() - .filter(loc -> "ro".equals(loc.getPhysicalType().getCodingFirstRep().getCode())) - .map(el -> el.getLocation().getIdentifier()) - .toList(); - final List bedLocationIds = locations.stream() - .filter(loc -> "bd".equals(loc.getPhysicalType().getCodingFirstRep().getCode())) - .map(el -> el.getLocation().getIdentifier()) - .toList(); - final List wardLocationIds = locations.stream() - .filter(loc -> "wa".equals(loc.getPhysicalType().getCodingFirstRep().getCode())) - .map(el -> el.getLocation().getIdentifier()) - .toList(); - - Assert.assertTrue(locations.stream().allMatch(loc -> loc.getPhysicalType().getCodingFirstRep().getSystem() - .equals("http://terminology.hl7.org/CodeSystem/location-physical-type"))); - - Assert.assertEquals(1, roomLocationIds.size()); - Assert.assertEquals(1, bedLocationIds.size()); - Assert.assertEquals(1, wardLocationIds.size()); - - Assert.assertEquals("zimmer-1", roomLocationIds.get(0).getValue()); - Assert.assertEquals("bett-1", bedLocationIds.get(0).getValue()); - Assert.assertEquals("station-1", wardLocationIds.get(0).getValue()); - } - - - public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - Assert.assertEquals("einrichtungskontakt", - jsonObject.get("kds_fall_einfach/context/falltyp|code").getAsString()); - Assert.assertEquals("local_terms", - jsonObject.get("kds_fall_einfach/context/falltyp|terminology").getAsString()); - Assert.assertEquals("AMB", jsonObject.get("kds_fall_einfach/context/fallklasse|code").getAsString()); - Assert.assertEquals("ambulatory", jsonObject.get("kds_fall_einfach/context/fallklasse|value").getAsString()); - Assert.assertEquals("http://terminology.hl7.org/CodeSystem/v3-ActCode", - jsonObject.get("kds_fall_einfach/context/fallklasse|terminology").getAsString()); - Assert.assertEquals("finished", jsonObject.get("kds_fall_einfach/context/fallart|code").getAsString()); - Assert.assertEquals("VN-encounter-id-12345", jsonObject.get("kds_fall_einfach/context/fall-id").getAsString()); - Assert.assertEquals("Example Hospital", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/überweiser/namenszeile") - .getAsString()); - Assert.assertEquals("ORG-001", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/überweiser/identifier:0/identifier_value|id").getAsString()); - Assert.assertEquals("01", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_ersteundzweitestelle|code").getAsString()); - Assert.assertEquals("Krankenhausbehandlung, vollstationär", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_ersteundzweitestelle|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dkgev/AufnahmegrundErsteUndZweiteStelle", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_ersteundzweitestelle|terminology") - .getAsString()); - Assert.assertEquals("0", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_dritte_stelle|code") - .getAsString()); - Assert.assertEquals("Anderes", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_dritte_stelle|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dkgev/AufnahmegrundDritteStelle", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_dritte_stelle|terminology").getAsString()); - Assert.assertEquals("1", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_vierte_stelle|code") - .getAsString()); - Assert.assertEquals("Normalfall", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_vierte_stelle|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dkgev/AufnahmegrundVierteStelle", jsonObject.get( - "kds_fall_einfach/institutionsaufenthalt/aufnahmegrund_-_vierte_stelle|terminology").getAsString()); - Assert.assertEquals("E", jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmekategorie|code") - .getAsString()); - Assert.assertEquals("Einweisung durch einen Arzt", jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmekategorie|value") - .getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dgkev/Aufnahmeanlass", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmekategorie|terminology") - .getAsString()); - Assert.assertEquals("01", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/outcome:0|code").getAsString()); - Assert.assertEquals("Reguläre Entlassung", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/outcome:0|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/entlassungsgrund", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/outcome:0|terminology") - .getAsString()); - Assert.assertEquals("referral-diagnosis", - jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosetyp|code").getAsString()); - Assert.assertEquals("Einweisungs-/Überweisungsdiagnos", - jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosetyp|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dki-diagnosetyp", - jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosetyp|terminology").getAsString()); - Assert.assertEquals("surgery-diagnosis", - jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosesubtyp|code").getAsString()); - Assert.assertEquals("Operationsdiagnose", - jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosesubtyp|value").getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/dki-diagnosesubtyp", - jsonObject.get("kds_fall_einfach/problem_diagnose/diagnosesubtyp|terminology") - .getAsString()); -// Assert.assertEquals("Organization", -// jsonObject.get("kds_fall_einfach/context/_health_care_facility|name").getAsString()); - Assert.assertEquals("2022-02-03T05:05:06", jsonObject.get("kds_fall_einfach/context/start_time").getAsString()); - Assert.assertEquals("2022-04-03T06:05:06", jsonObject.get("kds_fall_einfach/context/_end_time").getAsString()); -// Assert.assertEquals("Organization", jsonObject.get("kds_fall_einfach/composer|name").getAsString()); - Assert.assertEquals("2022-02-03T05:05:06", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/aufnahmedatum").getAsString()); - Assert.assertEquals("2022-04-03T06:05:06", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/entlassungsdatum").getAsString()); - Assert.assertEquals("zimmer-1-identifier", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/standort:0/zimmer").getAsString()); - Assert.assertEquals("station-1-identifier", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/standort:0/station").getAsString()); - Assert.assertEquals("bett-1-identifier", - jsonObject.get("kds_fall_einfach/institutionsaufenthalt/standort:0/bett").getAsString()); - - return jsonObject; - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/KdsTest.java b/src/test/java/com/medblocks/openfhir/kds/KdsTest.java new file mode 100644 index 00000000..c7db1337 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/KdsTest.java @@ -0,0 +1,182 @@ +package com.medblocks.openfhir.kds; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.fhirpath.IFhirPathEvaluationContext; +import ca.uhn.fhir.parser.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.medblocks.openfhir.*; +import com.medblocks.openfhir.fc.schema.context.FhirConnectContext; +import com.medblocks.openfhir.kds.ehrbase.EhrBaseTestClient; +import com.medblocks.openfhir.tofhir.IntermediateCacheProcessing; +import com.medblocks.openfhir.tofhir.OpenEhrToFhir; +import com.medblocks.openfhir.toopenehr.FhirToOpenEhr; +import com.medblocks.openfhir.util.*; +import com.nedap.archie.rm.composition.Composition; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.marshal.FlatJsonMarshaller; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.model.WebTemplate; +import org.hl7.fhir.instance.model.api.IBase; +import org.hl7.fhir.instance.model.api.IIdType; +import org.hl7.fhir.r4.hapi.fluentpath.FhirPathR4; +import org.hl7.fhir.r4.model.Reference; +import org.junit.Before; +import org.openehr.schemas.v1.OPERATIONALTEMPLATE; +import org.openehr.schemas.v1.TemplateDocument; +import org.springframework.http.ResponseEntity; + +@Slf4j +public abstract class KdsTest { + + // integration toggle + protected boolean TEST_AGAINST_EHRBASE = false; + protected String EHRBASE_BASIC_USERNAME = "ehrbase-user"; + protected String EHRBASE_BASIC_PASSWORD = "SuperSecretPassword"; + protected String EHRBASE_HOST = "http://localhost:8081"; + + protected final OpenFhirStringUtils openFhirStringUtils = new OpenFhirStringUtils(); + protected final OpenFhirMapperUtils openFhirMapperUtils = new OpenFhirMapperUtils(); + protected final FhirConnectModelMerger fhirConnectModelMerger = new FhirConnectModelMerger(); + + protected final FhirPathR4 fhirPath = new FhirPathR4(FhirContext.forR4()); + protected final JsonParser jsonParser = (JsonParser) FhirContext.forR4().newJsonParser(); + + protected TestOpenFhirMappingContext repo; + protected OpenEhrToFhir openEhrToFhir; + protected FhirToOpenEhr fhirToOpenEhr; + + protected FhirConnectContext context; + protected OPERATIONALTEMPLATE operationaltemplate; + protected String operationaltemplateSerialized; + protected WebTemplate webTemplate; + + protected StandardsAsserter standardsAsserter = new StandardsAsserter(); + protected final Gson gson = new Gson(); + protected final FlatJsonUnmarshaller flatUnmarshaller = new FlatJsonUnmarshaller(); + protected final FlatJsonMarshaller flatMarshaller = new FlatJsonMarshaller(); + + /** subclasses set context/template/webTemplate/etc here */ + protected abstract void prepareState(); + + @Before + public void initBase() { + TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); + + repo = new TestOpenFhirMappingContext(fhirPath, openFhirStringUtils, fhirConnectModelMerger); + + fhirPath.setEvaluationContext(new IFhirPathEvaluationContext() { + @Override + public IBase resolveReference(@Nonnull IIdType theReference, @Nullable IBase theContext) { + return ((Reference) theContext).getResource(); + } + }); + + final FhirInstanceCreatorUtility fhirInstanceCreatorUtility = + new FhirInstanceCreatorUtility(openFhirStringUtils); + + openEhrToFhir = + new OpenEhrToFhir( + flatMarshaller, + repo, + new OpenEhrCachedUtils(null), + gson, + openFhirStringUtils, + new OpenEhrRmWorker(openFhirStringUtils, openFhirMapperUtils), + new OpenFhirMapperUtils(), + new FhirInstancePopulator(), + new FhirInstanceCreator(openFhirStringUtils, fhirInstanceCreatorUtility), + fhirInstanceCreatorUtility, + fhirPath, + new IntermediateCacheProcessing(openFhirStringUtils), + new OpenEhrConditionEvaluator(openFhirStringUtils)); + + fhirToOpenEhr = + new FhirToOpenEhr( + fhirPath, + new OpenFhirStringUtils(), + flatUnmarshaller, + gson, + new OpenEhrRmWorker(openFhirStringUtils, openFhirMapperUtils), + openFhirStringUtils, + repo, + new OpenEhrCachedUtils(null), + new OpenFhirMapperUtils(), + new OpenEhrPopulator(new OpenFhirMapperUtils())); + + prepareState(); + } + + protected boolean testAgainstEhrBase() { + return TEST_AGAINST_EHRBASE; + } + + protected void storeToEhrBaseOrFail(Composition composition) { + if (!testAgainstEhrBase()) return; + + ResponseEntity result = + new EhrBaseTestClient(EHRBASE_HOST, EHRBASE_BASIC_USERNAME, EHRBASE_BASIC_PASSWORD) + .createComposition(composition, operationaltemplateSerialized); + + int code = result.getStatusCode().value(); + if (code != 204) { + String body = result.getBody(); + if (body != null) Arrays.stream(body.split(", /")).forEach(log::error); + } else { + log.info("Successfully stored to EHRBase."); + } + org.junit.Assert.assertEquals(204, code); + } + + protected String getFile(String path) { + InputStream is = getClass().getResourceAsStream(path); + try { + return IOUtils.toString(is); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + protected org.hl7.fhir.r4.model.Bundle getTestBundle(String path) { + InputStream is = getClass().getResourceAsStream(path); + return (org.hl7.fhir.r4.model.Bundle) jsonParser.parseResource(is); + } + + protected FhirConnectContext getContext(String path) { + ObjectMapper yaml = OpenFhirTestUtility.getYaml(); + InputStream is = getClass().getResourceAsStream(path); + try { + return yaml.readValue(is, FhirConnectContext.class); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + protected OPERATIONALTEMPLATE getOperationalTemplate() { + try { + return TemplateDocument.Factory.parse(operationaltemplateSerialized).getTemplate(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + protected void compareJsonObjects(JsonObject actual, JsonObject expected) { + for (Map.Entry e : expected.entrySet()) { + String key = e.getKey(); + String expectedValue = e.getValue().getAsString(); + String actualValue = actual.getAsJsonPrimitive(key).getAsString(); + if (!expectedValue.equals(actualValue)) { + System.out.println(key); + } + org.junit.Assert.assertEquals(expectedValue, actualValue); + } + } +} diff --git a/src/test/java/com/medblocks/openfhir/kds/LaborauftragTest.java b/src/test/java/com/medblocks/openfhir/kds/LaborauftragTest.java deleted file mode 100644 index ec1a6c93..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/LaborauftragTest.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.medblocks.openfhir.kds; - -import static org.junit.Assert.assertEquals; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.io.IOException; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.Organization; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.Resource; -import org.hl7.fhir.r4.model.ServiceRequest; -import org.hl7.fhir.r4.model.Specimen; -import org.junit.Assert; -import org.junit.Test; - -public class LaborauftragTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/laborauftrag/KDS_laborauftrag.context.yaml"; - final String HELPER_LOCATION = "/kds/laborauftrag/"; - final String OPT = "KDS_Laborauftrag.opt"; - final String FLAT = "KDS_Laborauftrag.flat.json"; - - final String BUNDLE = "KDS_Laborauftrag_bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - @Test - public void kdsServiceRequest_toFhir_toOpenEhr() throws IOException { - - // openEHR to FHIR - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFlat(HELPER_LOCATION + FLAT), - webTemplate); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - - final List requests = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof ServiceRequest) - .map(en -> (ServiceRequest) en.getResource()) - .collect(Collectors.toList()); - - Assert.assertEquals(1, requests.size()); - final ServiceRequest serviceRequest = requests.get(0); - - assertServiceRequest(serviceRequest); - - - final Bundle toRunMappingOn = new Bundle(); - for (Bundle.BundleEntryComponent bundleEntryComponent : bundle.getEntry()) { - final Resource resource = bundleEntryComponent.getResource(); - if (resource instanceof ServiceRequest) { - final Reference requesterReference = ((ServiceRequest) resource).getRequester(); - final IBaseResource requester = requesterReference.getResource(); - if (requester != null) { - final String reqId = UUID.randomUUID().toString(); - requesterReference.setReference(reqId); - requester.setId(reqId); - toRunMappingOn.addEntry( - new Bundle.BundleEntryComponent().setFullUrl(reqId).setResource((Resource) requester)); - } - } - toRunMappingOn.addEntry(bundleEntryComponent); - } - - final JsonObject jsonObject2 = fhirToOpenEhr.fhirToFlatJsonObject(context, toRunMappingOn, operationaltemplate); - - - final JsonObject expected = new Gson().fromJson(IOUtils.toString( - getClass().getResourceAsStream(HELPER_LOCATION + "Laborauftrag_expected-jsonobject-from-flat.json")), - JsonObject.class); - - - // todo: enable comaprison once https://github.com/medblocks/openFHIR/pull/79/files#r1956650118 is solved -// compareJsonObjects(jsonObject2, expected); -// compareJsonObjects(expected, jsonObject2); - - // do this just to assert all flat paths are legit - new FlatJsonUnmarshaller().unmarshal(new Gson().toJson(jsonObject2), webTemplate); - - } - - @SneakyThrows - public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - - Assert.assertEquals("123456-0_KH", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/auftrags-id_des_anfordernden_einsendenden_systems_plac|id").getAsString()); - Assert.assertEquals("completed", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/status_der_anfrage|code").getAsString()); - Assert.assertEquals("2345-7", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/name_der_laborleistung|code").getAsString()); - Assert.assertEquals("http://loinc.org", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/name_der_laborleistung|terminology").getAsString()); - Assert.assertEquals("Blood Glucose Test", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/name_der_laborleistung|value").getAsString()); -// Assert.assertEquals("order", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/art_der_laborleistung_kategorie|code").getAsString()); -// Assert.assertEquals("http://terminology.hl7.org/ValueSet/observation-category", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/art_der_laborleistung_kategorie|terminology").getAsString()); -// Assert.assertEquals("Laboratory", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/art_der_laborleistung_kategorie|value").getAsString()); - Assert.assertEquals("order", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/intention|code").getAsString()); - Assert.assertEquals("Sample collected in the morning.", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/kommentar").getAsString()); - Assert.assertEquals("Example Hospital", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/einsender/namenszeile").getAsString()); - Assert.assertEquals("ORG-001", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/einsender/identifier|id").getAsString()); - - Assert.assertEquals("SP-987654", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/probe:0/laborprobenidentifikator|id").getAsString()); - Assert.assertEquals("2024-08-24T11:00:00", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/probe:0/zeitpunkt_der_probenentnahme/date_time_value").getAsString()); - Assert.assertEquals("example-practitioner", jsonObject.getAsJsonPrimitive("leistungsanforderung/laborleistung/aktuelle_aktivität/probe:0/identifikator_des_probenehmers|id").getAsString()); - - - return jsonObject; - } - - @Test - public void toFhir() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFlat(HELPER_LOCATION + FLAT), - new OPTParser( - operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allServiceRequests = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof ServiceRequest).collect(Collectors.toList()); - assertEquals(1, allServiceRequests.size()); - - final ServiceRequest serviceRequest = (ServiceRequest) allServiceRequests.get(0).getResource(); - - assertServiceRequest(serviceRequest); - } - - private void assertServiceRequest(final ServiceRequest serviceRequest) { - - // - name: "identifier" - Assert.assertEquals("Medical record identifier", serviceRequest.getIdentifierFirstRep().getValue()); - - // - name: "status" - Assert.assertEquals("completed", serviceRequest.getStatusElement().getValueAsString()); - - // - name: "code" - Assert.assertEquals("2345-7", serviceRequest.getCode().getCodingFirstRep().getCode()); - Assert.assertEquals("Blood Glucose Test", serviceRequest.getCode().getText()); - - // - name: "category" - Assert.assertEquals("laboratory", serviceRequest.getCategoryFirstRep().getCodingFirstRep().getCode()); - - // - name: "intent" - Assert.assertEquals("order", serviceRequest.getIntentElement().getValueAsString()); - - // - name: "note" - Assert.assertEquals("Sample collected in the morning.", serviceRequest.getNoteFirstRep().getText()); - - // - name: "organisation" - // - name: "org name" - // - name: "org id" - final Organization org = (Organization) serviceRequest.getRequester().getResource(); - Assert.assertEquals("Einsender name", org.getName()); - Assert.assertEquals("Example Hospital", org.getIdentifierFirstRep().getValue()); - - // - name: "specimen" - final List specimenReferences = serviceRequest.getSpecimen(); - Assert.assertEquals(2, specimenReferences.size()); - final List specimens = specimenReferences.stream().map(spec -> (Specimen) spec.getResource()) - .toList(); - - // - name: "specimen identifier" - // - name: "specimen collection date time" - // - name: "specimen collector" - final Specimen specimen1 = specimens.get(0); - Assert.assertEquals("spec1", specimen1.getAccessionIdentifier().getValue()); -// Assert.assertEquals("2022-02-03T04:05:06+01:00", -// specimen1.getCollection().getCollectedPeriod().getStartElement().getValueAsString()); - Assert.assertEquals("probenehmers_id1", specimen1.getCollection().getCollector().getIdentifier().getValue()); - - final Specimen specimen2 = specimens.get(1); - Assert.assertEquals("spec2", specimen2.getAccessionIdentifier().getValue()); -// Assert.assertEquals("3022-02-03T04:05:06+01:00", -// specimen2.getCollection().getCollectedDateTimeType().getValueAsString()); - Assert.assertEquals("probenehmers_id2", specimen2.getCollection().getCollector().getIdentifier().getValue()); - - } - -} diff --git a/src/test/java/com/medblocks/openfhir/kds/LaborberichtTest.java b/src/test/java/com/medblocks/openfhir/kds/LaborberichtTest.java deleted file mode 100644 index e44e0fed..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/LaborberichtTest.java +++ /dev/null @@ -1,451 +0,0 @@ -package com.medblocks.openfhir.kds; - -import static org.junit.Assert.assertEquals; - -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.util.List; -import java.util.stream.Collectors; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.DiagnosticReport; -import org.hl7.fhir.r4.model.Observation; -import org.hl7.fhir.r4.model.Specimen; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -public class LaborberichtTest extends KdsBidirectionalTest { - - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/laborbericht/KDS_laborbericht.context.yaml"; - final String HELPER_LOCATION = "/kds/laborbericht/"; - final String OPT = "KDS_Laborbericht.opt"; - final String FLAT = "KDS_Laborbericht.flat.json"; - - final String BUNDLE = "KDS_Laborbericht_bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - -// Assert.assertEquals("Example Lab Organization", -// jsonObject.getAsJsonPrimitive("laborbericht/context/_health_care_facility|name") -// .getAsString()); -// Assert.assertEquals("Example Lab Organization", -// jsonObject.getAsJsonPrimitive("laborbericht/composer|name").getAsString()); - Assert.assertEquals("26436-6", - jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/labortest-kategorie|code") - .getAsString()); - Assert.assertEquals("LOINC", - jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/labortest-kategorie|terminology") - .getAsString()); - Assert.assertEquals("registered", jsonObject.getAsJsonPrimitive("laborbericht/context/status|code").getAsString()); - Assert.assertEquals("Normal blood count", - jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/conclusion").getAsString()); - Assert.assertEquals("2022-02-03T05:05:06", - jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/time").getAsString()); - Assert.assertEquals("SP-987654", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/probenmaterial:0/external_identifier/identifier_value|id").getAsString()); - Assert.assertEquals("2024-08-24T11:00:00", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/probenmaterial:0/collection_date_time/date_time_value") - .getAsString()); - Assert.assertEquals("1234567", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_collector_identifier|id").getAsString()); -// Assert.assertEquals("Aspiration", jsonObject.getAsJsonPrimitive( -// "laborbericht/laborbefund/any_event:0/probenmaterial:0/probenentnahmemethode").getAsString()); -// Assert.assertEquals("Right arm", -// jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/körperstelle") -// .getAsString()); - Assert.assertEquals("122555007", - jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_type|code") - .getAsString()); - Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_type|terminology").getAsString()); - Assert.assertEquals("Venous blood specimen", - jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/specimen_type|value") - .getAsString()); - Assert.assertEquals("Sample collected in the morning.", - jsonObject.getAsJsonPrimitive("laborbericht/laborbefund/any_event:0/probenmaterial:0/comment") - .getAsString()); - Assert.assertEquals("2022-02-03T05:05:06", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/probenmaterial:0/date_time_received").getAsString()); - Assert.assertEquals("at0062", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/probenmaterial:0/adequacy_for_testing|code").getAsString()); -// Assert.assertEquals("at0018", jsonObject.getAsJsonPrimitive( -// "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/ergebnis-status|code").getAsString()); - Assert.assertEquals("2022-02-03T05:05:06", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/result_status_time").getAsString()); - Assert.assertEquals("7.4", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/messwert:0/quantity_value|magnitude").getAsString()); - Assert.assertEquals("g/dL", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/messwert:0/quantity_value|unit").getAsString()); - Assert.assertEquals("718-7", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/analyte_name|code").getAsString()); - Assert.assertEquals("http://loinc.org", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/analyte_name|terminology").getAsString()); - Assert.assertEquals("Hemoglobin [Mass/volume] in Blood", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/analyte_name|value").getAsString()); - Assert.assertEquals("H", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/interpretation|code").getAsString()); - Assert.assertEquals("http://hl7.org/fhir/ValueSet/observation-interpretation", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/interpretation|terminology").getAsString()); - Assert.assertEquals("Interpretation description", jsonObject.getAsJsonPrimitive( - "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/interpretation|value").getAsString()); -// Assert.assertEquals("Blood test using standard laboratory methods", jsonObject.getAsJsonPrimitive( -// "laborbericht/laborbefund/any_event:0/pro_laboranalyt:0/testmethode|other").getAsString()); - Assert.assertEquals("FILL-12345", - jsonObject.getAsJsonPrimitive("laborbericht/context/id").getAsString()); - - return jsonObject; - } - - @Test - public void toFhir() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFlat(HELPER_LOCATION + FLAT), - new OPTParser( - operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allDiagnosticReports = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof DiagnosticReport).collect(Collectors.toList()); - assertEquals(1, allDiagnosticReports.size()); - - final DiagnosticReport diagnosticReport = (DiagnosticReport) allDiagnosticReports.get(0).getResource(); - - //- name: "healthCareFacility" -// - name: "composer" -// Assert.assertEquals(2, diagnosticReport.getPerformer().size()); // commented out with the comment out of mapping of this field -// Assert.assertEquals("DOE, John", diagnosticReport.getPerformer().get(0).getDisplay()); -// Assert.assertEquals("Max Mustermann", diagnosticReport.getPerformer().get(1).getDisplay()); - - // - name: "Effective" -// assertEquals("2020-02-03T04:05:06+01:00", // commented out with the comment out of mapping of this field -// diagnosticReport.getEffectivePeriod().getStartElement().getValueAsString()); -// assertEquals("2022-02-03T04:05:06+01:00", -// diagnosticReport.getEffectivePeriod().getEndElement().getValueAsString()); - - // - name: "Category" - assertEquals(1, diagnosticReport.getCategory().size()); - assertEquals("LOINC", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getSystem()); - assertEquals("26436-6", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getCode()); - assertEquals("laboratory", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getDisplay()); - - // - name: "Status" - assertEquals("at0107", diagnosticReport.getStatusElement().getValueAsString()); - - // - name: "Conclusion" - assertEquals("Normal blood count", diagnosticReport.getConclusion()); - - // - name: "issued" - assertEquals("2022-02-03T04:05:06.000+01:00", diagnosticReport.getIssuedElement().getValueAsString()); - - // - name: "berichtId" - assertEquals(1, diagnosticReport.getIdentifierFirstRep().getType().getCoding().size()); - assertEquals("FILL", diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getCode()); - assertEquals("http://terminology.hl7.org/CodeSystem/v2-0203", - diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getSystem()); - assertEquals("bericht_id", diagnosticReport.getIdentifierFirstRep().getValue()); - - // Assert Specimen - name: "specimen" - Specimen specimen = (Specimen) diagnosticReport.getSpecimenFirstRep().getResource(); - - // - name: "identifier" - assertEquals("SP-987654", specimen.getIdentifierFirstRep().getValue()); - - // - name: "collected" -// assertEquals("2022-02-03T04:05:06+01:00", -// specimen.getCollection().getCollectedDateTimeType().getValueAsString()); - - // - name: "collector" - assertEquals("collectorId", specimen.getCollection().getCollector().getIdentifier().getValue()); - - // - name: "specimen type" - assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); - assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", - specimen.getType().getText()); - - // - name: "specimenCollectionMethod" -// assertEquals("Aspiration - action", specimen.getCollection().getMethod().getCodingFirstRep().getCode()); - - // specimenCollectionBodySite -// assertEquals("Arm", specimen.getCollection().getBodySite().getCodingFirstRep().getCode()); - - // - name: "samplingContext" -// assertEquals("Lorem ipsum", specimen.getCollection().getFastingStatusCodeableConcept().getCodingFirstRep().getCode()); - - // - name: "type" - Assert.assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", - specimen.getType().getText()); - Assert.assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); - - // - name: "note" - assertEquals("Sample collected in the morning.", specimen.getNoteFirstRep().getText()); - - // - name: "descriptionOfSpecimen" - Assert.assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0493' available", - specimen.getConditionFirstRep().getText()); - Assert.assertEquals("conditionCode", specimen.getConditionFirstRep().getCodingFirstRep().getCode()); - - // - name: "identifierOfSpecimen" - assertEquals("identifierOfSpecimen", specimen.getAccessionIdentifier().getValue()); - - // - name: "dateReceived" - assertEquals("2022-02-03T04:05:06+01:00", specimen.getReceivedTimeElement().getValueAsString()); - - // specimen - name: "status" - assertEquals("available", specimen.getStatusElement().getValueAsString()); - - // basedOn, identifierInReference - assertEquals("identifikation_der_laboranforderung", - diagnosticReport.getBasedOnFirstRep().getIdentifier().getValue()); - - - // Assert Observation - name: "result" - Observation observation = (Observation) diagnosticReport.getResultFirstRep().getResource(); - - // - name: "status" -// Assert.assertEquals("registered", observation.getStatusElement().getValueAsString()); - - // - name: "issued" - Assert.assertEquals("2022-02-03T04:05:06.000+01:00", observation.getIssuedElement().getValueAsString()); - - // - name: "analyteMeasurement" - assertEquals(7.4, observation.getValueQuantity().getValue().doubleValue(), 0); - assertEquals("mm", observation.getValueQuantity().getUnit()); - - // laboryte name - assertEquals("718-7", observation.getCode().getCodingFirstRep().getCode()); - assertEquals( - "//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/uv/ips/ValueSet/results-laboratory-observations-uv-ips", - observation.getCode().getCodingFirstRep().getSystem()); - assertEquals("Hemoglobin [Mass/volume] in Blood", observation.getCode().getText()); - - // - name: "interpretation" - assertEquals("142", observation.getInterpretationFirstRep().getCodingFirstRep().getCode()); - assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/observation-interpretation' available", - observation.getInterpretationFirstRep().getText()); - - // - name: "testmethod" -// assertEquals("testmethode", observation.getMethod().getText()); - } - - @Test - public void toFhir_multiples() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( - getFlat(HELPER_LOCATION + "KDS_Laborbericht_multiples.flat.json"), - new OPTParser(operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allDiagnosticReports = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof DiagnosticReport).collect(Collectors.toList()); - assertEquals(1, allDiagnosticReports.size()); - - final DiagnosticReport diagnosticReport = (DiagnosticReport) allDiagnosticReports.get(0).getResource(); - - Assert.assertEquals(2, diagnosticReport.getSpecimen().size()); - Assert.assertEquals(2, diagnosticReport.getResult().size()); - - - //- name: "healthCareFacility" -// - name: "composer" -// Assert.assertEquals(2, diagnosticReport.getPerformer().size()); // commented out with the comment out of mapping of this field -// Assert.assertEquals("DOE, John", diagnosticReport.getPerformer().get(0).getDisplay()); -// Assert.assertEquals("Max Mustermann", diagnosticReport.getPerformer().get(1).getDisplay()); - - // - name: "Effective" -// assertEquals("2020-02-03T04:05:06+01:00", // commented out with the comment out of mapping of this field -// diagnosticReport.getEffectivePeriod().getStartElement().getValueAsString()); -// assertEquals("2022-02-03T04:05:06+01:00", -// diagnosticReport.getEffectivePeriod().getEndElement().getValueAsString()); - - // - name: "Category" - assertEquals(1, diagnosticReport.getCategory().size()); - assertEquals("LOINC", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getSystem()); - assertEquals("26436-6", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getCode()); - assertEquals("laboratory", diagnosticReport.getCategoryFirstRep().getCodingFirstRep().getDisplay()); - - // - name: "Status" - assertEquals("at0107", diagnosticReport.getStatusElement().getValueAsString()); - - // - name: "Conclusion" - assertEquals("Normal blood count", diagnosticReport.getConclusion()); - - // - name: "issued" - assertEquals("2022-02-03T04:05:06.000+01:00", diagnosticReport.getIssuedElement().getValueAsString()); - - // - name: "berichtId" - assertEquals(1, diagnosticReport.getIdentifierFirstRep().getType().getCoding().size()); - assertEquals("FILL", diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getCode()); - assertEquals("http://terminology.hl7.org/CodeSystem/v2-0203", - diagnosticReport.getIdentifierFirstRep().getType().getCodingFirstRep().getSystem()); - assertEquals("bericht_id", diagnosticReport.getIdentifierFirstRep().getValue()); - - // Assert Specimen - name: "specimen" - Specimen specimen = (Specimen) diagnosticReport.getSpecimenFirstRep().getResource(); - - // - name: "identifier" - assertEquals("SP-987654", specimen.getIdentifierFirstRep().getValue()); - - // - name: "collected" -// assertEquals("2022-02-03T04:05:06+01:00", -// specimen.getCollection().getCollectedPeriod().getStartElement().getValueAsString()); - - // - name: "collector" - assertEquals("collectorId", specimen.getCollection().getCollector().getIdentifier().getValue()); - - // - name: "specimen type" - assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); - assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", - specimen.getType().getText()); - - // - name: "specimenCollectionMethod" -// assertEquals("Aspiration - action", specimen.getCollection().getMethod().getCodingFirstRep().getCode()); - - // specimenCollectionBodySite -// assertEquals("Arm", specimen.getCollection().getBodySite().getCodingFirstRep().getCode()); - - // - name: "samplingContext" -// assertEquals("Lorem ipsum", specimen.getCollection().getFastingStatusCodeableConcept().getCodingFirstRep().getCode()); - - // - name: "type" - Assert.assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0487' available", - specimen.getType().getText()); - Assert.assertEquals("probenartcode", specimen.getType().getCodingFirstRep().getCode()); - - // - name: "note" - assertEquals("Sample collected in the morning.", specimen.getNoteFirstRep().getText()); - - // - name: "descriptionOfSpecimen" - Assert.assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://terminology.hl7.org/ValueSet/v2-0493' available", - specimen.getConditionFirstRep().getText()); - Assert.assertEquals("conditionCode", specimen.getConditionFirstRep().getCodingFirstRep().getCode()); - - // - name: "identifierOfSpecimen" - assertEquals("identifierOfSpecimen", specimen.getAccessionIdentifier().getValue()); - - // - name: "dateReceived" - assertEquals("2022-02-03T04:05:06+01:00", specimen.getReceivedTimeElement().getValueAsString()); - - // specimen - name: "status" - assertEquals("available", specimen.getStatusElement().getValueAsString()); - - Specimen specimen1 = (Specimen) diagnosticReport.getSpecimen().get(1).getResource(); - - // - name: "identifier" - assertEquals("1_SP-987654", specimen1.getIdentifierFirstRep().getValue()); - - // - name: "collected" -// assertEquals("3022-02-03T04:05:06+01:00", -// specimen1.getCollection().getCollectedDateTimeType().getValueAsString()); - - // - name: "collector" - assertEquals("1_collectorId", specimen1.getCollection().getCollector().getIdentifier().getValue()); - - // - name: "specimen type" - assertEquals("1_probenartcode", specimen1.getType().getCodingFirstRep().getCode()); - - // - name: "specimenCollectionMethod" -// assertEquals("1_Aspiration - action", specimen1.getCollection().getMethod().getCodingFirstRep().getCode()); - - // specimenCollectionBodySite -// assertEquals("1_Arm", specimen1.getCollection().getBodySite().getCodingFirstRep().getCode()); - - // - name: "samplingContext" -// assertEquals("1_Lorem ipsum", specimen1.getCollection().getFastingStatusCodeableConcept().getCodingFirstRep().getCode()); - - // - name: "type" - Assert.assertEquals("1_probenartcode", specimen1.getType().getCodingFirstRep().getCode()); - - // - name: "note" - assertEquals("1_Sample collected in the morning.", specimen1.getNoteFirstRep().getText()); - - // - name: "descriptionOfSpecimen" - Assert.assertEquals("1_conditionCode", specimen1.getConditionFirstRep().getCodingFirstRep().getCode()); - - // - name: "identifierOfSpecimen" - assertEquals("1_identifierOfSpecimen", specimen1.getAccessionIdentifier().getValue()); - - // - name: "dateReceived" - assertEquals("3022-02-03T04:05:06+01:00", specimen1.getReceivedTimeElement().getValueAsString()); - - // specimen - name: "status" - assertEquals("unsatisfactory", specimen1.getStatusElement().getValueAsString()); - - - // basedOn, identifierInReference - assertEquals("identifikation_der_laboranforderung", - diagnosticReport.getBasedOnFirstRep().getIdentifier().getValue()); - - - // Assert Observation - name: "result" - Observation observation = (Observation) diagnosticReport.getResultFirstRep().getResource(); - - // - name: "status" -// Assert.assertEquals("registered", observation.getStatusElement().getValueAsString()); todo: where in flat? why not in flat? :o ergebniss-status is gone - - // - name: "issued" - Assert.assertEquals("2022-02-03T04:05:06.000+01:00", observation.getIssuedElement().getValueAsString()); - - // - name: "analyteMeasurement" - assertEquals(7.4, observation.getValueQuantity().getValue().doubleValue(), 0); - assertEquals("mm", observation.getValueQuantity().getUnit()); - - // laboryte name - assertEquals("718-7", observation.getCode().getCodingFirstRep().getCode()); - assertEquals( - "//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/uv/ips/ValueSet/results-laboratory-observations-uv-ips", - observation.getCode().getCodingFirstRep().getSystem()); - assertEquals("Hemoglobin [Mass/volume] in Blood", observation.getCode().getText()); - - // - name: "interpretation" - assertEquals("142", observation.getInterpretationFirstRep().getCodingFirstRep().getCode()); - assertEquals( - "No example for termínology '//fhir.hl7.org/ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/observation-interpretation' available", - observation.getInterpretationFirstRep().getText()); - - // - name: "testmethod" -// assertEquals("testmethode", observation.getMethod().getText()); - - Observation observation1 = (Observation) diagnosticReport.getResult().get(1).getResource(); - - // - name: "status" -// Assert.assertEquals("partial", observation1.getStatusElement().getValueAsString()); todo: where in flat? why not in flat? :o ergebniss-status is gone - - // - name: "issued" - Assert.assertEquals("3022-02-03T04:05:06.000+01:00", observation1.getIssuedElement().getValueAsString()); - - // - name: "analyteMeasurement" - assertEquals(8.4, observation1.getValueQuantity().getValue().doubleValue(), 0); - assertEquals("1_mm", observation1.getValueQuantity().getUnit()); - - // laboryte name - assertEquals("1_718-7", observation1.getCode().getCodingFirstRep().getCode()); - assertEquals("1_Hemoglobin [Mass/volume] in Blood", observation1.getCode().getText()); - - // - name: "interpretation" - assertEquals("1_142", observation1.getInterpretationFirstRep().getCodingFirstRep().getCode()); - - // - name: "testmethod" -// assertEquals("1_testmethode", observation1.getMethod().getText()); - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/MedikamentenverabreichungenTest.java b/src/test/java/com/medblocks/openfhir/kds/MedikamentenverabreichungenTest.java deleted file mode 100644 index 448e323a..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/MedikamentenverabreichungenTest.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.medblocks.openfhir.kds; - -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Medication; -import org.hl7.fhir.r4.model.MedicationAdministration; -import org.hl7.fhir.r4.model.MedicationRequest; -import org.hl7.fhir.r4.model.Period; -import org.junit.Assert; -import org.junit.Test; - -import java.util.List; -import java.util.stream.Collectors; - -public class MedikamentenverabreichungenTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/medikationsverabreichung/KDS_medikationsverabreichung.context.yaml"; - final String HELPER_LOCATION = "/kds/medikationsverabreichung/"; - final String OPT = "KDS_Medikamentenverabreichungen.opt"; - final String FLAT = "KDS_Medikamentenverabreichungen.flat.json"; - - final String BUNDLE = "KDS_Medikamentenverabreichungen_Bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - @Test - public void toFhir() { - // openEHR to FHIR - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFlat(HELPER_LOCATION + FLAT), webTemplate); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - - final List administrations = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof MedicationAdministration) - .map(en -> (MedicationAdministration) en.getResource()) - .collect(Collectors.toList()); - - Assert.assertEquals(1, administrations.size()); - - final MedicationAdministration medicationAdministration = administrations.get(0); - final CodeableConcept medicationResource = (CodeableConcept) medicationAdministration.getMedicationCodeableConcept(); - - Assert.assertEquals("arzneimittel-name", medicationResource.getCodingFirstRep().getDisplay()); - -// Assert.assertEquals("in-progress", medicationAdministration.getStatusElement().getValueAsString()); -// Assert.assertEquals("context reference encounter 123", medicationAdministration.getContext().getReference()); - - final Period effectivePeriod = medicationAdministration.getEffectivePeriod(); - Assert.assertEquals("2022-02-03T04:05:06+01:00", effectivePeriod.getStartElement().getValueAsString()); - Assert.assertEquals("2022-02-03T04:05:06+01:00", effectivePeriod.getEndElement().getValueAsString()); - - Assert.assertEquals("Admin note comment", medicationAdministration.getNoteFirstRep().getText()); - - final MedicationAdministration.MedicationAdministrationDosageComponent dosage = medicationAdministration.getDosage(); - Assert.assertEquals("20 mg orally once daily", dosage.getText()); -// Assert.assertEquals("1", dosage.getDose().getUnit()); - Assert.assertEquals("22.0", dosage.getDose().getValue().toPlainString()); - - Assert.assertEquals("route42", dosage.getRoute().getCodingFirstRep().getCode()); - - Assert.assertEquals("SiteDisplay", dosage.getSite().getText()); - Assert.assertEquals("siteCode", dosage.getSite().getCodingFirstRep().getCode()); - Assert.assertEquals("//snomed.info/sct", dosage.getSite().getCodingFirstRep().getSystem()); - - Assert.assertEquals("21.0", dosage.getRateQuantity().getValue().toPlainString()); - Assert.assertEquals("l/h", dosage.getRateQuantity().getUnit()); - - Assert.assertEquals("Reason code", medicationAdministration.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()); - Assert.assertEquals("dev/null", ((MedicationRequest) medicationAdministration.getRequest().getResource()).getIdentifierFirstRep().getValue()); - } - - - - public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - // status -// Assert.assertEquals("completed", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/status|code").getAsString()); - - // berichtId - Assert.assertEquals("MA123456", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/bericht_id").getAsString()); - - // reason code - Assert.assertEquals("Hypertensive disorder, systemic arterial", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/klinische_indikation").getAsString()); - - // route - Assert.assertEquals("26643006", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/details_zur_verabreichung/verabreichungsweg|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/details_zur_verabreichung/verabreichungsweg|terminology").getAsString()); - Assert.assertEquals("Oral", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/details_zur_verabreichung/verabreichungsweg|value").getAsString()); - - // - name: "category" - Assert.assertEquals("232", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/setting|code").getAsString()); - Assert.assertEquals("openehr", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/setting|terminology").getAsString()); - Assert.assertEquals("secondary medical care", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/context/setting|value").getAsString()); - - // - name: "note" - Assert.assertEquals("textab", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/kommentar").getAsString()); - - // dosage text - Assert.assertEquals("20 mg orally once daily", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/dosierung/dosierung_freitext").getAsString()); - - // dose value - Assert.assertEquals(250.0, jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/dosierung/dosis|magnitude").getAsDouble(), 0); - Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/dosierung/dosis|unit").getAsString()); - - // name -// Assert.assertEquals("Paracetamol 500mg tablet", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/arzneimittel/arzneimittel-name").getAsString()); - - // form - Assert.assertEquals("UTA", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/arzneimittel/darreichungsform|code").getAsString()); - Assert.assertEquals("https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_BMP_DARREICHUNGSFORM", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/arzneimittel/darreichungsform|terminology").getAsString()); - - //- name: "klinischeIndikation" - Assert.assertEquals("Hypertensive disorder, systemic arterial", jsonObject.getAsJsonPrimitive("kds_medikamentenverabreichungen/arzneimittelanwendung:0/klinische_indikation").getAsString()); - - return jsonObject; - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/MedikationseintragTest.java b/src/test/java/com/medblocks/openfhir/kds/MedikationseintragTest.java deleted file mode 100644 index 9f4d6e02..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/MedikationseintragTest.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.medblocks.openfhir.kds; - -import ca.uhn.fhir.context.FhirContext; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.nio.charset.StandardCharsets; -import lombok.SneakyThrows; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.xmlbeans.XmlException; -import org.bson.types.Code; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.*; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.io.IOException; -import java.util.TimeZone; -import java.text.SimpleDateFormat; -import java.util.List; -import java.util.stream.Collectors; -import org.openehr.schemas.v1.TemplateDocument; - -public class MedikationseintragTest extends KdsBidirectionalTest { - - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/medikationseintrag/KDS_medikationseintrag.context.yaml"; - final String HELPER_LOCATION = "/kds/medikationseintrag/"; - final String OPT = "KDS_Medikationseintrag.opt"; - final String FLAT = "KDS_Medikationseintrag.flat.json"; - - final String BUNDLE = "KDS_Medikationseintrag_v1-Fhir-Bundle-input.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - @Test - public void kdsMedicationList_toFhir() throws IOException { - // openEHR to FHIR - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFlat(HELPER_LOCATION + FLAT), webTemplate); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - - final List requests = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof MedicationStatement) - .map(en -> (MedicationStatement) en.getResource()) - .collect(Collectors.toList()); - - Assert.assertEquals(2, requests.size()); - - final MedicationStatement req1 = requests.get(0); - final MedicationStatement req2 = requests.get(1); - - Assert.assertEquals("2022-02-03T04:05:06+01:00", req2.getDateAssertedElement().getValueAsString()); - - - Assert.assertEquals("behandlungsgrund1", req1.getReasonCodeFirstRep().getText()); - Assert.assertEquals("behandlungsgrund", req2.getReasonCodeFirstRep().getText()); - - Assert.assertEquals("hinweis1", req1.getNoteFirstRep().getText()); - Assert.assertEquals("hinweis", req2.getNoteFirstRep().getText()); - - final List req2Dosages = req2.getDosage(); - - Assert.assertEquals(2, req2Dosages.size()); - Assert.assertEquals("structured dosage text", req2Dosages.get(0).getText()); - Assert.assertEquals("mm", req2Dosages.get(0).getDoseAndRateFirstRep().getDoseQuantity().getUnit()); - Assert.assertEquals("22.0", req2Dosages.get(0).getDoseAndRateFirstRep().getDoseQuantity().getValue().toPlainString()); - Assert.assertEquals(22, req2Dosages.get(0).getSequence()); - - Assert.assertEquals("structured dosage 2 text", req2Dosages.get(1).getText()); - Assert.assertEquals("mm1", req2Dosages.get(1).getDoseAndRateFirstRep().getDoseQuantity().getUnit()); - Assert.assertEquals("23.0", req2Dosages.get(1).getDoseAndRateFirstRep().getDoseQuantity().getValue().toPlainString()); - Assert.assertEquals(23, req2Dosages.get(1).getSequence()); - -// Assert.assertEquals(true, req2.getDosageFirstRep().getAsNeededBooleanType().getValue()); - Assert.assertNull(req1.getDosageFirstRep().getAsNeededBooleanType().getValue()); - - final Medication med1 = (Medication) req1.getMedicationReference().getResource(); - final Medication med2 = (Medication) req2.getMedicationReference().getResource(); -// Assert.assertEquals("req0, medication code text", med2.getCode().getCodingFirstRep().getDisplay()); - Assert.assertEquals("42", med2.getForm().getCodingFirstRep().getCode()); - Assert.assertEquals("52", med1.getForm().getCodingFirstRep().getCode()); -// Assert.assertEquals("req1, medication code text", med1.getCode().getCodingFirstRep().getDisplay()); - Assert.assertEquals("25.0", med1.getAmount().getNumerator().getValue().toPlainString()); - Assert.assertEquals("mm", med1.getAmount().getNumerator().getUnit()); - Assert.assertEquals("20.0", med2.getAmount().getNumerator().getValue().toPlainString()); - Assert.assertEquals("mm", med2.getAmount().getNumerator().getUnit()); - - Assert.assertEquals(3, med2.getIngredient().size()); - Assert.assertEquals(2, med1.getIngredient().size()); - Assert.assertEquals("ingridient item 0, 0", - ((Medication) med2.getIngredient().get(0).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); - Assert.assertEquals("ingridient item 0, 1", ((Medication) med2.getIngredient().get(1).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); - - Assert.assertEquals("ingridient item 1, 0", ((Medication) med1.getIngredient().get(0).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); - Assert.assertEquals("ingridient item 1, 1", ((Medication) med1.getIngredient().get(1).getItemReference().getResource()).getCode().getCodingFirstRep().getCode()); - - - final Medication.MedicationIngredientComponent ingridient00 = med2.getIngredient().get(0); - - final Medication.MedicationIngredientComponent ingridient01 = med2.getIngredient().get(1); - - final Medication.MedicationIngredientComponent ingridient0Empty = med2.getIngredient().get(2); - - final Medication.MedicationIngredientComponent ingridient10 = med1.getIngredient().get(0); - - final Ratio zerothIngridientStrenght = ingridient00.getStrength(); - final Ratio firstIngridientStrenght = ingridient01.getStrength(); - - final Ratio secondIngridientStrenght = ingridient0Empty.getStrength(); - - Assert.assertEquals("10.0", zerothIngridientStrenght.getNumerator().getValue().toPlainString()); - Assert.assertEquals("11.0", zerothIngridientStrenght.getDenominator().getValue().toPlainString()); - Assert.assertEquals("1mm", zerothIngridientStrenght.getNumerator().getUnit()); - Assert.assertEquals("2mm", zerothIngridientStrenght.getDenominator().getUnit()); - - Assert.assertEquals("20.0", firstIngridientStrenght.getNumerator().getValue().toPlainString()); - Assert.assertEquals("21.0", firstIngridientStrenght.getDenominator().getValue().toPlainString()); - Assert.assertEquals("3mm", firstIngridientStrenght.getNumerator().getUnit()); - Assert.assertEquals("4mm", firstIngridientStrenght.getDenominator().getUnit()); - - Assert.assertEquals("30.0", secondIngridientStrenght.getNumerator().getValue().toPlainString()); - Assert.assertEquals("31.0", secondIngridientStrenght.getDenominator().getValue().toPlainString()); - Assert.assertEquals("5mm", secondIngridientStrenght.getNumerator().getUnit()); - Assert.assertEquals("6mm", secondIngridientStrenght.getDenominator().getUnit()); - - final Ratio firstZerothIngridientStrenght = ingridient10.getStrength(); - - final Ratio firstFirstIngridientStrenght = med1.getIngredient().get(1).getStrength(); - - Assert.assertEquals("40.0", firstZerothIngridientStrenght.getDenominator().getValue().toPlainString()); - Assert.assertEquals("mm", firstZerothIngridientStrenght.getDenominator().getUnit()); - - Assert.assertEquals("41.0", firstFirstIngridientStrenght.getDenominator().getValue().toPlainString()); - Assert.assertEquals("mm", firstFirstIngridientStrenght.getDenominator().getUnit()); - -// Assert.assertEquals("at0143", ingridient00.getItemCodeableConcept().getCodingFirstRep().getCode()); -// Assert.assertEquals("Ad-hoc Mixtur", ingridient00.getItemCodeableConcept().getCodingFirstRep().getDisplay()); -// -// Assert.assertEquals("at3143", ingridient0Empty.getItemCodeableConcept().getCodingFirstRep().getCode()); -// Assert.assertEquals("3Ad-hoc Mixtur", ingridient0Empty.getItemCodeableConcept().getCodingFirstRep().getDisplay()); -// -// Assert.assertEquals("at0243", ingridient10.getItemCodeableConcept().getCodingFirstRep().getCode()); -// Assert.assertEquals("2Ad-hoc Mixtur", ingridient10.getItemCodeableConcept().getCodingFirstRep().getDisplay()); - } - - @Test - public void kdsMedicationList_toFhir_testOpenEhrCondition() throws IOException { - // openEHR to FHIR - final String flat = getFlat(HELPER_LOCATION + FLAT); - final Gson gson = new Gson(); - final JsonObject flatJsonObject = gson.fromJson(flat, JsonObject.class); - -// flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|value"); -// flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|code"); -// flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|terminology"); - flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/wirkstärke_konzentration|magnitude"); - flatJsonObject.remove("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/wirkstärke_konzentration|unit"); - - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(gson.toJson(flatJsonObject), webTemplate); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - - final List requests = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof MedicationStatement) - .map(en -> (MedicationStatement) en.getResource()) - .collect(Collectors.toList()); - - Assert.assertEquals(2, requests.size()); - - final MedicationStatement theOneWithMedicationReference = requests.stream() - .filter(req -> req.getReasonCodeFirstRep().getText().equals("behandlungsgrund")) - .findFirst().orElse(null); - - final MedicationStatement theOneWithMedicationCodeableConcept = requests.stream() - .filter(req -> req.getReasonCodeFirstRep().getText().equals("behandlungsgrund1")) - .findFirst().orElse(null); - - final Medication med1 = (Medication) theOneWithMedicationReference.getMedicationReference().getResource(); -// final CodeableConcept med2 = theOneWithMedicationCodeableConcept.getMedicationCodeableConcept(); -// -// Assert.assertEquals("req1, medication code text", med2.getText()); -// -// Assert.assertEquals("req0, medication code text", med1.getCode().getCodingFirstRep().getDisplay()); - Assert.assertEquals("20.0", med1.getAmount().getNumerator().getValue().toPlainString()); - Assert.assertEquals("mm", med1.getAmount().getNumerator().getUnit()); - - } - - - public JsonObject toOpenEhr() { - final Bundle testBundle = FhirContext.forR4().newJsonParser().parseResource(Bundle.class, getClass().getResourceAsStream(HELPER_LOCATION + BUNDLE)); - - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - Assert.assertEquals("Take 1 tablet every 6 hours as needed for pain", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/dosierung:0/dosierung_freitext").getAsString()); - Assert.assertEquals("500.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/dosierung:0/dosis/quantity_value|magnitude").getAsString()); - Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/dosierung:0/dosis/quantity_value|unit").getAsString()); - Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/arzneimittel-name|code").getAsString()); - Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/arzneimittel-name|terminology").getAsString()); - Assert.assertEquals("Paracetamol 500mg tablet", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/arzneimittel-name|value").getAsString()); - Assert.assertEquals("385055001", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/darreichungsform|terminology").getAsString()); - Assert.assertEquals("Paracetamol", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil").getAsString()); - Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/wirkstofftyp|code").getAsString()); - Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/wirkstofftyp|terminology").getAsString()); - Assert.assertEquals("500.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/zähler|magnitude").getAsString()); - Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/zähler|unit").getAsString()); - Assert.assertEquals("1.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/nenner|magnitude").getAsString()); - Assert.assertEquals("tablet", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:0/bestandteil-menge/nenner|unit").getAsString()); - Assert.assertEquals("11Paracetamol", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil").getAsString()); - Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/wirkstofftyp|code").getAsString()); - Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/wirkstofftyp|terminology").getAsString()); - Assert.assertEquals("1500.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/zähler|magnitude").getAsString()); - Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/zähler|unit").getAsString()); - Assert.assertEquals("11.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/nenner|magnitude").getAsString()); - Assert.assertEquals("tablet", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:1/bestandteil-menge/nenner|unit").getAsString()); - Assert.assertEquals("at0143", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:2/wirkstofftyp|code").getAsString()); - Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/arzneimittel/bestandteil:2/wirkstofftyp|terminology").getAsString()); - Assert.assertEquals("Take 1 capsule daily", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/dosierung:0/dosierung_freitext").getAsString()); - Assert.assertEquals("5.0", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/dosierung:0/dosis/quantity_value|magnitude").getAsString()); - Assert.assertEquals("mg", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/dosierung:0/dosis/quantity_value|unit").getAsString()); - Assert.assertEquals("local", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/arzneimittel-name|terminology").getAsString()); - Assert.assertEquals("C09AA05", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/arzneimittel-name|code").getAsString()); - Assert.assertEquals("Ramipril 5mg capsule", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:1/arzneimittel/arzneimittel-name|value").getAsString()); - - Assert.assertEquals("High cholesterol", jsonObject.getAsJsonPrimitive("medikamentenliste/aussage_zur_medikamenteneinnahme:0/behandlungsgrund:0").getAsString()); - - return jsonObject; - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/PersonTest.java b/src/test/java/com/medblocks/openfhir/kds/PersonTest.java deleted file mode 100644 index 653b6fc9..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/PersonTest.java +++ /dev/null @@ -1,340 +0,0 @@ -package com.medblocks.openfhir.kds; - -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.util.List; -import java.util.stream.Collectors; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Address; -import org.hl7.fhir.r4.model.BooleanType; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Condition; -import org.hl7.fhir.r4.model.HumanName; -import org.hl7.fhir.r4.model.Observation; -import org.hl7.fhir.r4.model.Organization; -import org.hl7.fhir.r4.model.Patient; -import org.hl7.fhir.r4.model.StringType; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -@Ignore -public class PersonTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/person/KDS_medikationsverabreichung.context.yaml"; - final String HELPER_LOCATION = "/kds/person/"; - final String OPT = "KDS_Person.opt"; - final String FLAT = "KDS_Person.flat.json"; - - final String BUNDLE = "kds_person_bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - @Test - public void kdsPerson_toFhir() { - // openEHR to FHIR - final String initialFlat = getFlat(HELPER_LOCATION + FLAT); - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(initialFlat, webTemplate); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - - final List patients = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Patient) - .map(en -> (Patient) en.getResource()) - .collect(Collectors.toList()); - - final List conditions = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Condition) - .map(en -> (Condition) en.getResource()) - .collect(Collectors.toList()); - - final List observations = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Observation) - .map(en -> (Observation) en.getResource()) - .collect(Collectors.toList()); - - Assert.assertEquals(1, patients.size()); - final Patient thePatient = patients.get(0); - - final Address strasseAddress = thePatient.getAddress().get(0); - final Address postfachAddress = thePatient.getAddress().get(1); - final List strasseLines = strasseAddress.getLine(); - Assert.assertEquals(1, strasseLines.size()); - Assert.assertEquals(3, strasseLines.get(0).getExtension().size()); - Assert.assertEquals("123 Main St", ((StringType) strasseLines.get(0) - .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-streetName") - .getValue()).getValue()); - Assert.assertEquals("Apt 4B", ((StringType) strasseLines.get(0) - .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-houseNumber") - .getValue()).getValue()); - Assert.assertEquals("Wohnung 3", ((StringType) strasseLines.get(0) - .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-additionalLocator") - .getValue()).getValue()); - Assert.assertEquals("Hamburg", ((StringType) strasseAddress.getCityElement().getExtensionFirstRep() - .getValue()).getValue()); - Assert.assertEquals("Mitte", ((StringType) strasseAddress.getExtensionFirstRep().getValue()).getValue()); - Assert.assertEquals("postal", strasseAddress.getTypeElement().getValueAsString()); - Assert.assertEquals("20095", strasseAddress.getPostalCode()); - Assert.assertEquals("DE", strasseAddress.getCountry()); - - final List postfachLines = postfachAddress.getLine(); - Assert.assertEquals(0, postfachLines.size()); - Assert.assertEquals("Berlin", ((StringType) postfachAddress.getCityElement().getExtensionFirstRep() - .getValue()).getValue()); - Assert.assertEquals("Kreuzberg", ((StringType) postfachAddress.getExtensionFirstRep().getValue()).getValue()); - Assert.assertEquals("postal", postfachAddress.getTypeElement().getValueAsString()); - Assert.assertEquals("10997", postfachAddress.getPostalCode()); - Assert.assertEquals(" DE", postfachAddress.getCountry()); - Assert.assertEquals("Berlin", postfachAddress.getState()); - - Assert.assertEquals("D", ((Coding) thePatient.getExtensionByUrl("extension_url_to_be_defined") - .getValue()).getCode()); - Assert.assertEquals("divers", ((Coding) thePatient.getExtensionByUrl("extension_url_to_be_defined") - .getValue()).getDisplay()); - Assert.assertEquals("http://fhir.de/ValueSet/gender-other-de", - ((Coding) thePatient.getExtensionByUrl("extension_url_to_be_defined") - .getValue()).getSystem()); - Assert.assertEquals("male", thePatient.getGenderElement().getValueAsString()); - final List names = thePatient.getName(); - Assert.assertEquals(2, names.size()); - final List maidenNames = names.stream() - .filter(name -> name.getUseElement().getCode().equals("maiden")).collect(Collectors.toList()); - final List officialNames = names.stream() - .filter(name -> name.getUseElement().getCode().equals("official")).collect(Collectors.toList()); - Assert.assertEquals(1, maidenNames.size()); - Assert.assertEquals(1, officialNames.size()); - final HumanName maidenName = maidenNames.get(0); - final HumanName officialName = officialNames.get(0); - - Assert.assertEquals("Doe", officialName.getText()); - Assert.assertEquals("John", ((StringType) officialName.getFamilyElement() - .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-name") - .getValue()).getValue()); - Assert.assertEquals("Doe", ((StringType) officialName.getFamilyElement() - .getExtensionByUrl("http://fhir.de/StructureDefinition/humanname-namenszusatz").getValue()).getValue()); - Assert.assertEquals("zu", ((StringType) officialName.getFamilyElement() - .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-prefix") - .getValue()).getValue()); - - Assert.assertNull(maidenName.getText()); - Assert.assertEquals("Smith", ((StringType) maidenName.getFamilyElement() - .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-name") - .getValue()).getValue()); - Assert.assertEquals("Von", ((StringType) maidenName.getFamilyElement() - .getExtensionByUrl("http://fhir.de/StructureDefinition/humanname-namenszusatz").getValue()).getValue()); - Assert.assertEquals("zu", ((StringType) maidenName.getFamilyElement() - .getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/humanname-own-prefix") - .getValue()).getValue()); - - Assert.assertEquals(3, thePatient.getIdentifier().size()); - Assert.assertEquals("PID987654321", thePatient.getIdentifier().stream() - .filter(id -> id.getSystem().equals("http://hospital.smarthealthit.org")).findFirst().orElse(null) - .getValue()); - Assert.assertEquals("GKV123456789", thePatient.getIdentifier().stream() - .filter(id -> id.getSystem().equals("http://fhir.de/NamingSystem/gkv/patient")).findFirst().orElse(null) - .getValue()); - Assert.assertEquals("PKV543210987", thePatient.getIdentifier().stream() - .filter(id -> id.getSystem().equals("http://fhir.de/NamingSystem/pkv/patient")).findFirst().orElse(null) - .getValue()); - - - final Organization org = (Organization) thePatient.getManagingOrganization().getResource(); - Assert.assertEquals("Example Administrative Organization", org.getName()); - Assert.assertEquals("ORG-98765", org.getIdentifierFirstRep().getValue()); - - Assert.assertEquals("Tue Jan 01 00:00:00 CET 1980", thePatient.getBirthDate().toString()); - Assert.assertEquals(true, ((BooleanType) thePatient.getBirthDateElement().getExtensionByUrl("isdeceased") - .getValue()).getValue()); - - Assert.assertEquals("2022-02-03T04:05:06+01:00", thePatient.getDeceasedDateTimeType().getValueAsString()); - - Assert.assertEquals(1, conditions.size()); - Assert.assertEquals( - "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://fhir.de/ValueSet/bfarm/icd-10-gm' available", - conditions.get(0).getCode().getText()); - Assert.assertEquals("42", conditions.get(0).getCode().getCodingFirstRep().getCode()); - - final Patient.ContactComponent zerothContact = thePatient.getContact().get(0); - final CodeableConcept firstRelationshipCodeable = zerothContact.getRelationship().get(0); - final CodeableConcept secondRelationshipCodeable = zerothContact.getRelationship().get(1); - - Assert.assertEquals("contact person name", zerothContact.getName().getText()); - - Assert.assertEquals( - "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/patient-contactrelationship' available", - firstRelationshipCodeable.getText()); - Assert.assertEquals("42", firstRelationshipCodeable.getCodingFirstRep().getCode()); - - - Assert.assertEquals("another contact person role relationship", secondRelationshipCodeable.getText()); - Assert.assertEquals("43", secondRelationshipCodeable.getCodingFirstRep().getCode()); - - - Assert.assertEquals("contact person address", zerothContact.getAddress().getText()); - Assert.assertEquals("+1-555-1234", zerothContact.getTelecomFirstRep().getValue()); - - Assert.assertEquals(1, observations.size()); - Assert.assertEquals("vital status text", observations.get(0).getNoteFirstRep().getText()); - Assert.assertEquals("final", observations.get(0).getStatusElement().getCode()); - Assert.assertEquals("2022-02-03T04:05:06+01:00", - observations.get(0).getEffectiveDateTimeType().getValueAsString()); - -// ??? -// final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, bundle, operationaltemplate); - - } - - public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - Assert.assertEquals("PID987654321", - jsonObject.getAsJsonPrimitive("person/personendaten/person/pid:0|id").getAsString()); - Assert.assertEquals("Von Smith", - jsonObject.getAsJsonPrimitive("person/personendaten/person/geburtsname/vollständiger_name") - .getAsString()); - Assert.assertEquals("maiden", - jsonObject.getAsJsonPrimitive("person/personendaten/person/geburtsname/namensart|code") - .getAsString()); - Assert.assertEquals("Von Smith", - jsonObject.getAsJsonPrimitive("person/personendaten/person/geburtsname/familienname") - .getAsString()); - Assert.assertEquals("Smith", jsonObject.getAsJsonPrimitive( - "person/personendaten/person/geburtsname/familienname-nachname").getAsString()); - Assert.assertEquals("Von", jsonObject.getAsJsonPrimitive( - "person/personendaten/person/geburtsname/familienname-namenszusatz").getAsString()); - Assert.assertEquals("zu", jsonObject.getAsJsonPrimitive( - "person/personendaten/person/geburtsname/familienname-vorsatzwort").getAsString()); - Assert.assertEquals("John Doe", - jsonObject.getAsJsonPrimitive("person/personendaten/person/name/vollständiger_name") - .getAsString()); - Assert.assertEquals("official", jsonObject.getAsJsonPrimitive("person/personendaten/person/name/namensart|code") - .getAsString()); - Assert.assertEquals("John", - jsonObject.getAsJsonPrimitive("person/personendaten/person/name/vorname:0").getAsString()); - Assert.assertEquals("John Doe", jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname") - .getAsString()); - Assert.assertEquals("John", - jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname-nachname") - .getAsString()); - Assert.assertEquals("Doe", - jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname-namenszusatz") - .getAsString()); - Assert.assertEquals("zu", - jsonObject.getAsJsonPrimitive("person/personendaten/person/name/familienname-vorsatzwort") - .getAsString()); - - Assert.assertEquals("Hamburg", jsonObject.getAsJsonPrimitive( - "person/personendaten/person/straßenanschrift:0/gemeindeschlüssel").getAsString()); - Assert.assertEquals("Hamburg", jsonObject.getAsJsonPrimitive( - "person/personendaten/person/straßenanschrift:0/bundesland|value").getAsString()); - Assert.assertEquals("20095", - jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/postleitzahl") - .getAsString()); - Assert.assertEquals("Mitte", - jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/stadtteil") - .getAsString()); - Assert.assertEquals("Hamburg", - jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/stadt") - .getAsString()); - Assert.assertEquals("Germany", - jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/land|value") - .getAsString()); - Assert.assertEquals("both", - jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/art|value") - .getAsString()); - Assert.assertEquals("123 Main St", - jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/straße:0") - .getAsString()); - Assert.assertEquals("Apt 4B", - jsonObject.getAsJsonPrimitive("person/personendaten/person/straßenanschrift:0/hausnummer:0") - .getAsString()); - Assert.assertEquals("Wohnung 3", jsonObject.getAsJsonPrimitive( - "person/personendaten/person/straßenanschrift:0/adresszusatz:0").getAsString()); - - Assert.assertEquals("Berlin", - jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/gemeindeschlüssel") - .getAsString()); - Assert.assertEquals("Berlin", - jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/bundesland|value") - .getAsString()); - Assert.assertEquals("Berlin", - jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/stadt").getAsString()); - Assert.assertEquals("10997", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/postleitzahl") - .getAsString()); - Assert.assertEquals("Kreuzberg", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/stadtteil") - .getAsString()); - Assert.assertEquals("Germany", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/land|value") - .getAsString()); - Assert.assertEquals("postal", jsonObject.getAsJsonPrimitive("person/personendaten/person/postfach/art|value") - .getAsString()); - - Assert.assertEquals("GKV123456789", - jsonObject.getAsJsonPrimitive("person/personendaten/person/versicherten_id_gkv|id") - .getAsString()); - Assert.assertEquals("PKV543210987", - jsonObject.getAsJsonPrimitive("person/personendaten/person/versicherungsnummer_pkv|id") - .getAsString()); - - Assert.assertEquals("1980-01-01", - jsonObject.getAsJsonPrimitive("person/personendaten/daten_zur_geburt/geburtsdatum") - .getAsString()); - - Assert.assertEquals("emergency", jsonObject.getAsJsonPrimitive( - "person/personendaten/kontaktperson/rolle_relationship:0|code").getAsString()); - Assert.assertEquals("http://hl7.org/fhir/ValueSet/contact-relationship", jsonObject.getAsJsonPrimitive( - "person/personendaten/kontaktperson/rolle_relationship:0|terminology").getAsString()); - Assert.assertEquals("Emergency Contact", jsonObject.getAsJsonPrimitive( - "person/personendaten/kontaktperson/rolle_relationship:0|value").getAsString()); - - Assert.assertEquals("+1-555-1234", jsonObject.getAsJsonPrimitive( - "person/personendaten/kontaktperson/elektronische_kommunikation:0/daten/text_value").getAsString()); - Assert.assertEquals("jane.doe@example.com", jsonObject.getAsJsonPrimitive( - "person/personendaten/kontaktperson/elektronische_kommunikation:1/daten/text_value").getAsString()); - - Assert.assertEquals("Example Health Clinic", - jsonObject.getAsJsonPrimitive("person/personendaten/kontaktperson/organisation/namenszeile") - .getAsString()); - Assert.assertEquals("ORG-12345", jsonObject.getAsJsonPrimitive( - "person/personendaten/kontaktperson/organisation/identifier:0/identifier_value|id").getAsString()); - - Assert.assertEquals("16100001", jsonObject.getAsJsonPrimitive( - "person/personendaten/angaben_zum_tod/angaben_zum_tod/todesdiagnose|code").getAsString()); - Assert.assertEquals("http://snomed.info/sct", jsonObject.getAsJsonPrimitive( - "person/personendaten/angaben_zum_tod/angaben_zum_tod/todesdiagnose|terminology").getAsString()); - Assert.assertEquals("Cause of death", jsonObject.getAsJsonPrimitive( - "person/personendaten/angaben_zum_tod/angaben_zum_tod/todesdiagnose|value").getAsString()); - Assert.assertEquals("2024-08-24T02:00:00", jsonObject.getAsJsonPrimitive( - "person/personendaten/angaben_zum_tod/angaben_zum_tod/sterbedatum").getAsString()); - - Assert.assertEquals("The patient is recorded Dead. Cause of death is based on the patient's medical history.", - jsonObject.getAsJsonPrimitive("person/vitalstatus/vitalstatus").getAsString()); - Assert.assertEquals("final", - jsonObject.getAsJsonPrimitive("person/vitalstatus/fhir_status_der_beobachtung/status") - .getAsString()); - Assert.assertEquals("2024-08-21T16:30:00", - jsonObject.getAsJsonPrimitive("person/vitalstatus/zeitpunkt_der_feststellung") - .getAsString()); - - Assert.assertEquals("male", jsonObject.getAsJsonPrimitive("person/geschlecht/administratives_geschlecht|code") - .getAsString()); - - - return jsonObject; - - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/ProcedureTest.java b/src/test/java/com/medblocks/openfhir/kds/ProcedureTest.java deleted file mode 100644 index a80305c6..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/ProcedureTest.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.medblocks.openfhir.kds; - -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.util.List; -import java.util.stream.Collectors; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Extension; -import org.hl7.fhir.r4.model.Procedure; -import org.junit.Assert; -import org.junit.Test; - -public class ProcedureTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/procedure/procedure.context.yaml"; - final String HELPER_LOCATION = "/kds/procedure/"; - final String OPT = "KDS_Prozedur.opt"; - final String FLAT = "KDS_Prozedur.flat.json"; - - final String BUNDLE = "KDS_Prozedur_bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - @Test - public void toFhir() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFlat(HELPER_LOCATION + FLAT), - new OPTParser( - operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allProcedures = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Procedure).collect(Collectors.toList()); - Assert.assertEquals(1, allProcedures.size()); - - final Procedure theProcedure = (Procedure) allProcedures.get(0).getResource(); - - // -performed - Assert.assertEquals("2022-02-03T04:05:06+01:00", - theProcedure.getPerformedDateTimeType().getValueAsString()); - -// - name: "ISM Transition" -// Assert.assertEquals("530", theProcedure.getStatusElement().getValueAsString()); - -// - name: "Name" - Assert.assertEquals("80146002", theProcedure.getCode().getCodingFirstRep().getCode()); - Assert.assertEquals("//fhir.hl7.org/ValueSet/$expand?url=http://fhir.de/ValueSet/bfarm/ops", - theProcedure.getCode().getCodingFirstRep().getSystem()); - -// - name: "Comment" - Assert.assertEquals("Procedure completed successfully with no complications.", - theProcedure.getNoteFirstRep().getText()); - -// - name: "Kategorie" - Assert.assertEquals("Diagnostic procedure", theProcedure.getCategory().getText()); - Assert.assertEquals("103693007", theProcedure.getCategory().getCodingFirstRep().getCode()); - -// - name: "Body site" - Assert.assertEquals("Abdomen", theProcedure.getBodySite().get(0).getText()); - Assert.assertEquals("818981001", theProcedure.getBodySite().get(0).getCodingFirstRep().getCode()); - - // - name: "berichtId" - Assert.assertEquals("bericht_idqa", theProcedure.getIdentifierFirstRep().getValue()); - -// - name: "Durchführungsabsicht" - final Extension durchuhrungsabsicht = theProcedure.getExtensionByUrl( - "https://www.medizininformatik-initiative.de/fhir/core/modul-prozedur/StructureDefinition/Durchfuehrungsabsicht"); - Assert.assertNotNull(durchuhrungsabsicht); - Assert.assertEquals("durchführungsabsicht", ((Coding) durchuhrungsabsicht.getValue()).getCode()); - Assert.assertEquals("valuedurchführungsabsicht", ((Coding) durchuhrungsabsicht.getValue()).getDisplay()); - - } - - public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - -// Assert.assertEquals("completed", -// jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/ism_transition/current_state") -// .getAsString()); - Assert.assertEquals("5-470", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/name_der_prozedur|code") - .getAsString()); - Assert.assertEquals("Interventional neurovascular procedures,", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/name_der_prozedur|value") - .getAsString()); - Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/ops", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/name_der_prozedur|terminology") - .getAsString()); - - Assert.assertEquals("Procedure completed successfully with no complications.", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kommentar").getAsString()); - Assert.assertEquals("103693007", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kategorie_der_prozedur|code") - .getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kategorie_der_prozedur|terminology") - .getAsString()); - Assert.assertEquals("Diagnostic procedure", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/kategorie_der_prozedur|value") - .getAsString()); - Assert.assertEquals("durchführungsabsicht", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/durchführungsabsicht|code") - .getAsString()); - Assert.assertEquals("valuedurchführungsabsicht", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/durchführungsabsicht|value") - .getAsString()); - Assert.assertEquals("Durchfuehrungsabsicht", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/durchführungsabsicht|terminology") - .getAsString()); - Assert.assertEquals("818981001", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/körperstelle:0|code") - .getAsString()); - Assert.assertEquals("http://snomed.info/sct", - jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/körperstelle:0|terminology") - .getAsString()); - Assert.assertEquals("Abdomen", jsonObject.getAsJsonPrimitive("kds_prozedur/prozedur:0/körperstelle:0|value") - .getAsString()); - - - return jsonObject; - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/StudienteilnahmeTest.java b/src/test/java/com/medblocks/openfhir/kds/StudienteilnahmeTest.java deleted file mode 100644 index 3d45a17a..00000000 --- a/src/test/java/com/medblocks/openfhir/kds/StudienteilnahmeTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.medblocks.openfhir.kds; - -import static org.junit.Assert.assertEquals; - -import com.google.gson.JsonObject; -import com.nedap.archie.rm.composition.Composition; -import java.util.List; -import java.util.stream.Collectors; -import lombok.SneakyThrows; -import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; -import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.Consent; -import org.hl7.fhir.r4.model.DateTimeType; -import org.junit.Assert; -import org.junit.Test; - -public class StudienteilnahmeTest extends KdsBidirectionalTest { - - final String MODEL_MAPPINGS = "/kds_new/"; - final String CONTEXT = "/kds_new/projects/org.highmed/KDS/studienteilnahme/studienteilnahme.context.yaml"; - final String HELPER_LOCATION = "/kds/studienteilnahme/"; - final String OPT = "Studienteilnahme.opt"; - final String FLAT = "studienteilnahme.flat.json"; - final String BUNDLE = "studienteilnahme_bundle.json"; - - @SneakyThrows - @Override - protected void prepareState() { - context = getContext(CONTEXT); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(HELPER_LOCATION + OPT)); - operationaltemplate = getOperationalTemplate(); - repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); - webTemplate = new OPTParser(operationaltemplate).parse(); - } - - @Test - public void toFhir() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal(getFlat(HELPER_LOCATION + FLAT), - new OPTParser( - operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allConsents = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Consent).collect(Collectors.toList()); - assertEquals(1, allConsents.size()); - - final Consent consent = (Consent) allConsents.get(0).getResource(); - - Assert.assertEquals("entered-in-error", consent.getStatusElement().getValueAsString()); - - // - name: "period" - final DateTimeType periodStart = consent.getProvision().getPeriod().getStartElement(); - final DateTimeType periodEnd = consent.getProvision().getPeriod().getEndElement(); - Assert.assertEquals("2020-02-03T04:05:06+01:00", periodStart.getValueAsString()); - Assert.assertEquals("2024-02-03T04:05:06+01:00", periodEnd.getValueAsString()); - } - - - public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(HELPER_LOCATION + BUNDLE); - final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); - - Assert.assertEquals("245", jsonObject.getAsJsonPrimitive( - "studienteilnahme/einwilligungserklärung/ism_transition/current_state|code") - .getAsString()); - - Assert.assertEquals("2024-08-22T10:30:00", jsonObject.getAsJsonPrimitive( - "studienteilnahme/context/start_time").getAsString()); - Assert.assertEquals("2023-07-22T10:30:00", jsonObject.getAsJsonPrimitive( - "studienteilnahme/einwilligungserklärung/studienteilnahme/beginn_der_teilnahme").getAsString()); - Assert.assertEquals("2024-08-22T10:30:00", jsonObject.getAsJsonPrimitive( - "studienteilnahme/einwilligungserklärung/studienteilnahme/ende_der_teilnahme").getAsString()); - -// return jsonObject; - return null; // returning null so tests dont fail against ehrbase; missing mapping data points - // /content[openEHR-EHR-ACTION.informed_consent.v0]/description[at0001]/items[at0002 and name/value='Studie'] - // /content[openEHR-EHR-ACTION.informed_consent.v0]/description[at0001]/items[openEHR-EHR-CLUSTER.study_participation.v1]/items[at0005 and name/value='Status der Teilnahme'] - // /content[openEHR-EHR-ACTION.informed_consent.v0]/description[at0001]/items[openEHR-EHR-CLUSTER.study_participation.v1]/items[at0016 and name/value='Subjekt Identifizierungscode'] - } -} diff --git a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java new file mode 100644 index 00000000..7dc4b436 --- /dev/null +++ b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java @@ -0,0 +1,305 @@ +package com.medblocks.openfhir.kds.diagnose; + +import com.google.gson.JsonObject; +import com.medblocks.openfhir.kds.KdsBidirectionalTest; +import com.medblocks.openfhir.kds.KdsTest; +import com.nedap.archie.json.JacksonUtil; +import com.nedap.archie.rm.composition.Composition; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import lombok.SneakyThrows; +import org.apache.commons.io.IOUtils; +import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; +import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Condition; +import org.hl7.fhir.r4.model.DateTimeType; +import org.hl7.fhir.r4.model.Encounter; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Type; +import org.junit.Assert; +import org.junit.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +public class DiagnoseToFHIRTest extends KdsTest { + + final String MODEL_MAPPINGS = "/kds_new/"; + final String CONTEXT_MAPPING = "/kds_new/projects/org.highmed/KDS/diagnose/KDS_diagnose.context.yaml"; + final String OPT = "/kds/diagnose/KDS_Diagnose.opt"; + //INPUT + final String FLAT = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition.flat.json"; + final String COMPOSITION_SINGLE = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json"; + final String COMPOSITION_MULTIPLE = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json"; + final String FLAT_MULTIPLE = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_multiple_Composition.flat.json"; // todo change to multiple + final String OPENEHR_COMPOSITION_1 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json"; + final String OPENEHR_COMPOSITION_2 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json"; + final String OPENEHR_COMPOSITION_3 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json"; + final String OPENEHR_COMPOSITION_4 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json"; + final String OPENEHR_COMPOSITION_5 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json"; + final String OPENEHR_COMPOSITION_6 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json"; + final String OPENEHR_COMPOSITION_7 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json"; + final String OPENEHR_COMPOSITION_8 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json"; + final String OPENEHR_COMPOSITION_9 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json"; + final String OPENEHR_COMPOSITION_10 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json"; + //OUTPUT + final String BUNDLE = "/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle_whole.json"; + final String BUNDLE_SINGLE = "/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle.json"; + final String FHIR_CONDITION_1 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json"; + final String FHIR_CONDITION_2 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json"; + final String FHIR_CONDITION_3 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-3-diagnose-1.json"; + final String FHIR_CONDITION_4 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-4-diagnose-1.json"; + final String FHIR_CONDITION_5 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-5-diagnose-1.json"; + final String FHIR_CONDITION_6 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-6-diagnose-1.json"; + final String FHIR_CONDITION_7 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-7-diagnose-1.json"; + final String FHIR_CONDITION_8 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-8-diagnose-1.json"; + final String FHIR_CONDITION_9 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-9-diagnose-1.json"; + final String FHIR_CONDITION_10 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-10-diagnose-1.json"; + + + @SneakyThrows + @Override + public void prepareState() { + context = getContext(CONTEXT_MAPPING); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(OPT)); + operationaltemplate = getOperationalTemplate(); + repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); + webTemplate = new OPTParser(operationaltemplate).parse(); + } + + @SneakyThrows + @Test + public void assertToFHIR1(){ + Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(OPENEHR_COMPOSITION_1), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_1); + + + } + + @SneakyThrows + @Test + public void assertToFHIR2(){ + Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(OPENEHR_COMPOSITION_2), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_2); + } + + @SneakyThrows + @Test + public void assertToFHIR3(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_3), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_3); + } + + @SneakyThrows + @Test + public void assertToFHIR4(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_4), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_4); + } + + @SneakyThrows + @Test + public void assertToFHIR5(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_5), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_5); + } + + @SneakyThrows + @Test + public void assertToFHIR6(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_6), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_6); + } + + @SneakyThrows + @Test + public void assertToFHIR7(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_7), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_7); + } + + @SneakyThrows + @Test + public void assertToFHIR8(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_8), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_8); + } + + @SneakyThrows + @Test + public void assertToFHIR9(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_9), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_9); + } + + @SneakyThrows + @Test + public void assertToFHIR10(){ + Composition composition = JacksonUtil.getObjectMapper() + .readValue(getFile(OPENEHR_COMPOSITION_10), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, FHIR_CONDITION_10); + } + + private void assertCondition(final Condition condition, final boolean second) { + // - name: "contextStartTime" + final String expectedTime = second ? "2023-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; +// Assert.assertEquals(expectedTime, condition.getRecordedDateElement().getValueAsString()); + + + // - name: "fallIdentifikationIdentifier" + if (!second) { + Assert.assertEquals("VN", ((Encounter) condition.getEncounter().getResource()).getIdentifier().get(0).getType().getCodingFirstRep().getCode()); + Assert.assertEquals("Encounter/123", ((Encounter) condition.getEncounter().getResource()).getIdentifier().get(0).getValue()); + } + + // - name: "status" + if (!second) { + Assert.assertEquals("unconfirmed", condition.getVerificationStatus().getCodingFirstRep().getCode()); + Assert.assertEquals("http://hl7.org/fhir/ValueSet/condition-ver-status", + condition.getVerificationStatus().getCodingFirstRep().getSystem()); + } + + // - name: "date" + final List assertedExtensions = condition.getExtensionsByUrl( + "http://hl7.org/fhir/StructureDefinition/condition-assertedDate"); + Assert.assertEquals(1, assertedExtensions.size()); + final String expectedAssertedTime = second ? "3022-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; + Assert.assertEquals(expectedAssertedTime, + ((DateTimeType) assertedExtensions.get(0).getValue()).getValueAsString()); + + // dateTime, onset + final String expectedOnsetStartTime = second ? "3022-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; + Assert.assertEquals(expectedOnsetStartTime, condition.getOnsetPeriod().getStartElement().getValueAsString()); + + //- name: "clinicalStatus" + Assert.assertEquals((second ? "referenced_" : "") + "Active", condition.getClinicalStatus().getText()); + Assert.assertEquals((second ? "referenced_" : "") + "at0026", + condition.getClinicalStatus().getCodingFirstRep().getCode()); + + // - name: "lebensphase" + Assert.assertEquals((second ? "referenced_" : "") + "43", + ((CodeableConcept) condition.getOnsetPeriod().getStartElement() + .getExtensionsByUrl("http://fhir.de/StructureDefinition/lebensphase") + .get(0).getValue()).getCodingFirstRep().getCode()); + Assert.assertEquals((second ? "referenced_" : "") + "44", + ((CodeableConcept) condition.getOnsetPeriod().getEndElement() + .getExtensionsByUrl("http://fhir.de/StructureDefinition/lebensphase") + .get(0).getValue()).getCodingFirstRep().getCode()); + +// - name: "schweregrad" + Assert.assertEquals((second ? "referenced_" : "") + "42", + condition.getSeverity().getCodingFirstRep().getCode()); + Assert.assertEquals( + (second ? "referenced_" : "") + + "No example for termínology '//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/condition-severity' available", + condition.getSeverity().getText()); + + // bodySite + final List bodySites = condition.getBodySite(); + Assert.assertEquals(1, bodySites.size()); + final CodeableConcept bodySite = bodySites.get(0); + Assert.assertEquals(1, bodySite.getCoding().size()); + final List snomedBodySiteCodings = bodySite.getCoding().stream() + .filter(bsite -> bsite.getSystem() + .equals((second ? "referenced_" : "") + + "//fhir.hl7.org//ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/body-site")) + .toList(); + Assert.assertEquals(1, snomedBodySiteCodings.size()); + Assert.assertEquals((second ? "referenced_" : "") + "42", snomedBodySiteCodings.get(0).getCode()); + + // bodySiteCluster; nothing to do here because the cluster is overwritten to be a unidiretional toopenehr only + +// - name: "problemDiagnose", - name: "problemDiagnoseNameCode" + Assert.assertEquals(2, condition.getCode().getCoding().size()); + Coding icd10code = condition.getCode().getCoding().get(0); + Assert.assertEquals((second ? "referenced_" : "") + "kodierte_diagnose value", icd10code.getCode()); +// - name: "problemDiagnoseText" +// Assert.assertEquals((second ? "referenced_" : "") + "freitextbeschreibung value", +// condition.getCode().getText()); +// - name: "icd10ProblemDiagnose" + + icd10code = condition.getCode().getCoding().get(1); + Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", icd10code.getSystem()); + +// - name: "codeIcd10Diagnosesicherheit" + final Coding diagnosessicherheit = (Coding) icd10code.getExtensionsByUrl( + "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit").stream() + .map(Extension::getValue).filter(value -> !value.isEmpty()).findAny().orElse(null); + Assert.assertEquals((second ? "referenced_" : "") + "diagnosesicherheit", + diagnosessicherheit.getCode()); + Assert.assertEquals( + (second ? "referenced_" : "") + + "//fhir.hl7.org//ValueSet/$expand?url=https://fhir.kbv.de/ValueSet/KBV_VS_SFHIR_ICD_DIAGNOSESICHERHEIT", + diagnosessicherheit.getSystem()); + + // - name: "mehrfachcodierung" + final Coding mehrfachcodierung = (Coding) icd10code.getExtensionByUrl( + "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen").getValue(); + Assert.assertEquals("!", mehrfachcodierung.getCode()); + Assert.assertEquals("http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen", mehrfachcodierung.getSystem()); + Assert.assertEquals("!", mehrfachcodierung.getDisplay()); + + // - name: "seitenlokalisation" + final Coding seitenlokalisation = (Coding) icd10code.getExtensionByUrl( + "http://fhir.de/StructureDefinition/seitenlokalisation").getValue(); + Assert.assertEquals((second ? "referenced_" : "") + "at0003", seitenlokalisation.getCode()); + Assert.assertEquals((second ? "referenced_" : "") + "local", + seitenlokalisation.getSystem()); + Assert.assertEquals((second ? "referenced_" : "") + "Left", + seitenlokalisation.getDisplay()); + + + Assert.assertEquals(3, icd10code.getExtension().size()); + } + + @Test + public void toFhir() { + final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( + getFile(FLAT_MULTIPLE), new OPTParser(operationaltemplate).parse()); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); + final List allConditions = bundle.getEntry().stream() + .filter(en -> en.getResource() instanceof Condition).collect(Collectors.toList()); + Assert.assertEquals(2, allConditions.size()); + final Condition condition = (Condition) allConditions.get(0).getResource(); // first condition + final Condition conditionSecond = (Condition) allConditions.get(1).getResource(); // second condition + + assertCondition(condition, false); +// assertCondition(conditionSecond, true); + + final Type referencedExtensionCondition = condition.getExtensionByUrl( + "http://hl7.org/fhir/StructureDefinition/condition-related") + .getValue(); + Assert.assertNotNull(referencedExtensionCondition); + Assert.assertTrue(conditionSecond.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/condition-related") + .getValue().isEmpty()); + + assertCondition((Condition) ((Reference) referencedExtensionCondition).getResource(), true); + + } + +} diff --git a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseTest.java b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToOpenEHRTest.java similarity index 78% rename from src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseTest.java rename to src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToOpenEHRTest.java index d878d05a..09b0aa9b 100644 --- a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseTest.java +++ b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToOpenEHRTest.java @@ -1,68 +1,57 @@ package com.medblocks.openfhir.kds.diagnose; import com.google.gson.JsonObject; -import com.medblocks.openfhir.kds.KdsBidirectionalTest; -import com.nedap.archie.json.JacksonUtil; +import com.medblocks.openfhir.kds.KdsTest; import com.nedap.archie.rm.composition.Composition; - -import java.util.List; -import java.util.stream.Collectors; import lombok.SneakyThrows; import org.apache.commons.io.IOUtils; -import org.ehrbase.openehr.sdk.serialisation.flatencoding.std.umarshal.FlatJsonUnmarshaller; import org.ehrbase.openehr.sdk.webtemplate.parser.OPTParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Condition; -import org.hl7.fhir.r4.model.DateTimeType; -import org.hl7.fhir.r4.model.Encounter; -import org.hl7.fhir.r4.model.Extension; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.Type; +import org.hl7.fhir.r4.model.*; import org.junit.Assert; import org.junit.Test; -public class DiagnoseTest extends KdsBidirectionalTest { +import java.util.List; + +public class DiagnoseToOpenEHRTest extends KdsTest { + final String MODEL_MAPPINGS = "/kds_new/"; final String CONTEXT_MAPPING = "/kds_new/projects/org.highmed/KDS/diagnose/KDS_diagnose.context.yaml"; - final String TEST_FILES_DIR = "/kds/diagnose/"; - final String OPT = "KDS_Diagnose.opt"; - final String FLAT = "KDS_Diagnose_Composition.flat.json"; - final String FLAT_MULTIPLE = "KDS_Diagnose_multiple_Composition.flat.json"; // todo change to multiple - final String BUNDLE = "KDS_Diagnose_bundle_whole.json"; - final String BUNDLE_SINGLE = "KDS_Diagnose_bundle.json"; - final String COMPOSITION_SINGLE = TEST_FILES_DIR +"KDS_Diagnose_Composition_bundle.json"; - final String COMPOSITION_MULTIPLE = TEST_FILES_DIR +"KDS_Diagnose_Composition_bundle_whole.json"; - final String FHIR_CONDITION_1 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-1-diagnose-1.json"; - final String FHIR_CONDITION_2 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-2-diagnose-1.json"; - final String FHIR_CONDITION_3 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-3-diagnose-1.json"; - final String FHIR_CONDITION_4 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-4-diagnose-1.json"; - final String FHIR_CONDITION_5 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-5-diagnose-1.json"; - final String FHIR_CONDITION_6 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-6-diagnose-1.json"; - final String FHIR_CONDITION_7 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-7-diagnose-1.json"; - final String FHIR_CONDITION_8 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-8-diagnose-1.json"; - final String FHIR_CONDITION_9 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-9-diagnose-1.json"; - final String FHIR_CONDITION_10 = TEST_FILES_DIR +"Condition-mii-exa-test-data-patient-10-diagnose-1.json"; - final String OPENEHR_COMPOSITION_1 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-1-diagnose-1.json"; - final String OPENEHR_COMPOSITION_2 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-2-diagnose-1.json"; - final String OPENEHR_COMPOSITION_3 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-3-diagnose-1.json"; - final String OPENEHR_COMPOSITION_4 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-4-diagnose-1.json"; - final String OPENEHR_COMPOSITION_5 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-5-diagnose-1.json"; - final String OPENEHR_COMPOSITION_6 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-6-diagnose-1.json"; - final String OPENEHR_COMPOSITION_7 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-7-diagnose-1.json"; - final String OPENEHR_COMPOSITION_8 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-8-diagnose-1.json"; - final String OPENEHR_COMPOSITION_9 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-9-diagnose-1.json"; - final String OPENEHR_COMPOSITION_10 = TEST_FILES_DIR +"Composition-mii-exa-test-data-patient-10-diagnose-1.json"; - + final String OPT = "/kds/diagnose/KDS_Diagnose.opt"; + final String BUNDLE = "/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json"; + final String BUNDLE_SINGLE = "/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle.json"; + final String FHIR_CONDITION_1 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-1-diagnose-1.json"; + final String FHIR_CONDITION_2 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-2-diagnose-1.json"; + final String FHIR_CONDITION_3 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-3-diagnose-1.json"; + final String FHIR_CONDITION_4 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-4-diagnose-1.json"; + final String FHIR_CONDITION_5 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-5-diagnose-1.json"; + final String FHIR_CONDITION_6 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-6-diagnose-1.json"; + final String FHIR_CONDITION_7 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-7-diagnose-1.json"; + final String FHIR_CONDITION_8 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-8-diagnose-1.json"; + final String FHIR_CONDITION_9 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-9-diagnose-1.json"; + final String FHIR_CONDITION_10 = "/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-10-diagnose-1.json"; + + final String FLAT = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition.flat.json"; + final String COMPOSITION_SINGLE = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json"; + final String COMPOSITION_MULTIPLE = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json"; + final String FLAT_MULTIPLE = "/kds/diagnose/toOpenEHR/output/KDS_Diagnose_multiple_Composition.flat.json"; // todo change to multiple + final String OPENEHR_COMPOSITION_1 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json"; + final String OPENEHR_COMPOSITION_2 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json"; + final String OPENEHR_COMPOSITION_3 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json"; + final String OPENEHR_COMPOSITION_4 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json"; + final String OPENEHR_COMPOSITION_5 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json"; + final String OPENEHR_COMPOSITION_6 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json"; + final String OPENEHR_COMPOSITION_7 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json"; + final String OPENEHR_COMPOSITION_8 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json"; + final String OPENEHR_COMPOSITION_9 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json"; + final String OPENEHR_COMPOSITION_10 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json"; @SneakyThrows @Override public void prepareState() { context = getContext(CONTEXT_MAPPING); - operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream(TEST_FILES_DIR + OPT)); + operationaltemplateSerialized = IOUtils.toString(this.getClass().getResourceAsStream( OPT)); operationaltemplate = getOperationalTemplate(); repo.initRepository(context, operationaltemplate, getClass().getResource(MODEL_MAPPINGS).getFile()); webTemplate = new OPTParser(operationaltemplate).parse(); @@ -70,100 +59,84 @@ public void prepareState() { @Test public void assertToOpenEHRBundle() { - final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(TEST_FILES_DIR + BUNDLE_SINGLE), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, COMPOSITION_SINGLE); + final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(BUNDLE_SINGLE), operationaltemplate); + standardsAsserter.assertComposition(composition, COMPOSITION_SINGLE); } @Test public void assertToOpenEHRBundleWhole() { - final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(TEST_FILES_DIR + BUNDLE), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, COMPOSITION_MULTIPLE); + final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(BUNDLE), operationaltemplate); + standardsAsserter.assertComposition(composition, COMPOSITION_MULTIPLE); } @Test public void assertToOpenEHR1() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_1), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_1); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_1); } @Test public void assertToOpenEHR2() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_2), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_2); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_2); } @Test public void assertToOpenEHR3() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_3), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_3); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_3); } @Test public void assertToOpenEHR4() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_4), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_4); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_4); } @Test public void assertToOpenEHR5() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_5), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_5); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_5); } @Test public void assertToOpenEHR6() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_6), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_6); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_6); } @Test public void assertToOpenEHR7() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_7), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_7); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_7); } @Test public void assertToOpenEHR8() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_8), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_8); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_8); } @Test public void assertToOpenEHR9() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_9), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_9); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_9); } @Test public void assertToOpenEHR10() { final Composition composition = fhirToOpenEhr.fhirToCompositionRm(context, getTestBundle(FHIR_CONDITION_10), operationaltemplate); - standardsAsserter.assertFlatComposition(composition, OPENEHR_COMPOSITION_10); - } - - @SneakyThrows - @Test - public void assertToFHIR1(){ - Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(OPENEHR_COMPOSITION_1), Composition.class); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); - standardsAsserter.assertBundle(bundle, FHIR_CONDITION_1); - } - - @SneakyThrows - @Test - public void assertToFHIR2(){ - Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(OPENEHR_COMPOSITION_2), Composition.class); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); - standardsAsserter.assertBundle(bundle, FHIR_CONDITION_2); + standardsAsserter.assertComposition(composition, OPENEHR_COMPOSITION_10); } private void assertCondition(final Condition condition, final boolean second) { @@ -278,34 +251,9 @@ private void assertCondition(final Condition condition, final boolean second) { Assert.assertEquals(3, icd10code.getExtension().size()); } - @Test - public void toFhir() { - final Composition compositionFromFlat = new FlatJsonUnmarshaller().unmarshal( - getFile(TEST_FILES_DIR + FLAT_MULTIPLE), new OPTParser(operationaltemplate).parse()); - final Bundle bundle = openEhrToFhir.compositionToFhir(context, compositionFromFlat, operationaltemplate); - final List allConditions = bundle.getEntry().stream() - .filter(en -> en.getResource() instanceof Condition).collect(Collectors.toList()); - Assert.assertEquals(2, allConditions.size()); - final Condition condition = (Condition) allConditions.get(0).getResource(); // first condition - final Condition conditionSecond = (Condition) allConditions.get(1).getResource(); // second condition - - assertCondition(condition, false); -// assertCondition(conditionSecond, true); - - final Type referencedExtensionCondition = condition.getExtensionByUrl( - "http://hl7.org/fhir/StructureDefinition/condition-related") - .getValue(); - Assert.assertNotNull(referencedExtensionCondition); - Assert.assertTrue(conditionSecond.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/condition-related") - .getValue().isEmpty()); - - assertCondition((Condition) ((Reference) referencedExtensionCondition).getResource(), true); - - } - @Test public void toOpenEhr_single() { - final Bundle testBundle = getTestBundle(TEST_FILES_DIR + BUNDLE_SINGLE); + final Bundle testBundle = getTestBundle(BUNDLE_SINGLE); final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); Assert.assertEquals("2022-02-03T01:00:00", jsonObject.get("diagnose/context/start_time").getAsString()); @@ -369,7 +317,7 @@ public void toOpenEhr_single() { public JsonObject toOpenEhr() { - final Bundle testBundle = getTestBundle(TEST_FILES_DIR + BUNDLE); + final Bundle testBundle = getTestBundle(BUNDLE); final JsonObject jsonObject = fhirToOpenEhr.fhirToFlatJsonObject(context, testBundle, operationaltemplate); Assert.assertEquals("2022-02-03T01:00:00", jsonObject.get("diagnose/context/start_time").getAsString()); @@ -436,10 +384,10 @@ public JsonObject toOpenEhr() { Assert.assertEquals("ref_C34.1", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|code").getAsString()); Assert.assertEquals("Malignant neoplasm of upper lobe, bronchus or lung", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|value").getAsString()); Assert.assertEquals("http://fhir.de/CodeSystem/bfarm/icd-10-gm", jsonObject.get("diagnose/diagnose:1/kodierte_diagnose|terminology").getAsString()); - Assert.assertEquals("ref_S", jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|code").getAsString()); + Assert.assertEquals("V", jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|code").getAsString()); Assert.assertEquals("http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|terminology").getAsString()); - Assert.assertEquals("ref_Suspected diagnosis", + Assert.assertEquals("Verdacht auf Diagnose", jsonObject.get("diagnose/diagnose:1/diagnosesicherheit|value").getAsString()); Assert.assertEquals("at0003", jsonObject.get( "diagnose/diagnose:1/mehrfachkodierungskennzeichen_icd-10-gm/mehrfachkodierungkennzeichen|code").getAsString()); diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json deleted file mode 100644 index d3f6b903..00000000 --- a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-1-diagnose-1.json +++ /dev/null @@ -1,277 +0,0 @@ -{ - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" - }, - "template_id" : { - "value" : "KDS_Diagnose" - }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" - }, - "code_string" : "de" - }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" - }, - "code_string" : "DE" - }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" - }, - "code_string" : "433" - } - }, - "composer" : { - "_type" : "PARTY_SELF" - }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2024-02-21T00:00:00" - }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" - }, - "code_string" : "238" - } - } - }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" - }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" - }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I29578", - "preferred_term" : "Masern mit Otitis" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "13420004", - "preferred_term" : "Post measles otitis media (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" - }, - "code_string" : "B05.3" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Middle ear structure (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "25342003" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinisch relevanter Zeitraum (Zeitpunkt des Auftretens)" - }, - "value" : { - "_type" : "DV_DATE_TIME", - "value" : "2024-02-21T00:00:00" - }, - "archetype_node_id" : "at0077" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" - }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" - }, - "code_string" : "at0064" - } - }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnosesicherheit" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "gesicherte Diagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_DIAGNOSESICHERHEIT" - }, - "code_string" : "G" - } - }, - "archetype_node_id" : "at0073" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Masernotitis" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" -} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json similarity index 62% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-1-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json index 11c4af28..b2927af1 100644 --- a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-1-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json @@ -5,6 +5,11 @@ { "resource": { "resourceType": "Condition", + "meta": { + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, "clinicalStatus": { "coding": [ { @@ -15,10 +20,6 @@ }, "code": { "coding": [ - { - "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "B05.3" - }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I29578", @@ -30,35 +31,34 @@ "display": "Post measles otitis media (disorder)" }, { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "B05.3", "extension": [ { "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", - "valueCodeableConcept": { - "coding": [ - { - "system": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_DIAGNOSESICHERHEIT", - "code": "G", - "display": "gesicherte Diagnose" - } - ], - "text": "gesicherte Diagnose" + "valueCoding": { + "system": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_DIAGNOSESICHERHEIT", + "code": "G", + "display": "gesicherte Diagnose" + } + }, + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", + "valueCoding": { + "system": "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen", + "code": "!", + "display": "!" } }, { "url": "http://fhir.de/StructureDefinition/seitenlokalisation", - "valueCodeableConcept": { - "coding": [ - { - "system": "http://snomed.info/sct", - "code": "25342003", - "display": "Middle ear structure (body structure)" - } - ], - "text": "Middle ear structure (body structure)" + "valueCoding": { + "system": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_SEITENLOKALISATION", + "code": "B", + "display": "beiderseits" } } - ], - "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + ] } ] }, diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-10-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-10-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-10-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json similarity index 58% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-2-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json index 3360647c..245bebd3 100644 --- a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-2-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-2", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:53:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-2-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-2-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,19 +14,16 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "C34.1", - "version": "2024" + "code": "C34.1" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I30011", - "version": "2024", "display": "Bösartige Neubildung des Lungenoberlappens" }, { "system": "http://snomed.info/sct", "code": "254637007", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Non-small cell lung cancer (disorder)" } ] @@ -66,10 +39,10 @@ { "system": "http://snomed.info/sct", "code": "45653009", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Structure of upper lobe of lung (body structure)" } - ] + ], + "text": "Structure of upper lobe of lung (body structure)" } ], "clinicalStatus": { @@ -88,10 +61,7 @@ } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-2" - }, - "recordedDate": "2024-03-02" + "recordedDate": "2024-03-02T00:00:00+01:00" } } ] diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-3-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-3-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-3-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-4-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-4-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-4-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-5-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-5-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-5-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-6-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-6-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-6-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-7-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-7-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-7-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-8-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-8-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-8-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-9-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-9-diagnose-1.json rename to src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-9-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-1-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-1-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-1-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-10-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-10-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-10-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-2-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Condition-mii-exa-test-data-patient-2-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-2-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-3-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-3-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-3-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-4-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-4-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-4-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-5-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-5-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-5-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-6-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-6-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-6-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-7-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-7-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-7-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-8-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-8-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-8-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-9-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/toFHIR/Condition-mii-exa-test-data-patient-9-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/Condition-mii-exa-test-data-patient-9-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_bundle.json b/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle.json similarity index 100% rename from src/test/resources/kds/diagnose/KDS_Diagnose_bundle.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle.json diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_bundle_whole.json b/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json similarity index 95% rename from src/test/resources/kds/diagnose/KDS_Diagnose_bundle_whole.json rename to src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json index 79c6e198..50921a5b 100644 --- a/src/test/resources/kds/diagnose/KDS_Diagnose_bundle_whole.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json @@ -353,42 +353,29 @@ "extension": [ { "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", - "valueCodeableConcept": { - "coding": [ - { + "valueCoding": { + "system": "local", "code": "*", "display": "ref_Primary code in multiple coding" - } - ], - "text": "ref_Primary code in multiple coding" - } - }, + + }}, { "url": "http://fhir.de/StructureDefinition/seitenlokalisation", - "valueCodeableConcept": { - "coding": [ - { + "valueCoding": { "system": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation", - "code": "ref_U", - "display": "ref_Upper lobe" - } - ], - "text": "ref_Upper lobe" + "code": "B", + "display": "Beiderseits" } }, { "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", - "valueCodeableConcept": { - "coding": [ + "valueCoding": { "system": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", - "code": "ref_S", - "display": "ref_Suspected diagnosis" + "code": "V", + "display": "Verdacht auf Diagnose" } - ], - "text": "ref_Suspected diagnosis" - } } ] }, diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json new file mode 100644 index 00000000..5db02355 --- /dev/null +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json @@ -0,0 +1,350 @@ +{ + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" + }, + "template_id": { + "value": "KDS_Diagnose" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" + }, + "code_string": "DE" + }, + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" + }, + "code_string": "433" + } + }, + "composer": { + "_type": "PARTY_SELF" + }, + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2024-02-21T00:00:00" + }, + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" + }, + "code_string": "238" + } + } + }, + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" + }, + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" + }, + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" + }, + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" + }, + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I29578", + "preferred_term": "Masern mit Otitis" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "13420004", + "preferred_term": "Post measles otitis media (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "B05.3" + } + }, + "archetype_node_id": "at0002" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Middle ear structure (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "25342003" + } + }, + "archetype_node_id": "at0001" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Lateralität" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "beiderseits", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_SEITENLOKALISATION" + }, + "code_string": "B" + } + }, + "archetype_node_id": "at0002" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinisch relevanter Zeitraum (Zeitpunkt des Auftretens)" + }, + "value": { + "_type": "DV_DATE_TIME", + "value": "2024-02-21T00:00:00" + }, + "archetype_node_id": "at0077" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungskennzeichen_ICD-10-GM" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Mehrfachkodierungkennzeichen" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "†", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0002" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" + }, + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosesicherheit" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "gesicherte Diagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "https://fhir.kbv.de/CodeSystem/KBV_CS_SFHIR_ICD_DIAGNOSESICHERHEIT" + }, + "code_string": "G" + } + }, + "archetype_node_id": "at0073" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Masernotitis" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-10-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-2-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-3-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-4-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-5-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-6-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-7-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-8-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json similarity index 100% rename from src/test/resources/kds/diagnose/Composition-mii-exa-test-data-patient-9-diagnose-1.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_Composition.flat.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition.flat.json similarity index 100% rename from src/test/resources/kds/diagnose/KDS_Diagnose_Composition.flat.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition.flat.json diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json similarity index 54% rename from src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json index bb5ff95d..6b787f45 100644 --- a/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json @@ -285,6 +285,18 @@ ], "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinisch relevanter Zeitraum (Zeitpunkt des Auftretens)" + }, + "value": { + "_type": "DV_DATE_TIME", + "value": "2024-12-24T16:13:43" + }, + "archetype_node_id": "at0077" + }, { "_type": "ELEMENT", "name": { @@ -430,7 +442,7 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "active", + "value": "Active", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { @@ -501,406 +513,6 @@ "archetype_node_id": "at0001" }, "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - }, - { - "_type": "EVALUATION", - "name": { - "_type": "DV_TEXT", - "value": "Diagnose" - }, - "archetype_details": { - "archetype_id": { - "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - }, - "rm_version": "1.0.4" - }, - "language": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "ISO_639-1" - }, - "code_string": "de" - }, - "encoding": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "IANA_character-sets" - }, - "code_string": "UTF-8" - }, - "subject": { - "_type": "PARTY_SELF" - }, - "data": { - "_type": "ITEM_TREE", - "name": { - "_type": "DV_TEXT", - "value": "Structure" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Kodierte Diagnose" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "Malignant neoplasm of upper lobe, bronchus or lung", - "mappings": [ - { - "_type": "TERM_MAPPING", - "match": "?", - "target": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" - }, - "code_string": "ref_C34.1", - "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" - } - }, - { - "_type": "TERM_MAPPING", - "match": "?", - "target": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string": "ref_098H5", - "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung, unspecified" - } - }, - { - "_type": "TERM_MAPPING", - "match": "?", - "target": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://snomed.info/sct" - }, - "code_string": "ref_254626006", - "preferred_term": "ref_Malignant neoplasm of the upper lobe of lung" - } - }, - { - "_type": "TERM_MAPPING", - "match": "?", - "target": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://www.orpha.net" - }, - "code_string": "ref_830", - "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" - } - } - ], - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" - }, - "code_string": "ref_C34.1" - } - }, - "archetype_node_id": "at0002" - }, - { - "_type": "CLUSTER", - "name": { - "_type": "DV_TEXT", - "value": "Anatomische Lokalisation" - }, - "archetype_details": { - "archetype_id": { - "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version": "1.0.4" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Name der Körperstelle" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "Entire cardiovascular system", - "mappings": [ - { - "_type": "TERM_MAPPING", - "match": "?", - "target": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" - }, - "code_string": "ref_C34.1", - "preferred_term": "ref_Upper lobe, bronchus or lung" - } - } - ], - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://snomed.info/sct" - }, - "code_string": "ref_368209003" - } - }, - "archetype_node_id": "at0001" - }, - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Lateralität" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "ref_Upper lobe", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation" - }, - "code_string": "ref_U" - } - }, - "archetype_node_id": "at0002" - } - ], - "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Feststellungsdatum" - }, - "value": { - "_type": "DV_DATE_TIME", - "value": "2125-02-03T05:05:06" - }, - "archetype_node_id": "at0003" - }, - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Schweregrad" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "ref_Severe", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://snomed.info/sct" - }, - "code_string": "ref_24484000" - } - }, - "archetype_node_id": "at0005" - }, - { - "_type": "CLUSTER", - "name": { - "_type": "DV_TEXT", - "value": "Lebensphase" - }, - "archetype_details": { - "archetype_id": { - "value": "openEHR-EHR-CLUSTER.lebensphase.v0" - }, - "rm_version": "1.0.4" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Beginn" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "ref_Start of adulthood phase", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://snomed.info/sct" - }, - "code_string": "ref_424144002" - } - }, - "archetype_node_id": "at0001" - }, - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Ende" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "ref_End of middle age phase", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://snomed.info/sct" - }, - "code_string": "ref_367640001" - } - }, - "archetype_node_id": "at0002" - } - ], - "archetype_node_id": "openEHR-EHR-CLUSTER.lebensphase.v0" - }, - { - "_type": "CLUSTER", - "name": { - "_type": "DV_TEXT", - "value": "Mehrfachkodierungskennzeichen_ICD-10-GM" - }, - "archetype_details": { - "archetype_id": { - "value": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" - }, - "rm_version": "1.0.4" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Mehrfachkodierungkennzeichen" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "*", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "local" - }, - "code_string": "at0003" - } - }, - "archetype_node_id": "at0001" - } - ], - "archetype_node_id": "openEHR-EHR-CLUSTER.multiple_coding_icd10gm.v1" - }, - { - "_type": "CLUSTER", - "name": { - "_type": "DV_TEXT", - "value": "Klinischer Status" - }, - "archetype_details": { - "archetype_id": { - "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version": "1.0.4" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Klinischer Status" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "ref_active", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" - }, - "code_string": "ref_active" - } - }, - "archetype_node_id": "at0003" - }, - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Diagnoserolle" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "Hauptdiagnose", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "local" - }, - "code_string": "at0064" - } - }, - "archetype_node_id": "at0063" - } - ], - "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Diagnosesicherheit" - }, - "value": { - "_type": "DV_CODED_TEXT", - "value": "ref_Suspected diagnosis", - "defining_code": { - "_type": "CODE_PHRASE", - "terminology_id": { - "_type": "TERMINOLOGY_ID", - "value": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit" - }, - "code_string": "ref_S" - } - }, - "archetype_node_id": "at0073" - }, - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "Diagnoseerläuterung" - }, - "value": { - "_type": "DV_TEXT", - "value": "ref_The patient has a history of high blood pressure, now presenting with severe hypertension." - }, - "archetype_node_id": "at0069" - } - ], - "archetype_node_id": "at0001" - }, - "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" } ], "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle_whole.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json similarity index 99% rename from src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle_whole.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json index bb5ff95d..16e71ce5 100644 --- a/src/test/resources/kds/diagnose/KDS_Diagnose_Composition_bundle_whole.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json @@ -670,14 +670,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "ref_Upper lobe", + "value": "Beiderseits", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation" }, - "code_string": "ref_U" + "code_string": "B" } }, "archetype_node_id": "at0002" @@ -873,14 +873,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "ref_Suspected diagnosis", + "value": "Verdacht auf Diagnose", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit" }, - "code_string": "ref_S" + "code_string": "V" } }, "archetype_node_id": "at0073" diff --git a/src/test/resources/kds/diagnose/KDS_Diagnose_multiple_Composition.flat.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_multiple_Composition.flat.json similarity index 100% rename from src/test/resources/kds/diagnose/KDS_Diagnose_multiple_Composition.flat.json rename to src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_multiple_Composition.flat.json diff --git a/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml b/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml index 931406e0..b88f4894 100644 --- a/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml +++ b/src/test/resources/kds_new/model/cluster/org.highmed/multiple_coding_icd10gm.v1.yml @@ -13,59 +13,37 @@ spec: structureDefinition: http://hl7.org/fhir/StructureDefinition/Coding mappings: - - name: "mehrfachcodierungManifestation" + - name: "mehrfachcodierung" with: - fhir: "$fhirRoot.value" #fhir.extension + fhir: "$fhirRoot.value.as(Coding)" #fhir.extension openehr: "$archetype/items[at0001]" - type: "$NONE" - openehrCondition: - targetRoot: "$archetype/items[at0001]" - targetAttribute: "defining_code/code_string" - operator: "one of" - criteria: "at0003" - fhirCondition: - targetRoot: "$fhirRoot" - targetAttribute: "code" - operator: "one of" - criteria: "*" - followedBy: - mapping: - with: - fhir: "$fhirRoot" - openehr: "$openehrRoot" - type: "$NONE" - manual: - - name: "manifestation" - openehr: - - path: "defining_code/terminology_id" - value: "local" - - path: "defining_code/code_string" - value: "at0003" - - path: "value" - value: "*" - fhir: - - path: "code" - value: "*" - - path: "display" - value: "*" - - path: "system" - value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" - - - name: "mehrfachcodierungAtiology" - with: - fhir: "$fhirRoot.value" #fhir.extension - openehr: "$archetype/items[at0001]" - openehrCondition: - targetRoot: "$archetype/items[at0001]" - targetAttribute: "value/defining_code/code_string" - operator: "one of" - criteria: "at0002" - fhirCondition: - targetRoot: "$fhirRoot" - targetAttribute: "code" - operator: "one of" - criteria: "†" manual: + - name: "manifestation" + openehr: + - path: "defining_code/terminology_id" + value: "local" + - path: "defining_code/code_string" + value: "at0003" + - path: "value" + value: "*" + fhirCondition: + targetRoot: "$fhirRoot.value.as(Coding)" + targetAttribute: "code" + operator: "one of" + criteria: "*" + fhir: + - path: "code" + value: "*" + - path: "display" + value: "*" + - path: "system" + value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" + openehrCondition: + targetRoot: "$openehrRoot/items[at0001]" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0003" + - name: "ätiology" openehr: - path: "defining_code/terminology_id" @@ -74,6 +52,11 @@ mappings: value: "at0002" - path: "value" value: "†" + fhirCondition: + targetRoot: "$fhirRoot.value.as(Coding)" + targetAttribute: "code" + operator: "one of" + criteria: "†" fhir: - path: "code" value: "†" @@ -81,23 +64,26 @@ mappings: value: "†" - path: "system" value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" + openehrCondition: + targetRoot: "$openehrRoot/items[at0001]" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0002" - - name: "mehrfachcodierungAdditionalInformation" - with: - fhir: "$fhirRoot.value" #fhir.extension - openehr: "$archetype/items[at0001]" - fhirCondition: - targetRoot: "$fhirRoot" - targetAttribute: "code" - operator: "one of" - criteria: "!" - openehrCondition: - targetRoot: "$archetype/items[at0001]" - targetAttribute: "value/defining_code/code_string" - operator: "one of" - criteria: "at0004" - manual: - name: "additionalInformation" + fhir: + - path: "code" + value: "!" + - path: "display" + value: "!" + - path: "system" + value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" + openehrCondition: + targetRoot: "$openehrRoot/items[at0001]" + targetAttribute: "defining_code/code_string" + operator: "one of" + criteria: "at0004" + openehr: - path: "defining_code/terminology_id" value: "local" @@ -105,10 +91,8 @@ mappings: value: "at0004" - path: "value" value: "!" - fhir: - - path: "code" - value: "!" - - path: "display" - value: "!" - - path: "system" - value: "http://fhir.de/ValueSet/icd-10-gm-mehrfachcodierungs-kennzeichen" \ No newline at end of file + fhirCondition: + targetRoot: "$fhirRoot.value.as(Coding)" + targetAttribute: "code" + operator: "one of" + criteria: "!" diff --git a/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml b/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml index 3efc8b17..ea23f8a6 100644 --- a/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml +++ b/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml @@ -10,7 +10,7 @@ spec: archetype: openEHR-EHR-CLUSTER.problem_qualifier.v2 revision: 2.0.1 fhirConfig: - structureDefinition: http://hl7.org/fhir/StructureDefinition/BackboneElement + structureDefinition: http://hl7.org/fhir/StructureDefinition/Coding mappings: - name: "statusCoded" @@ -47,7 +47,7 @@ mappings: value: "http://hl7.org/fhir/ValueSet/condition-ver-status" openehrCondition: targetRoot: "$archetype" - targetAttribute: "items[at0004]/code_string" + targetAttribute: "items[at0004]/defining_code/code_string" operator: "one of" criteria: "at0017" @@ -74,11 +74,11 @@ mappings: value: "http://hl7.org/fhir/ValueSet/condition-ver-status" openehrCondition: targetRoot: "$archetype" - targetAttribute: "items[at0004]/code_string" + targetAttribute: "items[at0004]/defining_code/code_string" operator: "one of" criteria: "at0017" - - name: "preliminary" + - name: "preliminary"#TODO this is wrong openehr: - path: "defining_code/terminology_id" value: "local" @@ -87,7 +87,7 @@ mappings: - path: "value" value: "Preliminary" fhirCondition: - targetRoot: "$fhirRoot" + targetRoot: "$resource.verificationStatus.coding" targetAttribute: "code" operator: "one of" criteria: "unconfirmed" @@ -101,7 +101,7 @@ mappings: value: "http://hl7.org/fhir/ValueSet/condition-ver-status" openehrCondition: targetRoot: "$archetype" - targetAttribute: "items[at0004]/code_string" + targetAttribute: "items[at0004]/defining_code/code_string" operator: "one of" criteria: "at0016" @@ -112,7 +112,7 @@ mappings: - path: "defining_code/code_string" value: "at0018" - path: "value" - value: "Established" + value: "Festgestellt" fhirCondition: targetRoot: "$fhirRoot" targetAttribute: "code" @@ -128,7 +128,7 @@ mappings: value: "http://hl7.org/fhir/ValueSet/condition-ver-status" openehrCondition: targetRoot: "$archetype" - targetAttribute: "items[at0004]/code_string" + targetAttribute: "items[at0004]/defining_code/code_string" operator: "one of" criteria: "at0018" @@ -155,6 +155,6 @@ mappings: value: "http://hl7.org/fhir/ValueSet/condition-ver-status" openehrCondition: targetRoot: "$archetype" - targetAttribute: "items[at0004]/code_string" + targetAttribute: "items[at0004]/defining_code/code_string" operator: "one of" criteria: "at0088" diff --git a/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml b/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml index b4ff652e..354e4601 100644 --- a/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml +++ b/src/test/resources/kds_new/projects/org.highmed/KDS/diagnose/KDS_problem_diagnose.yml @@ -65,7 +65,16 @@ mappings: - path: "url" value: "http://hl7.org/fhir/StructureDefinition/condition-assertedDate" - #/data[at0001]/items[at0073] -> + - name: "metaURL" + extension: "add" + unidirectional: "openEHR->fhir" + with: + fhir: "$resource.meta" + manual: + - name: "profileUrl" + fhir: + - path: "profile" + value: "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" # - name: "problemDiagnose2" # THIS SHOULD be for the export from openehr->fhir but it does not work since i cannot work on the codings since the transformation does not allow it # extension: "add" @@ -150,14 +159,9 @@ mappings: # type: "CODING" # -# - name: "icd10ProblemDiagnose" -# extension: "append" -# appendTo: "problemDiagnose" - - name: "problemDiagnose" - with: - fhir: "$resource.code" - openehr: "$archetype/data[at0001]/items[at0002]" - extension: "overwrite" + - name: "icd10ProblemDiagnose" + extension: "append" + appendTo: "problemDiagnose" followedBy: mappings: - name: "coding" @@ -197,6 +201,12 @@ mappings: with: fhir: "value" openehr: "data[at0001]/items[at0073]" + type: "CODING" + - name: "extensionValue"#TODO Bugfix since Coding maps no display + unidirectional: "fhir->openEHR" + with: + fhir: "value" + openehr: "data[at0001]/items[at0073]" - name: "extensionUrl" with: From 9f595ba41323656c455a68e490c7f252bddfa487 Mon Sep 17 00:00:00 2001 From: Severin Date: Mon, 26 Jan 2026 15:56:48 +0100 Subject: [PATCH 3/5] changed pom --- pom.xml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 95a8dc5c..739f8099 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,6 @@ jjwt ${jjwt.version} - junit @@ -116,7 +115,7 @@ ${junit.version} test - + org.ehrbase.openehr.sdk @@ -133,7 +132,7 @@ web-template ${ehrbase.version} - + @@ -241,7 +240,7 @@ com.github.java-json-tools json-schema-validator - + org.pf4j pf4j 3.11.0 @@ -251,6 +250,12 @@ openfhir-plugin-api 1.0.0 + + org.skyscreamer + jsonassert + 2.0-rc1 + test + From 700a98bece313dd372d6ba744681dfb700bf503e Mon Sep 17 00:00:00 2001 From: Severin Date: Mon, 26 Jan 2026 16:18:58 +0100 Subject: [PATCH 4/5] fixed Diagnosstatus --- ...ii-exa-test-data-patient-1-diagnose-1.json | 20 + ...i-exa-test-data-patient-10-diagnose-1.json | 467 ++++++++++-------- ...ii-exa-test-data-patient-2-diagnose-1.json | 467 ++++++++++-------- ...ii-exa-test-data-patient-3-diagnose-1.json | 467 ++++++++++-------- ...ii-exa-test-data-patient-4-diagnose-1.json | 349 +++++++------ ...ii-exa-test-data-patient-5-diagnose-1.json | 467 ++++++++++-------- ...ii-exa-test-data-patient-6-diagnose-1.json | 467 ++++++++++-------- ...ii-exa-test-data-patient-7-diagnose-1.json | 467 ++++++++++-------- ...ii-exa-test-data-patient-8-diagnose-1.json | 467 ++++++++++-------- ...ii-exa-test-data-patient-9-diagnose-1.json | 467 ++++++++++-------- .../KDS_Diagnose_Composition_bundle.json | 20 + ...KDS_Diagnose_Composition_bundle_whole.json | 20 + .../org.openehr/problem_qualifier.v2.yml | 11 +- 13 files changed, 2262 insertions(+), 1894 deletions(-) diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json index 5db02355..facfd571 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-1-diagnose-1.json @@ -266,6 +266,26 @@ "rm_version": "1.0.4" }, "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" + }, { "_type": "ELEMENT", "name": { diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json index c172ba96..53b479ea 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2019-05-14T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2019-05-14T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I18412", - "preferred_term" : "Migräne" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "37796009", - "preferred_term" : "Migraine (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "G43.9" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I18412", + "preferred_term": "Migräne" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "37796009", + "preferred_term": "Migraine (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "G43.9" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Vascular structure of head (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "281231009" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Vascular structure of head (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "281231009" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Migräne, nicht näher bezeichnet" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Migräne, nicht näher bezeichnet" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json index 5cee10a6..077c0485 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-2-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2024-03-02T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2024-03-02T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I30011", - "preferred_term" : "Bösartige Neubildung des Lungenoberlappens" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "254637007", - "preferred_term" : "Non-small cell lung cancer (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "C34.1" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I30011", + "preferred_term": "Bösartige Neubildung des Lungenoberlappens" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "254637007", + "preferred_term": "Non-small cell lung cancer (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "C34.1" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Structure of upper lobe of lung (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "45653009" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Structure of upper lobe of lung (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "45653009" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Bösartige Neubildung: Oberlappen-Bronchus" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Bösartige Neubildung: Oberlappen-Bronchus" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json index e21be7b4..393db4f8 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-3-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2022-04-02T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2022-04-02T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I29975", - "preferred_term" : "Bösartige anorektale Neubildung" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "447886005", - "preferred_term" : "Adenocarcinoma of anorectum (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "C21.8" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I29975", + "preferred_term": "Bösartige anorektale Neubildung" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "447886005", + "preferred_term": "Adenocarcinoma of anorectum (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "C21.8" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Structure of anus and/or rectum (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "281088000" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Structure of anus and/or rectum (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "281088000" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Bösartige anorektale Neubildung" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Bösartige anorektale Neubildung" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json index 97ae35b7..5635c787 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-4-diagnose-1.json @@ -1,189 +1,218 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2022-11-30T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2022-11-30T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "C16.9" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "C16.9" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Bösartige Neubildung des Magens nicht näher bezeichnet" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Bösartige Neubildung des Magens nicht näher bezeichnet" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json index 263a10a2..5c5956ae 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-5-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2023-07-10T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2023-07-10T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I133980", - "preferred_term" : "Endometriose des Ovars" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "129103003", - "preferred_term" : "Endometriosis (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "N80.1" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I133980", + "preferred_term": "Endometriose des Ovars" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "129103003", + "preferred_term": "Endometriosis (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "N80.1" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Ovarian structure (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "15497006" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Ovarian structure (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "15497006" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Endometriose des Ovars" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Endometriose des Ovars" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json index ca7f5097..de4a4982 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-6-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2022-03-12T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2022-03-12T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I30016", - "preferred_term" : "Chronische Gastritis" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "4556007", - "preferred_term" : "Gastritis (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "K29.5" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I30016", + "preferred_term": "Chronische Gastritis" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "4556007", + "preferred_term": "Gastritis (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "K29.5" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Stomach structure (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "69695003" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Stomach structure (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "69695003" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Chronische Gastritis, nicht näher bezeichnet" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Chronische Gastritis, nicht näher bezeichnet" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json index 3de21f13..87a94425 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-7-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2024-01-08T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2024-01-08T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I25780", - "preferred_term" : "Akute Bronchitis" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "10509002", - "preferred_term" : "Acute bronchitis (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "J20.9" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I25780", + "preferred_term": "Akute Bronchitis" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "10509002", + "preferred_term": "Acute bronchitis (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "J20.9" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Bronchial structure (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "955009" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Bronchial structure (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "955009" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Akute Bronchitis, nicht näher bezeichnet" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Akute Bronchitis, nicht näher bezeichnet" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json index 2b06cd74..95fc144b 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-8-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2023-11-10T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2023-11-10T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I26852", - "preferred_term" : "Chronische ischämische Herzkrankheit" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "413838009", - "preferred_term" : "Chronic ischemic heart disease (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "I25.9" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I26852", + "preferred_term": "Chronische ischämische Herzkrankheit" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "413838009", + "preferred_term": "Chronic ischemic heart disease (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "I25.9" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Heart structure (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "80891009" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Heart structure (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "80891009" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Chronische ischämische Herzkrankheit, nicht näher bezeichnet" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Chronische ischämische Herzkrankheit, nicht näher bezeichnet" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json index 0668da27..0f9b8243 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json @@ -1,247 +1,282 @@ { - "_type" : "COMPOSITION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" + "_type": "COMPOSITION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-COMPOSITION.report.v1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-COMPOSITION.report.v1" }, - "template_id" : { - "value" : "KDS_Diagnose" + "template_id": { + "value": "KDS_Diagnose" }, - "rm_version" : "1.0.4" + "rm_version": "1.0.4" }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" }, - "code_string" : "de" + "code_string": "de" }, - "territory" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_3166-1" + "territory": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_3166-1" }, - "code_string" : "DE" + "code_string": "DE" }, - "category" : { - "_type" : "DV_CODED_TEXT", - "value" : "event", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "category": { + "_type": "DV_CODED_TEXT", + "value": "event", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "433" + "code_string": "433" } }, - "composer" : { - "_type" : "PARTY_SELF" + "composer": { + "_type": "PARTY_SELF" }, - "context" : { - "_type" : "EVENT_CONTEXT", - "start_time" : { - "_type" : "DV_DATE_TIME", - "value" : "2024-02-20T00:00:00" + "context": { + "_type": "EVENT_CONTEXT", + "start_time": { + "_type": "DV_DATE_TIME", + "value": "2024-02-20T00:00:00" }, - "setting" : { - "_type" : "DV_CODED_TEXT", - "value" : "other care", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "openehr" + "setting": { + "_type": "DV_CODED_TEXT", + "value": "other care", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "openehr" }, - "code_string" : "238" + "code_string": "238" } } }, - "content" : [ { - "_type" : "EVALUATION", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnose" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + "content": [ + { + "_type": "EVALUATION", + "name": { + "_type": "DV_TEXT", + "value": "Diagnose" }, - "rm_version" : "1.0.4" - }, - "language" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "ISO_639-1" + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + }, + "rm_version": "1.0.4" }, - "code_string" : "de" - }, - "encoding" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "IANA_character-sets" + "language": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "ISO_639-1" + }, + "code_string": "de" }, - "code_string" : "UTF-8" - }, - "subject" : { - "_type" : "PARTY_SELF" - }, - "data" : { - "_type" : "ITEM_TREE", - "name" : { - "_type" : "DV_TEXT", - "value" : "Structure" + "encoding": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "IANA_character-sets" + }, + "code_string": "UTF-8" + }, + "subject": { + "_type": "PARTY_SELF" }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Kodierte Diagnose" + "data": { + "_type": "ITEM_TREE", + "name": { + "_type": "DV_TEXT", + "value": "Structure" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "mappings" : [ { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/alpha-id" - }, - "code_string" : "I20743", - "preferred_term" : "Ovarialzyste" - } - }, { - "_type" : "TERM_MAPPING", - "match" : "?", - "target" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" - }, - "code_string" : "79883001", - "preferred_term" : "Cyst of ovary (disorder)" - } - } ], - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Kodierte Diagnose" }, - "code_string" : "N83.2" - } - }, - "archetype_node_id" : "at0002" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Anatomische Lokalisation" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Name der Körperstelle" + "value": { + "_type": "DV_CODED_TEXT", + "mappings": [ + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" + }, + "code_string": "I20743", + "preferred_term": "Ovarialzyste" + } + }, + { + "_type": "TERM_MAPPING", + "match": "?", + "target": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "79883001", + "preferred_term": "Cyst of ovary (disorder)" + } + } + ], + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" + }, + "code_string": "N83.2" + } + }, + "archetype_node_id": "at0002" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Ovarian structure (body structure)", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://snomed.info/sct" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Anatomische Lokalisation" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "code_string" : "15497006" - } - }, - "archetype_node_id" : "at0001" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.anatomical_location.v1" - }, { - "_type" : "CLUSTER", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" - }, - "archetype_details" : { - "archetype_id" : { - "value" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, - "rm_version" : "1.0.4" - }, - "items" : [ { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Klinischer Status" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Name der Körperstelle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Ovarian structure (body structure)", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://snomed.info/sct" + }, + "code_string": "15497006" + } + }, + "archetype_node_id": "at0001" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.anatomical_location.v1" }, - "value" : { - "_type" : "DV_CODED_TEXT", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "http://terminology.hl7.org/CodeSystem/condition-clinical" + { + "_type": "CLUSTER", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "archetype_details": { + "archetype_id": { + "value": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "code_string" : "active" - } - }, - "archetype_node_id" : "at0003" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoserolle" - }, - "value" : { - "_type" : "DV_CODED_TEXT", - "value" : "Hauptdiagnose", - "defining_code" : { - "_type" : "CODE_PHRASE", - "terminology_id" : { - "_type" : "TERMINOLOGY_ID", - "value" : "local" + "rm_version": "1.0.4" + }, + "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" }, - "code_string" : "at0064" - } + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Klinischer Status" + }, + "value": { + "_type": "DV_CODED_TEXT", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" + }, + "code_string": "active" + } + }, + "archetype_node_id": "at0003" + }, + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoserolle" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Hauptdiagnose", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0064" + } + }, + "archetype_node_id": "at0063" + } + ], + "archetype_node_id": "openEHR-EHR-CLUSTER.problem_qualifier.v2" }, - "archetype_node_id" : "at0063" - } ], - "archetype_node_id" : "openEHR-EHR-CLUSTER.problem_qualifier.v2" - }, { - "_type" : "ELEMENT", - "name" : { - "_type" : "DV_TEXT", - "value" : "Diagnoseerläuterung" - }, - "value" : { - "_type" : "DV_TEXT", - "value" : "Sonstige und nicht näher bezeichnete Ovarialzysten" - }, - "archetype_node_id" : "at0069" - } ], - "archetype_node_id" : "at0001" - }, - "archetype_node_id" : "openEHR-EHR-EVALUATION.problem_diagnosis.v1" - } ], - "archetype_node_id" : "openEHR-EHR-COMPOSITION.report.v1" + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnoseerläuterung" + }, + "value": { + "_type": "DV_TEXT", + "value": "Sonstige und nicht näher bezeichnete Ovarialzysten" + }, + "archetype_node_id": "at0069" + } + ], + "archetype_node_id": "at0001" + }, + "archetype_node_id": "openEHR-EHR-EVALUATION.problem_diagnosis.v1" + } + ], + "archetype_node_id": "openEHR-EHR-COMPOSITION.report.v1" } \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json index 6b787f45..39ca593f 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json @@ -434,6 +434,26 @@ "rm_version": "1.0.4" }, "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" + }, { "_type": "ELEMENT", "name": { diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json index 16e71ce5..b11f4211 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json @@ -422,6 +422,26 @@ "rm_version": "1.0.4" }, "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" + }, { "_type": "ELEMENT", "name": { diff --git a/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml b/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml index ea23f8a6..a4bf2ea6 100644 --- a/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml +++ b/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml @@ -10,7 +10,7 @@ spec: archetype: openEHR-EHR-CLUSTER.problem_qualifier.v2 revision: 2.0.1 fhirConfig: - structureDefinition: http://hl7.org/fhir/StructureDefinition/Coding + structureDefinition: http://hl7.org/fhir/StructureDefinition/BackboneElement mappings: - name: "statusCoded" @@ -31,9 +31,8 @@ mappings: value: "at0017" - path: "value" value: "Working" - fhirCondition: - targetRoot: "$fhirRoot" + targetRoot: "$resource.verificationStatus.coding" targetAttribute: "code" operator: "one of" criteria: "provisional" @@ -60,7 +59,7 @@ mappings: - path: "value" value: "Working" fhirCondition: - targetRoot: "$fhirRoot" + targetRoot: "$resource.verificationStatus.coding" targetAttribute: "code" operator: "one of" criteria: "differential" @@ -114,7 +113,7 @@ mappings: - path: "value" value: "Festgestellt" fhirCondition: - targetRoot: "$fhirRoot" + targetRoot: "$resource.verificationStatus.coding" targetAttribute: "code" operator: "one of" criteria: "confirmed" @@ -141,7 +140,7 @@ mappings: - path: "value" value: "Refuted" fhirCondition: - targetRoot: "$fhirRoot" + targetRoot: "$resource.verificationStatus.coding" targetAttribute: "code" operator: "one of" criteria: "refuted" From 1a62ce83e72e7477d1be2546978ddca4ec66f5a4 Mon Sep 17 00:00:00 2001 From: Severin Date: Mon, 26 Jan 2026 18:20:58 +0100 Subject: [PATCH 5/5] finished Diagnosis test --- .../kds/diagnose/DiagnoseToFHIRTest.java | 28 +- .../kds/diagnose/DiagnoseToOpenEHRTest.java | 14 +- ...ii-exa-test-data-patient-1-diagnose-1.json | 9 + ...i-exa-test-data-patient-10-diagnose-1.json | 41 +- ...ii-exa-test-data-patient-2-diagnose-1.json | 3 +- ...ii-exa-test-data-patient-3-diagnose-1.json | 43 +- ...ii-exa-test-data-patient-4-diagnose-1.json | 37 +- ...ii-exa-test-data-patient-5-diagnose-1.json | 49 +- ...ii-exa-test-data-patient-6-diagnose-1.json | 43 +- ...ii-exa-test-data-patient-7-diagnose-1.json | 43 +- ...ii-exa-test-data-patient-8-diagnose-1.json | 43 +- ...ii-exa-test-data-patient-9-diagnose-1.json | 43 +- .../toFHIR/output/KDS_Diagnose_bundle.json | 214 ++++++++ .../output/KDS_Diagnose_bundle_whole.json | 472 ++++++++++++++++++ .../toOpenEHR/input/KDS_Diagnose_bundle.json | 10 +- .../input/KDS_Diagnose_bundle_whole.json | 70 +-- .../KDS_Diagnose_Composition_bundle.json | 8 +- ...KDS_Diagnose_Composition_bundle_whole.json | 64 ++- .../org.openehr/problem_qualifier.v2.yml | 10 +- 19 files changed, 876 insertions(+), 368 deletions(-) create mode 100644 src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle.json create mode 100644 src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle_whole.json diff --git a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java index 7dc4b436..c3a73050 100644 --- a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java +++ b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToFHIRTest.java @@ -25,6 +25,7 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Type; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -51,7 +52,7 @@ public class DiagnoseToFHIRTest extends KdsTest { final String OPENEHR_COMPOSITION_9 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-9-diagnose-1.json"; final String OPENEHR_COMPOSITION_10 = "/kds/diagnose/toOpenEHR/output/Composition-mii-exa-test-data-patient-10-diagnose-1.json"; //OUTPUT - final String BUNDLE = "/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle_whole.json"; + final String BUNDLE_MULTIPLE = "/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle_whole.json"; final String BUNDLE_SINGLE = "/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle.json"; final String FHIR_CONDITION_1 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json"; final String FHIR_CONDITION_2 = "/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json"; @@ -75,6 +76,29 @@ public void prepareState() { webTemplate = new OPTParser(operationaltemplate).parse(); } + + @SneakyThrows + @Test + public void assertToFHIRBundle(){ + Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(COMPOSITION_SINGLE), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, BUNDLE_SINGLE); + + + } + + + @SneakyThrows + @Test + @Ignore // Needs major file clean up + public void assertToFHIRBundleWhole(){ + Composition composition = JacksonUtil.getObjectMapper().readValue(getFile(COMPOSITION_MULTIPLE), Composition.class); + final Bundle bundle = openEhrToFhir.compositionToFhir(context, composition, operationaltemplate); + standardsAsserter.assertBundle(bundle, BUNDLE_MULTIPLE); + + + } + @SneakyThrows @Test public void assertToFHIR1(){ @@ -168,7 +192,7 @@ public void assertToFHIR10(){ private void assertCondition(final Condition condition, final boolean second) { // - name: "contextStartTime" final String expectedTime = second ? "2023-02-03T04:05:06+01:00" : "2022-02-03T04:05:06+01:00"; -// Assert.assertEquals(expectedTime, condition.getRecordedDateElement().getValueAsString()); +// Assert.assertEquals(expectedTime, condition.getRecordedDateElssssement().getValueAsString()); // - name: "fallIdentifikationIdentifier" diff --git a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToOpenEHRTest.java b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToOpenEHRTest.java index 09b0aa9b..05a757d0 100644 --- a/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToOpenEHRTest.java +++ b/src/test/java/com/medblocks/openfhir/kds/diagnose/DiagnoseToOpenEHRTest.java @@ -288,15 +288,15 @@ public void toOpenEhr_single() { Assert.assertEquals("2024-12-24T16:13:43", jsonObject.get("diagnose/diagnose:0/klinisch_relevanter_zeitraum_zeitpunkt_des_auftretens") .getAsString()); - Assert.assertEquals("424144002", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); + Assert.assertEquals("41847000", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); Assert.assertEquals("http://snomed.info/sct", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|terminology").getAsString()); - Assert.assertEquals("Start of adulthood phase", + Assert.assertEquals("Adulthood", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|value").getAsString()); - Assert.assertEquals("367640001", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|code").getAsString()); + Assert.assertEquals("271872005", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|code").getAsString()); Assert.assertEquals("http://snomed.info/sct", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|terminology").getAsString()); - Assert.assertEquals("End of middle age phase", + Assert.assertEquals("Old age", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|value").getAsString()); Assert.assertEquals("24484000", jsonObject.get("diagnose/diagnose:0/schweregrad|code").getAsString()); Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-severity", @@ -347,15 +347,15 @@ public JsonObject toOpenEhr() { // jsonObject.get("diagnose/diagnose:0/freitextbeschreibung").getAsString()); Assert.assertEquals("Patient confirmed for secondary malignant neoplasm of lymph node.", jsonObject.get("diagnose/diagnose:0/diagnoseerläuterung").getAsString()); - Assert.assertEquals("424144002", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); + Assert.assertEquals("41847000", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|code").getAsString()); Assert.assertEquals("http://snomed.info/sct", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|terminology").getAsString()); - Assert.assertEquals("Start of adulthood phase", + Assert.assertEquals("Adulthood", jsonObject.get("diagnose/diagnose:0/lebensphase/beginn|value").getAsString()); Assert.assertEquals("367640001", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|code").getAsString()); Assert.assertEquals("http://snomed.info/sct", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|terminology").getAsString()); - Assert.assertEquals("End of middle age phase", + Assert.assertEquals("Old age", jsonObject.get("diagnose/diagnose:0/lebensphase/ende|value").getAsString()); Assert.assertEquals("24484000", jsonObject.get("diagnose/diagnose:0/schweregrad|code").getAsString()); Assert.assertEquals("http://terminology.hl7.org/CodeSystem/condition-severity", diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json index b2927af1..5f040261 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-1-diagnose-1.json @@ -62,6 +62,15 @@ } ] }, + "verificationStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "code": "confirmed", + "display": "Confirmed" + } + ] + }, "bodySite": [ { "coding": [ diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-10-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-10-diagnose-1.json index 5bb562dc..4ded1e81 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-10-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-10-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-10", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T14:00:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-10-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-10-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -39,18 +15,15 @@ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", "code": "G43.9", - "version": "2019" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I18412", - "version": "2019", "display": "Migräne" }, { "system": "http://snomed.info/sct", "code": "37796009", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Migraine (disorder)" } ] @@ -66,10 +39,10 @@ { "system": "http://snomed.info/sct", "code": "281231009", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Vascular structure of head (body structure)" } - ] + ], + "text": "Vascular structure of head (body structure)" } ], "clinicalStatus": { @@ -84,14 +57,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-10" - }, - "recordedDate": "2019-05-14" + "recordedDate": "2019-05-14T00:00:00+02:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json index 245bebd3..c938bb90 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-2-diagnose-1.json @@ -56,8 +56,9 @@ "verificationStatus": { "coding": [ { + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "display": "Confirmed" } ] }, diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-3-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-3-diagnose-1.json index 0640e64d..669db905 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-3-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-3-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-3", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:51:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-3-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-3-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,19 +14,16 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "C21.8", - "version": "2022" + "code": "C21.8" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I29975", - "version": "2022", "display": "Bösartige anorektale Neubildung" }, { "system": "http://snomed.info/sct", "code": "447886005", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Adenocarcinoma of anorectum (disorder)" } ] @@ -66,10 +39,10 @@ { "system": "http://snomed.info/sct", "code": "281088000", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Structure of anus and/or rectum (body structure)" } - ] + ], + "text": "Structure of anus and/or rectum (body structure)" } ], "clinicalStatus": { @@ -84,14 +57,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-3" - }, - "recordedDate": "2022-04-02" + "recordedDate": "2022-04-02T00:00:00+02:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-4-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-4-diagnose-1.json index 15b3eac4..000216fb 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-4-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-4-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-4", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:54:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-4-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-4-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,8 +14,7 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "C16.9", - "version": "2022" + "code": "C16.9" } ] }, @@ -60,14 +35,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-4" - }, - "recordedDate": "2022-11-30" + "recordedDate": "2022-11-30T00:00:00+01:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-5-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-5-diagnose-1.json index 296975cc..528b11a1 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-5-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-5-diagnose-1.json @@ -1,35 +1,10 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-5", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:55:00+02:00", - "entry": [ - { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-5-diagnose-1", + "type": "collection", + "entry": [{ "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-5-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,19 +13,15 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "N80.1", - "version": "2023" + "code": "N80.1" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", - "code": "I133980", - "version": "2023", - "display": "Endometriose des Ovars" + "code": "I133980" }, { "system": "http://snomed.info/sct", "code": "129103003", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Endometriosis (disorder)" } ] @@ -66,10 +37,10 @@ { "system": "http://snomed.info/sct", "code": "15497006", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Ovarian structure (body structure)" } - ] + ], + "text": "Ovarian structure (body structure)" } ], "clinicalStatus": { @@ -84,14 +55,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-5" - }, - "recordedDate": "2023-07-10" + "recordedDate": "2023-07-10T00:00:00+02:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-6-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-6-diagnose-1.json index 14f9a6f0..577c740a 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-6-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-6-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-6", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:56:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-6-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-6-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,19 +14,16 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "K29.5", - "version": "2022" + "code": "K29.5" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I30016", - "version": "2022", "display": "Chronische Gastritis" }, { "system": "http://snomed.info/sct", "code": "4556007", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Gastritis (disorder)" } ] @@ -66,10 +39,10 @@ { "system": "http://snomed.info/sct", "code": "69695003", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Stomach structure (body structure)" } - ] + ], + "text": "Stomach structure (body structure)" } ], "clinicalStatus": { @@ -84,14 +57,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-6" - }, - "recordedDate": "2022-03-12" + "recordedDate": "2022-03-12T00:00:00+01:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-7-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-7-diagnose-1.json index e9c6ca4e..3907b89f 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-7-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-7-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-7", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:57:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-7-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-7-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,19 +14,16 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "J20.9", - "version": "2024" + "code": "J20.9" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I25780", - "version": "2024", "display": "Akute Bronchitis" }, { "system": "http://snomed.info/sct", "code": "10509002", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Acute bronchitis (disorder)" } ] @@ -66,10 +39,10 @@ { "system": "http://snomed.info/sct", "code": "955009", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Bronchial structure (body structure)" } - ] + ], + "text": "Bronchial structure (body structure)" } ], "clinicalStatus": { @@ -84,14 +57,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-7" - }, - "recordedDate": "2024-01-08" + "recordedDate": "2024-01-08T00:00:00+01:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-8-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-8-diagnose-1.json index 0678da28..5e1a0a29 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-8-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-8-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-8", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:58:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-8-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-8-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,19 +14,16 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "I25.9", - "version": "2023" + "code": "I25.9" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I26852", - "version": "2023", "display": "Chronische ischämische Herzkrankheit" }, { "system": "http://snomed.info/sct", "code": "413838009", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Chronic ischemic heart disease (disorder)" } ] @@ -66,10 +39,10 @@ { "system": "http://snomed.info/sct", "code": "80891009", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Heart structure (body structure)" } - ] + ], + "text": "Heart structure (body structure)" } ], "clinicalStatus": { @@ -84,14 +57,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-8" - }, - "recordedDate": "2023-11-10" + "recordedDate": "2023-11-10T00:00:00+01:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-9-diagnose-1.json b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-9-diagnose-1.json index 74fa0fb5..cd8a7287 100644 --- a/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-9-diagnose-1.json +++ b/src/test/resources/kds/diagnose/toFHIR/output/Condition-mii-exa-test-data-patient-9-diagnose-1.json @@ -1,35 +1,11 @@ { "resourceType": "Bundle", - "id": "mii-exa-test-data-bundle-pat-9", - "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ] - }, - "type": "transaction", - "timestamp": "2025-06-18T13:59:00+02:00", + "type": "collection", "entry": [ { - "request": { - "method": "POST", - "url": "Condition" - }, - "fullUrl": "https://www.medizininformatik-initiative.de/Condition/mii-exa-test-data-patient-9-diagnose-1", "resource": { "resourceType": "Condition", - "id": "mii-exa-test-data-patient-9-diagnose-1", "meta": { - "security": [ - { - "code": "HTEST", - "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason", - "display": "test health data" - } - ], "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" ] @@ -38,19 +14,16 @@ "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "N83.2", - "version": "2024" + "code": "N83.2" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", "code": "I20743", - "version": "2024", "display": "Ovarialzyste" }, { "system": "http://snomed.info/sct", "code": "79883001", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Cyst of ovary (disorder)" } ] @@ -66,10 +39,10 @@ { "system": "http://snomed.info/sct", "code": "15497006", - "version": "http://snomed.info/sct/900000000000207008/version/20230731", "display": "Ovarian structure (body structure)" } - ] + ], + "text": "Ovarian structure (body structure)" } ], "clinicalStatus": { @@ -84,14 +57,12 @@ "coding": [ { "code": "confirmed", - "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status" + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "display": "Confirmed" } ] }, - "subject": { - "reference": "Patient/mii-exa-test-data-patient-9" - }, - "recordedDate": "2024-02-20" + "recordedDate": "2024-02-20T00:00:00+01:00" } } ] diff --git a/src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle.json b/src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle.json new file mode 100644 index 00000000..5a240924 --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle.json @@ -0,0 +1,214 @@ +{ + "resourceType": "Bundle", + "type": "collection", + "entry": [ + { + "resource": { + "resourceType": "Condition", + "meta": { + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "contained": [ + { + "resourceType": "Encounter", + "id": "1", + "identifier": [ + { + "type": { + "coding": [ + { + "code": "VN" + } + ] + }, + "value": "encounter-id-1245" + } + ] + } + ], + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/condition-related", + "valueReference": { + "reference": "Condition/reference-condition", + "type": "Condition", + "identifier": { + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "MR", + "display": "Medical record number" + } + ], + "text": "Medical record number" + }, + "system": "http://hospital.smarthealthit.org/conditions", + "value": "CON123456", + "period": { + "start": "1993-09-08", + "end": "1993-12-13" + } + }, + "display": "Related Condition" + } + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/condition-assertedDate", + "valueDateTime": "2025-02-03T04:05:06Z" + } + ], + "clinicalStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical", + "code": "active", + "display": "Active" + } + ], + "text": "Active" + }, + "verificationStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "code": "confirmed", + "display": "Confirmed" + } + ] + }, + "severity": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-severity", + "code": "24484000", + "display": "Severe" + } + ], + "text": "Severe" + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C34.1", + "display": "Malignant neoplasm of the upper lobe of the lung", + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", + "valueCoding": { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm-mc", + "code": "†", + "display": "Primary code in multiple coding" + } + }, + { + "url": "http://fhir.de/StructureDefinition/seitenlokalisation", + "valueCoding": { + "system": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation", + "code": "L", + "display": "Left side" + } + }, + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", + "valueCoding": { + "system": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", + "code": "G", + "display": "Confirmed diagnosis" + } + } + ] + }, + { + "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", + "code": "C77.0", + "display": "Malignant neoplasm of lymph nodes" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "057E3", + "display": "secondary malignant neoplasm of lymph nodes" + }, + { + "system": "http://www.orpha.net", + "code": "1777", + "display": "lung cancer associated with hereditary syndromes" + }, + { + "system": "http://snomed.info/sct", + "code": "128462008", + "display": "Secondary malignant neoplasm of lymph node" + } + ], + "text": "Secondary malignant neoplasm of lymph node" + }, + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "321667001", + "display": "Respiratory tract, Upper lobe, bronchus or lung" + }, + { + "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", + "code": "C34.1", + "display": "Upper lobe, bronchus or lung" + } + ], + "text": "Respiratory tract, Upper lobe, bronchus or lung" + } + ], + "encounter": { + "reference": "#1" + }, + "onsetPeriod": { + "start": "2024-12-24T16:13:43+01:00", + "_start": { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/lebensphase", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "41847000", + "display": "Adulthood" + } + ], + "text": "Adulthood" + } + } + ] + }, + "_end": { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/lebensphase", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "271872005", + "display": "Old age" + } + ], + "text": "Old age" + } + } + ] + } + }, + "recordedDate": "2022-02-03T01:00:00+01:00", + "note": [ + { + "text": "Patient confirmed for secondary malignant neoplasm of lymph node." + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle_whole.json b/src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle_whole.json new file mode 100644 index 00000000..1940a264 --- /dev/null +++ b/src/test/resources/kds/diagnose/toFHIR/output/KDS_Diagnose_bundle_whole.json @@ -0,0 +1,472 @@ +{ + "resourceType": "Bundle", + "type": "collection", + "entry": [ + { + "resource": { + "resourceType": "Condition", + "id": "reference-condition", + "contained": { + "resourceType": "Encounter", + "id": "2", + "identifier": [ + { + "type": { + "coding": [ + { + "code": "VN" + } + ] + }, + "value": "encounter-id-1245" + } + ] + }, + "identifier": [ + { + "system": "http://localhost:8888/fhir-bridge/fhir/identifiers/conditions", + "value": "COND-123456", + "use": "official", + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "MR", + "display": "Medical record number" + } + ], + "text": "Medical Record Number" + }, + "assigner": { + "display": "Example Hospital" + } + } + ], + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/condition-assertedDate", + "valueDateTime": "2125-02-03T05:05:06+01:00" + } + ], + "clinicalStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical", + "code": "active", + "display": "Active" + } + ], + "text": "active" + }, + "verificationStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "code": "confirmed", + "display": "Confirmed" + } + ], + "text": "confirmed" + }, + "severity": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "24484000", + "display": "Severe" + } + ], + "text": "Severe" + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C34.1", + "display": "Malignant neoplasm of upper lobe, bronchus or lung", + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", + "valueCoding": { + "system": "local", + "code": "*", + "display": "Primary code in multiple coding" + } + }, + { + "url": "http://fhir.de/StructureDefinition/seitenlokalisation", + "valueCoding": { + "system": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation", + "code": "B", + "display": "Beiderseits" + } + }, + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", + "valueCoding": { + "system": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", + "code": "V", + "display": "Verdacht auf Diagnose" + } + } + ] + }, + { + "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", + "code": "C34.1", + "display": "Malignant neoplasm of upper lobe, bronchus or lung" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "098H5", + "display": "Malignant neoplasm of upper lobe, bronchus or lung, unspecified" + }, + { + "system": "http://snomed.info/sct", + "code": "254626006", + "display": "Malignant neoplasm of the upper lobe of lung" + }, + { + "system": "http://www.orpha.net", + "code": "830", + "display": "Malignant neoplasm of upper lobe, bronchus or lung" + } + ], + "text": "Malignant neoplasm of upper lobe, bronchus or lung" + }, + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "321667001", + "display": "Respiratory tract, Upper lobe, bronchus or lung" + }, + { + "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", + "code": "C34.1", + "display": "Upper lobe, bronchus or lung" + } + ], + "text": "Respiratory tract, Upper lobe, bronchus or lung" + } + ], + "encounter": { + "reference": "#2" + }, + "onsetPeriod": { + "start": { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/lebensphase", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "424144002", + "display": "Adulthood" + } + ], + "text": "Adulthood" + } + } + ] + }, + "end": { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/lebensphase", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "367640001", + "display": "Middle age" + } + ], + "text": "End of middle age phase" + } + } + ] + } + }, + "recordedDate": "2027-05-02T00:00:00Z", + "stage": [ + { + "summary": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "258219007", + "display": "Stage 2" + } + ], + "text": "Stage 2" + } + } + ], + "evidence": [ + { + "code": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "164729004", + "display": "Blood pressure measurement" + } + ], + "text": "Blood pressure measurement" + } + ] + } + ], + "note": [ + { + "text": "The patient has a history of high blood pressure, now presenting with severe hypertension." + } + ] + } + }, + { + "resource": { + "resourceType": "Condition", + "meta": { + "profile": [ + "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose" + ] + }, + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/condition-related", + "valueReference": { + "reference": "#1" + } + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/condition-assertedDate", + "valueDateTime": "2025-02-03T04:05:06Z" + } + ], + "identifier": [ + { + "system": "http://localhost:8888/fhir-bridge/fhir/identifiers/conditions", + "value": "1234567890", + "use": "official", + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "MR", + "display": "Medical record number" + } + ], + "text": "Medical Record Number" + }, + "assigner": { + "display": "Example Hospital" + }, + "period": { + "start": "2023-01-01", + "end": "2024-01-01" + } + } + ], + "clinicalStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-clinical", + "code": "active", + "display": "Active" + } + ], + "text": "active" + }, + "verificationStatus": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", + "code": "confirmed", + "display": "Confirmed" + } + ], + "text": "Confirmed" + }, + "category": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-category", + "code": "problem-list-item", + "display": "Problem List Item" + } + ], + "text": "Problem List Item" + } + ], + "severity": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/condition-severity", + "code": "24484000", + "display": "Severe" + } + ], + "text": "Severe" + }, + "code": { + "coding": [ + { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C34.1", + "display": "Malignant neoplasm of the upper lobe of the lung", + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", + "valueCoding": { + "system": "local", + "code": "†", + "display": "Primary code in multiple coding" + } + }, + { + "url": "http://fhir.de/StructureDefinition/seitenlokalisation", + "valueCoding": { + "system": "http://fhir.de/CodeSystem/dimdi/seitenlokalisation", + "code": "L", + "display": "Left side" + } + }, + { + "url": "http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit", + "valueCoding": { + "system": "http://fhir.de/CodeSystem/dimdi/diagnosesicherheit", + "code": "G", + "display": "Confirmed diagnosis" + } + } + ] + }, + { + "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", + "code": "C77.0", + "display": "Malignant neoplasm of lymph nodes" + }, + { + "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", + "code": "057E3", + "display": "secondary malignant neoplasm of lymph nodes" + }, + { + "system": "http://www.orpha.net", + "code": "1777", + "display": "lung cancer associated with hereditary syndromes" + }, + { + "system": "http://snomed.info/sct", + "code": "128462008", + "display": "Secondary malignant neoplasm of lymph node" + } + ], + "text": "Secondary malignant neoplasm of lymph node" + }, + "bodySite": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "321667001", + "display": "Respiratory tract" + }, + { + "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", + "code": "C34.1", + "display": "Upper lobe, bronchus or lung" + } + ], + "text": "Respiratory tract, Upper lobe, bronchus or lung" + } + ], + "encounter": { + "reference": "Encounter/encounter-12345", + "display": "Inpatient Encounter for Asthma", + "type": "Encounter", + "identifier": { + "system": "http://hospital.smarthealthit.org/encounters", + "value": "ENC123456", + "use": "official", + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "VN", + "display": "Visit Number" + } + ], + "text": "Visit Number" + }, + "assigner": { + "display": "Example Hospital" + }, + "period": { + "start": "2024-01-01T08:00:00Z", + "end": "2024-01-01T10:00:00Z" + } + } + }, + "subject": { + "reference": "/Patient?identifier=urn:ietf:rfc:4122|07f602e0-579e-4fe3-95af-381728bf0d49", + "identifier": { + "system": "urn:ietf:rfc:4122", + "value": "4c7d0173-7378-42b2-a9fa-64cd2664674f" + } + }, + "onsetPeriod": { + "start": { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/lebensphase", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "424144002", + "display": "Adulthood" + } + ], + "text": "Adulthood" + } + } + ] + }, + "end": { + "extension": [ + { + "url": "http://fhir.de/StructureDefinition/lebensphase", + "valueCodeableConcept": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "367640001", + "display": "Middle age" + } + ], + "text": "End of middle age phase" + } + } + ] + } + }, + "onsetDateTime": "2024-02-08T00:00:00Z", + "recordedDate": "2022-02-03T00:00:00Z", + "note": [ + { + "text": "Patient confirmed for secondary malignant neoplasm of lymph node.", + "time": "2024-02-09T12:00:00Z" + } + ] + } + } + + ] +} \ No newline at end of file diff --git a/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle.json b/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle.json index bd98b3e9..8400e43b 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle.json @@ -231,11 +231,11 @@ "coding": [ { "system": "http://snomed.info/sct", - "code": "424144002", + "code": "41847000", "display": "Adulthood" } ], - "text": "Start of adulthood phase" + "text": "Adulthood" } } ] @@ -248,11 +248,11 @@ "coding": [ { "system": "http://snomed.info/sct", - "code": "367640001", - "display": "Middle age" + "code": "271872005", + "display": "Old age" } ], - "text": "End of middle age phase" + "text": "Old age" } } ] diff --git a/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json b/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json index 50921a5b..35c42ef5 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/input/KDS_Diagnose_bundle_whole.json @@ -235,7 +235,7 @@ "display": "Adulthood" } ], - "text": "Start of adulthood phase" + "text": "Adulthood" } } ] @@ -306,50 +306,50 @@ "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/condition-clinical", - "code": "ref_active", - "display": "ref_Active" + "code": "active", + "display": "Active" } ], - "text": "ref_active" + "text": "active" }, "verificationStatus": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status", - "code": "ref_confirmed", - "display": "ref_Confirmed" + "code": "confirmed", + "display": "Confirmed" } ], - "text": "ref_confirmed" + "text": "confirmed" }, "category": [ { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/condition-category", - "code": "ref_problem-list-item", - "display": "ref_Problem List Item" + "code": "problem-list-item", + "display": "Problem List Item" } ], - "text": "ref_Problem List Item" + "text": "Problem List Item" } ], "severity": { "coding": [ { "system": "http://snomed.info/sct", - "code": "ref_24484000", - "display": "ref_Severe" + "code": "24484000", + "display": "Severe" } ], - "text": "ref_Severe" + "text": "Severe" }, "code": { "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", - "code": "ref_C34.1", - "display": "ref_Malignant neoplasm of upper lobe, bronchus or lung", + "code": "C34.1", + "display": "Malignant neoplasm of upper lobe, bronchus or lung", "extension": [ { "url": "http://fhir.de/StructureDefinition/icd-10-gm-mehrfachcodierungs-kennzeichen", @@ -357,7 +357,7 @@ "system": "local", "code": "*", - "display": "ref_Primary code in multiple coding" + "display": "Primary code in multiple coding" }}, { @@ -381,23 +381,23 @@ }, { "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", - "code": "ref_C34.1", - "display": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + "code": "C34.1", + "display": "Malignant neoplasm of upper lobe, bronchus or lung" }, { "system": "http://fhir.de/CodeSystem/bfarm/alpha-id", - "code": "ref_098H5", - "display": "ref_Malignant neoplasm of upper lobe, bronchus or lung, unspecified" + "code": "098H5", + "display": "Malignant neoplasm of upper lobe, bronchus or lung, unspecified" }, { "system": "http://snomed.info/sct", - "code": "ref_254626006", - "display": "ref_Malignant neoplasm of the upper lobe of lung" + "code": "254626006", + "display": "Malignant neoplasm of the upper lobe of lung" }, { "system": "http://www.orpha.net", - "code": "ref_830", - "display": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + "code": "830", + "display": "Malignant neoplasm of upper lobe, bronchus or lung" } ], "text": "Malignant neoplasm of upper lobe, bronchus or lung" @@ -407,14 +407,14 @@ "coding": [ { "system": "http://snomed.info/sct", - "code": "ref_368209003", - "display": "ref_Entire cardiovascular system" + "code": "368209003", + "display": "Entire cardiovascular system" }, { "system": "http://terminology.hl7.org/CodeSystem/icd-o-3", "version": "2022", - "code": "ref_C34.1", - "display": "ref_Upper lobe, bronchus or lung" + "code": "C34.1", + "display": "Upper lobe, bronchus or lung" } ], "text": "Entire cardiovascular system" @@ -463,11 +463,11 @@ "coding": [ { "system": "http://snomed.info/sct", - "code": "ref_424144002", - "display": "ref_Adulthood" + "code": "424144002", + "display": "Adulthood" } ], - "text": "ref_Start of adulthood phase" + "text": "Adulthood" } } ] @@ -480,11 +480,11 @@ "coding": [ { "system": "http://snomed.info/sct", - "code": "ref_367640001", - "display": "ref_Middle age" + "code": "367640001", + "display": "Middle age" } ], - "text": "ref_End of middle age phase" + "text": "End of middle age phase" } } ] @@ -553,7 +553,7 @@ ], "note": [ { - "text": "ref_The patient has a history of high blood pressure, now presenting with severe hypertension." + "text": "The patient has a history of high blood pressure, now presenting with severe hypertension." } ] } diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json index 39ca593f..0cb361c3 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle.json @@ -350,14 +350,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "Start of adulthood phase", + "value": "Adulthood", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://snomed.info/sct" }, - "code_string": "424144002" + "code_string": "41847000" } }, "archetype_node_id": "at0001" @@ -370,14 +370,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "End of middle age phase", + "value": "Old age", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://snomed.info/sct" }, - "code_string": "367640001" + "code_string": "271872005" } }, "archetype_node_id": "at0002" diff --git a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json index b11f4211..4504307c 100644 --- a/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json +++ b/src/test/resources/kds/diagnose/toOpenEHR/output/KDS_Diagnose_Composition_bundle_whole.json @@ -338,7 +338,7 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "Start of adulthood phase", + "value": "Adulthood", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { @@ -579,8 +579,8 @@ "_type": "TERMINOLOGY_ID", "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" }, - "code_string": "ref_C34.1", - "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + "code_string": "C34.1", + "preferred_term": "Malignant neoplasm of upper lobe, bronchus or lung" } }, { @@ -592,8 +592,8 @@ "_type": "TERMINOLOGY_ID", "value": "http://fhir.de/CodeSystem/bfarm/alpha-id" }, - "code_string": "ref_098H5", - "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung, unspecified" + "code_string": "098H5", + "preferred_term": "Malignant neoplasm of upper lobe, bronchus or lung, unspecified" } }, { @@ -605,8 +605,8 @@ "_type": "TERMINOLOGY_ID", "value": "http://snomed.info/sct" }, - "code_string": "ref_254626006", - "preferred_term": "ref_Malignant neoplasm of the upper lobe of lung" + "code_string": "254626006", + "preferred_term": "Malignant neoplasm of the upper lobe of lung" } }, { @@ -618,8 +618,8 @@ "_type": "TERMINOLOGY_ID", "value": "http://www.orpha.net" }, - "code_string": "ref_830", - "preferred_term": "ref_Malignant neoplasm of upper lobe, bronchus or lung" + "code_string": "830", + "preferred_term": "Malignant neoplasm of upper lobe, bronchus or lung" } } ], @@ -629,7 +629,7 @@ "_type": "TERMINOLOGY_ID", "value": "http://fhir.de/CodeSystem/bfarm/icd-10-gm" }, - "code_string": "ref_C34.1" + "code_string": "C34.1" } }, "archetype_node_id": "at0002" @@ -666,8 +666,8 @@ "_type": "TERMINOLOGY_ID", "value": "http://terminology.hl7.org/CodeSystem/icd-o-3" }, - "code_string": "ref_C34.1", - "preferred_term": "ref_Upper lobe, bronchus or lung" + "code_string": "C34.1", + "preferred_term": "Upper lobe, bronchus or lung" } } ], @@ -677,7 +677,7 @@ "_type": "TERMINOLOGY_ID", "value": "http://snomed.info/sct" }, - "code_string": "ref_368209003" + "code_string": "368209003" } }, "archetype_node_id": "at0001" @@ -725,14 +725,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "ref_Severe", + "value": "Severe", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://snomed.info/sct" }, - "code_string": "ref_24484000" + "code_string": "24484000" } }, "archetype_node_id": "at0005" @@ -758,14 +758,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "ref_Start of adulthood phase", + "value": "Adulthood", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://snomed.info/sct" }, - "code_string": "ref_424144002" + "code_string": "424144002" } }, "archetype_node_id": "at0001" @@ -778,14 +778,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "ref_End of middle age phase", + "value": "End of middle age phase", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://snomed.info/sct" }, - "code_string": "ref_367640001" + "code_string": "367640001" } }, "archetype_node_id": "at0002" @@ -842,6 +842,26 @@ "rm_version": "1.0.4" }, "items": [ + { + "_type": "ELEMENT", + "name": { + "_type": "DV_TEXT", + "value": "Diagnosestatus" + }, + "value": { + "_type": "DV_CODED_TEXT", + "value": "Festgestellt", + "defining_code": { + "_type": "CODE_PHRASE", + "terminology_id": { + "_type": "TERMINOLOGY_ID", + "value": "local" + }, + "code_string": "at0018" + } + }, + "archetype_node_id": "at0004" + }, { "_type": "ELEMENT", "name": { @@ -850,14 +870,14 @@ }, "value": { "_type": "DV_CODED_TEXT", - "value": "ref_active", + "value": "active", "defining_code": { "_type": "CODE_PHRASE", "terminology_id": { "_type": "TERMINOLOGY_ID", "value": "http://terminology.hl7.org/CodeSystem/condition-clinical" }, - "code_string": "ref_active" + "code_string": "active" } }, "archetype_node_id": "at0003" @@ -913,7 +933,7 @@ }, "value": { "_type": "DV_TEXT", - "value": "ref_The patient has a history of high blood pressure, now presenting with severe hypertension." + "value": "The patient has a history of high blood pressure, now presenting with severe hypertension." }, "archetype_node_id": "at0069" } diff --git a/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml b/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml index a4bf2ea6..43c8c30d 100644 --- a/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml +++ b/src/test/resources/kds_new/model/cluster/org.openehr/problem_qualifier.v2.yml @@ -43,7 +43,7 @@ mappings: - path: "display" value: "Provisional" - path: "system" - value: "http://hl7.org/fhir/ValueSet/condition-ver-status" + value: "http://terminology.hl7.org/CodeSystem/condition-ver-status" openehrCondition: targetRoot: "$archetype" targetAttribute: "items[at0004]/defining_code/code_string" @@ -70,7 +70,7 @@ mappings: - path: "display" value: "Differential" - path: "system" - value: "http://hl7.org/fhir/ValueSet/condition-ver-status" + value: "http://terminology.hl7.org/CodeSystem/condition-ver-status" openehrCondition: targetRoot: "$archetype" targetAttribute: "items[at0004]/defining_code/code_string" @@ -97,7 +97,7 @@ mappings: - path: "display" value: "Unconfirmed" - path: "system" - value: "http://hl7.org/fhir/ValueSet/condition-ver-status" + value: "http://terminology.hl7.org/CodeSystem/condition-ver-status" openehrCondition: targetRoot: "$archetype" targetAttribute: "items[at0004]/defining_code/code_string" @@ -124,7 +124,7 @@ mappings: - path: "display" value: "Confirmed" - path: "system" - value: "http://hl7.org/fhir/ValueSet/condition-ver-status" + value: "http://terminology.hl7.org/CodeSystem/condition-ver-status" openehrCondition: targetRoot: "$archetype" targetAttribute: "items[at0004]/defining_code/code_string" @@ -151,7 +151,7 @@ mappings: - path: "display" value: "Refuted" - path: "system" - value: "http://hl7.org/fhir/ValueSet/condition-ver-status" + value: "http://terminology.hl7.org/CodeSystem/condition-ver-status" openehrCondition: targetRoot: "$archetype" targetAttribute: "items[at0004]/defining_code/code_string"