Incremental work on large ValueSet expansion support; still need to actually use the terminology tables when expanding.

This commit is contained in:
Diederik Muylwyk 2019-07-31 16:33:50 -04:00
parent 0e2dcce841
commit ffda92514a
2 changed files with 9 additions and 15 deletions

View File

@ -1495,7 +1495,7 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
ourLog.info("Done storing TermConceptMap."); ourLog.info("Done storing TermConceptMap.");
} }
@Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 600000) // 10 minutes.
@Transactional @Transactional
@Override @Override
public synchronized void preExpandValueSetToTerminologyTables() { public synchronized void preExpandValueSetToTerminologyTables() {

View File

@ -22,6 +22,7 @@ import org.junit.rules.ExpectedException;
import org.mockito.Mock; import org.mockito.Mock;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.test.context.TestPropertySource;
import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult; import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
@ -38,6 +39,9 @@ import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@TestPropertySource(properties = {
"scheduling_disabled=true"
})
public class TerminologySvcImplR4Test extends BaseJpaR4Test { public class TerminologySvcImplR4Test extends BaseJpaR4Test {
private static final Logger ourLog = LoggerFactory.getLogger(TerminologySvcImplR4Test.class); private static final Logger ourLog = LoggerFactory.getLogger(TerminologySvcImplR4Test.class);
@Rule @Rule
@ -980,16 +984,11 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
ourLog.info("ValueSet:\n" + termValueSet.toString()); ourLog.info("ValueSet:\n" + termValueSet.toString());
assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl());
assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName());
assertEquals(0, termValueSet.getConcepts().size()); // DM 2019-07-30: Concepts are persisted in the background. assertEquals(0, termValueSet.getConcepts().size());
assertEquals(TermValueSetExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); assertEquals(TermValueSetExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus());
}); });
// FIXME: DM 2019-07-31 - Wait for ValueSet expansion status to be EXPANDED. myTermSvc.preExpandValueSetToTerminologyTables();
try {
Thread.sleep(10000);
} catch (InterruptedException theE) {
theE.printStackTrace();
}
runInTransaction(()->{ runInTransaction(()->{
Optional<TermValueSet> optionalValueSetByResourcePid = myTermValueSetDao.findByResourcePid(myExtensionalVsId.getIdPartAsLong()); Optional<TermValueSet> optionalValueSetByResourcePid = myTermValueSetDao.findByResourcePid(myExtensionalVsId.getIdPartAsLong());
@ -1083,16 +1082,11 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
ourLog.info("ValueSet:\n" + termValueSet.toString()); ourLog.info("ValueSet:\n" + termValueSet.toString());
assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl()); assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", termValueSet.getUrl());
assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName()); assertEquals("Terminology Services Connectation #1 Extensional case #2", termValueSet.getName());
assertEquals(0, termValueSet.getConcepts().size()); // DM 2019-07-30: Concepts are persisted in the background. assertEquals(0, termValueSet.getConcepts().size());
assertEquals(TermValueSetExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus()); assertEquals(TermValueSetExpansionStatusEnum.NOT_EXPANDED, termValueSet.getExpansionStatus());
}); });
// FIXME: DM 2019-07-31 - Wait for ValueSet expansion status to be EXPANDED. myTermSvc.preExpandValueSetToTerminologyTables();
try {
Thread.sleep(10000);
} catch (InterruptedException theE) {
theE.printStackTrace();
}
runInTransaction(()->{ runInTransaction(()->{
Optional<TermValueSet> optionalValueSetByResourcePid = myTermValueSetDao.findByResourcePid(myExtensionalVsId.getIdPartAsLong()); Optional<TermValueSet> optionalValueSetByResourcePid = myTermValueSetDao.findByResourcePid(myExtensionalVsId.getIdPartAsLong());