Class FakeTerminologyServiceValidationSupport

java.lang.Object
org.hl7.fhir.common.hapi.validation.support.BaseValidationSupport
org.projecthusky.fhir.emed.ch.epr.validator.FakeTerminologyServiceValidationSupport
All Implemented Interfaces:
ca.uhn.fhir.context.support.IValidationSupport

@ThreadSafe public class FakeTerminologyServiceValidationSupport extends org.hl7.fhir.common.hapi.validation.support.BaseValidationSupport implements ca.uhn.fhir.context.support.IValidationSupport
This class is an implementation of IValidationSupport that fakes validation of codes. It only do so for 'external' code systems like SNOMED CT and LOINC, which HAPI always tries to validate.

It's useful when value sets are checked at IG compilation time.

Author:
Quentin Ligier
  • Nested Class Summary

    Nested classes/interfaces inherited from interface ca.uhn.fhir.context.support.IValidationSupport

    ca.uhn.fhir.context.support.IValidationSupport.BaseConceptProperty, ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult, ca.uhn.fhir.context.support.IValidationSupport.CodingConceptProperty, ca.uhn.fhir.context.support.IValidationSupport.ConceptDesignation, ca.uhn.fhir.context.support.IValidationSupport.IssueSeverity, ca.uhn.fhir.context.support.IValidationSupport.LookupCodeResult, ca.uhn.fhir.context.support.IValidationSupport.StringConceptProperty, ca.uhn.fhir.context.support.IValidationSupport.TranslateCodeRequest, ca.uhn.fhir.context.support.IValidationSupport.ValueSetExpansionOutcome
  • Field Summary

    Fields inherited from class org.hl7.fhir.common.hapi.validation.support.BaseValidationSupport

    myCtx

    Fields inherited from interface ca.uhn.fhir.context.support.IValidationSupport

    URL_PREFIX_VALUE_SET
  • Constructor Summary

    Constructors
    Constructor
    Description
    FakeTerminologyServiceValidationSupport(ca.uhn.fhir.context.FhirContext theFhirContext)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    protected ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult
     
    Gets the list of supported code systems.
    boolean
    isCodeSystemSupported(ca.uhn.fhir.context.support.ValidationSupportContext theValidationSupportContext, String theSystem)
    Returns true if codes in the given code system can be expanded or validated.
    @Nullable ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult
    validateCode(ca.uhn.fhir.context.support.ValidationSupportContext theValidationSupportContext, ca.uhn.fhir.context.support.ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl)
    Validates that the given code exists and if possible returns a display name.
    @Nullable ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult
    validateCodeInValueSet(ca.uhn.fhir.context.support.ValidationSupportContext theValidationSupportContext, ca.uhn.fhir.context.support.ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @NonNull org.hl7.fhir.instance.model.api.IBaseResource theValueSet)
    Validates that the given code exists and if possible returns a display name.

    Methods inherited from class org.hl7.fhir.common.hapi.validation.support.BaseValidationSupport

    getFhirContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface ca.uhn.fhir.context.support.IValidationSupport

    expandValueSet, expandValueSet, fetchAllConformanceResources, fetchAllNonBaseStructureDefinitions, fetchAllSearchParameters, fetchAllStructureDefinitions, fetchBinary, fetchCodeSystem, fetchResource, fetchStructureDefinition, fetchValueSet, generateSnapshot, getFhirContext, invalidateCaches, isEnabledValidationForCodingsLogicalAnd, isRemoteTerminologyServiceConfigured, isValueSetSupported, lookupCode, lookupCode, translateConcept
  • Constructor Details

    • FakeTerminologyServiceValidationSupport

      public FakeTerminologyServiceValidationSupport(ca.uhn.fhir.context.FhirContext theFhirContext)
      Constructor
      Parameters:
      theFhirContext - The FHIR context.
  • Method Details

    • getSupportedCodeSystems

      public List<String> getSupportedCodeSystems()
      Gets the list of supported code systems.
      Returns:
      a live list.
    • validateCode

      public @Nullable ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult validateCode(ca.uhn.fhir.context.support.ValidationSupportContext theValidationSupportContext, ca.uhn.fhir.context.support.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.
      Specified by:
      validateCode in interface ca.uhn.fhir.context.support.IValidationSupport
      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 validation
      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 validated
      Returns:
      Returns a validation result object
    • validateCodeInValueSet

      public @Nullable ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult validateCodeInValueSet(ca.uhn.fhir.context.support.ValidationSupportContext theValidationSupportContext, ca.uhn.fhir.context.support.ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @NonNull org.hl7.fhir.instance.model.api.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.
      Specified by:
      validateCodeInValueSet in interface ca.uhn.fhir.context.support.IValidationSupport
      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 validated
      theValueSet - 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
    • isCodeSystemSupported

      public boolean isCodeSystemSupported(ca.uhn.fhir.context.support.ValidationSupportContext theValidationSupportContext, String theSystem)
      Returns true if codes in the given code system can be expanded or validated.
      Specified by:
      isCodeSystemSupported in interface ca.uhn.fhir.context.support.IValidationSupport
      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
    • createSuccessfulCodeValidationResult

      protected ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult createSuccessfulCodeValidationResult(String theCode, String theDisplay)
      Parameters:
      theCode - The code, e.g. "1234-5".
      theDisplay - The display name.
      Returns:
      a validation result object.