Supported ConceptMap Version from the properties
This commit is contained in:
parent
b29d5388c6
commit
91c1df7ce4
|
@ -52,7 +52,7 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
||||||
private final List<ValueSet> myValueSets;
|
private final List<ValueSet> myValueSets;
|
||||||
private final Map<String, ValueSet> myIdToValueSet = new HashMap<>();
|
private final Map<String, ValueSet> myIdToValueSet = new HashMap<>();
|
||||||
private final Map<String, TermConcept> myCode2Concept;
|
private final Map<String, TermConcept> myCode2Concept;
|
||||||
private final Properties myUploadProperties;
|
protected final Properties myUploadProperties;
|
||||||
|
|
||||||
BaseLoincHandler(Map<String, TermConcept> theCode2Concept, List<ValueSet> theValueSets, List<ConceptMap> theConceptMaps, Properties theUploadProperties) {
|
BaseLoincHandler(Map<String, TermConcept> theCode2Concept, List<ValueSet> theValueSets, List<ConceptMap> theConceptMaps, Properties theUploadProperties) {
|
||||||
myValueSets = theValueSets;
|
myValueSets = theValueSets;
|
||||||
|
@ -115,7 +115,7 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
||||||
conceptMap.setId(theMapping.getConceptMapId());
|
conceptMap.setId(theMapping.getConceptMapId());
|
||||||
conceptMap.setUrl(theMapping.getConceptMapUri());
|
conceptMap.setUrl(theMapping.getConceptMapUri());
|
||||||
conceptMap.setName(theMapping.getConceptMapName());
|
conceptMap.setName(theMapping.getConceptMapName());
|
||||||
conceptMap.setVersion(myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()));
|
conceptMap.setVersion(theMapping.getConceptMapVersion());
|
||||||
conceptMap.setPublisher(REGENSTRIEF_INSTITUTE_INC);
|
conceptMap.setPublisher(REGENSTRIEF_INSTITUTE_INC);
|
||||||
conceptMap.addContact()
|
conceptMap.addContact()
|
||||||
.setName(REGENSTRIEF_INSTITUTE_INC)
|
.setName(REGENSTRIEF_INSTITUTE_INC)
|
||||||
|
@ -226,6 +226,7 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
||||||
private String myCopyright;
|
private String myCopyright;
|
||||||
private String myConceptMapId;
|
private String myConceptMapId;
|
||||||
private String myConceptMapUri;
|
private String myConceptMapUri;
|
||||||
|
private String myConceptMapVersion;
|
||||||
private String myConceptMapName;
|
private String myConceptMapName;
|
||||||
private String mySourceCodeSystem;
|
private String mySourceCodeSystem;
|
||||||
private String mySourceCode;
|
private String mySourceCode;
|
||||||
|
@ -263,6 +264,15 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getConceptMapVersion() {
|
||||||
|
return myConceptMapVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConceptMapping setConceptMapVersion(String theConceptMapVersion) {
|
||||||
|
myConceptMapVersion = theConceptMapVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
String getCopyright() {
|
String getCopyright() {
|
||||||
return myCopyright;
|
return myCopyright;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
package ca.uhn.fhir.jpa.term.loinc;
|
package ca.uhn.fhir.jpa.term.loinc;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_CONCEPTMAP_VERSION;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.trim;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.commons.csv.CSVRecord;
|
||||||
|
import org.hl7.fhir.r4.model.ConceptMap;
|
||||||
|
import org.hl7.fhir.r4.model.Enumerations;
|
||||||
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
* HAPI FHIR JPA Server
|
* HAPI FHIR JPA Server
|
||||||
|
@ -21,18 +33,8 @@ package ca.uhn.fhir.jpa.term.loinc;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||||
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
|
||||||
import ca.uhn.fhir.jpa.term.IRecordHandler;
|
import ca.uhn.fhir.jpa.term.IRecordHandler;
|
||||||
import org.apache.commons.csv.CSVRecord;
|
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
||||||
import org.hl7.fhir.r4.model.ConceptMap;
|
|
||||||
import org.hl7.fhir.r4.model.Enumerations;
|
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.trim;
|
|
||||||
|
|
||||||
public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implements IRecordHandler {
|
public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implements IRecordHandler {
|
||||||
|
|
||||||
|
@ -51,6 +53,7 @@ public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implemen
|
||||||
@Override
|
@Override
|
||||||
public void accept(CSVRecord theRecord) {
|
public void accept(CSVRecord theRecord) {
|
||||||
|
|
||||||
|
String loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||||
String loincNumber = trim(theRecord.get("LOINC_NUM"));
|
String loincNumber = trim(theRecord.get("LOINC_NUM"));
|
||||||
String longCommonName = trim(theRecord.get("LOINC_LONG_COMMON_NAME"));
|
String longCommonName = trim(theRecord.get("LOINC_LONG_COMMON_NAME"));
|
||||||
String ieeeCode = trim(theRecord.get("IEEE_CF_CODE10"));
|
String ieeeCode = trim(theRecord.get("IEEE_CF_CODE10"));
|
||||||
|
@ -63,6 +66,7 @@ public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implemen
|
||||||
new ConceptMapping()
|
new ConceptMapping()
|
||||||
.setConceptMapId(LOINC_IEEE_CM_ID)
|
.setConceptMapId(LOINC_IEEE_CM_ID)
|
||||||
.setConceptMapUri(LOINC_IEEE_CM_URI)
|
.setConceptMapUri(LOINC_IEEE_CM_URI)
|
||||||
|
.setConceptMapVersion(loincIeeeCmVersion)
|
||||||
.setConceptMapName(LOINC_IEEE_CM_NAME)
|
.setConceptMapName(LOINC_IEEE_CM_NAME)
|
||||||
.setSourceCodeSystem(sourceCodeSystemUri)
|
.setSourceCodeSystem(sourceCodeSystemUri)
|
||||||
.setSourceCode(loincNumber)
|
.setSourceCode(loincNumber)
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_CONCEPTMAP_VERSION;
|
||||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||||
import static org.apache.commons.lang3.StringUtils.trim;
|
import static org.apache.commons.lang3.StringUtils.trim;
|
||||||
|
|
||||||
|
@ -75,6 +76,9 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
|
||||||
String extCodeSystemVersion = trim(theRecord.get("ExtCodeSystemVersion"));
|
String extCodeSystemVersion = trim(theRecord.get("ExtCodeSystemVersion"));
|
||||||
String extCodeSystemCopyrightNotice = trim(theRecord.get("ExtCodeSystemCopyrightNotice"));
|
String extCodeSystemCopyrightNotice = trim(theRecord.get("ExtCodeSystemCopyrightNotice"));
|
||||||
|
|
||||||
|
// ConceptMap version from properties files
|
||||||
|
String loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||||
|
|
||||||
Enumerations.ConceptMapEquivalence equivalence;
|
Enumerations.ConceptMapEquivalence equivalence;
|
||||||
switch (trim(defaultString(mapType))) {
|
switch (trim(defaultString(mapType))) {
|
||||||
case "":
|
case "":
|
||||||
|
@ -130,6 +134,7 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
|
||||||
new ConceptMapping()
|
new ConceptMapping()
|
||||||
.setConceptMapId(loincPartMapId)
|
.setConceptMapId(loincPartMapId)
|
||||||
.setConceptMapUri(loincPartMapUri)
|
.setConceptMapUri(loincPartMapUri)
|
||||||
|
.setConceptMapVersion(loincIeeeCmVersion)
|
||||||
.setConceptMapName(loincPartMapName)
|
.setConceptMapName(loincPartMapName)
|
||||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||||
.setSourceCode(partNumber)
|
.setSourceCode(partNumber)
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.hl7.fhir.r4.model.ValueSet;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_CONCEPTMAP_VERSION;
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import static org.apache.commons.lang3.StringUtils.trim;
|
import static org.apache.commons.lang3.StringUtils.trim;
|
||||||
|
|
||||||
|
@ -80,6 +81,9 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
||||||
String rpid = trim(theRecord.get("RPID"));
|
String rpid = trim(theRecord.get("RPID"));
|
||||||
String longName = trim(theRecord.get("LongName"));
|
String longName = trim(theRecord.get("LongName"));
|
||||||
|
|
||||||
|
// ConceptMap version from properties files
|
||||||
|
String loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||||
|
|
||||||
// RSNA Codes VS
|
// RSNA Codes VS
|
||||||
ValueSet vs;
|
ValueSet vs;
|
||||||
if (!myIdToValueSet.containsKey(RSNA_CODES_VS_ID)) {
|
if (!myIdToValueSet.containsKey(RSNA_CODES_VS_ID)) {
|
||||||
|
@ -176,6 +180,7 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
||||||
new ConceptMapping()
|
new ConceptMapping()
|
||||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID)
|
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID)
|
||||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_URI)
|
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_URI)
|
||||||
|
.setConceptMapVersion(loincIeeeCmVersion)
|
||||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME)
|
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME)
|
||||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||||
.setSourceCode(partNumber)
|
.setSourceCode(partNumber)
|
||||||
|
@ -193,6 +198,7 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
||||||
new ConceptMapping()
|
new ConceptMapping()
|
||||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID)
|
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID)
|
||||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_URI)
|
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_URI)
|
||||||
|
.setConceptMapVersion(loincIeeeCmVersion)
|
||||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME)
|
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME)
|
||||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||||
.setSourceCode(loincNumber)
|
.setSourceCode(loincNumber)
|
||||||
|
|
|
@ -17,12 +17,10 @@ import ca.uhn.fhir.jpa.term.loinc.LoincTop2000LabResultsUsHandler;
|
||||||
import ca.uhn.fhir.jpa.term.loinc.LoincUniversalOrderSetHandler;
|
import ca.uhn.fhir.jpa.term.loinc.LoincUniversalOrderSetHandler;
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
|
||||||
import org.hl7.fhir.r4.model.CodeSystem;
|
import org.hl7.fhir.r4.model.CodeSystem;
|
||||||
import org.hl7.fhir.r4.model.ConceptMap;
|
import org.hl7.fhir.r4.model.ConceptMap;
|
||||||
import org.hl7.fhir.r4.model.Enumerations;
|
import org.hl7.fhir.r4.model.Enumerations;
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -167,7 +165,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
assertEquals(1, group.getElement().get(0).getTarget().size());
|
assertEquals(1, group.getElement().get(0).getTarget().size());
|
||||||
assertEquals("420710006", group.getElement().get(0).getTarget().get(0).getCode());
|
assertEquals("420710006", group.getElement().get(0).getTarget().get(0).getCode());
|
||||||
assertEquals("Interferon beta (substance)", group.getElement().get(0).getTarget().get(0).getDisplay());
|
assertEquals("Interferon beta (substance)", group.getElement().get(0).getTarget().get(0).getDisplay());
|
||||||
|
|
||||||
// Document Ontology ValueSet
|
// Document Ontology ValueSet
|
||||||
vs = valueSets.get(LoincDocumentOntologyHandler.DOCUMENT_ONTOLOGY_CODES_VS_ID);
|
vs = valueSets.get(LoincDocumentOntologyHandler.DOCUMENT_ONTOLOGY_CODES_VS_ID);
|
||||||
assertEquals(LoincDocumentOntologyHandler.DOCUMENT_ONTOLOGY_CODES_VS_NAME, vs.getName());
|
assertEquals(LoincDocumentOntologyHandler.DOCUMENT_ONTOLOGY_CODES_VS_NAME, vs.getName());
|
||||||
|
@ -220,6 +218,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
// RSNA Playbook - LOINC Part -> RadLex RID Mappings
|
// RSNA Playbook - LOINC Part -> RadLex RID Mappings
|
||||||
conceptMap = conceptMaps.get(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID);
|
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_URI, conceptMap.getUrl());
|
||||||
|
assertEquals("Beta.1", conceptMap.getVersion());
|
||||||
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME, conceptMap.getName());
|
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME, conceptMap.getName());
|
||||||
assertEquals(1, conceptMap.getGroup().size());
|
assertEquals(1, conceptMap.getGroup().size());
|
||||||
group = conceptMap.getGroupFirstRep();
|
group = conceptMap.getGroupFirstRep();
|
||||||
|
@ -236,6 +235,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
// RSNA Playbook - LOINC Term -> RadLex RPID Mappings
|
// RSNA Playbook - LOINC Term -> RadLex RPID Mappings
|
||||||
conceptMap = conceptMaps.get(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID);
|
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_URI, conceptMap.getUrl());
|
||||||
|
assertEquals("Beta.1", conceptMap.getVersion());
|
||||||
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME, conceptMap.getName());
|
assertEquals(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME, conceptMap.getName());
|
||||||
assertEquals(1, conceptMap.getGroup().size());
|
assertEquals(1, conceptMap.getGroup().size());
|
||||||
group = conceptMap.getGroupFirstRep();
|
group = conceptMap.getGroupFirstRep();
|
||||||
|
@ -302,6 +302,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
ourLog.debug(FhirContext.forCached(FhirVersionEnum.R4).newXmlParser().setPrettyPrint(true).encodeResourceToString(conceptMap));
|
ourLog.debug(FhirContext.forCached(FhirVersionEnum.R4).newXmlParser().setPrettyPrint(true).encodeResourceToString(conceptMap));
|
||||||
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_NAME, conceptMap.getName());
|
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_NAME, conceptMap.getName());
|
||||||
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_URI, conceptMap.getUrl());
|
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_URI, conceptMap.getUrl());
|
||||||
|
assertEquals("Beta.1", conceptMap.getVersion());
|
||||||
assertEquals(1, conceptMap.getGroup().size());
|
assertEquals(1, conceptMap.getGroup().size());
|
||||||
assertEquals(ITermLoaderSvc.LOINC_URI, conceptMap.getGroup().get(0).getSource());
|
assertEquals(ITermLoaderSvc.LOINC_URI, conceptMap.getGroup().get(0).getSource());
|
||||||
assertEquals(ITermLoaderSvc.IEEE_11073_10101_URI, conceptMap.getGroup().get(0).getTarget());
|
assertEquals(ITermLoaderSvc.IEEE_11073_10101_URI, conceptMap.getGroup().get(0).getTarget());
|
||||||
|
|
Loading…
Reference in New Issue