Merge pull request #1537 from hapifhir/2024-01-gg-mimetype-header-version

update headers on client to add ;fhirVersion=X
This commit is contained in:
Grahame Grieve 2024-01-10 22:15:41 +11:00 committed by GitHub
commit 109ed9db2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 284 additions and 486 deletions

View File

@ -84,6 +84,7 @@ public class TerminologyClientR2 implements ITerminologyClient {
public TerminologyClientR2(String id, String address, String userAgent) throws URISyntaxException {
client = new FHIRToolingClient(address, userAgent);
this.client.setVersionInMimeTypes(true);
this.id = id;
}

View File

@ -193,6 +193,7 @@ public class TerminologyClientR3 implements ITerminologyClient {
if (this.clientHeaders != null) {
this.client.setClientHeaders(this.clientHeaders.headers());
}
this.client.setVersionInMimeTypes(true);
return this;
}

View File

@ -204,6 +204,7 @@ public class TerminologyClientR4 implements ITerminologyClient {
if (this.clientHeaders != null) {
this.client.setClientHeaders(this.clientHeaders.headers());
}
this.client.setVersionInMimeTypes(true);
return this;
}

View File

@ -81,7 +81,7 @@ import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.dstu2.model.ResourceType;
import org.hl7.fhir.dstu2.utils.ResourceUtilities;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.MimeType;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.settings.FhirSettings;
@ -573,10 +573,11 @@ public class ClientUtils {
if (StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if (format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())
MimeType mm = new MimeType(format);
if (mm.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())
|| format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if (format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())
} else if (mm.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())
|| format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {

View File

@ -178,11 +178,11 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
if (useOptionsVerb) {
conformance = (Conformance) utils
.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat(), timeoutNormal)
.issueOptionsRequest(resourceAddress.getBaseServiceUri(), withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal)
.getReference();// TODO fix this
} else {
conformance = (Conformance) utils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(false),
getPreferredResourceFormat(), timeoutNormal).getReference();
withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal).getReference();
}
} catch (Exception e) {
handleException("An error has occurred while trying to fetch the server's conformance statement", e);
@ -201,11 +201,11 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
if (useOptionsVerb) {
conformance = (Conformance) utils
.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat(), timeoutNormal)
.issueOptionsRequest(resourceAddress.getBaseServiceUri(), withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal)
.getReference();// TODO fix this
} else {
conformance = (Conformance) utils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(true),
getPreferredResourceFormat(), timeoutNormal).getReference();
withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal).getReference();
}
} catch (Exception e) {
handleException("An error has occurred while trying to fetch the server's conformance statement", e);
@ -218,7 +218,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
getPreferredResourceFormat(), timeoutNormal);
withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
result.addSuccessStatus(200);// Only one for now
@ -238,7 +238,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = utils.issueGetResourceRequest(
resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version),
getPreferredResourceFormat(), timeoutNormal);
withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
result.addErrorStatus(405);// unknown
@ -262,7 +262,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = utils.issueGetResourceRequest(
resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL),
getPreferredResourceFormat(), timeoutNormal);
withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
result.addErrorStatus(405);// unknown
@ -290,7 +290,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
result = utils.issuePutRequest(
resourceAddress.resolveGetUriFromResourceClassAndId(resource.getClass(), resource.getId()),
utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), headers, timeoutOperation);
withVer(getPreferredResourceFormat(), "1.0"), headers, timeoutOperation);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
result.addErrorStatus(405);
@ -326,7 +326,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), headers, timeoutOperation);
withVer(getPreferredResourceFormat(), "1.0"), headers, timeoutOperation);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
result.addErrorStatus(405);
@ -370,7 +370,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// ResourceRequest<T> resourceRequest = null;
// try {
// List<Header> headers = null;
// resourceRequest = utils.issuePostRequest(resourceAddress.resolveGetUriFromResourceClass(resourceClass),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// resourceRequest = utils.issuePostRequest(resourceAddress.resolveGetUriFromResourceClass(resourceClass),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"), headers, proxy);
// resourceRequest.addSuccessStatus(201);
// if(resourceRequest.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server responded with HTTP error code " + resourceRequest.getHttpStatus(), (OperationOutcome)resourceRequest.getPayload());
@ -403,7 +403,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate, Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -414,7 +414,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate, Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -425,7 +425,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate, Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -436,7 +436,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate, Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -447,7 +447,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -458,7 +458,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -469,7 +469,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -480,7 +480,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate) {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -491,7 +491,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle history() {
// Bundle history = null;
// try {
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(maxResultSetSize), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -502,7 +502,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// public <T extends Resource> Bundle search(Class<T> resourceClass, Map<String, String> parameters) {
// Bundle searchResults = null;
// try {
// searchResults = utils.issueGetFeedRequest(resourceAddress.resolveSearchUri(resourceClass, parameters), getPreferredResourceFormat(), proxy);
// searchResults = utils.issueGetFeedRequest(resourceAddress.resolveSearchUri(resourceClass, parameters), withVer(getPreferredResourceFormat(), "1.0"), proxy);
// } catch (Exception e) {
// handleException("Error performing search with parameters " + parameters, e);
// }
@ -535,10 +535,10 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
if (complex)
result = utils.issuePostRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), timeoutLong);
withVer(getPreferredResourceFormat(), "1.0"), timeoutLong);
else
result = utils.issueGetResourceRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps),
getPreferredResourceFormat(), timeoutLong);
withVer(getPreferredResourceFormat(), "1.0"), timeoutLong);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
result.addSuccessStatus(200);// Only one for now
@ -559,7 +559,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
Bundle transactionResult = null;
try {
transactionResult = utils.postBatchRequest(resourceAddress.getBaseServiceUri(),
utils.getFeedAsByteArray(batch, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
utils.getFeedAsByteArray(batch, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
timeoutNormal + batch.getEntry().size());
} catch (Exception e) {
handleException("An error occurred trying to process this transaction request", e);
@ -574,7 +574,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = utils.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id),
utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), 3);
withVer(getPreferredResourceFormat(), "1.0"), 3);
result.addErrorStatus(400);// gone
result.addErrorStatus(422);// Unprocessable Entity
result.addSuccessStatus(200);// OK
@ -593,7 +593,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
*
* public List<Coding> getAllTags() { TagListRequest result = null; try { result
* = utils.issueGetRequestForTagList(resourceAddress.resolveGetAllTags(),
* getPreferredResourceFormat(), null, proxy); } catch (Exception e) {
* withVer(getPreferredResourceFormat(), "1.0"), null, proxy); } catch (Exception e) {
* handleException("An error has occurred while trying to retrieve all tags",
* e); } return result.getPayload(); }
*
@ -602,7 +602,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
* resourceClass) { TagListRequest result = null; try { result =
* utils.issueGetRequestForTagList(resourceAddress.
* resolveGetAllTagsForResourceType(resourceClass),
* getPreferredResourceFormat(), null, proxy); } catch (Exception e) {
* withVer(getPreferredResourceFormat(), "1.0"), null, proxy); } catch (Exception e) {
* handleException("An error has occurred while trying to retrieve tags for this resource type"
* , e); } return result.getPayload(); }
*
@ -610,7 +610,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
* public <T extends Resource> List<Coding> getTagsForReference(Class<T>
* resource, String id) { TagListRequest result = null; try { result =
* utils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForReference(
* resource, id), getPreferredResourceFormat(), null, proxy); } catch (Exception
* resource, id), withVer(getPreferredResourceFormat(), "1.0"), null, proxy); } catch (Exception
* e) {
* handleException("An error has occurred while trying to retrieve tags for this resource"
* , e); } return result.getPayload(); }
@ -620,7 +620,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
* resource, String id, String versionId) { TagListRequest result = null; try {
* result = utils.issueGetRequestForTagList(resourceAddress.
* resolveGetTagsForResourceVersion(resource, id, versionId),
* getPreferredResourceFormat(), null, proxy); } catch (Exception e) {
* withVer(getPreferredResourceFormat(), "1.0"), null, proxy); } catch (Exception e) {
* handleException("An error has occurred while trying to retrieve tags for this resource version"
* , e); } return result.getPayload(); }
*
@ -647,7 +647,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
* request =
* utils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForReference(
* resourceClass, id),utils.getTagListAsByteArray(tags, false,
* isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null,
* isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"), null,
* proxy); request.addSuccessStatus(201); request.addSuccessStatus(200);
* if(request.isUnsuccessfulRequest()) { throw new
* EFhirClientException("Server responded with HTTP error code " +
@ -661,7 +661,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
* null; try { request = utils.issuePostRequestForTagList(resourceAddress.
* resolveGetTagsForResourceVersion(resourceClass, id,
* version),utils.getTagListAsByteArray(tags, false,
* isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null,
* isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"), null,
* proxy); request.addSuccessStatus(201); request.addSuccessStatus(200);
* if(request.isUnsuccessfulRequest()) { throw new
* EFhirClientException("Server responded with HTTP error code " +
@ -675,7 +675,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
* null; try { request = utils.issuePostRequestForTagList(resourceAddress.
* resolveDeleteTagsForResourceVersion(resourceClass, id,
* version),utils.getTagListAsByteArray(tags, false,
* isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null,
* isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"), null,
* proxy); request.addSuccessStatus(201); request.addSuccessStatus(200);
* if(request.isUnsuccessfulRequest()) { throw new
* EFhirClientException("Server responded with HTTP error code " +
@ -729,7 +729,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
List<Header> headers = null;
ResourceRequest<Resource> result = utils.issuePostRequest(
resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
headers, timeoutLong);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
@ -747,7 +747,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
public Parameters lookupCode(Map<String, String> params) {
recordUse();
ResourceRequest<Resource> result = utils.issueGetResourceRequest(
resourceAddress.resolveOperationUri(ValueSet.class, "lookup", params), getPreferredResourceFormat(),
resourceAddress.resolveOperationUri(ValueSet.class, "lookup", params), withVer(getPreferredResourceFormat(), "1.0"),
timeoutNormal);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
@ -771,7 +771,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
ResourceRequest<Resource> result = utils.issuePostRequest(
resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
headers, 4);
result.addErrorStatus(410); // gone
result.addErrorStatus(404); // unknown
@ -789,7 +789,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
// 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())), getPreferredResourceFormat(), headers, proxy);
// utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"), headers, proxy);
// result.addErrorStatus(410);//gone
// result.addErrorStatus(404);//unknown
// result.addErrorStatus(405);
@ -813,7 +813,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
List<Header> headers = null;
ResourceRequest<Resource> result = utils.issuePostRequest(
resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
headers, timeoutNormal);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
@ -836,7 +836,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
List<Header> headers = null;
ResourceRequest<Resource> result = utils.issuePostRequest(
resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
headers, timeoutOperation);
result.addErrorStatus(410);// gone
result.addErrorStatus(404);// unknown
@ -877,7 +877,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
public Parameters getTerminologyCapabilities() {
return (Parameters) utils
.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(), getPreferredResourceFormat(), timeoutNormal)
.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(), withVer(getPreferredResourceFormat(), "1.0"), timeoutNormal)
.getReference();
}
@ -924,4 +924,5 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
private void recordUse() {
useCount++;
}
}

View File

@ -149,7 +149,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
Parameters capabilities = null;
try {
capabilities = (Parameters) client.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"TerminologyCapabilities",
timeoutNormal).getReference();
@ -163,7 +163,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
CapabilityStatement conformance = null;
try {
conformance = (CapabilityStatement) client.issueGetResourceRequest(resourceAddress.resolveMetadataUri(false),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"CapabilitiesStatement",
timeoutNormal).getReference();
@ -177,7 +177,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
if (capabilities != null) return capabilities;
try {
capabilities = (CapabilityStatement) client.issueGetResourceRequest(resourceAddress.resolveMetadataUri(true),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"CapabilitiesStatement-Quick",
timeoutNormal).getReference();
@ -192,7 +192,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"Read " + resourceClass.getName() + "/" + id,
timeoutNormal);
@ -210,7 +210,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"VRead " + resourceClass.getName() + "/" + id + "/?_history/" + version,
timeoutNormal);
@ -228,7 +228,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"Read " + resourceClass.getName() + "?url=" + canonicalURL,
timeoutNormal);
@ -252,7 +252,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resource.getClass(), resource.getId()),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"Update " + resource.fhirType() + "/" + resource.getId(),
timeoutOperation);
@ -280,7 +280,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"Update " + resource.fhirType() + "/" + id,
timeoutOperation);
@ -320,13 +320,13 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
if (client.getLogger() != null) {
client.getLogger().logRequest("POST", url.toString(), null, body);
}
result = client.issuePostRequest(url, body, getPreferredResourceFormat(), generateHeaders(),
result = client.issuePostRequest(url, body, withVer(getPreferredResourceFormat(), "3.0"), generateHeaders(),
"POST " + resourceClass.getName() + "/$" + name, timeoutLong);
} else {
if (client.getLogger() != null) {
client.getLogger().logRequest("GET", url.toString(), null, null);
}
result = client.issueGetResourceRequest(url, getPreferredResourceFormat(), generateHeaders(), "GET " + resourceClass.getName() + "/$" + name, timeoutLong);
result = client.issueGetResourceRequest(url, withVer(getPreferredResourceFormat(), "3.0"), generateHeaders(), "GET " + resourceClass.getName() + "/$" + name, timeoutLong);
}
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
@ -349,7 +349,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
recordUse();
Bundle transactionResult = null;
try {
transactionResult = client.postBatchRequest(resourceAddress.getBaseServiceUri(), ByteUtils.resourceToByteArray(batch, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), "transaction", timeoutOperation + (timeoutEntry * batch.getEntry().size()));
transactionResult = client.postBatchRequest(resourceAddress.getBaseServiceUri(), ByteUtils.resourceToByteArray(batch, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "3.0"), "transaction", timeoutOperation + (timeoutEntry * batch.getEntry().size()));
} catch (Exception e) {
handleException("An error occurred trying to process this transaction request", e);
}
@ -363,7 +363,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), generateHeaders(),
withVer(getPreferredResourceFormat(), "3.0"), generateHeaders(),
"POST " + resourceClass.getName() + (id != null ? "/" + id : "") + "/$validate", timeoutLong);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
@ -422,7 +422,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"ValueSet/$expand?url=" + source.getUrl(),
timeoutExpand);
@ -441,7 +441,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(CodeSystem.class, "lookup", params),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"CodeSystem/$lookup",
timeoutNormal);
@ -465,7 +465,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"ValueSet/$expand?url=" + source.getUrl(),
timeoutExpand);
@ -490,7 +490,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"ValueSet/$expand?url=" + source.getUrl(),
timeoutExpand);
@ -515,7 +515,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"Closure?name=" + name,
timeoutNormal);
@ -537,7 +537,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "3.0"),
generateHeaders(),
"UpdateClosure?name=" + name,
timeoutOperation);
@ -653,5 +653,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
private void recordUse() {
useCount++;
}
}

