Update loader to ensure that ConceptMap and ValueSet Ids are unique for each version loaded.
This commit is contained in:
parent
5fe46be41c
commit
2bceacd9a6
|
@ -64,9 +64,6 @@ public class BaseJpaResourceProviderCodeSystemDstu3 extends JpaResourceProviderD
|
|||
IValidationSupport.LookupCodeResult result;
|
||||
if (theVersion != null) {
|
||||
result = dao.lookupCode(theCode, new UriType(theSystem.getValue() + "|" + theVersion), theCoding, theRequestDetails);
|
||||
} else if (theCoding != null && theCoding.hasVersion()) {
|
||||
Coding codingWithVersion = new Coding(theCoding.getSystem() + "|" + theCoding.getVersion(), theCoding.getCode(), theCoding.getDisplay());
|
||||
result = dao.lookupCode(theCode, theSystem, codingWithVersion, theRequestDetails);
|
||||
} else {
|
||||
result = dao.lookupCode(theCode, theSystem, theCoding, theRequestDetails);
|
||||
}
|
||||
|
@ -104,12 +101,6 @@ public class BaseJpaResourceProviderCodeSystemDstu3 extends JpaResourceProviderD
|
|||
if (theVersion != null) {
|
||||
theSystem = new UriType(theSystem.asStringValue() + "|" + theVersion.toString());
|
||||
}
|
||||
if (theCodingA != null && theCodingA.hasVersion()) {
|
||||
theCodingA.setSystem(theCodingA.getSystemElement().asStringValue() + "|" + theCodingA.getVersion());
|
||||
}
|
||||
if (theCodingB != null && theCodingB.hasVersion()) {
|
||||
theCodingB.setSystem(theCodingB.getSystemElement().asStringValue() + "|" + theCodingB.getVersion());
|
||||
}
|
||||
result = dao.subsumes(theCodeA, theCodeB, theSystem, theCodingA, theCodingB, theRequestDetails);
|
||||
return (Parameters) result.toParameters(theRequestDetails.getFhirContext());
|
||||
} finally {
|
||||
|
|
|
@ -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;
|
||||
final Properties myUploadProperties;
|
||||
|
||||
BaseLoincHandler(Map<String, TermConcept> theCode2Concept, List<ValueSet> theValueSets, List<ConceptMap> theConceptMaps, Properties theUploadProperties) {
|
||||
myValueSets = theValueSets;
|
||||
|
@ -191,6 +191,8 @@ public abstract class BaseLoincHandler implements IRecordHandler {
|
|||
String version = null;
|
||||
if (isNotBlank(theVersionPropertyName)) {
|
||||
version = myUploadProperties.getProperty(theVersionPropertyName);
|
||||
} else {
|
||||
version = myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
}
|
||||
|
||||
ValueSet vs;
|
||||
|
|
|
@ -31,6 +31,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.trim;
|
||||
|
||||
public class BaseLoincTop2000LabResultsHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
@ -41,7 +42,7 @@ public class BaseLoincTop2000LabResultsHandler extends BaseLoincHandler implemen
|
|||
|
||||
public BaseLoincTop2000LabResultsHandler(Map<String, TermConcept> theCode2concept, List<ValueSet> theValueSets, String theValueSetId, String theValueSetUri, String theValueSetName, List<ConceptMap> theConceptMaps, Properties theUploadProperties) {
|
||||
super(theCode2concept, theValueSets, theConceptMaps, theUploadProperties);
|
||||
myValueSetId = theValueSetId;
|
||||
myValueSetId = theValueSetId + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
myValueSetUri = theValueSetUri;
|
||||
myValueSetName = theValueSetName;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class LoincAnswerListHandler extends BaseLoincHandler {
|
|||
public void accept(CSVRecord theRecord) {
|
||||
|
||||
// this is the code for the list (will repeat)
|
||||
String answerListId = trim(theRecord.get("AnswerListId"));
|
||||
String answerListId = trim(theRecord.get("AnswerListId")) + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
String answerListName = trim(theRecord.get("AnswerListName"));
|
||||
String answerListOid = trim(theRecord.get("AnswerListOID"));
|
||||
String externallyDefined = trim(theRecord.get("ExtDefinedYN"));
|
||||
|
|
|
@ -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.trim;
|
||||
|
||||
public class LoincDocumentOntologyHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
@ -57,7 +58,8 @@ public class LoincDocumentOntologyHandler extends BaseLoincHandler implements IR
|
|||
String partName = trim(theRecord.get("PartName"));
|
||||
|
||||
// RSNA Codes VS
|
||||
ValueSet vs = getValueSet(DOCUMENT_ONTOLOGY_CODES_VS_ID, DOCUMENT_ONTOLOGY_CODES_VS_URI, DOCUMENT_ONTOLOGY_CODES_VS_NAME, null);
|
||||
ValueSet vs = getValueSet(DOCUMENT_ONTOLOGY_CODES_VS_ID + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()),
|
||||
DOCUMENT_ONTOLOGY_CODES_VS_URI, DOCUMENT_ONTOLOGY_CODES_VS_NAME, null);
|
||||
addCodeAsIncludeToValueSet(vs, ITermLoaderSvc.LOINC_URI, loincNumber, null);
|
||||
|
||||
// Part Properties
|
||||
|
|
|
@ -30,6 +30,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.trim;
|
||||
|
||||
public class LoincGroupFileHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
@ -43,7 +44,7 @@ public class LoincGroupFileHandler extends BaseLoincHandler implements IRecordHa
|
|||
@Override
|
||||
public void accept(CSVRecord theRecord) {
|
||||
//"ParentGroupId","GroupId","Group","Archetype","Status","VersionFirstReleased"
|
||||
String parentGroupId = trim(theRecord.get("ParentGroupId"));
|
||||
String parentGroupId = trim(theRecord.get("ParentGroupId")) + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
String groupId = trim(theRecord.get("GroupId"));
|
||||
String groupName = trim(theRecord.get("Group"));
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class LoincGroupFileHandler extends BaseLoincHandler implements IRecordHa
|
|||
|
||||
// Create group to set its name (terms are added in a different
|
||||
// handler)
|
||||
getValueSet(groupId, VS_URI_PREFIX + groupId, groupName, null);
|
||||
getValueSet(groupId, VS_URI_PREFIX + groupId + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()), groupName, null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,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.trim;
|
||||
|
||||
public class LoincGroupTermsFileHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
@ -42,7 +43,7 @@ public class LoincGroupTermsFileHandler extends BaseLoincHandler implements IRec
|
|||
@Override
|
||||
public void accept(CSVRecord theRecord) {
|
||||
//"Category","GroupId","Archetype","LoincNumber","LongCommonName"
|
||||
String groupId = trim(theRecord.get("GroupId"));
|
||||
String groupId = trim(theRecord.get("GroupId")) + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
String loincNumber = trim(theRecord.get("LoincNumber"));
|
||||
|
||||
ValueSet valueSet = getValueSet(groupId, LoincGroupFileHandler.VS_URI_PREFIX + groupId, null, null);
|
||||
|
|
|
@ -32,6 +32,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.trim;
|
||||
|
||||
public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
@ -61,7 +62,7 @@ public class LoincIeeeMedicalDeviceCodeHandler extends BaseLoincHandler implemen
|
|||
String targetCodeSystemUri = ITermLoaderSvc.IEEE_11073_10101_URI;
|
||||
addConceptMapEntry(
|
||||
new ConceptMapping()
|
||||
.setConceptMapId(LOINC_IEEE_CM_ID)
|
||||
.setConceptMapId(LOINC_IEEE_CM_ID + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()))
|
||||
.setConceptMapUri(LOINC_IEEE_CM_URI)
|
||||
.setConceptMapName(LOINC_IEEE_CM_NAME)
|
||||
.setSourceCodeSystem(sourceCodeSystemUri)
|
||||
|
|
|
@ -31,11 +31,12 @@ 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.trim;
|
||||
|
||||
public class LoincImagingDocumentCodeHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
||||
public static final String VS_ID = "loinc-imaging-document-codes";
|
||||
public final String VS_ID = "loinc-imaging-document-codes" + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
public static final String VS_URI = "http://loinc.org/vs/loinc-imaging-document-codes";
|
||||
public static final String VS_NAME = "LOINC Imaging Document Codes";
|
||||
|
||||
|
|
|
@ -30,6 +30,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.trim;
|
||||
|
||||
public class LoincParentGroupFileHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
@ -41,7 +42,7 @@ public class LoincParentGroupFileHandler extends BaseLoincHandler implements IRe
|
|||
@Override
|
||||
public void accept(CSVRecord theRecord) {
|
||||
// "ParentGroupId","ParentGroup","Status"
|
||||
String parentGroupId = trim(theRecord.get("ParentGroupId"));
|
||||
String parentGroupId = trim(theRecord.get("ParentGroupId")) + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
String parentGroupName = trim(theRecord.get("ParentGroup"));
|
||||
|
||||
getValueSet(parentGroupId, LoincGroupFileHandler.VS_URI_PREFIX + parentGroupId, parentGroupName, null);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -128,7 +129,7 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
|
|||
|
||||
addConceptMapEntry(
|
||||
new ConceptMapping()
|
||||
.setConceptMapId(loincPartMapId)
|
||||
.setConceptMapId(loincPartMapId + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()))
|
||||
.setConceptMapUri(loincPartMapUri)
|
||||
.setConceptMapName(loincPartMapName)
|
||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -174,7 +175,7 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
|||
if (isNotBlank(rid)) {
|
||||
addConceptMapEntry(
|
||||
new ConceptMapping()
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID)
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_ID + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()))
|
||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_URI)
|
||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_PART_TO_RID_PART_MAP_NAME)
|
||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||
|
@ -191,7 +192,7 @@ public class LoincRsnaPlaybookHandler extends BaseLoincHandler implements IRecor
|
|||
if (isNotBlank(rpid)) {
|
||||
addConceptMapEntry(
|
||||
new ConceptMapping()
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID)
|
||||
.setConceptMapId(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_ID + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()))
|
||||
.setConceptMapUri(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_URI)
|
||||
.setConceptMapName(LoincPartRelatedCodeMappingHandler.LOINC_TERM_TO_RPID_PART_MAP_NAME)
|
||||
.setSourceCodeSystem(ITermLoaderSvc.LOINC_URI)
|
||||
|
|
|
@ -29,11 +29,12 @@ 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.trim;
|
||||
|
||||
public class LoincUniversalOrderSetHandler extends BaseLoincHandler implements IRecordHandler {
|
||||
|
||||
public static final String VS_ID = "loinc-universal-order-set";
|
||||
public final String VS_ID = "loinc-universal-order-set" + "-" + myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode());
|
||||
public static final String VS_URI = "http://loinc.org/vs/loinc-universal-order-set";
|
||||
public static final String VS_NAME = "LOINC Universal Order Set";
|
||||
|
||||
|
|
Loading…
Reference in New Issue