
001package ca.uhn.fhir.jpa.term.api; 002 003/* 004 * #%L 005 * HAPI FHIR Storage api 006 * %% 007 * Copyright (C) 2014 - 2022 Smile CDR, Inc. 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import ca.uhn.fhir.jpa.term.UploadStatistics; 024import ca.uhn.fhir.rest.api.server.RequestDetails; 025 026import java.io.ByteArrayInputStream; 027import java.io.InputStream; 028import java.util.List; 029 030/** 031 * This service handles bulk loading concepts into the terminology service concept tables 032 * using any of several predefined input formats 033 */ 034public interface ITermLoaderSvc { 035 036 String IMGTHLA_URI = "http://www.ebi.ac.uk/ipd/imgt/hla"; 037 String LOINC_URI = "http://loinc.org"; 038 String SCT_URI = "http://snomed.info/sct"; 039 String ICD10CM_URI = "http://hl7.org/fhir/sid/icd-10-cm"; 040 String IEEE_11073_10101_URI = "urn:iso:std:iso:11073:10101"; 041 042 UploadStatistics loadImgthla(List<FileDescriptor> theFiles, RequestDetails theRequestDetails); 043 044 UploadStatistics loadLoinc(List<FileDescriptor> theFiles, RequestDetails theRequestDetails); 045 046 UploadStatistics loadSnomedCt(List<FileDescriptor> theFiles, RequestDetails theRequestDetails); 047 048 UploadStatistics loadIcd10cm(List<FileDescriptor> theFiles, RequestDetails theRequestDetails); 049 050 UploadStatistics loadCustom(String theSystem, List<FileDescriptor> theFiles, RequestDetails theRequestDetails); 051 052 UploadStatistics loadDeltaAdd(String theSystem, List<FileDescriptor> theFiles, RequestDetails theRequestDetails); 053 054 UploadStatistics loadDeltaRemove(String theSystem, List<FileDescriptor> theFiles, RequestDetails theRequestDetails); 055 056 interface FileDescriptor { 057 058 String getFilename(); 059 060 InputStream getInputStream(); 061 062 } 063 064 class ByteArrayFileDescriptor implements FileDescriptor { 065 066 private final String myNextUrl; 067 private final byte[] myNextData; 068 069 public ByteArrayFileDescriptor(String theNextUrl, byte[] theNextData) { 070 myNextUrl = theNextUrl; 071 myNextData = theNextData; 072 } 073 074 @Override 075 public String getFilename() { 076 return myNextUrl; 077 } 078 079 @Override 080 public InputStream getInputStream() { 081 return new ByteArrayInputStream(myNextData); 082 } 083 } 084 085}