View File

@ -20,6 +20,7 @@ import org.hl7.fhir.dstu3.utils.ResourceUtilities;
import org.hl7.fhir.dstu3.utils.client.EFhirClientException;
import org.hl7.fhir.dstu3.utils.client.ResourceFormat;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.MimeType;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.settings.FhirSettings;
@ -326,9 +327,10 @@ public class FhirRequestBuilder {
if (StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if (format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
MimeType mt = new MimeType(format);
if (mt.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if (format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
} else if (mt.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {
throw new EFhirClientException("Invalid format: " + format);

View File

@ -81,7 +81,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
private String acceptLang;
private String contentLang;
private int useCount;
// Pass endpoint for client - URI
public FHIRToolingClient(String baseServiceUrl, String userAgent) throws URISyntaxException {
preferredResourceFormat = ResourceFormat.RESOURCE_JSON;
@ -131,7 +131,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
TerminologyCapabilities capabilities = null;
try {
capabilities = (TerminologyCapabilities) client.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(),
getPreferredResourceFormat(), generateHeaders(), "TerminologyCapabilities", timeoutNormal).getReference();
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "TerminologyCapabilities", timeoutNormal).getReference();
} catch (Exception e) {
throw new FHIRException("Error fetching the server's terminology capabilities", e);
}
@ -142,7 +142,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
CapabilityStatement conformance = null;
try {
conformance = (CapabilityStatement) client.issueGetResourceRequest(resourceAddress.resolveMetadataUri(false),
getPreferredResourceFormat(), generateHeaders(), "CapabilitiesStatement", timeoutNormal).getReference();
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "CapabilitiesStatement", timeoutNormal).getReference();
} catch (Exception e) {
throw new FHIRException("Error fetching the server's conformance statement", e);
}
@ -150,11 +150,11 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
}
public CapabilityStatement getCapabilitiesStatementQuick() throws EFhirClientException {
if (capabilities != null)
if (capabilities != null)
return capabilities;
try {
capabilities = (CapabilityStatement) client.issueGetResourceRequest(resourceAddress.resolveMetadataUri(true),
getPreferredResourceFormat(), generateHeaders(), "CapabilitiesStatement-Quick", timeoutNormal)
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "CapabilitiesStatement-Quick", timeoutNormal)
.getReference();
} catch (Exception e) {
throw new FHIRException("Error fetching the server's capability statement: " + e.getMessage(), e);
@ -167,7 +167,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
getPreferredResourceFormat(), generateHeaders(), "Read " + resourceClass + "/" + id,
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "Read " + resourceClass + "/" + id,
timeoutNormal);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -184,7 +184,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
getPreferredResourceFormat(), generateHeaders(), "Read " + resourceClass.getName() + "/" + id,
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "Read " + resourceClass.getName() + "/" + id,
timeoutNormal);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -202,7 +202,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issueGetResourceRequest(
resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version),
getPreferredResourceFormat(), generateHeaders(),
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(),
"VRead " + resourceClass.getName() + "/" + id + "/?_history/" + version, timeoutNormal);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -220,7 +220,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issueGetResourceRequest(
resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL),
getPreferredResourceFormat(), generateHeaders(), "Read " + resourceClass.getName() + "?url=" + canonicalURL,
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "Read " + resourceClass.getName() + "?url=" + canonicalURL,
timeoutNormal);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -244,7 +244,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
result = client.issuePutRequest(
resourceAddress.resolveGetUriFromResourceClassAndId(resource.getClass(), resource.getId()),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), generateHeaders(), "Update " + resource.fhirType() + "/" + resource.getId(),
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "Update " + resource.fhirType() + "/" + resource.getId(),
timeoutOperation);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -274,7 +274,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), generateHeaders(), "Update " + resource.fhirType() + "/" + id,
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "Update " + resource.fhirType() + "/" + id,
timeoutOperation);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -312,10 +312,10 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
URI url = resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps);
if (complex) {
byte[] body = ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat()));
result = client.issuePostRequest(url, body, getPreferredResourceFormat(), generateHeaders(),
result = client.issuePostRequest(url, body, withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(),
"POST " + resourceClass.getName() + "/$" + name, timeoutLong);
} else {
result = client.issueGetResourceRequest(url, getPreferredResourceFormat(), generateHeaders(),
result = client.issueGetResourceRequest(url, withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(),
"GET " + resourceClass.getName() + "/$" + name, timeoutLong);
}
if (result.isUnsuccessfulRequest()) {
@ -337,7 +337,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
transactionResult = client.postBatchRequest(resourceAddress.getBaseServiceUri(),
ByteUtils.resourceToByteArray(batch, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), "transaction", timeoutOperation + (timeoutEntry * batch.getEntry().size()));
withVer(getPreferredResourceFormat(), "4.0"), "transaction", timeoutOperation + (timeoutEntry * batch.getEntry().size()));
} catch (Exception e) {
handleException("An error occurred trying to process this transaction request", e);
}
@ -351,7 +351,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), generateHeaders(),
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(),
"POST " + resourceClass.getName() + (id != null ? "/" + id : "") + "/$validate", timeoutLong);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -396,7 +396,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
recordUse();
Bundle feed = null;
try {
feed = client.issueGetFeedRequest(new URI(url), getPreferredResourceFormat(), timeoutLong);
feed = client.issueGetFeedRequest(new URI(url), withVer(getPreferredResourceFormat(), "4.0"), timeoutLong);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve history since last update", e);
}
@ -422,7 +422,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", parameters),
getPreferredResourceFormat(), generateHeaders(), "ValueSet/$expand?url=" + vsUrl, timeoutExpand);
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "ValueSet/$expand?url=" + vsUrl, timeoutExpand);
} catch (IOException e) {
throw new FHIRException(e);
}
@ -440,7 +440,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
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())), getPreferredResourceFormat(),
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(),
@ -457,7 +457,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(CodeSystem.class, "lookup", params),
getPreferredResourceFormat(), generateHeaders(), "CodeSystem/$lookup", timeoutNormal);
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "CodeSystem/$lookup", timeoutNormal);
} catch (IOException e) {
throw new FHIRException(e);
}
@ -480,7 +480,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(), source == null ? "ValueSet/$expand" : "ValueSet/$expand?url=" + source.getUrl(),
timeoutExpand);
if (result.isUnsuccessfulRequest()) {
@ -512,7 +512,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
result = client.issuePostRequest(
resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), generateHeaders(), "Closure?name=" + name, timeoutNormal);
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "Closure?name=" + name, timeoutNormal);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
(OperationOutcome) result.getPayload());
@ -533,7 +533,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
result = client.issuePostRequest(
resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), generateHeaders(), "UpdateClosure?name=" + name, timeoutOperation);
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "UpdateClosure?name=" + name, timeoutOperation);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
(OperationOutcome) result.getPayload());
@ -645,7 +645,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetResource(resourceClass, id),
getPreferredResourceFormat(), generateHeaders(), resourceClass.getName()+"/"+id, timeoutNormal);
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), resourceClass.getName()+"/"+id, timeoutNormal);
} catch (IOException e) {
throw new FHIRException(e);
}
@ -664,4 +664,5 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
useCount++;
}
}

