Bug fix and test improvements.

This commit is contained in:
ianmarshall 2020-10-06 21:22:09 -04:00
parent f044f9c47e
commit 0f39eeb0e9
5 changed files with 55 additions and 7 deletions

View File

@ -192,7 +192,7 @@ public abstract class BaseLoincHandler implements IRecordHandler {
if (isNotBlank(theVersionPropertyName)) {
version = myUploadProperties.getProperty(theVersionPropertyName);
} else {
version = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
version = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
}
ValueSet vs;

View File

@ -85,6 +85,9 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
// 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());
// RSNA Codes VS
ValueSet vs;
if (!myIdToValueSet.containsKey(RSNA_CODES_VS_ID)) {
@ -93,6 +96,7 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
vs.setId(RSNA_CODES_VS_ID);
vs.setName(RSNA_CODES_VS_NAME);
vs.setStatus(Enumerations.PublicationStatus.ACTIVE);
vs.setVersion(codeSystemVersionId);
myIdToValueSet.put(RSNA_CODES_VS_ID, vs);
myValueSets.add(vs);
} else {
@ -177,7 +181,6 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
String partConceptMapId;
String termConceptMapId;
String codeSystemVersionId = myUploadProperties.getProperty(LOINC_CODESYSTEM_VERSION.getCode());
if (codeSystemVersionId != null) {
partConceptMapId = LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID + "-" + codeSystemVersionId;
termConceptMapId = LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID + "-" + codeSystemVersionId;

View File

@ -39,6 +39,7 @@ import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.junit.jupiter.api.Assertions.assertEquals;
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;
@ -183,10 +184,12 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertEquals(ITermLoaderSvc.LOINC_URI, vs.getCompose().getInclude().get(0).getSystem());
assertEquals("LA6270-8", vs.getCompose().getInclude().get(0).getConcept().get(0).getCode());
assertEquals("Never", vs.getCompose().getInclude().get(0).getConcept().get(0).getDisplay());
assertEquals("Beta.1", vs.getVersion());
// External AnswerList
vs = valueSets.get("LL1892-0");
assertEquals(0, vs.getCompose().getIncludeFirstRep().getConcept().size());
assertEquals("Beta.1", vs.getVersion());
// Part
code = concepts.get("LP101394-7");
@ -220,6 +223,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertEquals(3, vs.getCompose().getInclude().get(0).getConcept().size());
assertEquals("11488-4", vs.getCompose().getInclude().get(0).getConcept().get(0).getCode());
assertEquals("Consult note", vs.getCompose().getInclude().get(0).getConcept().get(0).getDisplay());
assertNull(vs.getVersion());
// Document ontology parts
code = concepts.get("11488-4");
@ -237,6 +241,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertEquals(ITermLoaderSvc.LOINC_URI, vs.getCompose().getInclude().get(0).getSystem());
assertEquals("17787-3", vs.getCompose().getInclude().get(0).getConcept().get(0).getCode());
assertEquals("NM Thyroid gland Study report", vs.getCompose().getInclude().get(0).getConcept().get(0).getDisplay());
assertNull(vs.getVersion());
// RSNA Playbook Code Parts - Region Imaged
code = concepts.get("17787-3");
@ -305,6 +310,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertEquals("Creatinine [Mass/volume] in Serum or Plasma", vs.getCompose().getInclude().get(0).getConcept().get(0).getDisplay());
assertEquals("718-7", vs.getCompose().getInclude().get(0).getConcept().get(1).getCode());
assertEquals("Hemoglobin [Mass/volume] in Blood", vs.getCompose().getInclude().get(0).getConcept().get(1).getDisplay());
assertNull(vs.getVersion());
// TOP 2000 - SI
vs = valueSets.get(LoincTop2000LabResultsSiHandler.TOP_2000_SI_VS_ID);
@ -317,6 +323,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertEquals("Creatinine [Moles/volume] in Serum or Plasma", vs.getCompose().getInclude().get(0).getConcept().get(0).getDisplay());
assertEquals("718-7", vs.getCompose().getInclude().get(0).getConcept().get(1).getCode());
assertEquals("Hemoglobin [Mass/volume] in Blood", vs.getCompose().getInclude().get(0).getConcept().get(1).getDisplay());
assertNull(vs.getVersion());
// Universal lab order VS
vs = valueSets.get(LoincUniversalOrderSetHandler.VS_ID_BASE);
@ -325,6 +332,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertEquals(9, vs.getCompose().getInclude().get(0).getConcept().size());
assertEquals("42176-8", vs.getCompose().getInclude().get(0).getConcept().get(0).getCode());
assertEquals("1,3 beta glucan [Mass/volume] in Serum", vs.getCompose().getInclude().get(0).getConcept().get(0).getDisplay());
assertNull(vs.getVersion());
// All LOINC codes
assertTrue(valueSets.containsKey("loinc-all"));
@ -341,6 +349,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
assertTrue(vs.getCompose().hasInclude());
assertEquals(1, vs.getCompose().getInclude().size());
assertEquals(ITermLoaderSvc.LOINC_URI, vs.getCompose().getInclude().get(0).getSystem());
assertEquals("1.0.0", vs.getVersion());
// IEEE Medical Device Codes
conceptMap = conceptMaps.get(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_ID);
@ -398,6 +407,18 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
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();
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());
} else {
assertEquals("2.67", loincVS.getVersion());
}
}
List<ConceptMap> loincCM_resources = myConceptMapCaptor.getValue();
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("2.67.Beta.1", loincCM.getVersion());
}
// Update LOINC marked as version 2.67
myFiles = new ZipCollectionBuilder();
@ -407,6 +428,18 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
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();
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());
} else {
assertEquals("2.67", loincVS.getVersion());
}
}
loincCM_resources = myConceptMapCaptor.getValue();
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("2.67.Beta.1", loincCM.getVersion());
}
// Load LOINC marked as version 2.68
myFiles = new ZipCollectionBuilder();
@ -416,6 +449,18 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
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();
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());
} else {
assertEquals("2.68", loincVS.getVersion());
}
}
loincCM_resources = myConceptMapCaptor.getValue();
for (ConceptMap loincCM : loincCM_resources) {
assertEquals("2.68.Beta.1", loincCM.getVersion());
}
}

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=Beta.1
loinc.answerlist.version=2.67.Beta.1
# This is the version identifier for uploaded ConceptMap resources
## Key may be omitted
loinc.conceptmap.version=Beta.1
loinc.conceptmap.version=2.67.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=Beta.1
loinc.answerlist.version=2.68.Beta.1
# This is the version identifier for uploaded ConceptMap resources
## Key may be omitted
loinc.conceptmap.version=Beta.1
loinc.conceptmap.version=2.68.Beta.1
# Group
## Default value if key not provided: AccessoryFiles/GroupFile/Group.csv