Changes to terminology loader to support preserving the original resource IDs for LOINC even when multiple versions are loaded.

This commit is contained in:
ianmarshall 2020-10-16 16:30:37 -04:00
parent 66e36378c1
commit f3639ee1ce
10 changed files with 222 additions and 60 deletions

View File

@ -1 +0,0 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip

View File

@ -137,7 +137,15 @@ public class TermLoaderSvcImpl implements ITermLoaderSvc {
ourLog.info("Beginning LOINC processing");
return processLoincFiles(descriptors, theRequestDetails, uploadProperties);
String codeSystemVersionId = uploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
if (codeSystemVersionId != null ) {
// Load the code system with version and then remove the version property.
processLoincFiles(descriptors, theRequestDetails, uploadProperties, false);
uploadProperties.remove(LOINC_CODESYSTEM_VERSION.getCode());
}
// Load the same code system with null version. This will become the default version.
return processLoincFiles(descriptors, theRequestDetails, uploadProperties, true);
}
}
@ -372,7 +380,7 @@ public class TermLoaderSvcImpl implements ITermLoaderSvc {
// return new UploadStatistics(conceptCount, target);
}
UploadStatistics processLoincFiles(LoadedFileDescriptors theDescriptors, RequestDetails theRequestDetails, Properties theUploadProperties) {
UploadStatistics processLoincFiles(LoadedFileDescriptors theDescriptors, RequestDetails theRequestDetails, Properties theUploadProperties, Boolean theCloseFiles) {
final TermCodeSystemVersion codeSystemVersion = new TermCodeSystemVersion();
final Map<String, TermConcept> code2concept = new HashMap<>();
final List<ValueSet> valueSets = new ArrayList<>();
@ -483,7 +491,9 @@ public class TermLoaderSvcImpl implements ITermLoaderSvc {
iterateOverZipFileOptional(theDescriptors, theUploadProperties.getProperty(LOINC_PART_LINK_FILE_PRIMARY.getCode(), LOINC_PART_LINK_FILE_PRIMARY_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
iterateOverZipFileOptional(theDescriptors, theUploadProperties.getProperty(LOINC_PART_LINK_FILE_SUPPLEMENTARY.getCode(), LOINC_PART_LINK_FILE_SUPPLEMENTARY_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
IOUtils.closeQuietly(theDescriptors);
if (theCloseFiles) {
IOUtils.closeQuietly(theDescriptors);
}
valueSets.add(getValueSetLoincAll(theUploadProperties));

View File

@ -190,10 +190,15 @@ public abstract class BaseLoincHandler implements IRecordHandler {
ValueSet getValueSet(String theValueSetId, String theValueSetUri, String theValueSetName, String theVersionPropertyName) {
String version;
String codeSystemVersion = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
if (isNotBlank(theVersionPropertyName)) {
version = myUploadProperties.getProperty(theVersionPropertyName);
if (codeSystemVersion != null) {
version = myUploadProperties.getProperty(theVersionPropertyName) + "-" + codeSystemVersion;
} else {
version = myUploadProperties.getProperty(theVersionPropertyName);
}
} else {
version = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
version = codeSystemVersion;
}
ValueSet vs;

View File

@ -53,7 +53,13 @@ public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implemen
@Override
public void accept(CSVRecord theRecord) {
String loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
String codeSystemVersionId = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
String loincIeeeCmVersion;
if (codeSystemVersionId != null) {
loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()) + "-" + codeSystemVersionId;
} else {
loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
}
String loincNumber = trim(theRecord.get("LOINC_NUM"));
String longCommonName = trim(theRecord.get("LOINC_LONG_COMMON_NAME"));
String ieeeCode = trim(theRecord.get("IEEE_CF_CODE10"));
@ -63,7 +69,6 @@ public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implemen
String sourceCodeSystemUri = ITermLoaderSvc.LOINC_URI;
String targetCodeSystemUri = ITermLoaderSvc.IEEE_11073_10101_URI;
String conceptMapId;
String codeSystemVersionId = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
if (codeSystemVersionId != null) {
conceptMapId = LOINC_IEEE_CM_ID + "-" + codeSystemVersionId;
} else {

View File

@ -77,8 +77,16 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
String extCodeSystemVersion = trim(theRecord.get("ExtCodeSystemVersion"));
String extCodeSystemCopyrightNotice = trim(theRecord.get("ExtCodeSystemCopyrightNotice"));
// CodeSystem version from properties file
String codeSystemVersionId = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
// ConceptMap version from properties files
String loincPartMapVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
String loincPartMapVersion;
if (codeSystemVersionId != null) {
loincPartMapVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()) + "-" + codeSystemVersionId;
} else {
loincPartMapVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
}
Enumerations.ConceptMapEquivalence equivalence;
switch (trim(defaultString(mapType))) {
@ -131,7 +139,6 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
break;
}
String conceptMapId;
String codeSystemVersionId = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
if (codeSystemVersionId != null) {
conceptMapId = loincPartMapId + "-" + codeSystemVersionId;
} else {

View File

@ -82,25 +82,37 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
String rpid = trim(theRecord.get("RPID"));
String longName = trim(theRecord.get("LongName"));
// ConceptMap version from properties files
String loincRsnaCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
// CodeSystem version from properties file
String codeSystemVersionId = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
// ConceptMap version from properties files
String loincRsnaCmVersion;
if (codeSystemVersionId != null) {
loincRsnaCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()) + "-" + codeSystemVersionId;
} else {
loincRsnaCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
}
// RSNA Codes VS
ValueSet vs;
if (!myIdToValueSet.containsKey(RSNA_CODES_VS_ID)) {
String rsnaCodesValueSetId;
if (codeSystemVersionId != null) {
rsnaCodesValueSetId = RSNA_CODES_VS_ID + "-" + codeSystemVersionId;
} else {
rsnaCodesValueSetId = RSNA_CODES_VS_ID;
}
if (!myIdToValueSet.containsKey(rsnaCodesValueSetId)) {
vs = new ValueSet();
vs.setUrl(RSNA_CODES_VS_URI);
vs.setId(RSNA_CODES_VS_ID);
vs.setId(rsnaCodesValueSetId);
vs.setName(RSNA_CODES_VS_NAME);
vs.setStatus(Enumerations.PublicationStatus.ACTIVE);
vs.setVersion(codeSystemVersionId);
myIdToValueSet.put(RSNA_CODES_VS_ID, vs);
myIdToValueSet.put(rsnaCodesValueSetId, vs);
myValueSets.add(vs);
} else {
vs = myIdToValueSet.get(RSNA_CODES_VS_ID);
vs = myIdToValueSet.get(rsnaCodesValueSetId);
}
if (!myCodesInRsnaPlaybookValueSet.contains(loincNumber)) {

View File

@ -3,13 +3,12 @@ package ca.uhn.fhir.jpa.term;
import ca.uhn.fhir.jpa.dao.r4.BaseJpaR4Test;
import ca.uhn.fhir.jpa.entity.TermCodeSystem;
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
import org.eclipse.jetty.http.HttpStatus;
import org.hl7.fhir.r4.model.CodeSystem;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class TerminologyLoaderSvcLoincJpaTest extends BaseJpaR4Test {
private TermLoaderSvcImpl mySvc;
@ -31,35 +30,48 @@ public class TerminologyLoaderSvcLoincJpaTest extends BaseJpaR4Test {
// Load LOINC marked as version 2.67
TerminologyLoaderSvcLoincTest.addLoincMandatoryFilesWithPropertiesFileToZip(myFiles, "v267_loincupload.properties");
mySvc.loadLoinc(myFiles.getFiles(), mySrd);
myTerminologyDeferredStorageSvc.saveAllDeferred();
runInTransaction(() -> {
assertEquals(1, myTermCodeSystemDao.count());
assertEquals(1, myTermCodeSystemVersionDao.count());
assertEquals(1, myResourceTableDao.count());
assertEquals(2, myTermCodeSystemVersionDao.count());
assertEquals(24, myTermValueSetDao.count());
assertEquals(12, myTermConceptMapDao.count());
assertEquals(38, myResourceTableDao.count());
TermCodeSystem myTermCodeSystem = myTermCodeSystemDao.findByCodeSystemUri("http://loinc.org");
TermCodeSystemVersion myTermCodeSystemVersion = myTermCodeSystemVersionDao.findByCodeSystemPidAndVersion(myTermCodeSystem.getPid(), "2.67");
assertEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion.getPid());
assertEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion.getResource().getId());
TermCodeSystemVersion myTermCodeSystemVersion_versioned = myTermCodeSystemVersionDao.findByCodeSystemPidAndVersion(myTermCodeSystem.getPid(), "2.67");
assertNotEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion_versioned.getPid());
assertNotEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion_versioned.getResource().getId());
TermCodeSystemVersion myTermCodeSystemVersion_nonversioned = myTermCodeSystemVersionDao.findByCodeSystemPidVersionIsNull(myTermCodeSystem.getPid());
assertEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion_nonversioned.getPid());
assertEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion_nonversioned.getResource().getId());
assertEquals(1, myResourceTableDao.count());
});
// Update LOINC marked as version 2.67
myFiles = new ZipCollectionBuilder();
TerminologyLoaderSvcLoincTest.addLoincMandatoryFilesWithPropertiesFileToZip(myFiles, "v267_loincupload.properties");
mySvc.loadLoinc(myFiles.getFiles(), mySrd);
myTerminologyDeferredStorageSvc.saveAllDeferred();
runInTransaction(() -> {
assertEquals(1, myTermCodeSystemDao.count());
assertEquals(1, myTermCodeSystemVersionDao.count());
assertEquals(2, myTermCodeSystemVersionDao.count());
assertEquals(24, myTermValueSetDao.count());
assertEquals(12, myTermConceptMapDao.count());
assertEquals(38, myResourceTableDao.count());
TermCodeSystem myTermCodeSystem = myTermCodeSystemDao.findByCodeSystemUri("http://loinc.org");
TermCodeSystemVersion myTermCodeSystemVersion = myTermCodeSystemVersionDao.findByCodeSystemPidAndVersion(myTermCodeSystem.getPid(), "2.67");
assertEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion.getPid());
assertEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion.getResource().getId());
TermCodeSystemVersion myTermCodeSystemVersion_versioned = myTermCodeSystemVersionDao.findByCodeSystemPidAndVersion(myTermCodeSystem.getPid(), "2.67");
assertNotEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion_versioned.getPid());
assertNotEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion_versioned.getResource().getId());
TermCodeSystemVersion myTermCodeSystemVersion_nonversioned = myTermCodeSystemVersionDao.findByCodeSystemPidVersionIsNull(myTermCodeSystem.getPid());
assertEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion_nonversioned.getPid());
assertEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion_nonversioned.getResource().getId());
assertEquals(1, myResourceTableDao.count());
});
@ -67,17 +79,27 @@ public class TerminologyLoaderSvcLoincJpaTest extends BaseJpaR4Test {
myFiles = new ZipCollectionBuilder();
TerminologyLoaderSvcLoincTest.addLoincMandatoryFilesWithPropertiesFileToZip(myFiles, "v268_loincupload.properties");
mySvc.loadLoinc(myFiles.getFiles(), mySrd);
myTerminologyDeferredStorageSvc.saveAllDeferred();
runInTransaction(() -> {
assertEquals(1, myTermCodeSystemDao.count());
assertEquals(2, myTermCodeSystemVersionDao.count());
assertEquals(3, myTermCodeSystemVersionDao.count());
assertEquals(36, myTermValueSetDao.count());
assertEquals(18, myTermConceptMapDao.count());
assertEquals(57, myResourceTableDao.count());
TermCodeSystem myTermCodeSystem = myTermCodeSystemDao.findByCodeSystemUri("http://loinc.org");
TermCodeSystemVersion mySecondTermCodeSystemVersion = myTermCodeSystemVersionDao.findByCodeSystemPidAndVersion(myTermCodeSystem.getPid(), "2.68");
assertEquals(myTermCodeSystem.getCurrentVersion().getPid(), mySecondTermCodeSystemVersion.getPid());
assertEquals(myTermCodeSystem.getResource().getId(), mySecondTermCodeSystemVersion.getResource().getId());
TermCodeSystemVersion mySecondTermCodeSystemVersion_versioned = myTermCodeSystemVersionDao.findByCodeSystemPidAndVersion(myTermCodeSystem.getPid(), "2.68");
assertNotEquals(myTermCodeSystem.getCurrentVersion().getPid(), mySecondTermCodeSystemVersion_versioned.getPid());
assertNotEquals(myTermCodeSystem.getResource().getId(), mySecondTermCodeSystemVersion_versioned.getResource().getId());
assertEquals(2, myResourceTableDao.count());
TermCodeSystemVersion myTermCodeSystemVersion_versioned = myTermCodeSystemVersionDao.findByCodeSystemPidAndVersion(myTermCodeSystem.getPid(), "2.67");
assertNotEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion_versioned.getPid());
assertNotEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion_versioned.getResource().getId());
TermCodeSystemVersion myTermCodeSystemVersion_nonversioned = myTermCodeSystemVersionDao.findByCodeSystemPidVersionIsNull(myTermCodeSystem.getPid());
assertEquals(myTermCodeSystem.getCurrentVersion().getPid(), myTermCodeSystemVersion_nonversioned.getPid());
assertEquals(myTermCodeSystem.getResource().getId(), myTermCodeSystemVersion_nonversioned.getResource().getId());
});
}

