001package org.hl7.fhir.dstu2.terminologies; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu2 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 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 023 024import org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity; 025import org.hl7.fhir.dstu2.model.ValueSet; 026import org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent; 027import org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent; 028import org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent; 029import org.hl7.fhir.dstu2.terminologies.ValueSetExpander.ValueSetExpansionOutcome; 030 031 032/** 033 * The value set system has a collection of value sets 034 * that define code systems, and construct value sets from 035 * them 036 * 037 * Large external terminologies - LOINC, Snomed, etc - are too big, and 038 * trying to represent their definition as a native value set is too 039 * large. (e.g. LOINC + properties ~ 500MB). So we don't try. Instead. 040 * we assume that there's some external server that provides these 041 * services, using this interface 042 * 043 * The FHIR build tool uses http://fhir.healthintersections.com.au for 044 * these services 045 * 046 * @author Grahame 047 * 048 */ 049public interface ITerminologyServices { 050 /** 051 * return true if the service handles code or value set resolution on the system 052 */ 053 public boolean supportsSystem(String system); 054 055 /** 056 * given a system|code, return a definition for it. Nil means not valid 057 */ 058 public ConceptDefinitionComponent getCodeDefinition(String system, String code); 059 060 public class ValidationResult { 061 private IssueSeverity severity; 062 private String message; 063 public ValidationResult(IssueSeverity severity, String message) { 064 super(); 065 this.severity = severity; 066 this.message = message; 067 } 068 public IssueSeverity getSeverity() { 069 return severity; 070 } 071 public String getMessage() { 072 return message; 073 } 074 075 076 } 077 078 /** 079 * for this system|code and display, validate the triple against the rules of 080 * the underlying code system 081 */ 082 public ValidationResult validateCode(String system, String code, String display); 083 084 /** 085 * Expand the value set fragment (system | codes | filters). Note that this 086 * might fail if the expansion is very large. If the expansion fails, then the 087 * checkVS will be called instead 088 */ 089 public ValueSetExpansionComponent expandVS(ConceptSetComponent inc) throws Exception; 090// public ValueSet expandVS(ValueSet vs) throws Exception; 091 public ValueSetExpansionOutcome expand(ValueSet vs); 092 093 /** 094 * Test the value set fragment (system | codes | filters). 095 */ 096 public boolean checkVS(ConceptSetComponent vsi, String system, String code); 097 098 public boolean verifiesSystem(String system); 099 100 101 102}