View File

@ -18,6 +18,7 @@ import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.utils.ResourceUtilities;
import org.hl7.fhir.r4.utils.client.EFhirClientException;
import org.hl7.fhir.r4.utils.client.ResourceFormat;
import org.hl7.fhir.utilities.MimeType;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.settings.FhirSettings;
@ -335,9 +336,11 @@ public class FhirRequestBuilder {
if (StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if (format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
MimeType mt = new MimeType(format);
if (mt.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if (format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
} else if (mt.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {
throw new EFhirClientException("Invalid format: " + format);

View File

@ -350,6 +350,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
setTxCaps(capabilityStatement);
return capabilitiesStatementQuick.getSoftware().getVersion();
} catch (Exception e) {
e.printStackTrace();
throw new FHIRException(formatMessage(canNoTS ? I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ : I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER, e.getMessage(), client.getAddress()), e);
}
}

View File

@ -72,6 +72,8 @@ public class TerminologyClientManager {
serverList.addAll(other.serverList);
serverMap.putAll(other.serverMap);
resMap.putAll(other.resMap);
monitorServiceURL = other.monitorServiceURL;
factory = other.factory;
}
public boolean usingCache() {

View File

@ -205,6 +205,7 @@ public class TerminologyClientR5 implements ITerminologyClient {
public ITerminologyClient setClientHeaders(ClientHeaders clientHeaders) {
this.clientHeaders = clientHeaders;
this.client.setClientHeaders(this.clientHeaders.headers());
this.client.setVersionInMimeTypes(true);
return this;
}

View File

@ -109,6 +109,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
private int useCount;
//Pass endpoint for client - URI
public FHIRToolingClient(String baseServiceUrl, String userAgent) throws URISyntaxException {
preferredResourceFormat = ResourceFormat.RESOURCE_JSON;
@ -160,7 +161,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
for (ResourceFormat attemptedResourceFormat : resourceFormats) {
try {
T output = (T) client.issueGetResourceRequest(resourceUri,
preferredResourceFormat.getHeader(),
withVer(preferredResourceFormat.getHeader(), "5.0"),
generateHeaders(),
message,
timeoutNormal).getReference();
@ -213,7 +214,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
getPreferredResourceFormat(), generateHeaders(), "Read " + resourceClass + "/" + id,
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "Read " + resourceClass + "/" + id,
timeoutNormal);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
@ -231,7 +232,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"Read " + resourceClass.getName() + "/" + id,
timeoutNormal);
@ -249,7 +250,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"VRead " + resourceClass.getName() + "/" + id + "/?_history/" + version,
timeoutNormal);
@ -267,7 +268,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
ResourceRequest<T> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"Read " + resourceClass.getName() + "?url=" + canonicalURL,
timeoutNormal);
@ -291,7 +292,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resource.getClass(), resource.getId()),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"Update " + resource.fhirType() + "/" + resource.getId(),
timeoutOperation);
@ -319,7 +320,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"Update " + resource.fhirType() + "/" + id,
timeoutOperation);
@ -356,10 +357,10 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
URI url = resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps);
if (complex) {
byte[] body = ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat()));
result = client.issuePostRequest(url, body, getPreferredResourceFormat(), generateHeaders(),
result = client.issuePostRequest(url, body, withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(),
"POST " + resourceClass.getName() + "/$" + name, timeoutLong);
} else {
result = client.issueGetResourceRequest(url, getPreferredResourceFormat(), generateHeaders(), "GET " + resourceClass.getName() + "/$" + name, timeoutLong);
result = client.issueGetResourceRequest(url, withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "GET " + resourceClass.getName() + "/$" + name, timeoutLong);
}
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
@ -381,7 +382,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
recordUse();
Bundle transactionResult = null;
try {
transactionResult = client.postBatchRequest(resourceAddress.getBaseServiceUri(), ByteUtils.resourceToByteArray(batch, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
transactionResult = client.postBatchRequest(resourceAddress.getBaseServiceUri(), ByteUtils.resourceToByteArray(batch, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"transaction", timeoutOperation + (timeoutEntry * batch.getEntry().size()));
} catch (Exception e) {
@ -397,7 +398,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(), generateHeaders(),
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(),
"POST " + resourceClass.getName() + (id != null ? "/" + id : "") + "/$validate", timeoutLong);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
@ -456,7 +457,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"ValueSet/$expand?url=" + source.getUrl(),
timeoutExpand);
@ -475,7 +476,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(CodeSystem.class, "lookup", params),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"CodeSystem/$lookup",
timeoutNormal);
@ -505,7 +506,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
source == null ? "ValueSet/$expand" : "ValueSet/$expand?url=" + source.getUrl(),
timeoutExpand);
@ -530,7 +531,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"Closure?name=" + name,
timeoutNormal);
@ -552,7 +553,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),
withVer(getPreferredResourceFormat(), "4.0"),
generateHeaders(),
"UpdateClosure?name=" + name,
timeoutOperation);
@ -681,7 +682,7 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveGetResource(resourceClass, id),
getPreferredResourceFormat(), generateHeaders(), resourceClass.getName()+"/"+id, timeoutNormal);
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), resourceClass.getName()+"/"+id, timeoutNormal);
} catch (IOException e) {
throw new FHIRException(e);
}