View File

@ -43,6 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@ -54,6 +55,24 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
private ITermCodeSystemStorageSvc myTermCodeSystemStorageSvc;
@Captor
private ArgumentCaptor<CodeSystem> mySystemCaptor;
@Captor
private ArgumentCaptor<CodeSystem> mySystemCaptor_267_first;
@Captor
private ArgumentCaptor<CodeSystem> mySystemCaptor_267_second;
@Captor
private ArgumentCaptor<CodeSystem> mySystemCaptor_268;
@Captor
private ArgumentCaptor<List<ValueSet>> myValueSetsCaptor_267_first;
@Captor
private ArgumentCaptor<List<ValueSet>> myValueSetsCaptor_267_second;
@Captor
private ArgumentCaptor<List<ValueSet>> myValueSetsCaptor_268;
@Captor
private ArgumentCaptor<List<ConceptMap>> myConceptMapCaptor_267_first;
@Captor
private ArgumentCaptor<List<ConceptMap>> myConceptMapCaptor_267_second;
@Captor
private ArgumentCaptor<List<ConceptMap>> myConceptMapCaptor_268;
private ZipCollectionBuilder myFiles;
@Mock
private ITermDeferredStorageSvc myTermDeferredStorageSvc;
@ -404,78 +423,161 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
public void testLoadLoincMultipleVersions() throws IOException {
// Load LOINC marked as version 2.67
addLoincMandatoryFilesWithPropertiesFileToZip(myFiles, "v267_loincupload.properties");
mySvc.loadLoinc(myFiles.getFiles(), mySrd);
verify(myTermCodeSystemStorageSvc, times(1)).storeNewCodeSystemVersion(mySystemCaptor.capture(), myCsvCaptor.capture(), any(RequestDetails.class), myValueSetsCaptor.capture(), myConceptMapCaptor.capture());
CodeSystem loincCS = mySystemCaptor.getValue();
assertEquals("2.67", loincCS.getVersion());
List<ValueSet> loincVS_resources = myValueSetsCaptor.getValue();
verify(myTermCodeSystemStorageSvc, times(2)).storeNewCodeSystemVersion(mySystemCaptor_267_first.capture(), myCsvCaptor.capture(), any(RequestDetails.class), myValueSetsCaptor_267_first.capture(), myConceptMapCaptor_267_first.capture());
List<CodeSystem> loincCSResources = mySystemCaptor_267_first.getAllValues();
assertEquals(2, loincCSResources.size());
assertEquals("2.67", loincCSResources.get(0).getVersion());
assertNull(loincCSResources.get(1).getVersion());
List<List<ValueSet>> loincVS_resourceLists = myValueSetsCaptor_267_first.getAllValues();
assertEquals(2, loincVS_resourceLists.size());
List<ValueSet> loincVS_resources = loincVS_resourceLists.get(0);
for (ValueSet loincVS : loincVS_resources) {
if (loincVS.getId().startsWith("LL1000-0") || loincVS.getId().startsWith("LL1001-8") || loincVS.getId().startsWith("LL1892-0")) {
assertEquals("2.67.Beta.1", loincVS.getVersion());
assertEquals("Beta.1-2.67", loincVS.getVersion());
} else {
assertEquals("2.67", loincVS.getVersion());
}
}
List<ConceptMap> loincCM_resources = myConceptMapCaptor.getValue();
loincVS_resources = loincVS_resourceLists.get(1);
for (ValueSet loincVS : loincVS_resources) {
if (loincVS.getId().startsWith("LL1000-0") || loincVS.getId().startsWith("LL1001-8") || loincVS.getId().startsWith("LL1892-0")) {
assertEquals("Beta.1", loincVS.getVersion());
} else if (loincVS.getId().equals("loinc-all")) {
assertEquals("1.0.0", loincVS.getVersion());
} else {
assertNull(loincVS.getVersion());
}
}
List<List<ConceptMap>> loincCM_resourceLists = myConceptMapCaptor_267_first.getAllValues();
assertEquals(2, loincCM_resourceLists.size());
List<ConceptMap> loincCM_resources = loincCM_resourceLists.get(0);
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("2.67.Beta.1", loincCM.getVersion());
assertEquals("Beta.1-2.67", loincCM.getVersion());
assertEquals(1, loincCM.getGroup().size());
ConceptMap.ConceptMapGroupComponent group = loincCM.getGroup().get(0);
assertEquals(ITermLoaderSvc.LOINC_URI, group.getSource());
assertEquals("2.67", group.getSourceVersion());
}
loincCM_resources = loincCM_resourceLists.get(1);
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("Beta.1", loincCM.getVersion());
assertEquals(1, loincCM.getGroup().size());
ConceptMap.ConceptMapGroupComponent group = loincCM.getGroup().get(0);
assertEquals(ITermLoaderSvc.LOINC_URI, group.getSource());
assertNull(group.getSourceVersion());
}
reset(myTermCodeSystemStorageSvc);
// Update LOINC marked as version 2.67
myFiles = new ZipCollectionBuilder();
addLoincMandatoryFilesWithPropertiesFileToZip(myFiles, "v267_loincupload.properties");
mySvc.loadLoinc(myFiles.getFiles(), mySrd);
verify(myTermCodeSystemStorageSvc, times(2)).storeNewCodeSystemVersion(mySystemCaptor.capture(), myCsvCaptor.capture(), any(RequestDetails.class), myValueSetsCaptor.capture(), myConceptMapCaptor.capture());
loincCS = mySystemCaptor.getValue();
assertEquals("2.67", loincCS.getVersion());
loincVS_resources = myValueSetsCaptor.getValue();
verify(myTermCodeSystemStorageSvc, times(2)).storeNewCodeSystemVersion(mySystemCaptor_267_second.capture(), myCsvCaptor.capture(), any(RequestDetails.class), myValueSetsCaptor_267_second.capture(), myConceptMapCaptor_267_second.capture());
loincCSResources = mySystemCaptor_267_second.getAllValues();
assertEquals(2, loincCSResources.size());
assertEquals("2.67", loincCSResources.get(0).getVersion());
assertNull(loincCSResources.get(1).getVersion());
loincVS_resourceLists = myValueSetsCaptor_267_second.getAllValues();
assertEquals(2, loincVS_resourceLists.size());
loincVS_resources = loincVS_resourceLists.get(0);
for (ValueSet loincVS : loincVS_resources) {
if (loincVS.getId().startsWith("LL1000-0") || loincVS.getId().startsWith("LL1001-8") || loincVS.getId().startsWith("LL1892-0")) {
assertEquals("2.67.Beta.1", loincVS.getVersion());
assertEquals("Beta.1-2.67", loincVS.getVersion());
} else {
assertEquals("2.67", loincVS.getVersion());
}
}
loincCM_resources = myConceptMapCaptor.getValue();
loincVS_resources = loincVS_resourceLists.get(1);
for (ValueSet loincVS : loincVS_resources) {
if (loincVS.getId().startsWith("LL1000-0") || loincVS.getId().startsWith("LL1001-8") || loincVS.getId().startsWith("LL1892-0")) {
assertEquals("Beta.1", loincVS.getVersion());
} else if (loincVS.getId().equals("loinc-all")) {
assertEquals("1.0.0", loincVS.getVersion());
} else {
assertNull(loincVS.getVersion());
}
}
loincCM_resourceLists = myConceptMapCaptor_267_second.getAllValues();
assertEquals(2, loincCM_resourceLists.size());
loincCM_resources = loincCM_resourceLists.get(0);
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("2.67.Beta.1", loincCM.getVersion());
assertEquals("Beta.1-2.67", loincCM.getVersion());
assertEquals(1, loincCM.getGroup().size());
ConceptMap.ConceptMapGroupComponent group = loincCM.getGroup().get(0);
assertEquals(ITermLoaderSvc.LOINC_URI, group.getSource());
assertEquals("2.67", group.getSourceVersion());
}
loincCM_resources = loincCM_resourceLists.get(1);
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("Beta.1", loincCM.getVersion());
assertEquals(1, loincCM.getGroup().size());
ConceptMap.ConceptMapGroupComponent group = loincCM.getGroup().get(0);
assertEquals(ITermLoaderSvc.LOINC_URI, group.getSource());
assertNull(group.getSourceVersion());
}
reset(myTermCodeSystemStorageSvc);
// Load LOINC marked as version 2.68
myFiles = new ZipCollectionBuilder();
addLoincMandatoryFilesWithPropertiesFileToZip(myFiles, "v268_loincupload.properties");
mySvc.loadLoinc(myFiles.getFiles(), mySrd);
verify(myTermCodeSystemStorageSvc, times(3)).storeNewCodeSystemVersion(mySystemCaptor.capture(), myCsvCaptor.capture(), any(RequestDetails.class), myValueSetsCaptor.capture(), myConceptMapCaptor.capture());
loincCS = mySystemCaptor.getValue();
assertEquals("2.68", loincCS.getVersion());
loincVS_resources = myValueSetsCaptor.getValue();
verify(myTermCodeSystemStorageSvc, times(2)).storeNewCodeSystemVersion(mySystemCaptor_268.capture(), myCsvCaptor.capture(), any(RequestDetails.class), myValueSetsCaptor_268.capture(), myConceptMapCaptor_268.capture());
loincCSResources = mySystemCaptor_268.getAllValues();
assertEquals(2, loincCSResources.size());
assertEquals("2.68", loincCSResources.get(0).getVersion());
assertNull(loincCSResources.get(1).getVersion());
loincVS_resourceLists = myValueSetsCaptor_268.getAllValues();
assertEquals(2, loincVS_resourceLists.size());
loincVS_resources = loincVS_resourceLists.get(0);
for (ValueSet loincVS : loincVS_resources) {
if (loincVS.getId().startsWith("LL1000-0") || loincVS.getId().startsWith("LL1001-8") || loincVS.getId().startsWith("LL1892-0")) {
assertEquals("2.68.Beta.1", loincVS.getVersion());
assertEquals("Beta.1-2.68", loincVS.getVersion());
} else {
assertEquals("2.68", loincVS.getVersion());
}
}
loincCM_resources = myConceptMapCaptor.getValue();
loincVS_resources = loincVS_resourceLists.get(1);
for (ValueSet loincVS : loincVS_resources) {
if (loincVS.getId().startsWith("LL1000-0") || loincVS.getId().startsWith("LL1001-8") || loincVS.getId().startsWith("LL1892-0")) {
assertEquals("Beta.1", loincVS.getVersion());
} else if (loincVS.getId().equals("loinc-all")) {
assertEquals("1.0.0", loincVS.getVersion());
} else {
assertNull(loincVS.getVersion());
}
}
loincCM_resourceLists = myConceptMapCaptor_268.getAllValues();
assertEquals(2, loincCM_resourceLists.size());
loincCM_resources = loincCM_resourceLists.get(0);
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("2.68.Beta.1", loincCM.getVersion());
assertEquals("Beta.1-2.68", loincCM.getVersion());
assertEquals(1, loincCM.getGroup().size());
ConceptMap.ConceptMapGroupComponent group = loincCM.getGroup().get(0);
assertEquals(ITermLoaderSvc.LOINC_URI, group.getSource());
assertEquals("2.68", group.getSourceVersion());
}
loincCM_resources = loincCM_resourceLists.get(1);
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("Beta.1", loincCM.getVersion());
assertEquals(1, loincCM.getGroup().size());
ConceptMap.ConceptMapGroupComponent group = loincCM.getGroup().get(0);
assertEquals(ITermLoaderSvc.LOINC_URI, group.getSource());
assertNull(group.getSourceVersion());
}
}

View File

@ -67,11 +67,11 @@ loinc.codesystem.version=2.67
# This is the version identifier for the answer list file
## Key may be omitted
loinc.answerlist.version=2.67.Beta.1
loinc.answerlist.version=Beta.1
# This is the version identifier for uploaded ConceptMap resources
## Key may be omitted
loinc.conceptmap.version=2.67.Beta.1
loinc.conceptmap.version=Beta.1
# Group
## Default value if key not provided: AccessoryFiles/GroupFile/Group.csv

View File

@ -67,11 +67,11 @@ loinc.codesystem.version=2.68
# This is the version identifier for the answer list file
## Key may be omitted
loinc.answerlist.version=2.68.Beta.1
loinc.answerlist.version=Beta.1
# This is the version identifier for uploaded ConceptMap resources
## Key may be omitted
loinc.conceptmap.version=2.68.Beta.1
loinc.conceptmap.version=Beta.1
# Group
## Default value if key not provided: AccessoryFiles/GroupFile/Group.csv