Loinc updates
This commit is contained in:
parent
3b794a4f39
commit
c9d7b88cab
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.term.loinc;
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -39,6 +39,7 @@ import static org.apache.commons.lang3.StringUtils.trim;
|
|||
|
||||
public class LoincHandler implements IRecordHandler {
|
||||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(LoincHandler.class);
|
||||
private final Map<String, TermConcept> myCode2Concept;
|
||||
private final TermCodeSystemVersion myCodeSystemVersion;
|
||||
private final Map<String, CodeSystem.PropertyType> myPropertyNames;
|
||||
|
@ -86,7 +87,16 @@ public class LoincHandler implements IRecordHandler {
|
|||
concept.addPropertyString(nextPropertyName, nextPropertyValue);
|
||||
break;
|
||||
case CODING:
|
||||
PartTypeAndPartName key = new PartTypeAndPartName(nextPropertyName, nextPropertyValue);
|
||||
String propertyValue = nextPropertyValue;
|
||||
if (nextPropertyName.equals("COMPONENT")) {
|
||||
if (propertyValue.contains("^")) {
|
||||
propertyValue = propertyValue.substring(0, propertyValue.indexOf("^"));
|
||||
} else if (propertyValue.contains("/")) {
|
||||
propertyValue = propertyValue.substring(0, propertyValue.indexOf("/"));
|
||||
}
|
||||
}
|
||||
|
||||
PartTypeAndPartName key = new PartTypeAndPartName(nextPropertyName, propertyValue);
|
||||
String partNumber = myPartTypeAndPartNameToPartNumber.get(key);
|
||||
|
||||
if (partNumber == null && nextPropertyName.equals("TIME_ASPCT")) {
|
||||
|
@ -106,11 +116,12 @@ public class LoincHandler implements IRecordHandler {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Validate.notBlank(partNumber, "Unknown part: " + key);
|
||||
if (isNotBlank(partNumber)) {
|
||||
concept.addPropertyCoding(nextPropertyName, IHapiTerminologyLoaderSvc.LOINC_URI, partNumber, nextPropertyValue);
|
||||
} else {
|
||||
ourLog.warn("Unable to find part code with TYPE[{}] and NAME[{}]", key.getPartType(), key.getPartName());
|
||||
String msg = "Unable to find part code with TYPE[" + key.getPartType() + "] and NAME[" + nextPropertyValue + "] (using name " + propertyValue + ")";
|
||||
ourLog.warn(msg);
|
||||
throw new InternalErrorException(msg);
|
||||
}
|
||||
break;
|
||||
case DECIMAL:
|
||||
|
@ -129,5 +140,4 @@ public class LoincHandler implements IRecordHandler {
|
|||
myCode2Concept.put(code, concept);
|
||||
}
|
||||
}
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(LoincHandler.class);
|
||||
}
|
||||
|
|
|
@ -40,9 +40,12 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
|
|||
|
||||
public static final String LOINC_SCT_PART_MAP_ID = "loinc-parts-to-snomed-ct";
|
||||
public static final String LOINC_SCT_PART_MAP_URI = "http://loinc.org/cm/loinc-parts-to-snomed-ct";
|
||||
static final String LOINC_RADLEX_PART_MAP_ID = "loinc-parts-to-radlex";
|
||||
static final String LOINC_RADLEX_PART_MAP_URI = "http://loinc.org/cm/loinc-parts-to-radlex";
|
||||
static final String LOINC_RADLEX_PART_MAP_NAME = "LOINC Part Map to RADLEX";
|
||||
public static final String LOINC_TERM_TO_RPID_PART_MAP_ID = "loinc-term-to-rpids";
|
||||
public static final String LOINC_TERM_TO_RPID_PART_MAP_URI = "http://loinc.org/cm/loinc-to-rpids";
|
||||
public static final String LOINC_TERM_TO_RPID_PART_MAP_NAME = "LOINC Terms to RadLex RPIDs";
|
||||
public static final String LOINC_PART_TO_RID_PART_MAP_ID = "loinc-term-to-rpids";
|
||||
public static final String LOINC_PART_TO_RID_PART_MAP_URI = "http://loinc.org/cm/loinc-to-rpids";
|
||||
public static final String LOINC_PART_TO_RID_PART_MAP_NAME = "LOINC Parts to RadLex RIDs";
|
||||
private static final String LOINC_SCT_PART_MAP_NAME = "LOINC Part Map to SNOMED CT";
|
||||
private static final String LOINC_RXNORM_PART_MAP_ID = "loinc-parts-to-rxnorm";
|
||||
private static final String LOINC_RXNORM_PART_MAP_URI = "http://loinc.org/cm/loinc-parts-to-rxnorm";
|
||||
|
@ -104,9 +107,9 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
|
|||
loincPartMapName = LOINC_RXNORM_PART_MAP_NAME;
|
||||
break;
|
||||
case "http://www.radlex.org":
|
||||
loincPartMapId = LOINC_RADLEX_PART_MAP_ID;
|
||||
loincPartMapUri = LOINC_RADLEX_PART_MAP_URI;
|
||||
loincPartMapName = LOINC_RADLEX_PART_MAP_NAME;
|
||||
loincPartMapId = LOINC_PART_TO_RID_PART_MAP_ID;
|
||||
loincPartMapUri = LOINC_PART_TO_RID_PART_MAP_URI;
|
||||
loincPartMapName = LOINC_PART_TO_RID_PART_MAP_NAME;
|
||||
break;
|
||||
case "http://pubchem.ncbi.nlm.nih.gov":
|
||||
loincPartMapId = LOINC_PUBCHEM_PART_MAP_ID;
|
||||
|
|
|
@ -39,9 +39,6 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
|||
public static final String RSNA_CODES_VS_ID = "loinc-rsna-radiology-playbook";
|
||||
public static final String RSNA_CODES_VS_URI = "http://loinc.org/vs/loinc-rsna-radiology-playbook";
|
||||
public static final String RSNA_CODES_VS_NAME = "LOINC/RSNA Radiology Playbook";
|
||||
public static final String RADLEX_MAPPING_CM_ID = LoincPartRelatedCodeMappingHandler.LOINC_RADLEX_PART_MAP_ID;
|
||||
public static final String RADLEX_MAPPING_CM_URI = LoincPartRelatedCodeMappingHandler.LOINC_RADLEX_PART_MAP_URI;
|
||||
public static final String RADLEX_MAPPING_CM_NAME = LoincPartRelatedCodeMappingHandler.LOINC_RADLEX_PART_MAP_NAME;
|
||||
public static final String RID_CS_URI = "http://www.radlex.org";
|
||||
/*
|
||||
* About these being the same - Per Dan Vreeman:
|
||||
|
@ -177,9 +174,9 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
|||
if (isNotBlank(rid)) {
|
||||
addConceptMapEntry(
|
||||
new ConceptMapping()
|
||||
.setConceptMapId(RADLEX_MAPPING_CM_ID)
|
||||
.setConceptMapUri(RADLEX_MAPPING_CM_URI)
|
||||
.setConceptMapName(RADLEX_MAPPING_CM_NAME)
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID)
|
||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_URI)
|
||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME)
|
||||
.setSourceCodeSystem(IHapiTerminologyLoaderSvc.LOINC_URI)
|
||||
.setSourceCode(partNumber)
|
||||
.setSourceDisplay(partName)
|
||||
|
@ -194,9 +191,9 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
|||
if (isNotBlank(rpid)) {
|
||||
addConceptMapEntry(
|
||||
new ConceptMapping()
|
||||
.setConceptMapId(RADLEX_MAPPING_CM_ID)
|
||||
.setConceptMapUri(RADLEX_MAPPING_CM_URI)
|
||||
.setConceptMapName(RADLEX_MAPPING_CM_NAME)
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID)
|
||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_URI)
|
||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME)
|
||||
.setSourceCodeSystem(IHapiTerminologyLoaderSvc.LOINC_URI)
|
||||
.setSourceCode(loincNumber)
|
||||
.setSourceDisplay(longCommonName)
|
||||
|
|
|
@ -222,9 +222,9 @@ public class TerminologyLoaderSvcLoincTest {
|
|||
assertEquals("NM", code.getCodingProperties(propertyName).get(0).getDisplay());
|
||||
|
||||
// RSNA Playbook - LOINC Part -> RadLex RID Mappings
|
||||
conceptMap = conceptMaps.get(LoincRsnaPlaybookHandler.RADLEX_MAPPING_CM_ID);
|
||||
assertEquals(LoincRsnaPlaybookHandler.RADLEX_MAPPING_CM_URI, conceptMap.getUrl());
|
||||
assertEquals(LoincRsnaPlaybookHandler.RADLEX_MAPPING_CM_NAME, conceptMap.getName());
|
||||
conceptMap = conceptMaps.get(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID);
|
||||
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_URI, conceptMap.getUrl());
|
||||
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME, conceptMap.getName());
|
||||
assertEquals(1, conceptMap.getGroup().size());
|
||||
group = conceptMap.getGroupFirstRep();
|
||||
// all entries have the same source and target so these should be null
|
||||
|
@ -238,9 +238,9 @@ public class TerminologyLoaderSvcLoincTest {
|
|||
assertEquals(Enumerations.ConceptMapEquivalence.EQUAL, group.getElement().get(0).getTarget().get(0).getEquivalence());
|
||||
|
||||
// RSNA Playbook - LOINC Term -> RadLex RPID Mappings
|
||||
conceptMap = conceptMaps.get(LoincRsnaPlaybookHandler.RADLEX_MAPPING_CM_ID);
|
||||
assertEquals(LoincRsnaPlaybookHandler.RADLEX_MAPPING_CM_URI, conceptMap.getUrl());
|
||||
assertEquals(LoincRsnaPlaybookHandler.RADLEX_MAPPING_CM_NAME, conceptMap.getName());
|
||||
conceptMap = conceptMaps.get(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID);
|
||||
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_URI, conceptMap.getUrl());
|
||||
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME, conceptMap.getName());
|
||||
assertEquals(1, conceptMap.getGroup().size());
|
||||
group = conceptMap.getGroupFirstRep();
|
||||
// all entries have the same source and target so these should be null
|
||||
|
|
Loading…
Reference in New Issue