Merge pull request #1554 from hapifhir/2024-01-gg-fix-expand-params
2024 01 gg fix expand params
This commit is contained in:
commit
42bddb9fdb
|
@ -23,6 +23,7 @@ import org.hl7.fhir.r4.model.OperationOutcome;
|
||||||
import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
|
import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
|
||||||
import org.hl7.fhir.r4.model.OperationOutcome.IssueType;
|
import org.hl7.fhir.r4.model.OperationOutcome.IssueType;
|
||||||
import org.hl7.fhir.r4.model.Parameters;
|
import org.hl7.fhir.r4.model.Parameters;
|
||||||
|
import org.hl7.fhir.r4.model.UriType;
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent;
|
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent;
|
||||||
import org.hl7.fhir.r4.utils.client.FHIRToolingClient;
|
import org.hl7.fhir.r4.utils.client.FHIRToolingClient;
|
||||||
|
@ -122,7 +123,9 @@ public class VSACImporter extends OIDBasedValueSetImporter {
|
||||||
}
|
}
|
||||||
t = System.currentTimeMillis();
|
t = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
ValueSet vse = fhirToolingClient.expandValueset(vs.getUrl(), null);
|
Parameters p = new Parameters();
|
||||||
|
p.addParameter("url", new UriType(vs.getUrl()));
|
||||||
|
ValueSet vse = fhirToolingClient.expandValueset(vs, p);
|
||||||
vs.setExpansion(vse.getExpansion());
|
vs.setExpansion(vse.getExpansion());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errs.put(oid, "Expansion: " +e.getMessage());
|
errs.put(oid, "Expansion: " +e.getMessage());
|
||||||
|
@ -132,9 +135,10 @@ public class VSACImporter extends OIDBasedValueSetImporter {
|
||||||
Parameters p = new Parameters();
|
Parameters p = new Parameters();
|
||||||
int offset = vs.getExpansion().getParameter("offset").getValueIntegerType().getValue() + vs.getExpansion().getParameter("count").getValueIntegerType().getValue();
|
int offset = vs.getExpansion().getParameter("offset").getValueIntegerType().getValue() + vs.getExpansion().getParameter("count").getValueIntegerType().getValue();
|
||||||
p.addParameter("offset", offset);
|
p.addParameter("offset", offset);
|
||||||
|
p.addParameter("url", new UriType(vs.getUrl()));
|
||||||
t = System.currentTimeMillis();
|
t = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
ValueSet vse = fhirToolingClient.expandValueset(vs.getUrl(), p);
|
ValueSet vse = fhirToolingClient.expandValueset(vs, p);
|
||||||
vs.getExpansion().getContains().addAll(vse.getExpansion().getContains());
|
vs.getExpansion().getContains().addAll(vse.getExpansion().getContains());
|
||||||
vs.getExpansion().setParameter(vse.getExpansion().getParameter());
|
vs.getExpansion().setParameter(vse.getExpansion().getParameter());
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
|
|
|
@ -104,10 +104,10 @@ public class TerminologyClientR2 implements ITerminologyClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException {
|
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException {
|
||||||
org.hl7.fhir.dstu2.model.ValueSet vs2 = (org.hl7.fhir.dstu2.model.ValueSet) VersionConvertorFactory_10_50.convertResource(vs);
|
org.hl7.fhir.dstu2.model.ValueSet vs2 = (org.hl7.fhir.dstu2.model.ValueSet) VersionConvertorFactory_10_50.convertResource(vs);
|
||||||
org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertorFactory_10_50.convertResource(p);
|
org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertorFactory_10_50.convertResource(p);
|
||||||
vs2 = client.expandValueset(vs2, p2, params);
|
vs2 = client.expandValueset(vs2, p2);
|
||||||
return (ValueSet) VersionConvertorFactory_10_50.convertResource(vs2);
|
return (ValueSet) VersionConvertorFactory_10_50.convertResource(vs2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,10 +101,10 @@ public class TerminologyClientR3 implements ITerminologyClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException {
|
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException {
|
||||||
org.hl7.fhir.dstu3.model.ValueSet vs2 = (org.hl7.fhir.dstu3.model.ValueSet) VersionConvertorFactory_30_50.convertResource(vs);
|
org.hl7.fhir.dstu3.model.ValueSet vs2 = (org.hl7.fhir.dstu3.model.ValueSet) VersionConvertorFactory_30_50.convertResource(vs);
|
||||||
org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertorFactory_30_50.convertResource(p);
|
org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertorFactory_30_50.convertResource(p);
|
||||||
vs2 = client.expandValueset(vs2, p2, params); // todo: second parameter
|
vs2 = client.expandValueset(vs2, p2); // todo: second parameter
|
||||||
return (ValueSet) VersionConvertorFactory_30_50.convertResource(vs2);
|
return (ValueSet) VersionConvertorFactory_30_50.convertResource(vs2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,14 +78,11 @@ public class TerminologyClientR4 implements ITerminologyClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException {
|
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException {
|
||||||
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.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);
|
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<>();
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
vs2 = client.expandValueset(vs2, p2, params); // todo: second parameter
|
vs2 = client.expandValueset(vs2, p2); // todo: second parameter
|
||||||
return (ValueSet) VersionConvertorFactory_40_50.convertResource(vs2);
|
return (ValueSet) VersionConvertorFactory_40_50.convertResource(vs2);
|
||||||
} catch (org.hl7.fhir.r4.utils.client.EFhirClientException e) {
|
} catch (org.hl7.fhir.r4.utils.client.EFhirClientException e) {
|
||||||
if (e.getServerErrors().size() > 0) {
|
if (e.getServerErrors().size() > 0) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.hl7.fhir.dstu2.model.Coding;
|
||||||
import org.hl7.fhir.dstu2.model.ConceptMap;
|
import org.hl7.fhir.dstu2.model.ConceptMap;
|
||||||
import org.hl7.fhir.dstu2.model.Conformance;
|
import org.hl7.fhir.dstu2.model.Conformance;
|
||||||
import org.hl7.fhir.dstu2.model.Extension;
|
import org.hl7.fhir.dstu2.model.Extension;
|
||||||
|
import org.hl7.fhir.dstu2.model.IntegerType;
|
||||||
import org.hl7.fhir.dstu2.model.Parameters;
|
import org.hl7.fhir.dstu2.model.Parameters;
|
||||||
import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent;
|
import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent;
|
||||||
import org.hl7.fhir.dstu2.model.Reference;
|
import org.hl7.fhir.dstu2.model.Reference;
|
||||||
|
@ -115,11 +116,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
@Override
|
@Override
|
||||||
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk) {
|
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk) {
|
||||||
try {
|
try {
|
||||||
Map<String, String> params = new HashMap<String, String>();
|
Parameters params = new Parameters();
|
||||||
params.put("_limit", "10000");
|
params.addParameter().setName("_limit").setValue(new IntegerType("10000"));
|
||||||
params.put("_incomplete", "true");
|
params.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||||
params.put("profile", "http://www.healthintersections.com.au/fhir/expansion/no-details");
|
params.addParameter().setName("profile").setValue(new UriType("http://www.healthintersections.com.au/fhir/expansion/no-details"));
|
||||||
ValueSet result = txServer.expandValueset(vs, null, params);
|
ValueSet result = txServer.expandValueset(vs, params);
|
||||||
return new ValueSetExpansionOutcome(result);
|
return new ValueSetExpansionOutcome(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ValueSetExpansionOutcome("Error expanding ValueSet \"" + vs.getUrl() + ": " + e.getMessage());
|
return new ValueSetExpansionOutcome("Error expanding ValueSet \"" + vs.getUrl() + ": " + e.getMessage());
|
||||||
|
|
|
@ -724,26 +724,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source) {
|
|
||||||
recordUse();
|
|
||||||
List<Header> headers = null;
|
|
||||||
ResourceRequest<Resource> result = utils.issuePostRequest(
|
|
||||||
resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
|
||||||
utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
|
|
||||||
headers, timeoutLong);
|
|
||||||
result.addErrorStatus(410);// gone
|
|
||||||
result.addErrorStatus(404);// unknown
|
|
||||||
result.addErrorStatus(405);
|
|
||||||
result.addErrorStatus(422);// Unprocessable Entity
|
|
||||||
result.addSuccessStatus(200);
|
|
||||||
result.addSuccessStatus(201);
|
|
||||||
if (result.isUnsuccessfulRequest()) {
|
|
||||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
|
|
||||||
(OperationOutcome) result.getPayload());
|
|
||||||
}
|
|
||||||
return (ValueSet) result.getPayload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Parameters lookupCode(Map<String, String> params) {
|
public Parameters lookupCode(Map<String, String> params) {
|
||||||
recordUse();
|
recordUse();
|
||||||
ResourceRequest<Resource> result = utils.issueGetResourceRequest(
|
ResourceRequest<Resource> result = utils.issueGetResourceRequest(
|
||||||
|
@ -762,15 +742,13 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return (Parameters) result.getPayload();
|
return (Parameters) result.getPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||||
recordUse();
|
recordUse();
|
||||||
List<Header> headers = null;
|
List<Header> headers = null;
|
||||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||||
p.addParameter().setName("valueSet").setResource(source);
|
p.addParameter().setName("valueSet").setResource(source);
|
||||||
for (String n : params.keySet())
|
|
||||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
|
||||||
ResourceRequest<Resource> result = utils.issuePostRequest(
|
ResourceRequest<Resource> result = utils.issuePostRequest(
|
||||||
resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||||
utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
|
utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
|
||||||
headers, 4);
|
headers, 4);
|
||||||
result.addErrorStatus(410); // gone
|
result.addErrorStatus(410); // gone
|
||||||
|
@ -786,22 +764,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return (ValueSet) result.getPayload();
|
return (ValueSet) result.getPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ValueSet expandValueset(ValueSet source, ExpansionProfile profile, Map<String, String> params) {
|
|
||||||
// List<Header> headers = null;
|
|
||||||
// ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
|
||||||
// utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"), headers, proxy);
|
|
||||||
// result.addErrorStatus(410);//gone
|
|
||||||
// result.addErrorStatus(404);//unknown
|
|
||||||
// result.addErrorStatus(405);
|
|
||||||
// result.addErrorStatus(422);//Unprocessable Entity
|
|
||||||
// result.addSuccessStatus(200);
|
|
||||||
// result.addSuccessStatus(201);
|
|
||||||
// if(result.isUnsuccessfulRequest()) {
|
|
||||||
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
|
|
||||||
// }
|
|
||||||
// return (ValueSet) result.getPayload();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class ResourceAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class ResourceAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
||||||
|
|
|
@ -60,6 +60,7 @@ import org.hl7.fhir.dstu3.model.Coding;
|
||||||
import org.hl7.fhir.dstu3.model.ConceptMap;
|
import org.hl7.fhir.dstu3.model.ConceptMap;
|
||||||
import org.hl7.fhir.dstu3.model.DataElement;
|
import org.hl7.fhir.dstu3.model.DataElement;
|
||||||
import org.hl7.fhir.dstu3.model.ExpansionProfile;
|
import org.hl7.fhir.dstu3.model.ExpansionProfile;
|
||||||
|
import org.hl7.fhir.dstu3.model.IntegerType;
|
||||||
import org.hl7.fhir.dstu3.model.OperationDefinition;
|
import org.hl7.fhir.dstu3.model.OperationDefinition;
|
||||||
import org.hl7.fhir.dstu3.model.OperationOutcome;
|
import org.hl7.fhir.dstu3.model.OperationOutcome;
|
||||||
import org.hl7.fhir.dstu3.model.Parameters;
|
import org.hl7.fhir.dstu3.model.Parameters;
|
||||||
|
@ -448,11 +449,12 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, String> params = new HashMap<String, String>();
|
Parameters params = new Parameters();
|
||||||
params.put("_limit", Integer.toString(expandCodesLimit));
|
params.addParameter().setName("profile").setResource(expProfile.setIncludeDefinition(false));
|
||||||
params.put("_incomplete", "true");
|
params.addParameter().setName("_limit").setValue(new IntegerType(expandCodesLimit));
|
||||||
|
params.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||||
tlog("Terminology Server: $expand on " + getVSSummary(vs));
|
tlog("Terminology Server: $expand on " + getVSSummary(vs));
|
||||||
ValueSet result = txServer.expandValueset(vs, expProfile.setIncludeDefinition(false), params);
|
ValueSet result = txServer.expandValueset(vs, params);
|
||||||
return new ValueSetExpansionOutcome(result);
|
return new ValueSetExpansionOutcome(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ValueSetExpansionOutcome(
|
return new ValueSetExpansionOutcome(
|
||||||
|
|
|
@ -414,28 +414,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
|
||||||
recordUse();
|
|
||||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
|
||||||
p.addParameter().setName("valueSet").setResource(source);
|
|
||||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
|
||||||
try {
|
|
||||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
|
||||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
|
||||||
withVer(getPreferredResourceFormat(), "3.0"),
|
|
||||||
generateHeaders(),
|
|
||||||
"ValueSet/$expand?url=" + source.getUrl(),
|
|
||||||
timeoutExpand);
|
|
||||||
if (result.isUnsuccessfulRequest()) {
|
|
||||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result == null ? null : (ValueSet) result.getPayload();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Parameters lookupCode(Map<String, String> params) {
|
public Parameters lookupCode(Map<String, String> params) {
|
||||||
recordUse();
|
recordUse();
|
||||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
||||||
|
@ -454,41 +432,14 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return (Parameters) result.getPayload();
|
return (Parameters) result.getPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source, ExpansionProfile profile, Map<String, String> params) {
|
|
||||||
recordUse();
|
|
||||||
Parameters p = new Parameters();
|
|
||||||
p.addParameter().setName("valueSet").setResource(source);
|
|
||||||
if (profile != null)
|
|
||||||
p.addParameter().setName("profile").setResource(profile);
|
|
||||||
|
|
||||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||||
try {
|
|
||||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
|
||||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
|
||||||
withVer(getPreferredResourceFormat(), "3.0"),
|
|
||||||
generateHeaders(),
|
|
||||||
"ValueSet/$expand?url=" + source.getUrl(),
|
|
||||||
timeoutExpand);
|
|
||||||
if (result.isUnsuccessfulRequest()) {
|
|
||||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result == null ? null : (ValueSet) result.getPayload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
|
||||||
recordUse();
|
recordUse();
|
||||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||||
p.addParameter().setName("valueSet").setResource(source);
|
p.addParameter().setName("valueSet").setResource(source);
|
||||||
for (String n : params.keySet()) {
|
|
||||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
|
||||||
}
|
|
||||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
||||||
try {
|
try {
|
||||||
|
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
|
||||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
||||||
withVer(getPreferredResourceFormat(), "3.0"),
|
withVer(getPreferredResourceFormat(), "3.0"),
|
||||||
generateHeaders(),
|
generateHeaders(),
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class ResourceAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"/"+opName);
|
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+opName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName, Map<String,String> parameters) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName, Map<String,String> parameters) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.hl7.fhir.r4.model.ConceptMap;
|
||||||
import org.hl7.fhir.r4.model.Constants;
|
import org.hl7.fhir.r4.model.Constants;
|
||||||
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
|
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
import org.hl7.fhir.r4.model.ImplementationGuide;
|
import org.hl7.fhir.r4.model.ImplementationGuide;
|
||||||
|
import org.hl7.fhir.r4.model.IntegerType;
|
||||||
import org.hl7.fhir.r4.model.MetadataResource;
|
import org.hl7.fhir.r4.model.MetadataResource;
|
||||||
import org.hl7.fhir.r4.model.NamingSystem;
|
import org.hl7.fhir.r4.model.NamingSystem;
|
||||||
import org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType;
|
import org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType;
|
||||||
|
@ -403,12 +404,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
if (noTerminologyServer)
|
if (noTerminologyServer)
|
||||||
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services",
|
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services",
|
||||||
TerminologyServiceErrorClass.NOSERVICE);
|
TerminologyServiceErrorClass.NOSERVICE);
|
||||||
Map<String, String> params = new HashMap<String, String>();
|
|
||||||
params.put("_limit", Integer.toString(expandCodesLimit));
|
p.addParameter().setName("_limit").setValue(new IntegerType(expandCodesLimit));
|
||||||
params.put("_incomplete", "true");
|
p.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||||
|
|
||||||
tlog("$expand on " + txCache.summary(vs));
|
tlog("$expand on " + txCache.summary(vs));
|
||||||
try {
|
try {
|
||||||
ValueSet result = txClient.expandValueset(vs, p, params);
|
ValueSet result = txClient.expandValueset(vs, p);
|
||||||
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(),
|
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(),
|
||||||
|
@ -463,12 +465,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
if (noTerminologyServer)
|
if (noTerminologyServer)
|
||||||
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services",
|
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services",
|
||||||
TerminologyServiceErrorClass.NOSERVICE);
|
TerminologyServiceErrorClass.NOSERVICE);
|
||||||
Map<String, String> params = new HashMap<String, String>();
|
|
||||||
params.put("_limit", Integer.toString(expandCodesLimit));
|
p.addParameter().setName("_limit").setValue(new IntegerType(expandCodesLimit));
|
||||||
params.put("_incomplete", "true");
|
p.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||||
|
|
||||||
tlog("$expand on " + txCache.summary(vs));
|
tlog("$expand on " + txCache.summary(vs));
|
||||||
try {
|
try {
|
||||||
ValueSet result = txClient.expandValueset(vs, p, params);
|
ValueSet result = txClient.expandValueset(vs, p);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
if (!result.hasUrl())
|
if (!result.hasUrl())
|
||||||
result.setUrl(vs.getUrl());
|
result.setUrl(vs.getUrl());
|
||||||
|
|
|
@ -43,7 +43,7 @@ public interface TerminologyClient {
|
||||||
|
|
||||||
public TerminologyCapabilities getTerminologyCapabilities() throws FHIRException;
|
public TerminologyCapabilities getTerminologyCapabilities() throws FHIRException;
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException;
|
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException;
|
||||||
|
|
||||||
public Parameters validateCS(Parameters pin) throws FHIRException;
|
public Parameters validateCS(Parameters pin) throws FHIRException;
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,8 @@ public class TerminologyClientR4 implements TerminologyClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) {
|
public ValueSet expandValueset(ValueSet vs, Parameters p) {
|
||||||
return client.expandValueset(vs, p, params);
|
return client.expandValueset(vs, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -403,55 +403,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSet expandValueset(String vsUrl, Parameters expParams) {
|
|
||||||
recordUse();
|
|
||||||
Map<String, String> parameters = new HashMap<>();
|
|
||||||
parameters.put("url", vsUrl);
|
|
||||||
if (expParams != null) {
|
|
||||||
for (ParametersParameterComponent p : expParams.getParameter()) {
|
|
||||||
if (p.getValue() == null) {
|
|
||||||
throw new FHIRException("Non-value Parameters are not supported for parameter '"+p.getName()+"'");
|
|
||||||
} else if (p.getValue() instanceof PrimitiveType) {
|
|
||||||
parameters.put(p.getName(), p.getValue().primitiveValue());
|
|
||||||
} else {
|
|
||||||
throw new FHIRException("Complex Parameters are not supported for parameter '"+p.getName()+"'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
|
||||||
try {
|
|
||||||
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", parameters),
|
|
||||||
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "ValueSet/$expand?url=" + vsUrl, timeoutExpand);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new FHIRException(e);
|
|
||||||
}
|
|
||||||
if (result.isUnsuccessfulRequest()) {
|
|
||||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
|
|
||||||
(OperationOutcome) result.getPayload());
|
|
||||||
}
|
|
||||||
return result == null ? null : (ValueSet) result.getPayload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
|
||||||
recordUse();
|
|
||||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
|
||||||
p.addParameter().setName("valueSet").setResource(source);
|
|
||||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
|
||||||
try {
|
|
||||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
|
||||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "4.0"),
|
|
||||||
generateHeaders(), "ValueSet/$expand?url=" + source.getUrl(), timeoutExpand);
|
|
||||||
if (result.isUnsuccessfulRequest()) {
|
|
||||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
|
|
||||||
(OperationOutcome) result.getPayload());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new FHIRException(e);
|
|
||||||
}
|
|
||||||
return result == null ? null : (ValueSet) result.getPayload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Parameters lookupCode(Map<String, String> params) {
|
public Parameters lookupCode(Map<String, String> params) {
|
||||||
recordUse();
|
recordUse();
|
||||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
||||||
|
@ -468,18 +419,13 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return (Parameters) result.getPayload();
|
return (Parameters) result.getPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||||
recordUse();
|
recordUse();
|
||||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||||
p.addParameter().setName("valueSet").setResource(source);
|
p.addParameter().setName("valueSet").setResource(source);
|
||||||
if (params != null) {
|
|
||||||
for (String n : params.keySet()) {
|
|
||||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
||||||
try {
|
try {
|
||||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "4.0"),
|
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "4.0"),
|
||||||
generateHeaders(), source == null ? "ValueSet/$expand" : "ValueSet/$expand?url=" + source.getUrl(),
|
generateHeaders(), source == null ? "ValueSet/$expand" : "ValueSet/$expand?url=" + source.getUrl(),
|
||||||
timeoutExpand);
|
timeoutExpand);
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ResourceAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveGetResource(Class<T> resourceClass, String id) {
|
public <T extends Resource> URI resolveGetResource(Class<T> resourceClass, String id) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class ResourceAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
||||||
|
|
|
@ -78,6 +78,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent
|
||||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
import org.hl7.fhir.r5.model.IdType;
|
import org.hl7.fhir.r5.model.IdType;
|
||||||
import org.hl7.fhir.r5.model.Identifier;
|
import org.hl7.fhir.r5.model.Identifier;
|
||||||
|
import org.hl7.fhir.r5.model.IntegerType;
|
||||||
import org.hl7.fhir.r5.model.ImplementationGuide;
|
import org.hl7.fhir.r5.model.ImplementationGuide;
|
||||||
import org.hl7.fhir.r5.model.Library;
|
import org.hl7.fhir.r5.model.Library;
|
||||||
import org.hl7.fhir.r5.model.Measure;
|
import org.hl7.fhir.r5.model.Measure;
|
||||||
|
@ -101,9 +102,7 @@ import org.hl7.fhir.r5.model.StringType;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.model.StructureMap;
|
import org.hl7.fhir.r5.model.StructureMap;
|
||||||
import org.hl7.fhir.r5.model.TerminologyCapabilities;
|
|
||||||
import org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent;
|
|
||||||
import org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent;
|
|
||||||
import org.hl7.fhir.r5.model.UriType;
|
import org.hl7.fhir.r5.model.UriType;
|
||||||
import org.hl7.fhir.r5.model.UrlType;
|
import org.hl7.fhir.r5.model.UrlType;
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
|
@ -129,7 +128,6 @@ import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache.SourcedValueSet;
|
||||||
import org.hl7.fhir.r5.terminologies.validation.VSCheckerException;
|
import org.hl7.fhir.r5.terminologies.validation.VSCheckerException;
|
||||||
import org.hl7.fhir.r5.terminologies.validation.ValueSetValidator;
|
import org.hl7.fhir.r5.terminologies.validation.ValueSetValidator;
|
||||||
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
|
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
|
||||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientR5.TerminologyClientR5Factory;
|
|
||||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientManager;
|
import org.hl7.fhir.r5.terminologies.client.TerminologyClientManager;
|
||||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientContext;
|
import org.hl7.fhir.r5.terminologies.client.TerminologyClientContext;
|
||||||
import org.hl7.fhir.r5.utils.PackageHackerR5;
|
import org.hl7.fhir.r5.utils.PackageHackerR5;
|
||||||
|
@ -138,7 +136,6 @@ import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r5.utils.client.EFhirClientException;
|
import org.hl7.fhir.r5.utils.client.EFhirClientException;
|
||||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||||
import org.hl7.fhir.utilities.FhirPublication;
|
import org.hl7.fhir.utilities.FhirPublication;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
|
||||||
import org.hl7.fhir.utilities.TimeTracker;
|
import org.hl7.fhir.utilities.TimeTracker;
|
||||||
import org.hl7.fhir.utilities.ToolingClientLogger;
|
import org.hl7.fhir.utilities.ToolingClientLogger;
|
||||||
import org.hl7.fhir.utilities.TranslationServices;
|
import org.hl7.fhir.utilities.TranslationServices;
|
||||||
|
@ -874,7 +871,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ValueSet result = tc.getClient().expandValueset(vs, p, null);
|
ValueSet result = tc.getClient().expandValueset(vs, p);
|
||||||
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), TerminologyServiceErrorClass.UNKNOWN, true);
|
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), TerminologyServiceErrorClass.UNKNOWN, true);
|
||||||
|
@ -915,7 +912,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
}
|
}
|
||||||
|
|
||||||
Parameters p = pIn.copy();
|
Parameters p = pIn.copy();
|
||||||
|
p.setParameter("_limit",new IntegerType("10000"));
|
||||||
|
p.setParameter("_incomplete", new BooleanType("true"));
|
||||||
if (vs.hasExpansion()) {
|
if (vs.hasExpansion()) {
|
||||||
return new ValueSetExpansionOutcome(vs.copy());
|
return new ValueSetExpansionOutcome(vs.copy());
|
||||||
}
|
}
|
||||||
|
@ -985,7 +983,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
txLog("$expand on "+txCache.summary(vs)+" on "+tc.getAddress());
|
txLog("$expand on "+txCache.summary(vs)+" on "+tc.getAddress());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ValueSet result = tc.getClient().expandValueset(vs, p, null);
|
ValueSet result = tc.getClient().expandValueset(vs, p);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
if (!result.hasUrl()) {
|
if (!result.hasUrl()) {
|
||||||
result.setUrl(vs.getUrl());
|
result.setUrl(vs.getUrl());
|
||||||
|
|
|
@ -51,7 +51,7 @@ public interface ITerminologyClient {
|
||||||
String getAddress();
|
String getAddress();
|
||||||
String getServerVersion();
|
String getServerVersion();
|
||||||
TerminologyCapabilities getTerminologyCapabilities() throws FHIRException;
|
TerminologyCapabilities getTerminologyCapabilities() throws FHIRException;
|
||||||
ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException;
|
ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException;
|
||||||
Parameters validateCS(Parameters pin) throws FHIRException;
|
Parameters validateCS(Parameters pin) throws FHIRException;
|
||||||
Parameters validateVS(Parameters pin) throws FHIRException;
|
Parameters validateVS(Parameters pin) throws FHIRException;
|
||||||
ITerminologyClient setTimeoutFactor(int i) throws FHIRException;
|
ITerminologyClient setTimeoutFactor(int i) throws FHIRException;
|
||||||
|
|
|
@ -126,8 +126,8 @@ public class TerminologyClientR5 implements ITerminologyClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) {
|
public ValueSet expandValueset(ValueSet vs, Parameters p) {
|
||||||
return client.expandValueset(vs, p, params);
|
return client.expandValueset(vs, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -470,7 +470,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return result == null ? null : (ValueSet) result.getPayload();
|
return result == null ? null : (ValueSet) result.getPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Parameters lookupCode(Map<String, String> params) {
|
public Parameters lookupCode(Map<String, String> params) {
|
||||||
recordUse();
|
recordUse();
|
||||||
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
|
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
|
||||||
|
@ -489,36 +488,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
||||||
return (Parameters) result.getPayload();
|
return (Parameters) result.getPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
|
||||||
recordUse();
|
|
||||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
|
||||||
if (source != null) {
|
|
||||||
p.addParameter().setName("valueSet").setResource(source);
|
|
||||||
}
|
|
||||||
if (params == null) {
|
|
||||||
params = new HashMap<>();
|
|
||||||
}
|
|
||||||
for (String n : params.keySet()) {
|
|
||||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
|
||||||
}
|
|
||||||
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
|
|
||||||
try {
|
|
||||||
|
|
||||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
|
||||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
|
||||||
withVer(getPreferredResourceFormat(), "4.0"),
|
|
||||||
generateHeaders(),
|
|
||||||
source == null ? "ValueSet/$expand" : "ValueSet/$expand?url=" + source.getUrl(),
|
|
||||||
timeoutExpand);
|
|
||||||
if (result.isUnsuccessfulRequest()) {
|
|
||||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result == null ? null : (ValueSet) result.getPayload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class ResourceAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"/"+opName);
|
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+opName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName, Map<String,String> parameters) {
|
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName, Map<String,String> parameters) {
|
||||||
|
|
|
@ -101,12 +101,6 @@ public class SimpleWorkerContextTests {
|
||||||
context.txLog = txLog;
|
context.txLog = txLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static Map<String, String> params = new HashMap<>();
|
|
||||||
static {
|
|
||||||
params.put("_limit", Integer.toString(1000));
|
|
||||||
params.put("_incomplete", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
private final static Parameters pInWithDependentResources = new Parameters();
|
private final static Parameters pInWithDependentResources = new Parameters();
|
||||||
static {
|
static {
|
||||||
pInWithDependentResources.addParameter("includeDefinition", false);
|
pInWithDependentResources.addParameter("includeDefinition", false);
|
||||||
|
@ -302,7 +296,7 @@ public class SimpleWorkerContextTests {
|
||||||
|
|
||||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||||
Mockito.verify(terminologyCache, times(0)).cacheExpansion(any(), any(), anyBoolean());
|
Mockito.verify(terminologyCache, times(0)).cacheExpansion(any(), any(), anyBoolean());
|
||||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -327,7 +321,7 @@ public class SimpleWorkerContextTests {
|
||||||
|
|
||||||
|
|
||||||
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(argThat(new ValueSetMatcher(vs)),
|
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(argThat(new ValueSetMatcher(vs)),
|
||||||
argThat(new ParametersMatcher(pInWithDependentResources)), eq(params));
|
argThat(new ParametersMatcher(pInWithDependentResources)));
|
||||||
|
|
||||||
ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true, false);
|
ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true, false);
|
||||||
|
|
||||||
|
@ -354,7 +348,7 @@ public class SimpleWorkerContextTests {
|
||||||
|
|
||||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||||
Mockito.verify(terminologyCache, times(0)).cacheExpansion(any(), any(), anyBoolean());
|
Mockito.verify(terminologyCache, times(0)).cacheExpansion(any(), any(), anyBoolean());
|
||||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ValidationOptionsFhirPublicationMatcher implements ArgumentMatcher<ValidationOptions> {
|
private class ValidationOptionsFhirPublicationMatcher implements ArgumentMatcher<ValidationOptions> {
|
||||||
|
@ -393,7 +387,7 @@ public class SimpleWorkerContextTests {
|
||||||
|
|
||||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||||
Mockito.verify(terminologyCache).cacheExpansion(cacheToken, actualExpansionResult, false);
|
Mockito.verify(terminologyCache).cacheExpansion(cacheToken, actualExpansionResult, false);
|
||||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -414,7 +408,7 @@ public class SimpleWorkerContextTests {
|
||||||
|
|
||||||
Mockito.doReturn(valueSetExpanderSimple).when(context).constructValueSetExpanderSimple(argThat(new ValidationOptionsFhirPublicationMatcher(vs.getFHIRPublicationVersion())));
|
Mockito.doReturn(valueSetExpanderSimple).when(context).constructValueSetExpanderSimple(argThat(new ValidationOptionsFhirPublicationMatcher(vs.getFHIRPublicationVersion())));
|
||||||
|
|
||||||
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(eq(vs), argThat(new ParametersMatcher(pInWithDependentResources)), eq(params));
|
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(eq(vs), argThat(new ParametersMatcher(pInWithDependentResources)));
|
||||||
|
|
||||||
ValueSetExpansionOutcome actualExpansionResult = context.expandVS(vs, true, true, true, pIn, false);
|
ValueSetExpansionOutcome actualExpansionResult = context.expandVS(vs, true, true, true, pIn, false);
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ public class TxTester {
|
||||||
p.getParameter().addAll(profile.getParameter());
|
p.getParameter().addAll(profile.getParameter());
|
||||||
String vsj;
|
String vsj;
|
||||||
try {
|
try {
|
||||||
ValueSet vs = tx.expandValueset(null, p, null);
|
ValueSet vs = tx.expandValueset(null, p);
|
||||||
TxTesterScrubbers.scrubVS(vs, tight);
|
TxTesterScrubbers.scrubVS(vs, tight);
|
||||||
TxTesterSorters.sortValueSet(vs);
|
TxTesterSorters.sortValueSet(vs);
|
||||||
vsj = new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).composeString(vs);
|
vsj = new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).composeString(vs);
|
||||||
|
|
Loading…
Reference in New Issue