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 Map<String, ValueSet> myIdToValueSet = new HashMap<>();
|
||||
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) {
|
||||
myValueSets = theValueSets;
|
||||
|
@ -115,7 +115,7 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
|||
conceptMap.setId(theMapping.getConceptMapId());
|
||||
conceptMap.setUrl(theMapping.getConceptMapUri());
|
||||
conceptMap.setName(theMapping.getConceptMapName());
|
||||
conceptMap.setVersion(myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()));
|
||||
conceptMap.setVersion(theMapping.getConceptMapVersion());
|
||||
conceptMap.setPublisher(REGENSTRIEF_INSTITUTE_INC);
|
||||
conceptMap.addContact()
|
||||
.setName(REGENSTRIEF_INSTITUTE_INC)
|
||||
|
@ -226,6 +226,7 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
|||
private String myCopyright;
|
||||
private String myConceptMapId;
|
||||
private String myConceptMapUri;
|
||||
private String myConceptMapVersion;
|
||||
private String myConceptMapName;
|
||||
private String mySourceCodeSystem;
|
||||
private String mySourceCode;
|
||||
|
@ -263,6 +264,15 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
|||
return this;
|
||||
}
|
||||
|
||||
String getConceptMapVersion() {
|
||||
return myConceptMapVersion;
|
||||
}
|
||||
|
||||
ConceptMapping setConceptMapVersion(String theConceptMapVersion) {
|
||||
myConceptMapVersion = theConceptMapVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
String getCopyright() {
|
||||
return myCopyright;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
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
|
||||
* 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.term.api.ITermLoaderSvc;
|
||||
import ca.uhn.fhir.jpa.term.IRecordHandler;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.trim;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
||||
|
||||
public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
||||
|
@ -51,6 +53,7 @@ public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implemen
|
|||
@Override
|
||||
public void accept(CSVRecord theRecord) {
|
||||
|
||||
String 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,6 +66,7 @@ public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implemen
|
|||
new ConceptMapping()
|
||||
.setConceptMapId(LOINC_IEEE_CM_ID)
|
||||
.setConceptMapUri(LOINC_IEEE_CM_URI)
|
||||
.setConceptMapVersion(loincIeeeCmVersion)
|
||||
.setConceptMapName(LOINC_IEEE_CM_NAME)
|
||||
.setSourceCodeSystem(sourceCodeSystemUri)
|
||||
.setSourceCode(loincNumber)
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
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.trim;
|
||||
|
||||
|
@ -75,6 +76,9 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
|
|||
String extCodeSystemVersion = trim(theRecord.get("ExtCodeSystemVersion"));
|
||||
String extCodeSystemCopyrightNotice = trim(theRecord.get("ExtCodeSystemCopyrightNotice"));
|
||||
|
||||
// ConceptMap version from properties files
|
||||
String loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
|
||||
Enumerations.ConceptMapEquivalence equivalence;
|
||||
switch (trim(defaultString(mapType))) {
|
||||
case "":
|
||||
|
@ -130,6 +134,7 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
|
|||
new ConceptMapping()
|
||||
.setConceptMapId(loincPartMapId)
|
||||
.setConceptMapUri(loincPartMapUri)
|
||||
.setConceptMapVersion(loincIeeeCmVersion)
|
||||
.setConceptMapName(loincPartMapName)
|
||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||
.setSourceCode(partNumber)
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.hl7.fhir.r4.model.ValueSet;
|
|||
|
||||
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.trim;
|
||||
|
||||
|
@ -80,6 +81,9 @@ 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 loincIeeeCmVersion = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
|
||||
// RSNA Codes VS
|
||||
ValueSet vs;
|
||||
if (!myIdToValueSet.containsKey(RSNA_CODES_VS_ID)) {
|
||||
|
@ -176,6 +180,7 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
|||
new ConceptMapping()
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID)
|
||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_URI)
|
||||
.setConceptMapVersion(loincIeeeCmVersion)
|
||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME)
|
||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||
.setSourceCode(partNumber)
|
||||
|
@ -193,6 +198,7 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
|||
new ConceptMapping()
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID)
|
||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_URI)
|
||||
.setConceptMapVersion(loincIeeeCmVersion)
|
||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME)
|
||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||
.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.rest.api.server.RequestDetails;
|
||||
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.ConceptMap;
|
||||
import org.hl7.fhir.r4.model.Enumerations;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -220,6 +218,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
|||
// RSNA Playbook - LOINC Part -> RadLex RID Mappings
|
||||
conceptMap = conceptMaps.get(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID);
|
||||
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(1, conceptMap.getGroup().size());
|
||||
group = conceptMap.getGroupFirstRep();
|
||||
|
@ -236,6 +235,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
|||
// RSNA Playbook - LOINC Term -> RadLex RPID Mappings
|
||||
conceptMap = conceptMaps.get(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID);
|
||||
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(1, conceptMap.getGroup().size());
|
||||
group = conceptMap.getGroupFirstRep();
|
||||
|
@ -302,6 +302,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
|||
ourLog.debug(FhirContext.forCached(FhirVersionEnum.R4).newXmlParser().setPrettyPrint(true).encodeResourceToString(conceptMap));
|
||||
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_NAME, conceptMap.getName());
|
||||
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_URI, conceptMap.getUrl());
|
||||
assertEquals("Beta.1", conceptMap.getVersion());
|
||||
assertEquals(1, conceptMap.getGroup().size());
|
||||
assertEquals(ITermLoaderSvc.LOINC_URI, conceptMap.getGroup().get(0).getSource());
|
||||
assertEquals(ITermLoaderSvc.IEEE_11073_10101_URI, conceptMap.getGroup().get(0).getTarget());
|
||||
|
|
Loading…
Reference in New Issue