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