
Interface IValidationSupport
-
- All Known Implementing Classes:
DefaultProfileValidationSupport
public interface IValidationSupport
This interface is a version-independent representation of the various functions that can be provided by validation and terminology services.This interface is invoked directly by internal parts of the HAPI FHIR API, including the Validator and the FHIRPath evaluator. It is used to supply artifacts required for validation (e.g. StructureDefinition resources, ValueSet resources, etc.) and also to provide terminology functions such as code validation, ValueSet expansion, etc.
Implementations are not required to implement all of the functions in this interface; in fact it is expected that most won't. Any methods which are not implemented may simply return
null
and calling code is expected to be able to handle this. Generally, a series of implementations of this interface will be joined together using the ValidationSupportChain class.See Validation Support Modules for information on how to assemble and configure implementations of this interface. See also the
org.hl7.fhir.common.hapi.validation.support
package summary in thehapi-fhir-validation
module for many implementations of this interface.- Since:
- 5.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IValidationSupport.BaseConceptProperty
static class
IValidationSupport.CodeValidationResult
static class
IValidationSupport.CodingConceptProperty
static class
IValidationSupport.ConceptDesignation
static class
IValidationSupport.IssueSeverity
static class
IValidationSupport.LookupCodeResult
static class
IValidationSupport.StringConceptProperty
static class
IValidationSupport.ValueSetExpansionOutcome
-
Field Summary
Fields Modifier and Type Field Description static String
URL_PREFIX_VALUE_SET
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default IValidationSupport.ValueSetExpansionOutcome
expandValueSet(ValidationSupportContext theValidationSupportContext, ValueSetExpansionOptions theExpansionOptions, IBaseResource theValueSetToExpand)
Expands the given portion of a ValueSetdefault List<IBaseResource>
fetchAllConformanceResources()
Load and return all conformance resources associated with this validation support module.default <T extends IBaseResource>
List<T>fetchAllStructureDefinitions()
Load and return all possible structure definitionsdefault IBaseResource
fetchCodeSystem(String theSystem)
Fetch a code system by IDdefault <T extends IBaseResource>
TfetchResource(Class<T> theClass, String theUri)
Loads a resource needed by the validation (a StructureDefinition, or a ValueSet)default IBaseResource
fetchStructureDefinition(String theUrl)
default IBaseResource
fetchValueSet(String theValueSetUrl)
Fetch the given ValueSet by URLdefault IBaseResource
generateSnapshot(ValidationSupportContext theValidationSupportContext, IBaseResource theInput, String theUrl, String theWebUrl, String theProfileName)
Generate a snapshot from the given differential profile.FhirContext
getFhirContext()
Returns the FHIR Context associated with this moduledefault void
invalidateCaches()
This method clears any temporary caches within the validation support.default boolean
isCodeSystemSupported(ValidationSupportContext theValidationSupportContext, String theSystem)
Returnstrue
if codes in the given code system can be expanded or validateddefault boolean
isValueSetSupported(ValidationSupportContext theValidationSupportContext, String theValueSetUrl)
Returnstrue
if the given valueset can be validated by the given validation support moduledefault IValidationSupport.LookupCodeResult
lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode)
Look up a code using the system and code valuedefault IValidationSupport.CodeValidationResult
validateCode(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl)
Validates that the given code exists and if possible returns a display name.default IValidationSupport.CodeValidationResult
validateCodeInValueSet(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, IBaseResource theValueSet)
Validates that the given code exists and if possible returns a display name.
-
-
-
Field Detail
-
URL_PREFIX_VALUE_SET
static final String URL_PREFIX_VALUE_SET
- See Also:
- Constant Field Values
-
-
Method Detail
-
expandValueSet
default IValidationSupport.ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, @Nullable ValueSetExpansionOptions theExpansionOptions, @Nonnull IBaseResource theValueSetToExpand)
Expands the given portion of a ValueSet- Parameters:
theValidationSupportContext
- The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter.theExpansionOptions
- If provided (may benull
), contains options controlling the expansiontheValueSetToExpand
- The valueset that should be expanded- Returns:
- The expansion, or null
-
fetchAllConformanceResources
default List<IBaseResource> fetchAllConformanceResources()
Load and return all conformance resources associated with this validation support module. This method may return null if it doesn't make sense for a given module.
-
fetchAllStructureDefinitions
default <T extends IBaseResource> List<T> fetchAllStructureDefinitions()
Load and return all possible structure definitions
-
fetchCodeSystem
default IBaseResource fetchCodeSystem(String theSystem)
Fetch a code system by ID- Parameters:
theSystem
- The code system- Returns:
- The valueset (must not be null, but can be an empty ValueSet)
-
fetchResource
default <T extends IBaseResource> T fetchResource(@Nullable Class<T> theClass, String theUri)
Loads a resource needed by the validation (a StructureDefinition, or a ValueSet)Note: Since 5.3.0, theClass can be null
- Parameters:
theClass
- The type of the resource to load, ornull
to return any resource with the given canonical URItheUri
- The resource URI- Returns:
- Returns the resource, or
null
if no resource with the given URI can be found
-
fetchStructureDefinition
default IBaseResource fetchStructureDefinition(String theUrl)
-
isCodeSystemSupported
default boolean isCodeSystemSupported(ValidationSupportContext theValidationSupportContext, String theSystem)
Returnstrue
if codes in the given code system can be expanded or validated- Parameters:
theValidationSupportContext
- The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter.theSystem
- The URI for the code system, e.g."http://loinc.org"
- Returns:
- Returns
true
if codes in the given code system can be validated
-
fetchValueSet
default IBaseResource fetchValueSet(String theValueSetUrl)
Fetch the given ValueSet by URL
-
validateCode
default IValidationSupport.CodeValidationResult validateCode(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl)
Validates that the given code exists and if possible returns a display name. This method is called to check codes which are found in "example" binding fields (e.g.Observation.code
in the default profile.- Parameters:
theValidationSupportContext
- The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter.theOptions
- Provides options controlling the validationtheCodeSystem
- The code system, e.g. "http://loinc.org
"theCode
- The code, e.g. "1234-5
"theDisplay
- The display name, if it should also be validated- Returns:
- Returns a validation result object
-
validateCodeInValueSet
default IValidationSupport.CodeValidationResult validateCodeInValueSet(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @Nonnull IBaseResource theValueSet)
Validates that the given code exists and if possible returns a display name. This method is called to check codes which are found in "example" binding fields (e.g.Observation.code
in the default profile.- Parameters:
theValidationSupportContext
- The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter.theCodeSystem
- The code system, e.g. "http://loinc.org
"theCode
- The code, e.g. "1234-5
"theDisplay
- The display name, if it should also be validatedtheValueSet
- The ValueSet to validate against. Must not be null, and must be a ValueSet resource.- Returns:
- Returns a validation result object, or
null
if this validation support module can not handle this kind of request
-
lookupCode
default IValidationSupport.LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode)
Look up a code using the system and code value- Parameters:
theValidationSupportContext
- The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter.theSystem
- The CodeSystem URLtheCode
- The code
-
isValueSetSupported
default boolean isValueSetSupported(ValidationSupportContext theValidationSupportContext, String theValueSetUrl)
Returnstrue
if the given valueset can be validated by the given validation support module- Parameters:
theValidationSupportContext
- The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter.theValueSetUrl
- The ValueSet canonical URL
-
generateSnapshot
default IBaseResource generateSnapshot(ValidationSupportContext theValidationSupportContext, IBaseResource theInput, String theUrl, String theWebUrl, String theProfileName)
Generate a snapshot from the given differential profile.- Parameters:
theValidationSupportContext
- The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter.- Returns:
- Returns null if this module does not know how to handle this request
-
getFhirContext
FhirContext getFhirContext()
Returns the FHIR Context associated with this module
-
invalidateCaches
default void invalidateCaches()
This method clears any temporary caches within the validation support. It is mainly intended for unit tests, but could be used in non-test scenarios as well.
-
-