From fe684ee4c0c2066c086fde29586ed62add223010 Mon Sep 17 00:00:00 2001 From: ianmarshall Date: Tue, 15 Sep 2020 12:26:17 -0400 Subject: [PATCH] Further cleanup --- .../fhir/jpa/dao/data/ITermValueSetDao.java | 2 +- .../dao/expunge/ExpungeEverythingService.java | 5 --- .../fhir/jpa/term/BaseTermReadSvcImpl.java | 32 ++++++++------- .../r4/FhirResourceDaoR4TerminologyTest.java | 2 +- .../dao/r4/FhirResourceDaoR4ValidateTest.java | 16 ++------ .../ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java | 2 - .../ResourceProviderDstu3ValueSetTest.java | 2 - .../r4/ResourceProviderR4ValueSetTest.java | 8 ---- .../r5/ResourceProviderR5ValueSetTest.java | 11 ----- .../jpa/term/TerminologySvcDeltaR4Test.java | 2 +- .../jpa/term/TerminologySvcImplR4Test.java | 6 --- .../jpa/term/ValueSetExpansionR4Test.java | 40 ------------------- 12 files changed, 24 insertions(+), 104 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ITermValueSetDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ITermValueSetDao.java index 33883b6073c..a7d72f71d6e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ITermValueSetDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ITermValueSetDao.java @@ -20,7 +20,6 @@ package ca.uhn.fhir.jpa.dao.data; * #L% */ -import ca.uhn.fhir.jpa.entity.TermCodeSystem; import ca.uhn.fhir.jpa.entity.TermValueSet; import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum; import org.springframework.data.domain.Pageable; @@ -33,6 +32,7 @@ import java.util.List; import java.util.Optional; public interface ITermValueSetDao extends JpaRepository { + @Query("SELECT vs FROM TermValueSet vs WHERE vs.myResourcePid = :resource_pid") Optional findByResourcePid(@Param("resource_pid") Long theResourcePid); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java index e80a2b67d9c..75e74b5ab75 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java @@ -117,10 +117,6 @@ public class ExpungeEverythingService { counter.addAndGet(doExpungeEverythingQuery("UPDATE " + TermCodeSystem.class.getSimpleName() + " d SET d.myCurrentVersion = null")); return null; }); -// myTxTemplate.execute(t -> { -// counter.addAndGet(doExpungeEverythingQuery("UPDATE " + TermValueSet.class.getSimpleName() + " d SET d.myCurrentVersion = null")); -// return null; -// }); counter.addAndGet(expungeEverythingByType(NpmPackageVersionResourceEntity.class)); counter.addAndGet(expungeEverythingByType(NpmPackageVersionEntity.class)); counter.addAndGet(expungeEverythingByType(NpmPackageEntity.class)); @@ -139,7 +135,6 @@ public class ExpungeEverythingService { counter.addAndGet(expungeEverythingByType(SearchInclude.class)); counter.addAndGet(expungeEverythingByType(TermValueSetConceptDesignation.class)); counter.addAndGet(expungeEverythingByType(TermValueSetConcept.class)); -// counter.addAndGet(expungeEverythingByType(TermValueSetVersion.class)); counter.addAndGet(expungeEverythingByType(TermValueSet.class)); counter.addAndGet(expungeEverythingByType(TermConceptParentChildLink.class)); counter.addAndGet(expungeEverythingByType(TermConceptMapGroupElementTarget.class)); 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 e38d53284b8..f41d9285826 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 @@ -343,7 +343,6 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { myValueSetConceptDao.deleteByTermValueSetId(existingTermValueSet.getId()); myValueSetDao.deleteById(existingTermValueSet.getId()); ourLog.info("Done deleting existing TermValueSet[{}] and its children.", existingTermValueSet.getId()); - } } @@ -395,7 +394,8 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { if (theValueSetToExpand.hasVersion()) { optionalTermValueSet = myValueSetDao.findTermValueSetByUrlAndVersion(theValueSetToExpand.getUrl(), theValueSetToExpand.getVersion()); } else { - optionalTermValueSet = myValueSetDao.findTermValueSetByUrlAndNullVersion(theValueSetToExpand.getUrl()); + List termValueSets = myValueSetDao.findTermValueSetByUrl(PageRequest.of(0, 1), theValueSetToExpand.getUrl()); + optionalTermValueSet = Optional.of(termValueSets.get(0)); } } else { optionalTermValueSet = Optional.empty(); @@ -421,7 +421,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { ValueSetExpansionOptions expansionOptions = provideExpansionOptions(theExpansionOptions); int offset = expansionOptions.getOffset(); int count = expansionOptions.getCount(); - populateExpansionComponent(expansionComponent, termValueSet, offset, count, termValueSet.getUrl()); + populateExpansionComponent(expansionComponent, termValueSet, offset, count); ValueSet valueSet = new ValueSet(); valueSet.setStatus(Enumerations.PublicationStatus.ACTIVE); @@ -430,7 +430,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { return valueSet; } - private void populateExpansionComponent(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount, String theValueSetUrl) { + private void populateExpansionComponent(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount) { int total = theTermValueSet.getTotalConcepts().intValue(); theExpansionComponent.setTotal(total); theExpansionComponent.setOffset(theOffset); @@ -441,17 +441,17 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { return; } - expandConcepts(theExpansionComponent, theTermValueSet, theOffset, theCount, theValueSetUrl); + expandConcepts(theExpansionComponent, theTermValueSet, theOffset, theCount); } - private void expandConcepts(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount, String theValueSetUrl) { + private void expandConcepts(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount) { int conceptsExpanded = 0; int designationsExpanded = 0; int toIndex = theOffset + theCount; Collection conceptViews = myTermValueSetConceptViewDao.findByTermValueSetId(theOffset, toIndex, theTermValueSet.getId()); if (conceptViews.isEmpty()) { - logConceptsExpanded("No concepts to expand. ", theValueSetUrl, conceptsExpanded); + logConceptsExpanded("No concepts to expand. ", theTermValueSet, conceptsExpanded); return; } @@ -482,28 +482,28 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { designationComponent.setValue(conceptView.getDesignationVal()); if (++designationsExpanded % 250 == 0) { - logDesignationsExpanded("Expansion of designations in progress. ", theValueSetUrl, designationsExpanded); + logDesignationsExpanded("Expansion of designations in progress. ", theTermValueSet, designationsExpanded); } } if (++conceptsExpanded % 250 == 0) { - logConceptsExpanded("Expansion of concepts in progress. ", theValueSetUrl, conceptsExpanded); + logConceptsExpanded("Expansion of concepts in progress. ", theTermValueSet, conceptsExpanded); } } - logDesignationsExpanded("Finished expanding designations. ", theValueSetUrl, designationsExpanded); - logConceptsExpanded("Finished expanding concepts. ", theValueSetUrl, conceptsExpanded); + logDesignationsExpanded("Finished expanding designations. ", theTermValueSet, designationsExpanded); + logConceptsExpanded("Finished expanding concepts. ", theTermValueSet, conceptsExpanded); } - private void logConceptsExpanded(String theLogDescriptionPrefix, String theValueSetUrl, int theConceptsExpanded) { + private void logConceptsExpanded(String theLogDescriptionPrefix, TermValueSet theTermValueSet, int theConceptsExpanded) { if (theConceptsExpanded > 0) { - ourLog.debug("{}Have expanded {} concepts in ValueSet[{}]", theLogDescriptionPrefix, theConceptsExpanded, theValueSetUrl); + ourLog.debug("{}Have expanded {} concepts in ValueSet[{}]", theLogDescriptionPrefix, theConceptsExpanded, theTermValueSet.getUrl()); } } - private void logDesignationsExpanded(String theLogDescriptionPrefix, String theValueSetUrl, int theDesignationsExpanded) { + private void logDesignationsExpanded(String theLogDescriptionPrefix, TermValueSet theTermValueSet, int theDesignationsExpanded) { if (theDesignationsExpanded > 0) { - ourLog.debug("{}Have expanded {} designations in ValueSet[{}]", theLogDescriptionPrefix, theDesignationsExpanded, theValueSetUrl); + ourLog.debug("{}Have expanded {} designations in ValueSet[{}]", theLogDescriptionPrefix, theDesignationsExpanded, theTermValueSet.getUrl()); } } @@ -1807,7 +1807,9 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { optionalExistingTermValueSetByUrl = myValueSetDao.findTermValueSetByUrlAndNullVersion(url); } if (!optionalExistingTermValueSetByUrl.isPresent()) { + myValueSetDao.save(termValueSet); + } else { TermValueSet existingTermValueSet = optionalExistingTermValueSetByUrl.get(); String msg; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java index 90d30645a5b..29db57d857f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java @@ -833,7 +833,7 @@ public class FhirResourceDaoR4TerminologyTest extends BaseJpaR4Test { StringType code = new StringType("ParentA"); StringType system = new StringType("http://snomed.info/sct"); - IValidationSupport.LookupCodeResult outcome = myCodeSystemDao.lookupCode(code, system, null,null, mySrd); + IValidationSupport.LookupCodeResult outcome = myCodeSystemDao.lookupCode(code, system, null, mySrd); assertEquals(true, outcome.isFound()); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java index 0ef54220a16..57f45050655 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java @@ -208,9 +208,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { myStructureDefinitionDao.create(loadResourceFromClasspath(StructureDefinition.class, "/r4/bl/bb-sd.json")); runInTransaction(() -> { - TermValueSet vs = myTermValueSetDao.findTermValueSetByUrlAndVersion("https://bb/ValueSet/BBDemographicAgeUnit","20190731").orElseThrow(() -> new IllegalArgumentException()); -// TermValueSetVersion vsv = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(vs.getId()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, vsv.getExpansionStatus()); + TermValueSet vs = myTermValueSetDao.findByUrl("https://bb/ValueSet/BBDemographicAgeUnit").orElseThrow(() -> new IllegalArgumentException()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, vs.getExpansionStatus()); }); @@ -239,18 +237,14 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { // Before, the VS wasn't pre-expanded. Try again with it pre-expanded runInTransaction(() -> { - TermValueSet vs = myTermValueSetDao.findTermValueSetByUrlAndVersion("https://bb/ValueSet/BBDemographicAgeUnit","20190731").orElseThrow(() -> new IllegalArgumentException()); -// TermValueSetVersion vsv = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(vs.getId()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, vsv.getExpansionStatus()); + TermValueSet vs = myTermValueSetDao.findByUrl("https://bb/ValueSet/BBDemographicAgeUnit").orElseThrow(() -> new IllegalArgumentException()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, vs.getExpansionStatus()); }); myTermReadSvc.preExpandDeferredValueSetsToTerminologyTables(); runInTransaction(() -> { - TermValueSet vs = myTermValueSetDao.findTermValueSetByUrlAndVersion("https://bb/ValueSet/BBDemographicAgeUnit", "20190731").orElseThrow(() -> new IllegalArgumentException()); -// TermValueSetVersion vsv = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(vs.getId()); -// assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, vsv.getExpansionStatus()); + TermValueSet vs = myTermValueSetDao.findByUrl("https://bb/ValueSet/BBDemographicAgeUnit").orElseThrow(() -> new IllegalArgumentException()); assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, vs.getExpansionStatus()); }); @@ -284,9 +278,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { myStructureDefinitionDao.create(loadResourceFromClasspath(StructureDefinition.class, "/r4/bl/bb-sd.json")); runInTransaction(() -> { - TermValueSet vs = myTermValueSetDao.findTermValueSetByUrlAndVersion("https://bb/ValueSet/BBDemographicAgeUnit", "20190731").orElseThrow(() -> new IllegalArgumentException()); -// TermValueSetVersion vsv = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(vs.getId()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, vsv.getExpansionStatus()); + TermValueSet vs = myTermValueSetDao.findByUrl("https://bb/ValueSet/BBDemographicAgeUnit").orElseThrow(() -> new IllegalArgumentException()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, vs.getExpansionStatus()); }); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java index 9cd0bb49e5a..85784c49eb6 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java @@ -383,8 +383,6 @@ public abstract class BaseJpaR5Test extends BaseJpaTest { protected IFhirResourceDaoValueSet myValueSetDao; @Autowired protected ITermValueSetDao myTermValueSetDao; -// @Autowired -// protected ITermValueSetVersionDao myTermValueSetVersionDao; @Autowired protected ITermValueSetConceptDao myTermValueSetConceptDao; @Autowired diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java index e7ee8efdc5c..e293bb59bb7 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java @@ -13,7 +13,6 @@ import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; -import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.UrlUtil; import com.google.common.base.Charsets; import org.apache.commons.io.IOUtils; @@ -37,7 +36,6 @@ import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent; import org.hl7.fhir.dstu3.model.ValueSet.FilterOperator; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallbackWithoutResult; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java index 6cb278e6bc8..a1dff9ee8ed 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java @@ -807,9 +807,6 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals(theValueSetName, termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(0, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(0, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); }); @@ -828,13 +825,9 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals(theValueSetName, termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(theCodeSystem.getConcept().size(), termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(theCodeSystem.getConcept().size(), termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus()); -// TermValueSetConcept concept = termValueSetVersion.getConcepts().get(0); TermValueSetConcept concept = termValueSet.getConcepts().get(0); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -857,7 +850,6 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systoliskt blodtryck - utgång", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(1); concept = termValueSet.getConcepts().get(1); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java index 8577c366884..c26c8bde431 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java @@ -10,7 +10,6 @@ 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.entity.TermValueSetVersion; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermReadSvc; @@ -1120,9 +1119,6 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals(theValueSetName, termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(0, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(0, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); }); @@ -1141,13 +1137,9 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals(theValueSetName, termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(theCodeSystem.getConcept().size(), termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(theCodeSystem.getConcept().size(), termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus()); -// TermValueSetConcept concept = termValueSetVersion.getConcepts().get(0); TermValueSetConcept concept = termValueSet.getConcepts().get(0); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1170,7 +1162,6 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systoliskt blodtryck - utgång", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(1); concept = termValueSet.getConcepts().get(1); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1181,7 +1172,6 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { // ... -// concept = termValueSetVersion.getConcepts().get(22); concept = termValueSet.getConcepts().get(22); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1197,7 +1187,6 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(23); concept = termValueSet.getConcepts().get(23); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java index db601c7a330..265e2064761 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java @@ -184,7 +184,7 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test { assertEquals(2, outcome.getUpdatedConceptCount()); runInTransaction(() -> { - TermConcept concept = myTermSvc.findCode("http://foo/cs", "ChildAA", null).orElseThrow(() -> new IllegalStateException()); + TermConcept concept = myTermSvc.findCode("http://foo/cs", "ChildAA").orElseThrow(() -> new IllegalStateException()); assertEquals(2, concept.getParents().size()); assertThat(concept.getParentPidsAsString(), matchesPattern("^[0-9]+ [0-9]+$")); }); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java index 629037325fe..79f2c37836c 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java @@ -194,11 +194,8 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { TermValueSet termValueSet = myTermValueSetDao.findByResourcePid(myExtensionalVsIdOnResourceTable).get(); Long termValueSetId = termValueSet.getId(); assertEquals(3, myTermValueSetConceptDesignationDao.countByTermValueSetId(termValueSetId).intValue()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(3, termValueSetVersion.getTotalConceptDesignations().intValue()); assertEquals(3, termValueSet.getTotalConceptDesignations().intValue()); assertEquals(24, myTermValueSetConceptDao.countByTermValueSetId(termValueSetId).intValue()); -// assertEquals(24, termValueSetVersion.getTotalConcepts().intValue()); assertEquals(24, termValueSet.getTotalConcepts().intValue()); new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() { @@ -234,11 +231,8 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { TermValueSet termValueSet = myTermValueSetDao.findByResourcePid(myExtensionalVsIdOnResourceTable).get(); Long termValueSetId = termValueSet.getId(); assertEquals(3, myTermValueSetConceptDesignationDao.countByTermValueSetId(termValueSetId).intValue()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(3, termValueSetVersion.getTotalConceptDesignations().intValue()); assertEquals(3, termValueSet.getTotalConceptDesignations().intValue()); assertEquals(24, myTermValueSetConceptDao.countByTermValueSetId(termValueSetId).intValue()); -// assertEquals(24, termValueSetVersion.getTotalConcepts().intValue()); assertEquals(24, termValueSet.getTotalConcepts().intValue()); new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java index 7cc370d572a..40850b23eaf 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java @@ -1165,9 +1165,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(0, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(0, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); }); @@ -1186,13 +1183,9 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(codeSystem.getConcept().size(), termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(codeSystem.getConcept().size(), termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus()); -// TermValueSetConcept concept = termValueSetVersion.getConcepts().get(0); TermValueSetConcept concept = termValueSet.getConcepts().get(0); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1215,7 +1208,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systoliskt blodtryck - utgång", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(1); concept = termValueSet.getConcepts().get(1); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1226,7 +1218,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { // ... -// concept = termValueSetVersion.getConcepts().get(22); concept = termValueSet.getConcepts().get(22); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1242,7 +1233,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(23); concept = termValueSet.getConcepts().get(23); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1277,9 +1267,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(0, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(0, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); }); @@ -1298,13 +1285,9 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(codeSystem.getConcept().size(), termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(codeSystem.getConcept().size(), termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus()); -// TermValueSetConcept concept = termValueSetVersion.getConcepts().get(0); TermValueSetConcept concept = termValueSet.getConcepts().get(0); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1327,7 +1310,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systoliskt blodtryck - utgång", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(1); concept = termValueSet.getConcepts().get(1); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1338,7 +1320,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { // ... -// concept = termValueSetVersion.getConcepts().get(22); concept = termValueSet.getConcepts().get(22); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1354,7 +1335,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(23); concept = termValueSet.getConcepts().get(23); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1389,9 +1369,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(0, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(0, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); }); @@ -1410,13 +1387,9 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(codeSystem.getConcept().size() - 2, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(codeSystem.getConcept().size() - 2, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus()); -// TermValueSetConcept concept = termValueSetVersion.getConcepts().get(0); TermValueSetConcept concept = termValueSet.getConcepts().get(0); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1439,7 +1412,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systoliskt blodtryck - utgång", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(1); concept = termValueSet.getConcepts().get(1); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1450,7 +1422,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { // ... -// concept = termValueSetVersion.getConcepts().get(20); concept = termValueSet.getConcepts().get(20); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1466,7 +1437,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(21); concept = termValueSet.getConcepts().get(21); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1501,9 +1471,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(0, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(0, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); }); @@ -1522,13 +1489,9 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("ValueSet:\n" + termValueSet.toString()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); -// TermValueSetVersion termValueSetVersion = myTermValueSetVersionDao.findByValueSetPidAndNullVersion(termValueSet.getId()); -// assertEquals(codeSystem.getConcept().size() - 2, termValueSetVersion.getConcepts().size()); -// assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSetVersion.getExpansionStatus()); assertEquals(codeSystem.getConcept().size() - 2, termValueSet.getConcepts().size()); assertEquals(TermValueSetPreExpansionStatusEnum.EXPANDED, termValueSet.getExpansionStatus()); -// TermValueSetConcept concept = termValueSetVersion.getConcepts().get(0); TermValueSetConcept concept = termValueSet.getConcepts().get(0); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1551,7 +1514,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systoliskt blodtryck - utgång", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(1); concept = termValueSet.getConcepts().get(1); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1562,7 +1524,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { // ... -// concept = termValueSetVersion.getConcepts().get(20); concept = termValueSet.getConcepts().get(20); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem()); @@ -1578,7 +1539,6 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertEquals("Synonym", designation.getUseDisplay()); assertEquals("Systolische bloeddruk minimaal 1 uur", designation.getValue()); -// concept = termValueSetVersion.getConcepts().get(21); concept = termValueSet.getConcepts().get(21); ourLog.info("Concept:\n" + concept.toString()); assertEquals("http://acme.org", concept.getSystem());