fix ValueSet$expand?includeHierarchy=true with fts disabled (#4449)

* fix ValueSet$expand?includeHierarchy=true

* add test for valuset$expand with hierarchy without hibernate search

* move testExpandValueSet_PreExpandedWithHierarchyNoHibernateSearch to FhirResourceDaoR4ValueSetTest, add javadoc

* Add credit

Co-authored-by: James Agnew <jamesagnew@gmail.com>
This commit is contained in:
ivagulin 2023-01-23 18:25:24 +03:00 committed by GitHub
parent 5dda16d467
commit 758c8f12dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 3 deletions

View File

@ -0,0 +1,6 @@
---
type: fix
issue: 4449
title: "A bug prevented valueset expansion with includeHierarchy=true when lucene/elasticsearch
was not enabled. This has been corrected. Thanks to GitHub user @ivagulin for the
contribution!"

View File

@ -250,7 +250,7 @@ public class ValueSetExpansionComponentWithConceptAccumulator extends ValueSet.V
ValueSet.ValueSetExpansionContainsComponent nextContains = this.getContains().get(i);
String directParentPidsString = myConceptToSourceDirectParentPids.get(nextContains);
if (isNotBlank(directParentPidsString)) {
if (isNotBlank(directParentPidsString) && !directParentPidsString.equals("NONE")) {
List<Long> directParentPids = Arrays.stream(directParentPidsString.split(" ")).map(t -> Long.parseLong(t)).collect(Collectors.toList());
boolean firstMatch = false;

View File

@ -572,7 +572,49 @@ public class FhirResourceDaoR4ValueSetTest extends BaseJpaR4Test {
}
/** See #4449 */
@Test
public void testExpandValueSet_PreExpandedWithHierarchyNoHibernateSearch() {
CodeSystem cs = new CodeSystem();
cs.setId("icd10cm");
cs.setStatus(Enumerations.PublicationStatus.ACTIVE);
cs.setContent(CodeSystem.CodeSystemContentMode.COMPLETE);
cs.setUrl("http://hl7.org/fhir/sid/icd-10-cm");
cs.setVersion("2021");
CodeSystem.ConceptDefinitionComponent parent = cs.addConcept()
.setCode("A00")
.setDisplay("Cholera");
parent.addConcept()
.setCode("A00.0")
.setDisplay("Cholera due to Vibrio cholerae 01, biovar cholerae");
parent.addConcept()
.setCode("A00.1")
.setDisplay("Cholera due to Vibrio cholerae 01, biovar eltor");
myCodeSystemDao.update(cs, mySrd);
ValueSet vs = new ValueSet();
vs.setId("icd10cm-valueset");
vs.setUrl("http://hl7.org/fhir/ValueSet/icd-10-cm");
vs.setVersion("2021");
vs.setStatus(Enumerations.PublicationStatus.ACTIVE);
ValueSet.ConceptSetComponent vsInclude = vs.getCompose().addInclude();
vsInclude.setSystem("http://hl7.org/fhir/sid/icd-10-cm");
vsInclude.setVersion("2021");
myValueSetDao.update(vs, mySrd);
TermReadSvcImpl.setForceDisableHibernateSearchForUnitTest(true);
myTerminologyDeferredStorageSvc.saveAllDeferred();
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
ValueSetExpansionOptions options = new ValueSetExpansionOptions();
options.setIncludeHierarchy(true);
ValueSet valueSet = myValueSetDao.expand(vs, options);
assertNotNull(valueSet);
assertEquals(1, valueSet.getExpansion().getContains().size());
assertEquals(2, valueSet.getExpansion().getContains().get(0).getContains().size());
}
}

View File

@ -843,6 +843,9 @@
<developer>
<id>granadacoder</id>
</developer>
<developer>
<id>ivagulin</id>
</developer>
</developers>
<licenses>