Changes per code review plus fix for possible intermittent JUnit failures.

This commit is contained in:
ianmarshall 2020-06-04 15:24:41 -04:00
parent 9696af5dc0
commit 0a2f9d2697
4 changed files with 15 additions and 2 deletions

View File

@ -57,7 +57,7 @@ public interface IElasticsearchSvc {
* Creates or updates index for an Observation Resource. * Creates or updates index for an Observation Resource.
* @param theDocumentId Identifier for Observation resource. * @param theDocumentId Identifier for Observation resource.
* @param theObservationDocument Indexing document for Observation. * @param theObservationDocument Indexing document for Observation.
* @return * @return True if Observation indexed successfully.
*/ */
Boolean createOrUpdateObservationIndex(String theDocumentId, ObservationJson theObservationDocument); Boolean createOrUpdateObservationIndex(String theDocumentId, ObservationJson theObservationDocument);
@ -65,7 +65,7 @@ public interface IElasticsearchSvc {
* Creates or updates index for an Observation Code. * Creates or updates index for an Observation Code.
* @param theCodeableConceptID Identifier for Observation resource. * @param theCodeableConceptID Identifier for Observation resource.
* @param theObservationCodeDocument Indexing document for Observation. * @param theObservationCodeDocument Indexing document for Observation.
* @return * @return True if Observation Code indexed successfully.
*/ */
Boolean createOrUpdateObservationCodeIndex(String theCodeableConceptID, CodeJson theObservationCodeDocument); Boolean createOrUpdateObservationCodeIndex(String theCodeableConceptID, CodeJson theObservationCodeDocument);

View File

@ -61,6 +61,8 @@ public class PersistObservationIndexedSearchParamLastNR4IT {
elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX);
elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
} }
private final String SINGLE_SUBJECT_ID = "4567"; private final String SINGLE_SUBJECT_ID = "4567";
@ -90,6 +92,9 @@ public class PersistObservationIndexedSearchParamLastNR4IT {
String observationCodeNormalizedId = persistedObservationEntity.getCode_concept_id(); String observationCodeNormalizedId = persistedObservationEntity.getCode_concept_id();
// List<CodeJson> persistedObservationCodes = elasticsearchSvc.queryAllIndexedObservationCodesForTest();
// assertEquals(1, persistedObservationCodes.size());
// Check that we can retrieve code by hash value. // Check that we can retrieve code by hash value.
String codeSystemHash = persistedObservationEntity.getCode_coding_code_system_hash(); String codeSystemHash = persistedObservationEntity.getCode_coding_code_system_hash();
CodeJson persistedObservationCode = elasticsearchSvc.getObservationCodeDocument(codeSystemHash, null); CodeJson persistedObservationCode = elasticsearchSvc.getObservationCodeDocument(codeSystemHash, null);
@ -181,6 +186,9 @@ public class PersistObservationIndexedSearchParamLastNR4IT {
List<ObservationJson> observationDocuments = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirCtx); List<ObservationJson> observationDocuments = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirCtx);
assertEquals(100, observationDocuments.size()); assertEquals(100, observationDocuments.size());
//List<CodeJson> codeDocuments = elasticsearchSvc.queryAllIndexedObservationCodesForTest();
//assertEquals(2, codeDocuments.size());
// Check that all observations were indexed. // Check that all observations were indexed.
searchParameterMap = new SearchParameterMap(); searchParameterMap = new SearchParameterMap();
searchParameterMap.add(Observation.SP_SUBJECT, multiSubjectParams); searchParameterMap.add(Observation.SP_SUBJECT, multiSubjectParams);

View File

@ -53,6 +53,8 @@ public class LastNElasticsearchSvcMultipleObservationsIT {
public void after() throws IOException { public void after() throws IOException {
elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX);
elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
} }
@Test @Test

View File

@ -92,6 +92,8 @@ public class LastNElasticsearchSvcSingleObservationIT {
public void after() throws IOException { public void after() throws IOException {
elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX);
elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
} }
@Test @Test
@ -297,6 +299,7 @@ public class LastNElasticsearchSvcSingleObservationIT {
assertTrue(elasticsearchSvc.createOrUpdateObservationCodeIndex(OBSERVATIONSINGLECODEID, codeableConceptField)); assertTrue(elasticsearchSvc.createOrUpdateObservationCodeIndex(OBSERVATIONSINGLECODEID, codeableConceptField));
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX); elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
} }
} }