From 316e7e0d6dc7e17ae732540bd5a7235ad098851a Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Wed, 12 May 2021 21:38:29 -0400 Subject: [PATCH] Ks 20210512 value set expansion id (#2654) * tested and fixed * changelog --- .../fhir/changelog/5_4_0/2654-value-set-expansion-id.yaml | 5 +++++ .../main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java | 3 ++- .../r4/ResourceProviderR4ValueSetVerCSNoVerTest.java | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_4_0/2654-value-set-expansion-id.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_4_0/2654-value-set-expansion-id.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_4_0/2654-value-set-expansion-id.yaml new file mode 100644 index 00000000000..3f360af2d2a --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_4_0/2654-value-set-expansion-id.yaml @@ -0,0 +1,5 @@ +--- +type: fix +issue: 2654 +title: "The id of ValueSet resources in ValueSet expansions was null. This has been corrected. The id of the expanded +value set is now the same as the id of the value set that was expanded." diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java index b66ec988a8e..3d8c9f0ce28 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java @@ -420,6 +420,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { } ValueSet valueSet = new ValueSet(); + valueSet.setId(theValueSetToExpand.getId()); valueSet.setStatus(Enumerations.PublicationStatus.ACTIVE); valueSet.setCompose(theValueSetToExpand.getCompose()); valueSet.setExpansion(accumulator); @@ -1765,7 +1766,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { return null; }); - ourLog.info("Pre-expanded ValueSet[{}] with URL[{}] - Saved {} concepts in {}", valueSet.getId(), valueSet.getUrl(), accumulator.getConceptsSaved(), sw.toString()); + ourLog.info("Pre-expanded ValueSet[{}] with URL[{}] - Saved {} concepts in {}", valueSet.getId(), valueSet.getUrl(), accumulator.getConceptsSaved(), sw); } catch (Exception e) { ourLog.error("Failed to pre-expand ValueSet: " + e.getMessage(), e); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java index e55fcbadf86..811786e9c5a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java @@ -8,7 +8,6 @@ import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum; import ca.uhn.fhir.jpa.entity.TermValueSet; import ca.uhn.fhir.jpa.entity.TermValueSetConcept; -import ca.uhn.fhir.jpa.entity.TermValueSetConceptDesignation; import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; @@ -706,6 +705,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid .execute(); ourLog.info("Expanded: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(expanded)); assertEquals(1, expanded.getExpansion().getContains().size()); + assertNotNull(expanded.getId()); } @Test @@ -791,7 +791,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid TermValueSet termValueSet = optionalValueSetByUrl.get(); assertSame(optionalValueSetByResourcePid.get(), termValueSet); - ourLog.info("ValueSet:\n" + termValueSet.toString()); + ourLog.info("ValueSet:\n" + termValueSet); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals(theValueSetName, termValueSet.getName()); assertEquals(0, termValueSet.getConcepts().size()); @@ -809,7 +809,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid TermValueSet termValueSet = optionalValueSetByUrl.get(); assertSame(optionalValueSetByResourcePid.get(), termValueSet); - ourLog.info("ValueSet:\n" + termValueSet.toString()); + ourLog.info("ValueSet:\n" + termValueSet); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals(theValueSetName, termValueSet.getName()); assertEquals(theCodeSystem.getConcept().size(), termValueSet.getConcepts().size());