View File

@ -12,6 +12,7 @@ import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.utils.ResourceUtilities;
import org.hl7.fhir.r5.utils.client.EFhirClientException;
import org.hl7.fhir.r5.utils.client.ResourceFormat;
import org.hl7.fhir.utilities.MimeType;
import org.hl7.fhir.utilities.settings.FhirSettings;
import javax.annotation.Nonnull;
@ -309,9 +310,10 @@ public class FhirRequestBuilder {
if (StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if (format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
MimeType mt = new MimeType(format);
if (mt.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if (format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
} else if (mt.getBase().equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {
throw new EFhirClientException("Invalid format: " + format);

View File

@ -1,15 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "urn:ietf:bcp:47"
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -1,47 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "http://loinc.org",
"concept" : [{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "A."
}],
"code" : "LA20752-4",
"display" : "Within 24 hours"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "B."
}],
"code" : "LA20753-2",
"display" : "After 24 hours but before 3 days"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "C."
}],
"code" : "LA20754-0",
"display" : "Three days or later"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "D."
}],
"code" : "LA4489-6",
"display" : "Unknown"
}]
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -1,15 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "urn:ietf:bcp:13"
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -1,99 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "http://unitsofmeasure.org",
"concept" : [{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "second"
}],
"code" : "s",
"display" : "second",
"designation" : [{
"language" : "zh",
"value" : "秒"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "minute"
}],
"code" : "min",
"display" : "minute",
"designation" : [{
"language" : "zh",
"value" : "分钟"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "hour"
}],
"code" : "h",
"display" : "hour",
"designation" : [{
"language" : "zh",
"value" : "小时"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "day"
}],
"code" : "d",
"display" : "day",
"designation" : [{
"language" : "zh",
"value" : "天"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "week"
}],
"code" : "wk",
"display" : "week",
"designation" : [{
"language" : "zh",
"value" : "星期"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "month - Normal practice is to use the 'mo' code as a calendar month when calculating the next occurrence."
}],
"code" : "mo",
"display" : "month",
"designation" : [{
"language" : "zh",
"value" : "月"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "year"
}],
"code" : "a",
"display" : "year",
"designation" : [{
"language" : "zh",
"value" : "年"
}]
}]
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -14,7 +14,9 @@ public class FHIRBaseToolingClient {
protected int timeoutEntry = DEFAULT_TIMEOUT_ENTRY;
protected int timeoutLong = DEFAULT_TIMEOUT_OPERATION_LONG;
protected int timeoutExpand = DEFAULT_TIMEOUT_OPERATION_EXPAND;
protected boolean versionInMimeTypes;
public long getTimeoutNormal() {
return timeoutNormal;
@ -64,5 +66,17 @@ public class FHIRBaseToolingClient {
timeoutLong = i * DEFAULT_TIMEOUT_OPERATION_LONG;
timeoutExpand = i * DEFAULT_TIMEOUT_OPERATION_EXPAND;
}
protected String withVer(String header, String version) {
return header+(versionInMimeTypes ? "; fhirVersion="+version : "");
}
public boolean isVersionInMimeTypes() {
return versionInMimeTypes;
}
public void setVersionInMimeTypes(boolean versionInMimeTypes) {
this.versionInMimeTypes = versionInMimeTypes;
}
}

View File

@ -71,6 +71,18 @@ public class MimeType {
return null;
}
public String getSource() {
return source;
}
public String getBase() {
return base;
}
public Map<String, String> getParams() {
return params;
}
public boolean hasParam(String name) {
return params.containsKey(name);
}
@ -135,4 +147,5 @@ public class MimeType {
return null;
}
}

View File

@ -1,15 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "urn:ietf:bcp:47"
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -1,47 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "http://loinc.org",
"concept" : [{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "A."
}],
"code" : "LA20752-4",
"display" : "Within 24 hours"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "B."
}],
"code" : "LA20753-2",
"display" : "After 24 hours but before 3 days"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "C."
}],
"code" : "LA20754-0",
"display" : "Three days or later"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
"valueString" : "D."
}],
"code" : "LA4489-6",
"display" : "Unknown"
}]
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -1,15 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "urn:ietf:bcp:13"
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -1,99 +0,0 @@
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "http://unitsofmeasure.org",
"concept" : [{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "second"
}],
"code" : "s",
"display" : "second",
"designation" : [{
"language" : "zh",
"value" : "秒"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "minute"
}],
"code" : "min",
"display" : "minute",
"designation" : [{
"language" : "zh",
"value" : "分钟"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "hour"
}],
"code" : "h",
"display" : "hour",
"designation" : [{
"language" : "zh",
"value" : "小时"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "day"
}],
"code" : "d",
"display" : "day",
"designation" : [{
"language" : "zh",
"value" : "天"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "week"
}],
"code" : "wk",
"display" : "week",
"designation" : [{
"language" : "zh",
"value" : "星期"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "month - Normal practice is to use the 'mo' code as a calendar month when calculating the next occurrence."
}],
"code" : "mo",
"display" : "month",
"designation" : [{
"language" : "zh",
"value" : "月"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "year"
}],
"code" : "a",
"display" : "year",
"designation" : [{
"language" : "zh",
"value" : "年"
}]
}]
}]
}
}}####
e: {
"from-server" : true,
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.client.ITerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because the return value of \"org.hl7.fhir.r5.terminologies.client.TerminologyClientContext.getClient()\" is null"
}
-------------------------------------------------------------------------------------

