diff --git a/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/CdaMappingEngine.java b/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/CdaMappingEngine.java
index e058b3bc31f..5a588abd9cb 100644
--- a/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/CdaMappingEngine.java
+++ b/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/CdaMappingEngine.java
@@ -5,6 +5,7 @@
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r5.model.StructureMap;
import org.hl7.fhir.validation.ValidationEngine;
import ch.ahdis.matchbox.engine.cli.VersionUtil;
@@ -114,7 +115,6 @@ public CdaMappingEngine getEngineR4() throws FHIRException, IOException, URISynt
engine.getContext().setCanRunWithoutTerminology(true);
engine.getContext().setNoTerminologyServer(true);
engine.getContext().setPackageTracker(engine);
-
return engine;
}
diff --git a/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/MatchboxEngine.java b/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/MatchboxEngine.java
index 4645e6f8ade..e13620760a3 100644
--- a/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/MatchboxEngine.java
+++ b/matchbox-engine/src/main/java/ch/ahdis/matchbox/engine/MatchboxEngine.java
@@ -53,6 +53,7 @@
import org.hl7.fhir.r5.model.Narrative.NarrativeStatus;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureMap;
+import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.renderers.RendererFactory;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.utils.EOperationOutcome;
@@ -63,6 +64,7 @@
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
import org.hl7.fhir.utilities.ByteProvider;
import org.hl7.fhir.utilities.FhirPublication;
+import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.json.model.JsonObject;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
@@ -74,6 +76,7 @@
import org.hl7.fhir.validation.ValidationEngine;
import org.hl7.fhir.validation.instance.InstanceValidator;
+import ch.ahdis.matchbox.engine.MatchboxEngine.FilesystemPackageCacheMode;
import ch.ahdis.matchbox.engine.cli.VersionUtil;
import ch.ahdis.matchbox.mappinglanguage.MatchboxStructureMapUtilities;
import ch.ahdis.matchbox.mappinglanguage.TransformSupportServices;
@@ -187,6 +190,8 @@ public MatchboxEngine getEngineR4() throws MatchboxEngineCreationException {
engine.loadPackage(getClass().getResourceAsStream("/hl7.fhir.r4.core.tgz"));
engine.loadPackage(getClass().getResourceAsStream("/hl7.terminology#5.4.0.tgz"));
engine.loadPackage(getClass().getResourceAsStream("/hl7.fhir.uv.extensions.r4#1.0.0.tgz"));
+ removeStructureMaps(engine);
+ engine.loadPackage(getClass().getResourceAsStream("/hl7.fhir.uv.xver#0.1.0@bp.tgz"));
} catch (final IOException e) {
throw new IgLoadException(e);
}
@@ -209,6 +214,16 @@ public MatchboxEngine getEngineR4() throws MatchboxEngineCreationException {
return engine;
}
+ /**
+ * remove old StructureMaps from the context, especially from hl7.fhir.uv.extensions.r4#1.0.0 which are replaced by newer versions
+ * @param engine
+ */
+ public void removeStructureMaps(MatchboxEngine engine) {
+ for (StructureMap map : engine.getContext().fetchResourcesByType(StructureMap.class)) {
+ engine.getContext().dropResource(map);
+ }
+ }
+
/**
* Returns a FHIR R5 engine configured with hl7 terminology
*
@@ -226,6 +241,8 @@ public MatchboxEngine getEngineR5() throws MatchboxEngineCreationException {
engine.loadPackage(getClass().getResourceAsStream("/hl7.fhir.r5.core.tgz"));
engine.loadPackage(getClass().getResourceAsStream("/hl7.terminology#5.4.0.tgz"));
engine.loadPackage(getClass().getResourceAsStream("/hl7.fhir.uv.extensions#1.0.0.tgz"));
+ removeStructureMaps(engine);
+ engine.loadPackage(getClass().getResourceAsStream("/hl7.fhir.uv.xver#0.1.0@bp.tgz"));
} catch (final IOException e) {
throw new IgLoadException(e);
}
@@ -357,15 +374,25 @@ public Resource transformToFhir(String input, boolean inputJson, String mapUri)
public String transform(String input, boolean inputJson, String mapUri, boolean outputJson)
throws FHIRException, IOException {
log.info("Start transform: " + mapUri);
+
+ SimpleWorkerContext context = this.getContext();
+ StructureMap map = context.fetchResource(StructureMap.class, mapUri);
+
+ String fhirVersionTarget = getFhirVersion(getCanonicalFromStructureMap(map, StructureMap.StructureMapModelMode.TARGET));
+ if (fhirVersionTarget !=null && !fhirVersionTarget.equals(this.getVersion())) {
+ log.info("Loading additional FHIR version for Target into context" + fhirVersionTarget);
+ context = getContextForFhirVersion(fhirVersionTarget);
+ }
+
Element transformed = transform(ByteProvider.forBytes(input.getBytes("UTF-8")), (inputJson ? FhirFormat.JSON : FhirFormat.XML),
- mapUri);
+ mapUri, context);
ByteArrayOutputStream boas = new ByteArrayOutputStream();
if (outputJson)
- new org.hl7.fhir.r5.elementmodel.JsonParser(getContext()).compose(transformed, boas,
+ new org.hl7.fhir.r5.elementmodel.JsonParser(context).compose(transformed, boas,
IParser.OutputStyle.PRETTY,
null);
else
- new org.hl7.fhir.r5.elementmodel.XmlParser(getContext()).compose(transformed, boas,
+ new org.hl7.fhir.r5.elementmodel.XmlParser(context).compose(transformed, boas,
IParser.OutputStyle.PRETTY,
null);
String result = new String(boas.toByteArray());
@@ -378,7 +405,7 @@ public String transform(String input, boolean inputJson, String mapUri, boolean
* Adapted transform operation from Validation Engine to use patched
* MatchboxStructureMapUtilities
*/
- public org.hl7.fhir.r5.elementmodel.Element transform(ByteProvider source, FhirFormat cntType, String mapUri)
+ public org.hl7.fhir.r5.elementmodel.Element transform(ByteProvider source, FhirFormat cntType, String mapUri, SimpleWorkerContext targetContext)
throws FHIRException, IOException {
SimpleWorkerContext context = this.getContext();
@@ -386,14 +413,46 @@ public org.hl7.fhir.r5.elementmodel.Element transform(ByteProvider source, FhirF
// if this is the case we do lazy loading of the additional FHIR version into the context
StructureMap map = context.fetchResource(StructureMap.class, mapUri);
- String fhirVersion = getFhirVersion(getCanonicalFromStructureMap(map, StructureMap.StructureMapModelMode.SOURCE));
- if (!fhirVersion.equals(this.getVersion())) {
- log.info("Loading additional FHIR version for Source into context" + fhirVersion);
- context.loadFromPackage("hl7.fhir.r5.core", fhirVersion);
+ String fhirVersionSource = getFhirVersion(getCanonicalFromStructureMap(map, StructureMap.StructureMapModelMode.SOURCE));
+ if (fhirVersionSource !=null && !fhirVersionSource.equals(this.getVersion())) {
+ log.info("Loading additional FHIR version for Source into context" + fhirVersionSource);
+ context = getContextForFhirVersion(fhirVersionSource);
}
org.hl7.fhir.r5.elementmodel.Element src = Manager.parseSingle(context, new ByteArrayInputStream(source.getBytes()),
cntType);
- return transform(src, mapUri);
+ return transform(src, mapUri, targetContext);
+ }
+
+ /**
+ * Adapted transform operation from Validation Engine to use patched
+ * MatchboxStructureMapUtilities
+ */
+ public SimpleWorkerContext getContextForFhirVersion(String fhirVersion)
+ throws FHIRException, IOException {
+ SimpleWorkerContext contextForFhirVersion = null;
+ if (fhirVersion.startsWith("4.0")) {
+ MatchboxEngine engine = new MatchboxEngineBuilder().getEngineR4();
+ contextForFhirVersion = engine.getContext();
+ }
+ if (fhirVersion.startsWith("5.0")) {
+ MatchboxEngine engine = new MatchboxEngineBuilder().getEngineR5();
+ contextForFhirVersion = engine.getContext();
+ }
+ if (contextForFhirVersion != null ) {
+ // we need to copy now all StructureDefinitions from this Version to the new context
+ for (StructureDefinition sd : contextForFhirVersion.listStructures()) {
+ StructureDefinition sdn = sd.copy();
+ if (sdn.getKind()!=null && sdn.getKind() != StructureDefinition.StructureDefinitionKind.LOGICAL && !"Extensions".equals(sdn.getType())) {
+ sdn.setUrl(sdn.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/"+fhirVersion+"/"));
+ sdn.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")
+ .setValue(new UriType("http://hl7.org/fhir"));
+ this.getContext().cacheResource(sdn);
+ }
+ contextForFhirVersion.cacheResource(sd);
+ }
+ }
+
+ return contextForFhirVersion;
}
/**
@@ -405,12 +464,12 @@ public org.hl7.fhir.r5.elementmodel.Element transform(ByteProvider source, FhirF
* @throws FHIRException
* @throws IOException
*/
- public org.hl7.fhir.r5.elementmodel.Element transform(org.hl7.fhir.r5.elementmodel.Element src, String mapUri)
+ public org.hl7.fhir.r5.elementmodel.Element transform(org.hl7.fhir.r5.elementmodel.Element src, String mapUri, SimpleWorkerContext targetContext)
throws FHIRException, IOException {
SimpleWorkerContext context = this.getContext();
List outputs = new ArrayList<>();
StructureMapUtilities scu = new MatchboxStructureMapUtilities(context,
- new TransformSupportServices(context, outputs), this);
+ new TransformSupportServices(targetContext!=null ? targetContext : context, outputs), this);
StructureMap map = context.fetchResource(StructureMap.class, mapUri);
if (map == null) {
log.error("Unable to find map " + mapUri + " (Known Maps = " + context.listMapUrls() + ")");
@@ -420,6 +479,7 @@ public org.hl7.fhir.r5.elementmodel.Element transform(org.hl7.fhir.r5.elementmod
+ (map.getDateElement() != null && !map.getDateElement().isEmpty() ? "(" + map.getDateElement().asStringValue() + ")" : ""));
org.hl7.fhir.r5.elementmodel.Element resource = getTargetResourceFromStructureMap(map);
+
scu.transform(null, src, map, resource);
resource.populatePaths(null);
return resource;
@@ -468,6 +528,13 @@ private org.hl7.fhir.r5.elementmodel.Element getTargetResourceFromStructureMap(S
throw new FHIRException("Unable to determine resource URL for target type");
}
+ if (Utilities.isAbsoluteUrl(targetTypeUrl)) {
+ int index = targetTypeUrl.indexOf("/"+this.getVersion().substring(0,3)+"/");
+ if (index >= 0) {
+ targetTypeUrl = targetTypeUrl.substring(0, index)+targetTypeUrl.substring(index+4);
+ }
+ }
+
StructureDefinition structureDefinition = null;
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
if (sd.getUrl().equalsIgnoreCase(targetTypeUrl)) {
diff --git a/matchbox-engine/src/main/java/ch/ahdis/matchbox/mappinglanguage/TransformSupportServices.java b/matchbox-engine/src/main/java/ch/ahdis/matchbox/mappinglanguage/TransformSupportServices.java
index e627bb7ce36..20056fb9bb8 100644
--- a/matchbox-engine/src/main/java/ch/ahdis/matchbox/mappinglanguage/TransformSupportServices.java
+++ b/matchbox-engine/src/main/java/ch/ahdis/matchbox/mappinglanguage/TransformSupportServices.java
@@ -29,6 +29,7 @@
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.utils.structuremap.ITransformerServices;
+import org.hl7.fhir.utilities.Utilities;
public class TransformSupportServices implements ITransformerServices {
@@ -44,6 +45,14 @@ public TransformSupportServices(IWorkerContext worker, List outputs) {
@Override
public Base createType(Object appInfo, String name) throws FHIRException {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, name);
+ if (sd == null) {
+ if (Utilities.existsInList(name, "http://hl7.org/fhirpath/System.String")) {
+ sd = context.fetchTypeDefinition("string");
+ }
+ }
+ if (sd == null) {
+ throw new FHIRException("Unable to create type "+name);
+ }
return Manager.build(context, sd);
}
diff --git a/matchbox-engine/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/matchbox-engine/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java
index 20b80b2c8f7..73b2a1a4553 100644
--- a/matchbox-engine/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java
+++ b/matchbox-engine/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java
@@ -2109,7 +2109,14 @@ public T fetchResourceWithExceptionByVersion(Class class
if (class_ == StructureDefinition.class) {
uri = ProfileUtilities.sdNs(uri, null);
}
- synchronized (lock) {
+ // matchbox patch for #265, fhirVersioned URL's eg (return urls with fhirVersion)
+ if (Utilities.isAbsoluteUrl(uri)) {
+ int index = uri.indexOf("/"+this.version.substring(0,3)+"/");
+ if (index >= 0) {
+ uri = uri.substring(0, index)+uri.substring(index+4);
+ }
+ }
+ synchronized (lock) {
if (version == null) {
if (uri.contains("|")) {
diff --git a/matchbox-engine/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java b/matchbox-engine/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java
index 09f23e6400a..360de7ccd44 100644
--- a/matchbox-engine/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java
+++ b/matchbox-engine/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java
@@ -73,9 +73,11 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.FhirPublication;
import org.hl7.fhir.utilities.Utilities;
+import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.validation.ValidationOptions;
import org.hl7.fhir.utilities.xhtml.NodeType;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
+import org.hl7.fhir.validation.instance.type.StructureMapValidator.VariableDefn;
import java.io.IOException;
import java.util.*;
@@ -1329,11 +1331,11 @@ private void executeRule(String indent, TransformContext context, StructureMap m
for (StructureMapGroupRuleComponent childrule : rule.getRule()) {
executeRule(indent + " ", context, map, v, group, childrule, false);
}
- } else if (rule.hasDependent()) {
+ } else if (rule.hasDependent() && !checkisSimple(rule)) {
for (StructureMapGroupRuleDependentComponent dependent : rule.getDependent()) {
executeDependency(indent + " ", context, map, v, group, dependent);
}
- } else if (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasVariable() && rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasVariable() && rule.getTargetFirstRep().getTransform() == StructureMapTransform.CREATE && !rule.getTargetFirstRep().hasParameter()) {
+ } else if (checkisSimple(rule) || (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasVariable() && rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasVariable() && rule.getTargetFirstRep().getTransform() == StructureMapTransform.CREATE && !rule.getTargetFirstRep().hasParameter())) {
// simple inferred, map by type
if (debug) {
log(v.summary());
diff --git a/matchbox-engine/src/main/resources/hl7.fhir.uv.xver#0.1.0@bp.tgz b/matchbox-engine/src/main/resources/hl7.fhir.uv.xver#0.1.0@bp.tgz
new file mode 100644
index 00000000000..3f0fbda0703
Binary files /dev/null and b/matchbox-engine/src/main/resources/hl7.fhir.uv.xver#0.1.0@bp.tgz differ
diff --git a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirXVersTests.java b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirXVersTests.java
new file mode 100644
index 00000000000..73c859483dc
--- /dev/null
+++ b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirXVersTests.java
@@ -0,0 +1,96 @@
+package ch.ahdis.matchbox.engine.tests;
+
+/*
+ * #%L
+ * Matchbox Engine
+ * %%
+ * Copyright (C) 2022 ahdis
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import org.apache.commons.io.IOUtils;
+import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r4.formats.XmlParser;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.ExplanationOfBenefit;
+import org.hl7.fhir.r4.model.Observation;
+import org.hl7.fhir.r4.model.Patient;
+import org.hl7.fhir.r4.model.Questionnaire;
+import org.hl7.fhir.r4.model.Resource;
+import org.hl7.fhir.r4.model.StructureDefinition;
+import org.hl7.fhir.r4.model.StructureMap;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import ch.ahdis.matchbox.engine.MatchboxEngine;
+import ch.ahdis.matchbox.engine.MatchboxEngine.MatchboxEngineBuilder;
+
+/**
+ * https://build.fhir.org/ig/HL7/fhir-cross-version/package.tgz
+ */
+class FhirXVersTests {
+
+ static private MatchboxEngine engine;
+
+ private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(FhirMappingLanguageTests.class);
+
+ @BeforeAll
+ static void setUpBeforeClass() throws Exception {
+ engine = new MatchboxEngineBuilder().getEngineR4();
+ }
+
+ @BeforeEach
+ void setUp() throws Exception {
+ }
+
+ public String getFileAsStringFromResources(String file) throws IOException {
+ InputStream in = FhirXVersTests.class.getResourceAsStream("/xvers" + file);
+ return IOUtils.toString(in, StandardCharsets.UTF_8);
+ }
+
+ public StructureDefinition getStructureDefinitionFromFile(String file) throws IOException {
+ return (StructureDefinition) new org.hl7.fhir.r4.formats.XmlParser()
+ .parse(FhirMappingLanguageTests.class.getResourceAsStream(file));
+ }
+
+ @Test
+ void testMedication5to4inR4() throws FHIRException, IOException {
+ MatchboxEngine engine = new MatchboxEngine(FhirXVersTests.engine);
+ String result = engine.transform(getFileAsStringFromResources("/medication-r5-med0301.json"), true,
+ "http://hl7.org/fhir/uv/xver/StructureMap/Medication5to4", true);
+ log.info(result);
+ CompareUtil.compare(getFileAsStringFromResources("/medication-r4-med0301.json"), result, false);
+ }
+
+ @Test
+ void testMedication4to5inR4() throws FHIRException, IOException {
+ MatchboxEngine engine = new MatchboxEngine(FhirXVersTests.engine);
+ String result = engine.transform(getFileAsStringFromResources("/medication-r4-med0301.json"), true,
+ "http://hl7.org/fhir/uv/xver/StructureMap/Medication4to5", true);
+ log.info(result);
+ CompareUtil.compare(getFileAsStringFromResources("/medication-r5-med0301.json"), result, false);
+ }
+
+
+}
diff --git a/matchbox-engine/src/test/resources/xvers/medication-r4-med0301-bak.json b/matchbox-engine/src/test/resources/xvers/medication-r4-med0301-bak.json
new file mode 100644
index 00000000000..077f185258d
--- /dev/null
+++ b/matchbox-engine/src/test/resources/xvers/medication-r4-med0301-bak.json
@@ -0,0 +1,68 @@
+{
+ "resourceType": "Medication",
+ "id": "med0301",
+ "contained": [
+ {
+ "resourceType": "Organization",
+ "id": "mmanu",
+ "name": "Medication Manufacturer"
+ }
+ ],
+ "identifier": [
+ {
+ "id": "123456789"
+ }
+ ],
+ "code": {
+ "coding": [
+ {
+ "system": "http://hl7.org/fhir/sid/ndc",
+ "code": "0409-6531-02",
+ "display": "Vancomycin Hydrochloride (VANCOMYCIN HYDROCHLORIDE)"
+ }
+ ]
+ },
+ "status": "active",
+ "manufacturer": {
+ "reference": "#mmanu"
+ },
+ "form": {
+ "coding": [
+ {
+ "system": "http://snomed.info/sct",
+ "code": "385219001",
+ "display": "Injection Solution (qualifier value)"
+ }
+ ]
+ },
+ "ingredient": [
+ {
+ "itemCodeableConcept": {
+ "coding": [
+ {
+ "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
+ "code": "66955",
+ "display": "Vancomycin Hydrochloride"
+ }
+ ]
+ },
+ "isActive": true,
+ "strength": {
+ "numerator": {
+ "value": 500,
+ "system": "http://unitsofmeasure.org",
+ "code": "mg"
+ },
+ "denominator": {
+ "value": 10,
+ "system": "http://unitsofmeasure.org",
+ "code": "mL"
+ }
+ }
+ }
+ ],
+ "batch": {
+ "lotNumber": "9494788",
+ "expirationDate": "2017-05-22"
+ }
+}
\ No newline at end of file
diff --git a/matchbox-engine/src/test/resources/xvers/medication-r4-med0301.json b/matchbox-engine/src/test/resources/xvers/medication-r4-med0301.json
new file mode 100644
index 00000000000..4113a478964
--- /dev/null
+++ b/matchbox-engine/src/test/resources/xvers/medication-r4-med0301.json
@@ -0,0 +1,16 @@
+{
+ "resourceType": "Medication",
+ "ingredient": [
+ {
+ "itemCodeableConcept": {
+ "coding": [
+ {
+ "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
+ "code": "66955",
+ "display": "Vancomycin Hydrochloride"
+ }
+ ]
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/matchbox-engine/src/test/resources/xvers/medication-r5-med0301.json b/matchbox-engine/src/test/resources/xvers/medication-r5-med0301.json
new file mode 100644
index 00000000000..84d6d93c82b
--- /dev/null
+++ b/matchbox-engine/src/test/resources/xvers/medication-r5-med0301.json
@@ -0,0 +1,70 @@
+{
+ "resourceType": "Medication",
+ "id": "med0301",
+ "contained": [
+ {
+ "resourceType": "Organization",
+ "id": "mmanu",
+ "name": "Medication Manufacturer"
+ }
+ ],
+ "identifier": [
+ {
+ "id": "123456789"
+ }
+ ],
+ "code": {
+ "coding": [
+ {
+ "system": "http://hl7.org/fhir/sid/ndc",
+ "code": "0409-6531-02",
+ "display": "Vancomycin Hydrochloride (VANCOMYCIN HYDROCHLORIDE)"
+ }
+ ]
+ },
+ "status": "active",
+ "marketingAuthorizationHolder": {
+ "reference": "#mmanu"
+ },
+ "doseForm": {
+ "coding": [
+ {
+ "system": "http://snomed.info/sct",
+ "code": "385219001",
+ "display": "Injection Solution (qualifier value)"
+ }
+ ]
+ },
+ "ingredient": [
+ {
+ "item": {
+ "concept": {
+ "coding": [
+ {
+ "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
+ "code": "66955",
+ "display": "Vancomycin Hydrochloride"
+ }
+ ]
+ }
+ },
+ "isActive": true,
+ "strengthRatio": {
+ "numerator": {
+ "value": 500,
+ "system": "http://unitsofmeasure.org",
+ "code": "mg"
+ },
+ "denominator": {
+ "value": 10,
+ "system": "http://unitsofmeasure.org",
+ "code": "mL"
+ }
+ }
+ }
+ ],
+ "batch": {
+ "lotNumber": "9494788",
+ "expirationDate": "2017-05-22"
+ }
+}
\ No newline at end of file
diff --git a/matchbox-server/cda.http b/matchbox-server/cda.http
index 5e5a2bb9d40..3d48acb68c4 100644
--- a/matchbox-server/cda.http
+++ b/matchbox-server/cda.http
@@ -1,5 +1,5 @@
-@host = http://localhost:8080/matchbox/fhir
-### @host = https://test.ahdis.ch/matchbox/fhir
+### @host = http://localhost:8080/matchbox/fhir
+@host = https://test.ahdis.ch/matchbox/fhir
### @host = https://test.ahdis.ch/matchboxv3/fhir
### Check if server is available
diff --git a/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR4.java b/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR4.java
index b603694fcc2..15d2461ca50 100644
--- a/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR4.java
+++ b/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR4.java
@@ -93,7 +93,7 @@ public void extract(org.hl7.fhir.r5.elementmodel.Element src, HttpServletRequest
throw new UnprocessableEntityException("Map not available with canonical url "+mapUrl);
}
- org.hl7.fhir.r5.elementmodel.Element r = matchboxEngine.transform(src, map.getUrl());
+ org.hl7.fhir.r5.elementmodel.Element r = matchboxEngine.transform(src, map.getUrl(), null);
theServletResponse.setContentType(responseContentType);
theServletResponse.setCharacterEncoding("UTF-8");
diff --git a/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR5.java b/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR5.java
index 83255838fba..153e7fc306f 100644
--- a/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR5.java
+++ b/matchbox-server/src/main/java/ch/ahdis/matchbox/questionnaire/QuestionnaireResponseExtractProviderR5.java
@@ -93,7 +93,7 @@ public void extract(org.hl7.fhir.r5.elementmodel.Element src, HttpServletRequest
throw new UnprocessableEntityException("Map not available with canonical url "+mapUrl);
}
- org.hl7.fhir.r5.elementmodel.Element r = matchboxEngine.transform(src, map.getUrl());
+ org.hl7.fhir.r5.elementmodel.Element r = matchboxEngine.transform(src, map.getUrl(), null);
theServletResponse.setContentType(responseContentType);
theServletResponse.setCharacterEncoding("UTF-8");