fix R4/R5 conversion issues
This commit is contained in:
parent
0bf811bc50
commit
730a199f7a
|
@ -16,6 +16,7 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown4
|
|||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptPropertyComponent;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -436,7 +437,7 @@ public class ValueSet40_50 {
|
|||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent();
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt, "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property");
|
||||
if (src.hasSystem())
|
||||
tgt.setSystemElement(Uri40_50.convertUri(src.getSystemElement()));
|
||||
if (src.hasAbstract())
|
||||
|
@ -451,6 +452,11 @@ public class ValueSet40_50 {
|
|||
tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
|
||||
for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
|
||||
tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
|
||||
for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) {
|
||||
if ("http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property".equals(t.getUrl())) {
|
||||
tgt.addProperty().setCode(t.getExtensionString("code")).setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(t.getExtensionByUrl("value").getValue()));
|
||||
}
|
||||
}
|
||||
for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
|
||||
tgt.addContains(convertValueSetExpansionContainsComponent(t));
|
||||
return tgt;
|
||||
|
@ -475,6 +481,11 @@ public class ValueSet40_50 {
|
|||
tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
|
||||
for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
|
||||
tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
|
||||
for (org.hl7.fhir.r5.model.ValueSet.ConceptPropertyComponent t : src.getProperty()) {
|
||||
org.hl7.fhir.r4.model.Extension ext = tgt.addExtension().setUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property");
|
||||
ext.addExtension().setUrl("code").setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(t.getCodeElement()));
|
||||
ext.addExtension().setUrl("value").setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(t.getValue()));
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
|
||||
tgt.addContains(convertValueSetExpansionContainsComponent(t));
|
||||
return tgt;
|
||||
|
|
|
@ -20,9 +20,9 @@ public class TerminologyClientFactory {
|
|||
case DSTU2:
|
||||
return new TerminologyClientR2(checkEndsWith("/r2", url), userAgent);
|
||||
case R4:
|
||||
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent);
|
||||
return new TerminologyClientR4(checkEndsWith("/r4", url), userAgent);
|
||||
case R4B:
|
||||
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent);
|
||||
return new TerminologyClientR4(checkEndsWith("/r4", url), userAgent);
|
||||
case R5:
|
||||
return new TerminologyClientR5(checkEndsWith("/r4", url), userAgent); // r4 for now, since the terminology is currently the same
|
||||
case STU3:
|
||||
|
@ -62,7 +62,7 @@ public class TerminologyClientFactory {
|
|||
return url;
|
||||
if (url.startsWith("http://tx.fhir.org") || url.startsWith("https://tx.fhir.org"))
|
||||
return Utilities.pathURL(url, term);
|
||||
if (url.equals("http://local.fhir.org:8080"))
|
||||
if (url.equals("http://local.fhir.org"))
|
||||
return Utilities.pathURL(url, term);
|
||||
return url;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.hl7.fhir.convertors.txClient;
|
|||
import java.net.URISyntaxException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -87,7 +88,7 @@ public class TerminologyClientR4 implements TerminologyClient {
|
|||
|
||||
@Override
|
||||
public TerminologyCapabilities getTerminologyCapabilities() throws FHIRException {
|
||||
return TerminologyCapabilities40_50.convertTerminologyCapabilities(client.getTerminologyCapabilities());
|
||||
return (TerminologyCapabilities) VersionConvertorFactory_40_50.convertResource(client.getTerminologyCapabilities());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,8 +98,11 @@ public class TerminologyClientR4 implements TerminologyClient {
|
|||
|
||||
@Override
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException {
|
||||
org.hl7.fhir.r4.model.ValueSet vs2 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(vs);
|
||||
org.hl7.fhir.r4.model.Parameters p2 = (org.hl7.fhir.r4.model.Parameters) VersionConvertorFactory_40_50.convertResource(p);
|
||||
org.hl7.fhir.r4.model.ValueSet vs2 = vs == null ? null : (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(vs);
|
||||
org.hl7.fhir.r4.model.Parameters p2 = p == null ? null : (org.hl7.fhir.r4.model.Parameters) VersionConvertorFactory_40_50.convertResource(p);
|
||||
if (params == null) {
|
||||
params = new HashMap<>();
|
||||
}
|
||||
vs2 = client.expandValueset(vs2, p2, params); // todo: second parameter
|
||||
return (ValueSet) VersionConvertorFactory_40_50.convertResource(vs2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue