From b29cdc22f377ab8fc82bf8fb07b864d44e790587 Mon Sep 17 00:00:00 2001 From: Rob Hausam Date: Tue, 29 May 2018 21:34:54 -0500 Subject: [PATCH 1/4] Fix client upload-terminology for r4. --- .../uhn/fhir/cli/UploadTerminologyCommand.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java index 756567ed7d4..5179a03afbc 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java @@ -28,9 +28,6 @@ import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -import org.hl7.fhir.dstu3.model.Parameters; -import org.hl7.fhir.dstu3.model.StringType; -import org.hl7.fhir.dstu3.model.UriType; import org.hl7.fhir.instance.model.api.IBaseParameters; import static org.apache.commons.lang3.StringUtils.isBlank; @@ -82,10 +79,17 @@ public class UploadTerminologyCommand extends BaseCommand { IGenericClient client = super.newClient(theCommandLine); IBaseParameters inputParameters; if (ctx.getVersion().getVersion() == FhirVersionEnum.DSTU3) { - Parameters p = new Parameters(); - p.addParameter().setName("url").setValue(new UriType(termUrl)); + org.hl7.fhir.dstu3.model.Parameters p = new org.hl7.fhir.dstu3.model.Parameters(); + p.addParameter().setName("url").setValue(new org.hl7.fhir.dstu3.model.UriType(termUrl)); for (String next : datafile) { - p.addParameter().setName("localfile").setValue(new StringType(next)); + p.addParameter().setName("localfile").setValue(new org.hl7.fhir.dstu3.model.StringType(next)); + } + inputParameters = p; + } else if (ctx.getVersion().getVersion() == FhirVersionEnum.R4) { + org.hl7.fhir.r4.model.Parameters p = new org.hl7.fhir.r4.model.Parameters(); + p.addParameter().setName("url").setValue(new org.hl7.fhir.r4.model.UriType(termUrl)); + for (String next : datafile) { + p.addParameter().setName("localfile").setValue(new org.hl7.fhir.r4.model.StringType(next)); } inputParameters = p; } else { From b2853b3f9dd6c85f71bf5c73d10d599b4f08f023 Mon Sep 17 00:00:00 2001 From: Joel Schneider Date: Wed, 27 Jun 2018 02:20:12 -0500 Subject: [PATCH 2/4] modify BaseHapiTerminologySvcImpl saveDeferred method to avoid short circuit that could potentially prevent processing of some deferred value sets and concept maps --- .../uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java index f2bcbc67a8c..5aedf94e8eb 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java @@ -850,15 +850,16 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc, return; } else if (myDeferredConcepts.isEmpty() && myConceptLinksToSaveLater.isEmpty()) { processReindexing(); - return; } TransactionTemplate tt = new TransactionTemplate(myTransactionMgr); tt.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); - tt.execute(t -> { - processDeferredConcepts(); - return null; - }); + if(!myDeferredConcepts.isEmpty() || !myConceptLinksToSaveLater.isEmpty()) { + tt.execute(t -> { + processDeferredConcepts(); + return null; + }); + } if (myDeferredValueSets.size() > 0) { tt.execute(t -> { From 609cfc7f0862bbefc04fa67bf15b1b5e1c64d80b Mon Sep 17 00:00:00 2001 From: James Agnew Date: Wed, 27 Jun 2018 10:36:50 -0400 Subject: [PATCH 3/4] Credit for #1015 --- src/changes/changes.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 62fd7417976..a2647660836 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -89,6 +89,12 @@ client-assigned reosurce ID). Thanks to Frank Tao for the pull request! + + A bug was fixed in the JPA terminology uploader, where it was possible + in some cases for some ValueSets and ConceptMaps to not be saved because + of a premature short circuit during deferred uploading. Thanks to + Joel Schneider for the pull request! + From bbf47454b3fca6ce3cbdc041e27156f438a1f44d Mon Sep 17 00:00:00 2001 From: James Agnew Date: Wed, 27 Jun 2018 10:42:56 -0400 Subject: [PATCH 4/4] Credit for #969 --- src/changes/changes.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index a2647660836..b60ec39af16 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -95,6 +95,11 @@ of a premature short circuit during deferred uploading. Thanks to Joel Schneider for the pull request! + + A bug in the HAPI FHIR CLI was fixed, where uploading terminology for R4 + could cause an error about the incorrect FHIR version. Thanks to + Rob Hausam for the pull request! +