Making LOINC filenames configurable; ready for review.
This commit is contained in:
parent
f4789247b2
commit
1adfda44d9
|
@ -34,6 +34,7 @@ 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.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
@ -42,6 +43,7 @@ import java.util.Map.Entry;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.*;
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -68,26 +70,10 @@ public class TerminologyLoaderSvcImpl implements IHapiTerminologyLoaderSvc {
|
||||||
public static final String SCT_FILE_CONCEPT = "Terminology/sct2_Concept_Full_";
|
public static final String SCT_FILE_CONCEPT = "Terminology/sct2_Concept_Full_";
|
||||||
public static final String SCT_FILE_DESCRIPTION = "Terminology/sct2_Description_Full-en";
|
public static final String SCT_FILE_DESCRIPTION = "Terminology/sct2_Description_Full-en";
|
||||||
public static final String SCT_FILE_RELATIONSHIP = "Terminology/sct2_Relationship_Full";
|
public static final String SCT_FILE_RELATIONSHIP = "Terminology/sct2_Relationship_Full";
|
||||||
|
|
||||||
public static final String IMGTHLA_HLA_NOM_TXT = "hla_nom.txt";
|
public static final String IMGTHLA_HLA_NOM_TXT = "hla_nom.txt";
|
||||||
public static final String IMGTHLA_HLA_XML = "hla.xml";
|
public static final String IMGTHLA_HLA_XML = "hla.xml";
|
||||||
public static final String LOINC_ANSWERLIST_FILE = "AnswerList.csv";
|
|
||||||
public static final String LOINC_ANSWERLIST_LINK_FILE = "LoincAnswerListLink.csv";
|
|
||||||
public static final String LOINC_DOCUMENT_ONTOLOGY_FILE = "DocumentOntology.csv";
|
|
||||||
public static final String LOINC_UPLOAD_PROPERTIES_FILE = "loincupload.properties";
|
|
||||||
public static final String LOINC_FILE = "LoincTable/Loinc.csv";
|
|
||||||
public static final String LOINC_HIERARCHY_FILE = "MultiAxialHierarchy.csv";
|
|
||||||
public static final String LOINC_PART_FILE = "Part.csv";
|
|
||||||
public static final String LOINC_PART_LINK_FILE = "LoincPartLink.csv";
|
|
||||||
public static final String LOINC_PART_RELATED_CODE_MAPPING_FILE = "PartRelatedCodeMapping.csv";
|
|
||||||
public static final String LOINC_RSNA_PLAYBOOK_FILE = "LoincRsnaRadiologyPlaybook.csv";
|
|
||||||
public static final String LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE = "Top2000CommonLabResultsUs.csv";
|
|
||||||
public static final String LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE = "Top2000CommonLabResultsSi.csv";
|
|
||||||
public static final String LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE = "LoincUniversalLabOrdersValueSet.csv";
|
|
||||||
public static final String LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_CSV = "LoincIeeeMedicalDeviceCodeMappingTable.csv";
|
|
||||||
public static final String LOINC_IMAGING_DOCUMENT_CODES_FILE = "ImagingDocumentCodes.csv";
|
|
||||||
public static final String LOINC_GROUP_FILE = "Group.csv";
|
|
||||||
public static final String LOINC_GROUP_TERMS_FILE = "GroupLoincTerms.csv";
|
|
||||||
public static final String LOINC_PARENT_GROUP_FILE = "ParentGroup.csv";
|
|
||||||
public static final String CUSTOM_CONCEPTS_FILE = "concepts.csv";
|
public static final String CUSTOM_CONCEPTS_FILE = "concepts.csv";
|
||||||
public static final String CUSTOM_HIERARCHY_FILE = "hierarchy.csv";
|
public static final String CUSTOM_HIERARCHY_FILE = "hierarchy.csv";
|
||||||
public static final String CUSTOM_CODESYSTEM_JSON = "codesystem.json";
|
public static final String CUSTOM_CODESYSTEM_JSON = "codesystem.json";
|
||||||
|
@ -220,35 +206,61 @@ public class TerminologyLoaderSvcImpl implements IHapiTerminologyLoaderSvc {
|
||||||
@Override
|
@Override
|
||||||
public UploadStatistics loadLoinc(List<FileDescriptor> theFiles, RequestDetails theRequestDetails) {
|
public UploadStatistics loadLoinc(List<FileDescriptor> theFiles, RequestDetails theRequestDetails) {
|
||||||
try (LoadedFileDescriptors descriptors = new LoadedFileDescriptors(theFiles)) {
|
try (LoadedFileDescriptors descriptors = new LoadedFileDescriptors(theFiles)) {
|
||||||
|
List<String> loincUploadPropertiesFragment = Arrays.asList(
|
||||||
|
LOINC_UPLOAD_PROPERTIES_FILE.getCode()
|
||||||
|
);
|
||||||
|
descriptors.verifyMandatoryFilesExist(loincUploadPropertiesFragment);
|
||||||
|
|
||||||
|
Properties uploadProperties = getProperties(descriptors, LOINC_UPLOAD_PROPERTIES_FILE.getCode());
|
||||||
|
|
||||||
List<String> mandatoryFilenameFragments = Arrays.asList(
|
List<String> mandatoryFilenameFragments = Arrays.asList(
|
||||||
LOINC_FILE,
|
uploadProperties.getProperty(LOINC_ANSWERLIST_FILE.getCode(), LOINC_ANSWERLIST_FILE_DEFAULT.getCode()),
|
||||||
LOINC_HIERARCHY_FILE,
|
uploadProperties.getProperty(LOINC_ANSWERLIST_LINK_FILE.getCode(), LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode()),
|
||||||
LOINC_UPLOAD_PROPERTIES_FILE,
|
uploadProperties.getProperty(LOINC_DOCUMENT_ONTOLOGY_FILE.getCode(), LOINC_DOCUMENT_ONTOLOGY_FILE_DEFAULT.getCode()),
|
||||||
LOINC_ANSWERLIST_FILE,
|
uploadProperties.getProperty(LOINC_FILE.getCode(), LOINC_FILE_DEFAULT.getCode()),
|
||||||
LOINC_ANSWERLIST_LINK_FILE,
|
uploadProperties.getProperty(LOINC_HIERARCHY_FILE.getCode(), LOINC_HIERARCHY_FILE_DEFAULT.getCode()),
|
||||||
LOINC_PART_FILE,
|
uploadProperties.getProperty(LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE.getCode(), LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE_DEFAULT.getCode()),
|
||||||
LOINC_PART_LINK_FILE,
|
uploadProperties.getProperty(LOINC_IMAGING_DOCUMENT_CODES_FILE.getCode(), LOINC_IMAGING_DOCUMENT_CODES_FILE_DEFAULT.getCode()),
|
||||||
LOINC_PART_RELATED_CODE_MAPPING_FILE,
|
uploadProperties.getProperty(LOINC_PART_FILE.getCode(), LOINC_PART_FILE_DEFAULT.getCode()),
|
||||||
LOINC_DOCUMENT_ONTOLOGY_FILE,
|
uploadProperties.getProperty(LOINC_PART_LINK_FILE.getCode(), LOINC_PART_LINK_FILE_DEFAULT.getCode()),
|
||||||
LOINC_RSNA_PLAYBOOK_FILE,
|
uploadProperties.getProperty(LOINC_PART_RELATED_CODE_MAPPING_FILE.getCode(), LOINC_PART_RELATED_CODE_MAPPING_FILE_DEFAULT.getCode()),
|
||||||
LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE,
|
uploadProperties.getProperty(LOINC_RSNA_PLAYBOOK_FILE.getCode(), LOINC_RSNA_PLAYBOOK_FILE_DEFAULT.getCode()),
|
||||||
LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE,
|
uploadProperties.getProperty(LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE.getCode(), LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE_DEFAULT.getCode()),
|
||||||
LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE,
|
uploadProperties.getProperty(LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE.getCode(), LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE_DEFAULT.getCode()),
|
||||||
LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_CSV,
|
uploadProperties.getProperty(LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE.getCode(), LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE_DEFAULT.getCode())
|
||||||
LOINC_IMAGING_DOCUMENT_CODES_FILE
|
|
||||||
);
|
);
|
||||||
descriptors.verifyMandatoryFilesExist(mandatoryFilenameFragments);
|
descriptors.verifyMandatoryFilesExist(mandatoryFilenameFragments);
|
||||||
|
|
||||||
List<String> optionalFilenameFragments = Arrays.asList(
|
List<String> optionalFilenameFragments = Arrays.asList(
|
||||||
|
uploadProperties.getProperty(LOINC_GROUP_FILE.getCode(), LOINC_GROUP_FILE_DEFAULT.getCode()),
|
||||||
|
uploadProperties.getProperty(LOINC_GROUP_TERMS_FILE.getCode(), LOINC_GROUP_TERMS_FILE_DEFAULT.getCode()),
|
||||||
|
uploadProperties.getProperty(LOINC_PARENT_GROUP_FILE.getCode(), LOINC_PARENT_GROUP_FILE_DEFAULT.getCode())
|
||||||
);
|
);
|
||||||
descriptors.verifyOptionalFilesExist(optionalFilenameFragments);
|
descriptors.verifyOptionalFilesExist(optionalFilenameFragments);
|
||||||
|
|
||||||
ourLog.info("Beginning LOINC processing");
|
ourLog.info("Beginning LOINC processing");
|
||||||
|
|
||||||
return processLoincFiles(descriptors, theRequestDetails);
|
return processLoincFiles(descriptors, theRequestDetails, uploadProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Properties getProperties(LoadedFileDescriptors theDescriptors, String thePropertiesFile) {
|
||||||
|
Properties retVal = new Properties();
|
||||||
|
for (FileDescriptor next : theDescriptors.getUncompressedFileDescriptors()) {
|
||||||
|
if (next.getFilename().endsWith(thePropertiesFile)) {
|
||||||
|
try {
|
||||||
|
try (InputStream inputStream = next.getInputStream()) {
|
||||||
|
retVal.load(inputStream);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new InternalErrorException("Failed to read " + thePropertiesFile, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadStatistics loadSnomedCt(List<FileDescriptor> theFiles, RequestDetails theRequestDetails) {
|
public UploadStatistics loadSnomedCt(List<FileDescriptor> theFiles, RequestDetails theRequestDetails) {
|
||||||
try (LoadedFileDescriptors descriptors = new LoadedFileDescriptors(theFiles)) {
|
try (LoadedFileDescriptors descriptors = new LoadedFileDescriptors(theFiles)) {
|
||||||
|
@ -445,7 +457,7 @@ public class TerminologyLoaderSvcImpl implements IHapiTerminologyLoaderSvc {
|
||||||
// return new UploadStatistics(conceptCount, target);
|
// return new UploadStatistics(conceptCount, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
UploadStatistics processLoincFiles(LoadedFileDescriptors theDescriptors, RequestDetails theRequestDetails) {
|
UploadStatistics processLoincFiles(LoadedFileDescriptors theDescriptors, RequestDetails theRequestDetails, Properties theUploadProperties) {
|
||||||
final TermCodeSystemVersion codeSystemVersion = new TermCodeSystemVersion();
|
final TermCodeSystemVersion codeSystemVersion = new TermCodeSystemVersion();
|
||||||
final Map<String, TermConcept> code2concept = new HashMap<>();
|
final Map<String, TermConcept> code2concept = new HashMap<>();
|
||||||
final List<ValueSet> valueSets = new ArrayList<>();
|
final List<ValueSet> valueSets = new ArrayList<>();
|
||||||
|
@ -470,90 +482,77 @@ public class TerminologyLoaderSvcImpl implements IHapiTerminologyLoaderSvc {
|
||||||
|
|
||||||
IRecordHandler handler;
|
IRecordHandler handler;
|
||||||
|
|
||||||
Properties uploadProperties = new Properties();
|
// Part
|
||||||
for (FileDescriptor next : theDescriptors.getUncompressedFileDescriptors()) {
|
|
||||||
if (next.getFilename().endsWith(LOINC_UPLOAD_PROPERTIES_FILE)) {
|
|
||||||
try {
|
|
||||||
try (InputStream inputStream = next.getInputStream()) {
|
|
||||||
uploadProperties.load(inputStream);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new InternalErrorException("Failed to read " + LOINC_UPLOAD_PROPERTIES_FILE, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Part file
|
|
||||||
handler = new LoincPartHandler(codeSystemVersion, code2concept);
|
handler = new LoincPartHandler(codeSystemVersion, code2concept);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_PART_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_PART_FILE.getCode(), LOINC_PART_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
Map<PartTypeAndPartName, String> partTypeAndPartNameToPartNumber = ((LoincPartHandler) handler).getPartTypeAndPartNameToPartNumber();
|
Map<PartTypeAndPartName, String> partTypeAndPartNameToPartNumber = ((LoincPartHandler) handler).getPartTypeAndPartNameToPartNumber();
|
||||||
|
|
||||||
// Loinc Codes
|
// LOINC codes
|
||||||
handler = new LoincHandler(codeSystemVersion, code2concept, propertyNamesToTypes, partTypeAndPartNameToPartNumber);
|
handler = new LoincHandler(codeSystemVersion, code2concept, propertyNamesToTypes, partTypeAndPartNameToPartNumber);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_FILE.getCode(), LOINC_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Loinc Hierarchy
|
// LOINC hierarchy
|
||||||
handler = new LoincHierarchyHandler(codeSystemVersion, code2concept);
|
handler = new LoincHierarchyHandler(codeSystemVersion, code2concept);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_HIERARCHY_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_HIERARCHY_FILE.getCode(), LOINC_HIERARCHY_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Answer lists (ValueSets of potential answers/values for loinc "questions")
|
// Answer lists (ValueSets of potential answers/values for LOINC "questions")
|
||||||
handler = new LoincAnswerListHandler(codeSystemVersion, code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincAnswerListHandler(codeSystemVersion, code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_ANSWERLIST_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_ANSWERLIST_FILE.getCode(), LOINC_ANSWERLIST_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Answer list links (connects loinc observation codes to answerlist codes)
|
// Answer list links (connects LOINC observation codes to answer list codes)
|
||||||
handler = new LoincAnswerListLinkHandler(code2concept, valueSets);
|
handler = new LoincAnswerListLinkHandler(code2concept, valueSets);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_ANSWERLIST_LINK_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_ANSWERLIST_LINK_FILE.getCode(), LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// RSNA Playbook file
|
// RSNA playbook
|
||||||
// Note that this should come before the "Part Related Code Mapping"
|
// Note that this should come before the "Part Related Code Mapping"
|
||||||
// file because there are some duplicate mappings between these
|
// file because there are some duplicate mappings between these
|
||||||
// two files, and the RSNA Playbook file has more metadata
|
// two files, and the RSNA Playbook file has more metadata
|
||||||
handler = new LoincRsnaPlaybookHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincRsnaPlaybookHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_RSNA_PLAYBOOK_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_RSNA_PLAYBOOK_FILE.getCode(), LOINC_RSNA_PLAYBOOK_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Part link file
|
// Part link
|
||||||
handler = new LoincPartLinkHandler(codeSystemVersion, code2concept);
|
handler = new LoincPartLinkHandler(codeSystemVersion, code2concept);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_PART_LINK_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_PART_LINK_FILE.getCode(), LOINC_PART_LINK_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Part related code mapping
|
// Part related code mapping
|
||||||
handler = new LoincPartRelatedCodeMappingHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincPartRelatedCodeMappingHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_PART_RELATED_CODE_MAPPING_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_PART_RELATED_CODE_MAPPING_FILE.getCode(), LOINC_PART_RELATED_CODE_MAPPING_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Document Ontology File
|
// Document ontology
|
||||||
handler = new LoincDocumentOntologyHandler(code2concept, propertyNamesToTypes, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincDocumentOntologyHandler(code2concept, propertyNamesToTypes, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_DOCUMENT_ONTOLOGY_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_DOCUMENT_ONTOLOGY_FILE.getCode(), LOINC_DOCUMENT_ONTOLOGY_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Top 2000 Codes - US
|
// Top 2000 codes - US
|
||||||
handler = new LoincTop2000LabResultsUsHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincTop2000LabResultsUsHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE.getCode(), LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Top 2000 Codes - SI
|
// Top 2000 codes - SI
|
||||||
handler = new LoincTop2000LabResultsSiHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincTop2000LabResultsSiHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE.getCode(), LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Universal Lab Order ValueSet
|
// Universal lab order ValueSet
|
||||||
handler = new LoincUniversalOrderSetHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincUniversalOrderSetHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE.getCode(), LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// IEEE Medical Device Codes
|
// IEEE medical device codes
|
||||||
handler = new LoincIeeeMedicalDeviceCodeHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincIeeeMedicalDeviceCodeHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_CSV, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE.getCode(), LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Imaging Document Codes
|
// Imaging document codes
|
||||||
handler = new LoincImagingDocumentCodeHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincImagingDocumentCodeHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_IMAGING_DOCUMENT_CODES_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_IMAGING_DOCUMENT_CODES_FILE.getCode(), LOINC_IMAGING_DOCUMENT_CODES_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Group File
|
// Group
|
||||||
handler = new LoincGroupFileHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincGroupFileHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_GROUP_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_GROUP_FILE.getCode(), LOINC_GROUP_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Group Terms File
|
// Group terms
|
||||||
handler = new LoincGroupTermsFileHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincGroupTermsFileHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_GROUP_TERMS_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_GROUP_TERMS_FILE.getCode(), LOINC_GROUP_TERMS_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
// Parent Group File
|
// Parent group
|
||||||
handler = new LoincParentGroupFileHandler(code2concept, valueSets, conceptMaps, uploadProperties);
|
handler = new LoincParentGroupFileHandler(code2concept, valueSets, conceptMaps, theUploadProperties);
|
||||||
iterateOverZipFile(theDescriptors, LOINC_PARENT_GROUP_FILE, handler, ',', QuoteMode.NON_NUMERIC, false);
|
iterateOverZipFile(theDescriptors, theUploadProperties.getProperty(LOINC_PARENT_GROUP_FILE.getCode(), LOINC_PARENT_GROUP_FILE_DEFAULT.getCode()), handler, ',', QuoteMode.NON_NUMERIC, false);
|
||||||
|
|
||||||
IOUtils.closeQuietly(theDescriptors);
|
IOUtils.closeQuietly(theDescriptors);
|
||||||
|
|
||||||
|
@ -752,7 +751,7 @@ public class TerminologyLoaderSvcImpl implements IHapiTerminologyLoaderSvc {
|
||||||
private void verifyOptionalFilesExist(List<String> theExpectedFilenameFragments) {
|
private void verifyOptionalFilesExist(List<String> theExpectedFilenameFragments) {
|
||||||
List<String> notFound = notFound(theExpectedFilenameFragments);
|
List<String> notFound = notFound(theExpectedFilenameFragments);
|
||||||
if (!notFound.isEmpty()) {
|
if (!notFound.isEmpty()) {
|
||||||
ourLog.warn("Could not find the following optional file: " + notFound);
|
ourLog.warn("Could not find the following optional files: " + notFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,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.*;
|
||||||
import static org.apache.commons.lang3.StringUtils.*;
|
import static org.apache.commons.lang3.StringUtils.*;
|
||||||
|
|
||||||
public abstract class BaseLoincHandler implements IRecordHandler {
|
public abstract class BaseLoincHandler implements IRecordHandler {
|
||||||
|
@ -114,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"));
|
conceptMap.setVersion(myUploadProperties.getProperty(LOINC_CONCEPTMAP_VERSION.getCode()));
|
||||||
conceptMap.setPublisher(REGENSTRIEF_INSTITUTE_INC);
|
conceptMap.setPublisher(REGENSTRIEF_INSTITUTE_INC);
|
||||||
conceptMap.addContact()
|
conceptMap.addContact()
|
||||||
.setName(REGENSTRIEF_INSTITUTE_INC)
|
.setName(REGENSTRIEF_INSTITUTE_INC)
|
||||||
|
|
|
@ -31,7 +31,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.*;
|
import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.*;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.trim;
|
||||||
|
|
||||||
public class LoincAnswerListHandler extends BaseLoincHandler {
|
public class LoincAnswerListHandler extends BaseLoincHandler {
|
||||||
|
|
||||||
|
@ -72,7 +74,7 @@ public class LoincAnswerListHandler extends BaseLoincHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Answer list ValueSet
|
// Answer list ValueSet
|
||||||
ValueSet vs = getValueSet(answerListId, "http://loinc.org/vs/" + answerListId, answerListName, "loinc.answerlist.version");
|
ValueSet vs = getValueSet(answerListId, "http://loinc.org/vs/" + answerListId, answerListName, LOINC_ANSWERLIST_VERSION.getCode());
|
||||||
if (vs.getIdentifier().isEmpty()) {
|
if (vs.getIdentifier().isEmpty()) {
|
||||||
vs.addIdentifier()
|
vs.addIdentifier()
|
||||||
.setSystem("urn:ietf:rfc:3986")
|
.setSystem("urn:ietf:rfc:3986")
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
package ca.uhn.fhir.jpa.term.loinc;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2019 University Health Network
|
||||||
|
* %%
|
||||||
|
* 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.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This enum is used to facilitate configurable filenames when uploading LOINC.
|
||||||
|
*/
|
||||||
|
public enum LoincUploadPropertiesEnum {
|
||||||
|
/**
|
||||||
|
* Sorting agnostic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
LOINC_UPLOAD_PROPERTIES_FILE("loincupload.properties"),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MANDATORY
|
||||||
|
*/
|
||||||
|
// Answer lists (ValueSets of potential answers/values for LOINC "questions")
|
||||||
|
LOINC_ANSWERLIST_FILE("loinc.answerlist.file"),
|
||||||
|
LOINC_ANSWERLIST_FILE_DEFAULT("AnswerList.csv"),
|
||||||
|
// Answer list links (connects LOINC observation codes to answer list codes)
|
||||||
|
LOINC_ANSWERLIST_LINK_FILE("loinc.answerlist.link.file"),
|
||||||
|
LOINC_ANSWERLIST_LINK_FILE_DEFAULT("LoincAnswerListLink.csv"),
|
||||||
|
|
||||||
|
// Document ontology
|
||||||
|
LOINC_DOCUMENT_ONTOLOGY_FILE("loinc.document.ontology.file"),
|
||||||
|
LOINC_DOCUMENT_ONTOLOGY_FILE_DEFAULT("DocumentOntology.csv"),
|
||||||
|
|
||||||
|
// LOINC codes
|
||||||
|
LOINC_FILE("loinc.file"),
|
||||||
|
LOINC_FILE_DEFAULT("LoincTable/Loinc.csv"),
|
||||||
|
|
||||||
|
// LOINC hierarchy
|
||||||
|
LOINC_HIERARCHY_FILE("loinc.hierarchy.file"),
|
||||||
|
LOINC_HIERARCHY_FILE_DEFAULT("MultiAxialHierarchy.csv"),
|
||||||
|
|
||||||
|
// IEEE medical device codes
|
||||||
|
LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE("loinc.ieee.medical.device.code.mapping.table.file"),
|
||||||
|
LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE_DEFAULT("LoincIeeeMedicalDeviceCodeMappingTable.csv"),
|
||||||
|
|
||||||
|
// Imaging document codes
|
||||||
|
LOINC_IMAGING_DOCUMENT_CODES_FILE("loinc.imaging.document.codes.file"),
|
||||||
|
LOINC_IMAGING_DOCUMENT_CODES_FILE_DEFAULT("ImagingDocumentCodes.csv"),
|
||||||
|
|
||||||
|
// Part
|
||||||
|
LOINC_PART_FILE("loinc.part.file"),
|
||||||
|
LOINC_PART_FILE_DEFAULT("Part.csv"),
|
||||||
|
// Part link
|
||||||
|
LOINC_PART_LINK_FILE("loinc.part.link.file"),
|
||||||
|
LOINC_PART_LINK_FILE_DEFAULT("LoincPartLink.csv"),
|
||||||
|
// Part related code mapping
|
||||||
|
LOINC_PART_RELATED_CODE_MAPPING_FILE("loinc.part.related.code.mapping.file"),
|
||||||
|
LOINC_PART_RELATED_CODE_MAPPING_FILE_DEFAULT("PartRelatedCodeMapping.csv"),
|
||||||
|
|
||||||
|
// RSNA playbook
|
||||||
|
LOINC_RSNA_PLAYBOOK_FILE("loinc.rsna.playbook.file"),
|
||||||
|
LOINC_RSNA_PLAYBOOK_FILE_DEFAULT("LoincRsnaRadiologyPlaybook.csv"),
|
||||||
|
|
||||||
|
// Top 2000 codes - SI
|
||||||
|
LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE("loinc.top2000.common.lab.results.si.file"),
|
||||||
|
LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE_DEFAULT("Top2000CommonLabResultsSi.csv"),
|
||||||
|
// Top 2000 codes - US
|
||||||
|
LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE("loinc.top2000.common.lab.results.us.file"),
|
||||||
|
LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE_DEFAULT("Top2000CommonLabResultsUs.csv"),
|
||||||
|
|
||||||
|
// Universal lab order ValueSet
|
||||||
|
LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE("loinc.universal.lab.order.valueset.file"),
|
||||||
|
LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE_DEFAULT("LoincUniversalLabOrdersValueSet.csv"),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OPTIONAL
|
||||||
|
*/
|
||||||
|
// This is the version identifier for the answer list file
|
||||||
|
LOINC_ANSWERLIST_VERSION("loinc.answerlist.version"),
|
||||||
|
|
||||||
|
// This is the version identifier for uploaded ConceptMap resources
|
||||||
|
LOINC_CONCEPTMAP_VERSION("loinc.conceptmap.version"),
|
||||||
|
|
||||||
|
// Group
|
||||||
|
LOINC_GROUP_FILE("loinc.group.file"),
|
||||||
|
LOINC_GROUP_FILE_DEFAULT("Group.csv"),
|
||||||
|
// Group terms
|
||||||
|
LOINC_GROUP_TERMS_FILE("loinc.group.terms.file"),
|
||||||
|
LOINC_GROUP_TERMS_FILE_DEFAULT("GroupLoincTerms.csv"),
|
||||||
|
|
||||||
|
// Parent group
|
||||||
|
LOINC_PARENT_GROUP_FILE("loinc.parent.group.file"),
|
||||||
|
LOINC_PARENT_GROUP_FILE_DEFAULT("ParentGroup.csv");
|
||||||
|
|
||||||
|
private static Map<String, LoincUploadPropertiesEnum> ourValues;
|
||||||
|
private String myCode;
|
||||||
|
|
||||||
|
LoincUploadPropertiesEnum(String theCode) {
|
||||||
|
myCode = theCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return myCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LoincUploadPropertiesEnum fromCode(String theCode) {
|
||||||
|
if (ourValues == null) {
|
||||||
|
HashMap<String, LoincUploadPropertiesEnum> values = new HashMap<String, LoincUploadPropertiesEnum>();
|
||||||
|
for (LoincUploadPropertiesEnum next : values()) {
|
||||||
|
values.put(next.getCode(), next);
|
||||||
|
}
|
||||||
|
ourValues = Collections.unmodifiableMap(values);
|
||||||
|
}
|
||||||
|
return ourValues.get(theCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from Enum ordinal to Enum type.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* <code>LoincUploadPropertiesEnum loincUploadPropertiesEnum = LoincUploadPropertiesEnum.values[ordinal];</code>
|
||||||
|
*/
|
||||||
|
public static final LoincUploadPropertiesEnum values[] = values();
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider.dstu3;
|
package ca.uhn.fhir.jpa.provider.dstu3;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.term.IHapiTerminologyLoaderSvc;
|
import ca.uhn.fhir.jpa.term.IHapiTerminologyLoaderSvc;
|
||||||
import ca.uhn.fhir.jpa.term.TerminologyLoaderSvcImpl;
|
|
||||||
import ca.uhn.fhir.jpa.term.ZipCollectionBuilder;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.util.TestUtil;
|
||||||
|
@ -20,6 +18,7 @@ import java.util.List;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.*;
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
@ -37,24 +36,24 @@ public class TerminologyUploaderProviderDstu3Test extends BaseResourceProviderDs
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zos = new ZipOutputStream(bos);
|
ZipOutputStream zos = new ZipOutputStream(bos);
|
||||||
|
|
||||||
addFile(zos, "loincupload.properties");
|
addFile(zos, LOINC_UPLOAD_PROPERTIES_FILE.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_PART_FILE);
|
addFile(zos, LOINC_PART_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_FILE);
|
addFile(zos, LOINC_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_HIERARCHY_FILE);
|
addFile(zos, LOINC_HIERARCHY_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_ANSWERLIST_FILE);
|
addFile(zos, LOINC_ANSWERLIST_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_ANSWERLIST_LINK_FILE);
|
addFile(zos, LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_GROUP_FILE);
|
addFile(zos, LOINC_GROUP_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_GROUP_TERMS_FILE);
|
addFile(zos, LOINC_GROUP_TERMS_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_PARENT_GROUP_FILE);
|
addFile(zos, LOINC_PARENT_GROUP_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_PART_LINK_FILE);
|
addFile(zos, LOINC_PART_LINK_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_PART_RELATED_CODE_MAPPING_FILE);
|
addFile(zos, LOINC_PART_RELATED_CODE_MAPPING_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_DOCUMENT_ONTOLOGY_FILE);
|
addFile(zos, LOINC_DOCUMENT_ONTOLOGY_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_RSNA_PLAYBOOK_FILE);
|
addFile(zos, LOINC_RSNA_PLAYBOOK_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE);
|
addFile(zos, LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_CSV);
|
addFile(zos, LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_IMAGING_DOCUMENT_CODES_FILE);
|
addFile(zos, LOINC_IMAGING_DOCUMENT_CODES_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE);
|
addFile(zos, LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE_DEFAULT.getCode());
|
||||||
addFile(zos, TerminologyLoaderSvcImpl.LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE);
|
addFile(zos, LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE_DEFAULT.getCode());
|
||||||
|
|
||||||
zos.close();
|
zos.close();
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.*;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
@ -341,8 +342,8 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadLoincMissingMandatoryFiles() throws IOException {
|
public void testLoadLoincMissingMandatoryFiles() throws IOException {
|
||||||
myFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_UPLOAD_PROPERTIES_FILE);
|
myFiles.addFileZip("/loinc/", LOINC_UPLOAD_PROPERTIES_FILE.getCode());
|
||||||
myFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_GROUP_FILE);
|
myFiles.addFileZip("/loinc/", LOINC_GROUP_FILE_DEFAULT.getCode());
|
||||||
|
|
||||||
// Actually do the load
|
// Actually do the load
|
||||||
try {
|
try {
|
||||||
|
@ -356,24 +357,24 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLoincMandatoryFilesToZip(ZipCollectionBuilder theFiles) throws IOException {
|
public static void addLoincMandatoryFilesToZip(ZipCollectionBuilder theFiles) throws IOException {
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_UPLOAD_PROPERTIES_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_UPLOAD_PROPERTIES_FILE.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_GROUP_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_GROUP_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_GROUP_TERMS_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_GROUP_TERMS_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_PARENT_GROUP_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_PARENT_GROUP_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_FILE, TerminologyLoaderSvcImpl.LOINC_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_FILE_DEFAULT.getCode(), LOINC_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_HIERARCHY_FILE, TerminologyLoaderSvcImpl.LOINC_HIERARCHY_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_HIERARCHY_FILE_DEFAULT.getCode(), LOINC_HIERARCHY_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_ANSWERLIST_FILE, TerminologyLoaderSvcImpl.LOINC_ANSWERLIST_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_ANSWERLIST_FILE_DEFAULT.getCode(), LOINC_ANSWERLIST_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_ANSWERLIST_LINK_FILE, TerminologyLoaderSvcImpl.LOINC_ANSWERLIST_LINK_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode(), LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_PART_FILE, TerminologyLoaderSvcImpl.LOINC_PART_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_PART_FILE_DEFAULT.getCode(), LOINC_PART_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_PART_LINK_FILE, TerminologyLoaderSvcImpl.LOINC_PART_LINK_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_PART_LINK_FILE_DEFAULT.getCode(), LOINC_PART_LINK_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_PART_RELATED_CODE_MAPPING_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_PART_RELATED_CODE_MAPPING_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_DOCUMENT_ONTOLOGY_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_DOCUMENT_ONTOLOGY_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_RSNA_PLAYBOOK_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_RSNA_PLAYBOOK_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_UNIVERSAL_LAB_ORDER_VALUESET_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_CSV);
|
theFiles.addFileZip("/loinc/", LOINC_IEEE_MEDICAL_DEVICE_CODE_MAPPING_TABLE_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_IMAGING_DOCUMENT_CODES_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_IMAGING_DOCUMENT_CODES_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_TOP2000_COMMON_LAB_RESULTS_SI_FILE_DEFAULT.getCode());
|
||||||
theFiles.addFileZip("/loinc/", TerminologyLoaderSvcImpl.LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE);
|
theFiles.addFileZip("/loinc/", LOINC_TOP2000_COMMON_LAB_RESULTS_US_FILE_DEFAULT.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,33 +1,95 @@
|
||||||
|
#################
|
||||||
|
### MANDATORY ###
|
||||||
|
#################
|
||||||
|
|
||||||
|
# Answer lists (ValueSets of potential answers/values for LOINC "questions")
|
||||||
|
## Default value if key not provided: AnswerList.csv
|
||||||
|
## File must be present
|
||||||
loinc.answerlist.file=AnswerList.csv
|
loinc.answerlist.file=AnswerList.csv
|
||||||
|
# Answer list links (connects LOINC observation codes to answer list codes)
|
||||||
|
## Default value if key not provided: LoincAnswerListLink.csv
|
||||||
|
## File must be present
|
||||||
loinc.answerlist.link.file=LoincAnswerListLink.csv
|
loinc.answerlist.link.file=LoincAnswerListLink.csv
|
||||||
# This is the version identifier for the AnswerList file
|
|
||||||
|
# Document ontology
|
||||||
|
## Default value if key not provided: DocumentOntology.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.document.ontology.file=DocumentOntology.csv
|
||||||
|
|
||||||
|
# LOINC codes
|
||||||
|
## Default value if key not provided: LoincTable/Loinc.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.file=LoincTable/Loinc.csv
|
||||||
|
|
||||||
|
# LOINC hierarchy
|
||||||
|
## Default value if key not provided: MultiAxialHierarchy.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.hierarchy.file=MultiAxialHierarchy.csv
|
||||||
|
|
||||||
|
# IEEE medical device codes
|
||||||
|
## Default value if key not provided: LoincIeeeMedicalDeviceCodeMappingTable.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.ieee.medical.device.code.mapping.table.file=LoincIeeeMedicalDeviceCodeMappingTable.csv
|
||||||
|
|
||||||
|
# Imaging document codes
|
||||||
|
## Default value if key not provided: ImagingDocumentCodes.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.imaging.document.codes.file=ImagingDocumentCodes.csv
|
||||||
|
|
||||||
|
# Part
|
||||||
|
## Default value if key not provided: Part.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.part.file=Part.csv
|
||||||
|
# Part link
|
||||||
|
## Default value if key not provided: LoincPartLink.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.part.link.file=LoincPartLink.csv
|
||||||
|
# Part related code mapping
|
||||||
|
## Default value if key not provided: PartRelatedCodeMapping.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.part.related.code.mapping.file=PartRelatedCodeMapping.csv
|
||||||
|
|
||||||
|
# RSNA playbook
|
||||||
|
## Default value if key not provided: LoincRsnaRadiologyPlaybook.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.rsna.playbook.file=LoincRsnaRadiologyPlaybook.csv
|
||||||
|
|
||||||
|
# Top 2000 codes - SI
|
||||||
|
## Default value if key not provided: Top2000CommonLabResultsSi.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.top2000.common.lab.results.si.file=Top2000CommonLabResultsSi.csv
|
||||||
|
# Top 2000 codes - US
|
||||||
|
## Default value if key not provided: Top2000CommonLabResultsUs.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.top2000.common.lab.results.us.file=Top2000CommonLabResultsUs.csv
|
||||||
|
|
||||||
|
# Universal lab order ValueSet
|
||||||
|
## Default value if key not provided: LoincUniversalLabOrdersValueSet.csv
|
||||||
|
## File must be present
|
||||||
|
loinc.universal.lab.order.valueset.file=LoincUniversalLabOrdersValueSet.csv
|
||||||
|
|
||||||
|
################
|
||||||
|
### OPTIONAL ###
|
||||||
|
################
|
||||||
|
|
||||||
|
# This is the version identifier for the answer list file
|
||||||
|
## Key may be omitted
|
||||||
loinc.answerlist.version=Beta.1
|
loinc.answerlist.version=Beta.1
|
||||||
|
|
||||||
# This is the version identifier for uploaded ConceptMap resources
|
# This is the version identifier for uploaded ConceptMap resources
|
||||||
|
## Key may be omitted
|
||||||
loinc.conceptmap.version=Beta.1
|
loinc.conceptmap.version=Beta.1
|
||||||
|
|
||||||
loinc.document.ontology.file=DocumentOntology.csv
|
# Group
|
||||||
|
## Default value if key not provided: Group.csv
|
||||||
loinc.file=LoincTable/Loinc.csv
|
## File may be omitted
|
||||||
|
|
||||||
loinc.group.file=Group.csv
|
loinc.group.file=Group.csv
|
||||||
|
# Group terms
|
||||||
|
## Default value if key not provided: GroupLoincTerms.csv
|
||||||
|
## File may be omitted
|
||||||
loinc.group.terms.file=GroupLoincTerms.csv
|
loinc.group.terms.file=GroupLoincTerms.csv
|
||||||
|
|
||||||
loinc.hierarchy.file=MultiAxialHierarchy.csv
|
# Parent group
|
||||||
|
## Default value if key not provided: ParentGroup.csv
|
||||||
loinc.ieee.medical.device.code.mapping.table.file=LoincIeeeMedicalDeviceCodeMappingTable.csv
|
## File may be omitted
|
||||||
|
|
||||||
loinc.imaging.document.codes.file=ImagingDocumentCodes.csv
|
|
||||||
|
|
||||||
loinc.parent.group.file=ParentGroup.csv
|
loinc.parent.group.file=ParentGroup.csv
|
||||||
|
|
||||||
loinc.part.file=Part.csv
|
|
||||||
loinc.part.link.file=LoincPartLink.csv
|
|
||||||
loinc.part.related.code.mapping.file=PartRelatedCodeMapping.csv
|
|
||||||
|
|
||||||
loinc.rsna.playbook.file=LoincRsnaRadiologyPlaybook.csv
|
|
||||||
|
|
||||||
loinc.top2000.common.lab.results.si.file=Top2000CommonLabResultsSi.csv
|
|
||||||
loinc.top2000.common.lab.results.us.file=Top2000CommonLabResultsUs.csv
|
|
||||||
|
|
||||||
loinc.universal.lab.order.valueset.file=LoincUniversalLabOrdersValueSet.csv
|
|
||||||
|
|
Loading…
Reference in New Issue