View File

@ -13,10 +13,10 @@
"valueCode" : "both"
}],
"url" : "http://tx-dev.fhir.org/r2/metadata",
"version" : "1.0.2-3.0.0",
"version" : "1.0.2-3.1.0",
"name" : "FHIR Reference Server Conformance Statement",
"status" : "active",
"date" : "2024-01-04T06:37:42.409Z",
"date" : "2024-01-10T05:45:51.112Z",
"contact" : [{
"telecom" : [{
"system" : "other",
@ -27,8 +27,8 @@
"kind" : "instance",
"software" : {
"name" : "Reference Server",
"version" : "3.0.0",
"releaseDate" : "2023-06-19T19:50:55.040Z"
"version" : "3.1.0",
"releaseDate" : "2024-01-08T12:29:45.425Z"
},
"implementation" : {
"description" : "FHIR Server running at http://tx-dev.fhir.org/r2",

View File

@ -0,0 +1,20 @@
{
"systems" : [
{
"system" : "http://acme.org/devices/clinical-codes",
"server" : "http://tx-dev.fhir.org/r2"
},
{
"system" : "http://loinc.org",
"server" : "http://tx-dev.fhir.org/r2"
},
{
"system" : "http://snomed.info/sct",
"server" : "http://tx-dev.fhir.org/r2"
},
{
"system" : "http://unitsofmeasure.org",
"server" : "http://tx-dev.fhir.org/r2"
}
]
}

View File

@ -13,10 +13,10 @@
"valueCode" : "both"
}],
"url" : "http://tx-dev.fhir.org/r3/metadata",
"version" : "3.0.2-3.0.0",
"version" : "3.0.2-3.1.0",
"name" : "FHIR Reference Server Conformance Statement",
"status" : "active",
"date" : "2024-01-04T06:37:48.299Z",
"date" : "2024-01-10T05:46:10.065Z",
"contact" : [{
"telecom" : [{
"system" : "other",
@ -27,8 +27,8 @@
"instantiates" : ["http://hl7.org/fhir/CapabilityStatement/terminology-server"],
"software" : {
"name" : "Reference Server",
"version" : "3.0.0",
"releaseDate" : "2023-06-19T19:50:55.040Z"
"version" : "3.1.0",
"releaseDate" : "2024-01-08T12:29:45.425Z"
},
"implementation" : {
"description" : "FHIR Server running at http://tx-dev.fhir.org/r3",

View File

@ -13,10 +13,10 @@
"valueCode" : "both"
}],
"url" : "http://tx-dev.fhir.org/r3/metadata",
"version" : "3.0.2-3.0.0",
"version" : "3.0.2-3.1.0",
"name" : "FHIR Reference Server Conformance Statement",
"status" : "active",
"date" : "2024-01-04T06:37:52.096Z",
"date" : "2024-01-10T05:46:15.222Z",
"contact" : [{
"telecom" : [{
"system" : "other",
@ -27,8 +27,8 @@
"instantiates" : ["http://hl7.org/fhir/CapabilityStatement/terminology-server"],
"software" : {
"name" : "Reference Server",
"version" : "3.0.0",
"releaseDate" : "2023-06-19T19:50:55.040Z"
"version" : "3.1.0",
"releaseDate" : "2024-01-08T12:29:45.425Z"
},
"implementation" : {
"description" : "FHIR Server running at http://tx-dev.fhir.org/r3",

View File

@ -0,0 +1,20 @@
{
"systems" : [
{
"system" : "http://acme.org/devices/clinical-codes",
"server" : "http://tx-dev.fhir.org/r3"
},
{
"system" : "http://loinc.org",
"server" : "http://tx-dev.fhir.org/r3"
},
{
"system" : "http://snomed.info/sct",
"server" : "http://tx-dev.fhir.org/r3"
},
{
"system" : "http://unitsofmeasure.org",
"server" : "http://tx-dev.fhir.org/r3"
}
]
}

View File

@ -9,10 +9,10 @@
}]
},
"url" : "http://tx-dev.fhir.org/r4/metadata",
"version" : "4.0.1-3.0.0",
"version" : "4.0.1-3.1.0",
"name" : "FHIR Reference Server Conformance Statement",
"status" : "active",
"date" : "2024-01-04T06:38:17.377Z",
"date" : "2024-01-10T05:46:50.565Z",
"contact" : [{
"telecom" : [{
"system" : "other",
@ -23,8 +23,8 @@
"instantiates" : ["http://hl7.org/fhir/CapabilityStatement/terminology-server"],
"software" : {
"name" : "Reference Server",
"version" : "3.0.0",
"releaseDate" : "2023-06-19T19:50:55.040Z"
"version" : "3.1.0",
"releaseDate" : "2024-01-08T12:29:45.425Z"
},
"implementation" : {
"description" : "FHIR Server running at http://tx-dev.fhir.org/r4",

View File

@ -5,7 +5,7 @@
"version" : "2.0.0",
"name" : "FHIR Reference Server Teminology Capability Statement",
"status" : "active",
"date" : "2024-01-04T06:38:17.612Z",
"date" : "2024-01-10T05:46:50.769Z",
"contact" : [{
"telecom" : [{
"system" : "other",

View File

@ -9,10 +9,10 @@
}]
},
"url" : "http://tx-dev.fhir.org/r4/metadata",
"version" : "4.0.1-3.0.0",
"version" : "4.0.1-3.1.0",
"name" : "FHIR Reference Server Conformance Statement",
"status" : "active",
"date" : "2024-01-04T06:43:06.502Z",
"date" : "2024-01-10T05:53:30.472Z",
"contact" : [{
"telecom" : [{
"system" : "other",
@ -23,8 +23,8 @@
"instantiates" : ["http://hl7.org/fhir/CapabilityStatement/terminology-server"],
"software" : {
"name" : "Reference Server",
"version" : "3.0.0",
"releaseDate" : "2023-06-19T19:50:55.040Z"
"version" : "3.1.0",
"releaseDate" : "2024-01-08T12:29:45.425Z"
},
"implementation" : {
"description" : "FHIR Server running at http://tx-dev.fhir.org/r4",

View File

@ -5,7 +5,7 @@
"version" : "2.0.0",
"name" : "FHIR Reference Server Teminology Capability Statement",
"status" : "active",
"date" : "2024-01-04T06:43:06.721Z",
"date" : "2024-01-10T05:53:30.690Z",
"contact" : [{
"telecom" : [{
"system" : "other",

View File

@ -9,10 +9,10 @@
}]
},
"url" : "http://tx-dev.fhir.org/r4/metadata",
"version" : "4.0.1-3.0.0",
"version" : "4.0.1-3.1.0",
"name" : "FHIR Reference Server Conformance Statement",
"status" : "active",
"date" : "2024-01-04T06:43:11.096Z",
"date" : "2024-01-10T05:53:38.034Z",
"contact" : [{
"telecom" : [{
"system" : "other",
@ -23,8 +23,8 @@
"instantiates" : ["http://hl7.org/fhir/CapabilityStatement/terminology-server"],
"software" : {
"name" : "Reference Server",
"version" : "3.0.0",
"releaseDate" : "2023-06-19T19:50:55.040Z"
"version" : "3.1.0",
"releaseDate" : "2024-01-08T12:29:45.425Z"
},
"implementation" : {
"description" : "FHIR Server running at http://tx-dev.fhir.org/r4",

View File

@ -5,7 +5,7 @@
"version" : "2.0.0",
"name" : "FHIR Reference Server Teminology Capability Statement",
"status" : "active",
"date" : "2024-01-04T06:43:11.299Z",
"date" : "2024-01-10T05:53:38.237Z",
"contact" : [{
"telecom" : [{
"system" : "other",

View File

@ -0,0 +1,64 @@
{
"systems" : [
{
"system" : "http://acme.com/config/fhir/codesystems/internal",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://acme.org/devices/clinical-codes",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://acme.ped/apgarcolor",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://acme.ped/apgarheartrate",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://acme.ped/apgarmuscletone",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://acme.ped/apgarreflexirritability",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://acme.ped/apgarrespiratoryeffort",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://hl7.org/fhir/sid/ndc",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://loinc.org",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://snomed.info/sct",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://terminology.hl7.org/CodeSystem/condition-category",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://terminology.hl7.org/CodeSystem/v2-0136",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://terminology.hl7.org/CodeSystem/v2-0360|2.7",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "http://unitsofmeasure.org",
"server" : "http://tx-dev.fhir.org/r4"
},
{
"system" : "urn:ietf:bcp:47",
"server" : "http://tx-dev.fhir.org/r4"
}
]
}