
Package org.hl7.fhir.r5.context
Class BaseWorkerContext
java.lang.Object
org.hl7.fhir.utilities.i18n.I18nBase
org.hl7.fhir.r5.context.BaseWorkerContext
- All Implemented Interfaces:
IOIDServices,IWorkerContext,IWorkerContextManager
- Direct Known Subclasses:
SimpleWorkerContext
public abstract class BaseWorkerContext
extends org.hl7.fhir.utilities.i18n.I18nBase
implements IWorkerContext, IWorkerContextManager, IOIDServices
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassclassstatic interfaceclassstatic classNested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IOIDServices
IOIDServices.OIDDefinition, IOIDServices.OIDDefinitionComparer, IOIDServices.OIDSummaryNested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IWorkerContext
IWorkerContext.SystemSupportInformationNested classes/interfaces inherited from interface org.hl7.fhir.r5.context.IWorkerContextManager
IWorkerContextManager.ICanonicalResourceLocator, IWorkerContextManager.IPackageLoadingTracker -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String, BaseWorkerContext.IByteProvider> protected booleanprotected org.hl7.fhir.utilities.TimeTrackerprotected ContextUtilitiesprotected AtomicReference<Parameters> protected ILoggingServiceprotected Stringprotected booleanprotected Map<String, Set<IOIDServices.OIDDefinition>> protected List<org.hl7.fhir.r5.context.BaseWorkerContext.OIDSource> protected final TerminologyClientManagerprotected CanonicalResourceManager<StructureMap> protected TerminologyCacheprotected org.hl7.fhir.utilities.ToolingClientLoggerprotected Stringprotected Map<String, Map<String, ValidationResult>> protected StringFields inherited from class org.hl7.fhir.utilities.i18n.I18nBase
KEY_DELIMITER, uncontainedKeys -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedBaseWorkerContext(Locale locale) protectedBaseWorkerContext(CanonicalResourceManager<CodeSystem> codeSystems, CanonicalResourceManager<ValueSet> valueSets, CanonicalResourceManager<ConceptMap> maps, CanonicalResourceManager<StructureDefinition> profiles, CanonicalResourceManager<ImplementationGuide> guides) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDependentCodeSystem(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext tc, Parameters pin, String sys, Resource src) protected voidaddServerValidationParameters(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext terminologyClientContext, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options) protected voidaddServerValidationParameters(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext terminologyClientContext, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options, Set<String> systems) voidcache a resource for later retrieval using fetchResource.voidcacheResourceFromPackage(Resource r, PackageInformation packageInfo) cache a resource for later retrieval using fetchResource.voidcacheVS(com.google.gson.JsonObject json, Map<String, ValidationResult> t) voidclearTSCache(String url) org.hl7.fhir.utilities.TimeTrackerclock()protected ParametersconstructParameters(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext tcd, ValueSet vs, boolean hierarchical) protected ParametersconstructParameters(org.hl7.fhir.utilities.validation.ValidationOptions options, CodeableConcept codeableConcept) protected ParametersconstructParameters(org.hl7.fhir.utilities.validation.ValidationOptions options, Coding coding) protected ParametersconstructParameters(org.hl7.fhir.utilities.validation.ValidationOptions options, CodingValidationRequest codingValidationRequest) protected ValueSetValidatorconstructValueSetCheckerSimple(org.hl7.fhir.utilities.validation.ValidationOptions options, ValueSet vs) protected ValueSetValidatorconstructValueSetCheckerSimple(org.hl7.fhir.utilities.validation.ValidationOptions options, ValueSet vs, ValidationContextCarrier ctxt) protected ValueSetExpanderconstructValueSetExpanderSimple(org.hl7.fhir.utilities.validation.ValidationOptions options) protected voidcopy(BaseWorkerContext other) intvoiddropResource(String fhirType, String id) voidexpandVS(ExpansionOptions options, String url) ValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care.expandVS(ExpansionOptions options, ValueSet vs) ValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care.expandVS(ExpansionOptions options, ValueSet vs, Parameters pIn, boolean noLimits) expandVS(Resource src, ElementDefinition.ElementDefinitionBindingComponent binding, boolean cacheOk, boolean heirarchical) ValueSet Expansion - see $expand, but resolves the binding firstValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care.expandVS(ValueSet vs, boolean cacheOk, boolean hierarchical, boolean incompleteOk, Parameters pIn) ValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care.expandVS(ValueSetProcessBase.TerminologyOperationDetails opCtxt, ValueSet.ConceptSetComponent inc, boolean hierarchical, boolean noInactive) fetchCodeSystem(String system) Find the code system definition for the nominated system uri.fetchCodeSystem(String system, String version) fetchCodeSystem(String system, String version, Resource sourceOfReference) Find the code system definition for the nominated system uri.<T extends Resource>
TfetchResource(Class<T> class_, String uri) Fetch (load if necessary) an identified resource.<T extends Resource>
TfetchResource(Class<T> class_, String uri, String version) <T extends Resource>
TfetchResource(Class<T> class_, String uri, String version, Resource sourceForReference) Fetch (load if necessary) an identified resource.fetchResourceById(String type, String uri) Fetch (load if necessary) an identified resource.fetchResourceById(String type, String uri, org.hl7.fhir.utilities.FhirPublication fhirVersion) <T extends Resource>
TfetchResourceByVersionWithException(Class<T> class_, String uri, String version) fetchResourcesByType(Class<T> class_) Fetch all the resources of a particular type. if class == (null | Resource | DomainResource | CanonicalResource) return everything Note: this forces every resource to be loaded; this might take a very long time.fetchResourcesByType(Class<T> class_, org.hl7.fhir.utilities.FhirPublication fhirVersion) fetchResourceVersions(Class<T> class_, String uri) Fetch all the versions of a resource.fetchResourceVersionsByTypeAndUrl(Class<T> class_, String url) <T extends Resource>
TfetchResourceWithException(Class<T> class_, String uri) Fetch (load if necessary) an identified resource.<T extends Resource>
TfetchResourceWithException(Class<T> class_, String uri, String version, Resource sourceForReference) Fetch (load if necessary) an identified resource.<T extends Resource>
TfetchResourceWithException(String cls, String uri) <T extends Resource>
TfetchResourceWithExceptionByVersion(Class<T> class_, String uri, String version, Resource sourceForReference) <T extends Resource>
TfetchResourceWithExceptionByVersion(String cls, String uri, String version, CanonicalResource source) fetchSupplementedCodeSystem(String system) Like fetchCodeSystem, except that the context will find any CodeSysetm supplements and merge them into the definition that's returnedfetchSupplementedCodeSystem(String system, String version, Resource sourceOfReference) Like fetchCodeSystem, except that the context will find any CodeSysetm supplements and merge them into the definition that's returnedfetchTypeDefinition(String typeName) This is a short cut for fetchResource(StructureDefinition.class, ...)fetchTypeDefinition(String typeName, org.hl7.fhir.utilities.FhirPublication fhirVersion) fetchTypeDefinitions(String typeName) This finds all the structure definitions that have the given typeName<T extends Resource>
TfindTxResource(Class<T> class_, String canonical) this first does a fetch resource, and if nothing is found, looks in the terminology eco-system for a matching definition for the resource<T extends Resource>
TfindTxResource(Class<T> class_, String canonical, String version) <T extends Resource>
TfindTxResource(Class<T> class_, String canonical, String version, Resource sourceOfReference) this first does a fetch resource, and if nothing is found, looks in the terminology eco-system for a matching definition for the resourcevoidfinishLoading(boolean genSnapshots) voidbyte[]getBinaryForKey(String binaryKey) Returns the binary for the keyReturns a set of keys that can be used to get binaries from this context.intintReturns a copy of the expansion parameters used by this context.getLinkForUrl(String corePath, String url) if this returns null, the context is frozen (usually for threading concerns on the server) If you're considering not providing this service, the context can't load stuff on the fly so you need to take care to load everything in advance.getName()getPackageForUrl(String uri) Note: take care with this method - there are multiple packages with the same canonical (different sub-packages, different versions)getProfiledElementBuilder(PEBuilder.PEElementPropertiesPolicy elementProps, boolean fixedProps) getResourceNames(org.hl7.fhir.utilities.FhirPublication fhirVersion) getResourceNamesAsSet(org.hl7.fhir.utilities.FhirPublication fhirVersion) getSearchParameter(String code) getStructure(String code) getTxSupportInfo(String system, String version) return the System Support Information for the server that serves the specified code systemorg.fhir.ucum.UcumServicebooleanhasBinaryKey(String binaryKey) Returns true if this worker context contains a binary for this key.<T extends Resource>
booleanhasResource(Class<T> class_, String uri) find whether a resource is available. the principal use of this method is to find whether a resource is known without actually loading it.<T extends Resource>
booleanhasResource(Class<T> class_, String uri, String version, Resource sourceForReference) find whether a resource is available. the principal use of this method is to find whether a resource is known without actually loading it.<T extends Resource>
booleanhasResource(Class<T> class_, String uri, Resource sourceOfReference) <T extends Resource>
booleanhasResource(String cls, String uri) <T extends Resource>
booleanhasResourceVersion(Class<T> class_, String uri, String version) <T extends Resource>
booleanhasResourceVersion(String cls, String uri, String version) <T extends Resource>
booleanhasResourceVersion(String cls, String uri, String version, org.hl7.fhir.utilities.FhirPublication fhirVersion) voidinitTxCache(String cachePath) voidinitTxCache(TerminologyCache cache) static booleanbooleanbooleanbooleanisDataType(String type) return whether type is data type.booleanbooleanbooleanisPrimitiveType(String type) return whether type is primitive type.booleanlistMaps()processSubsumesResult(Parameters pOut, String server) processValidationResult(Parameters pOut, String vs, String server) voidregisterResourceFromPackage(CanonicalResourceManager.CanonicalResourceProxy r, PackageInformation packageInfo) voidreportStatus(com.google.gson.JsonObject json) protected <T extends CanonicalResource>
voidseeMetadataResource(T r, Map<String, T> map, List<T> list, boolean addId) static voidsetAllowedToIterateTerminologyResources(boolean allowedToIterateTerminologyResources) voidsetCachingAllowed(boolean cachingAllowed) voidsetCanRunWithoutTerminology(boolean canRunWithoutTerminology) setClientRetryCount(int value) voidsetExpandCodesLimit(int expandCodesLimit) voidsetExpansionParameters(Parameters expansionParameters) Get the expansion parameters passed through the terminology server when txServer calls are made Note that the Validation Options override these when they are specified on validateCodevoidsetForPublication(boolean value) voidSets the locale for this worker context.voidvoidsetLogger(ILoggingService logger) voidvoidsetNoTerminologyServer(boolean noTerminologyServer) setPackageTracker(IWorkerContextManager.IPackageLoadingTracker packageTracker) voidsetSuppressedMappings(List<String> suppressedMappings) voidsetTlogging(boolean tlogging) voidsetUcumService(org.fhir.ucum.UcumService ucumService) protected voidsetUserAgent(String userAgent) subsumes(org.hl7.fhir.utilities.validation.ValidationOptions optionsArg, Coding parent, Coding child) ask the terminology system whether parent subsumes child.protected Stringintprotected voidvoidunload()urlsForOid(String oid, String resourceType) urlsForOid(String oid, String resourceType, boolean retired) validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String system, String version, String code, String display) Validation of a code - consult the terminology infrstructure and/or service to see whether it is known.validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String system, String version, String code, String display, ValueSet vs) Validation of a code - consult the terminology infrstructure and/or service to see whether it is known.validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String path, Coding code, ValueSet vs) validateCode(org.hl7.fhir.utilities.validation.ValidationOptions optionsArg, String path, Coding code, ValueSet vs, ValidationContextCarrier ctxt) validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String code, ValueSet vs) Validation of a code - consult the terminology infrstructure and/or service to see whether it is known.validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, CodeableConcept code, ValueSet vs) Validation of a code - consult the terminology infrstructure and/or service to see whether it is known.validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, Coding code, ValueSet vs) Validation of a code - consult the terminology infrstructure and/or service to see whether it is known.validateCode(org.hl7.fhir.utilities.validation.ValidationOptions optionsArg, Coding code, ValueSet vs, ValidationContextCarrier ctxt) See comments in ValidationContextCarrier.voidvalidateCodeBatch(org.hl7.fhir.utilities.validation.ValidationOptions options, List<? extends CodingValidationRequest> codes, ValueSet vs, boolean passVS) Batch validate code - reduce latency and do a bunch of codes in a single server call.protected ValidationResultvalidateOnServer(TerminologyClientContext tc, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options) protected ValidationResultvalidateOnServer2(TerminologyClientContext tc, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options, Set<String> systems) validateTxResource(org.hl7.fhir.utilities.validation.ValidationOptions options, Resource resource) Validate the actual terminology resource itself on the appropriate terminology server (used for ECL validation)Methods inherited from class org.hl7.fhir.utilities.i18n.I18nBase
formatMessage, formatMessagePlural, getLocale, getMessages, getMessagesSourceFileName, getPluralKey, getPluralKeys, getPluralRules, getPluralSuffixes, getRootKeyFromPlural, isWarnAboutMissingMessages, logUncontainedMessage, messageKeyExistsForLocale, setValidationMessageLanguage, setWarnAboutMissingMessages, typeOfStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hl7.fhir.r5.context.IWorkerContext
fetchResourceRaw, formatMessage, formatMessagePlural, getLocale, getPackage, getResourceNames, getSpecUrl, getVersion, hasPackage, hasPackage, newValidatorMethods inherited from interface org.hl7.fhir.r5.context.IWorkerContextManager
cachePackage, loadFromPackage, loadFromPackageAndDependencies, loadPackage, loadPackage, packageManager, setPackageManager
-
Field Details
-
version
-
transforms
-
binaries
-
oidCacheManual
-
oidSources
-
validationCache
-
name
-
txLog
-
canRunWithoutTerminology
-
noTerminologyServer
-
logger
-
terminologyClientManager
-
expansionParameters
-
txCache
-
clock
-
userAgent
-
cutils
-
packageTracker
-
-
Constructor Details
-
BaseWorkerContext
protected BaseWorkerContext() throws FileNotFoundException, IOException, org.hl7.fhir.exceptions.FHIRException- Throws:
FileNotFoundExceptionIOExceptionorg.hl7.fhir.exceptions.FHIRException
-
BaseWorkerContext
protected BaseWorkerContext(Locale locale) throws FileNotFoundException, IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
FileNotFoundExceptionIOExceptionorg.hl7.fhir.exceptions.FHIRException
-
BaseWorkerContext
protected BaseWorkerContext(CanonicalResourceManager<CodeSystem> codeSystems, CanonicalResourceManager<ValueSet> valueSets, CanonicalResourceManager<ConceptMap> maps, CanonicalResourceManager<StructureDefinition> profiles, CanonicalResourceManager<ImplementationGuide> guides) throws FileNotFoundException, IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
FileNotFoundExceptionIOExceptionorg.hl7.fhir.exceptions.FHIRException
-
-
Method Details
-
copy
-
cacheResource
Description copied from interface:IWorkerContextManagercache a resource for later retrieval using fetchResource. Note that various context implementations will have their own ways of loading rseources, and not all need implement cacheResource. If the resource is loaded out of a package, call cacheResourceFromPackage instead- Specified by:
cacheResourcein interfaceIWorkerContextManager- Parameters:
r-- Throws:
org.hl7.fhir.exceptions.FHIRException
-
registerResourceFromPackage
public void registerResourceFromPackage(CanonicalResourceManager.CanonicalResourceProxy r, PackageInformation packageInfo) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
cacheResourceFromPackage
public void cacheResourceFromPackage(Resource r, PackageInformation packageInfo) throws org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextManagercache a resource for later retrieval using fetchResource. The package information is used to help manage the cache internally, and to help with reference resolution. Packages should be define using cachePackage (but don't have to be) Note that various context implementations will have their own ways of loading rseources, and not all need implement cacheResource- Specified by:
cacheResourceFromPackagein interfaceIWorkerContextManager- Parameters:
r-- Throws:
org.hl7.fhir.exceptions.FHIRException
-
getNSUrlMap
- Specified by:
getNSUrlMapin interfaceIWorkerContext
-
fixOldSD
-
seeMetadataResource
protected <T extends CanonicalResource> void seeMetadataResource(T r, Map<String, T> map, List<T> list, boolean addId) throws org.hl7.fhir.exceptions.FHIRException- Throws:
org.hl7.fhir.exceptions.FHIRException
-
fetchCodeSystem
Description copied from interface:IWorkerContextFind the code system definition for the nominated system uri. return null if there isn't one (then the tool might try supportsSystem) This is a short cut for fetchResource(CodeSystem.class, system)- Specified by:
fetchCodeSystemin interfaceIWorkerContext- Parameters:
system-- Returns:
-
fetchCodeSystem
-
fetchCodeSystem
Description copied from interface:IWorkerContextFind the code system definition for the nominated system uri. return null if there isn't one (then the tool might try supportsSystem) This is a short cut for fetchResource(CodeSystem.class, system, version, sourceOfReference)- Specified by:
fetchCodeSystemin interfaceIWorkerContext
-
fetchSupplementedCodeSystem
Description copied from interface:IWorkerContextLike fetchCodeSystem, except that the context will find any CodeSysetm supplements and merge them into the definition that's returned- Specified by:
fetchSupplementedCodeSystemin interfaceIWorkerContext
-
fetchSupplementedCodeSystem
public CodeSystem fetchSupplementedCodeSystem(String system, String version, Resource sourceOfReference) Description copied from interface:IWorkerContextLike fetchCodeSystem, except that the context will find any CodeSysetm supplements and merge them into the definition that's returned- Specified by:
fetchSupplementedCodeSystemin interfaceIWorkerContext
-
getTxSupportInfo
public IWorkerContext.SystemSupportInformation getTxSupportInfo(String system, String version) throws org.hl7.fhir.exceptions.TerminologyServiceException Description copied from interface:IWorkerContextreturn the System Support Information for the server that serves the specified code system- Specified by:
getTxSupportInfoin interfaceIWorkerContext- Parameters:
system-version-- Returns:
- Throws:
org.hl7.fhir.exceptions.TerminologyServiceException
-
txLog
-
getExpandCodesLimit
-
setExpandCodesLimit
-
expandVS
public ValueSetExpansionOutcome expandVS(Resource src, ElementDefinition.ElementDefinitionBindingComponent binding, boolean cacheOk, boolean heirarchical) throws org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextValueSet Expansion - see $expand, but resolves the binding first- Specified by:
expandVSin interfaceIWorkerContext- Parameters:
src-- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
expandVS
public ValueSetExpansionOutcome expandVS(ValueSetProcessBase.TerminologyOperationDetails opCtxt, ValueSet.ConceptSetComponent inc, boolean hierarchical, boolean noInactive) throws org.hl7.fhir.exceptions.TerminologyServiceException - Throws:
org.hl7.fhir.exceptions.TerminologyServiceException
-
expandVS
Description copied from interface:IWorkerContextValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care.- Specified by:
expandVSin interfaceIWorkerContext- Parameters:
vs- - the valueset to expandcacheOk- - whether to look in the cache for an expansionheirarchical- - whether to accept a heirarchical expansion- Returns:
- the expansion, or information about how the expansion failed
-
expandVS
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean heirarchical, int count) Description copied from interface:IWorkerContextValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care.- Specified by:
expandVSin interfaceIWorkerContext- Parameters:
vs- - the valueset to expandcacheOk- - whether to look in the cache for an expansionheirarchical- - whether to accept a heirarchical expansioncount- - maximum concepts to return- Returns:
- the expansion, or information about how the expansion failed
-
expandVS
Description copied from interface:IWorkerContextValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care. This isn't quite the same as findTxResource+expand because if the uri can't be resolved, it'll be passed to the terminology service directly, and some terminology servers will expand value sets that they won't return.- Specified by:
expandVSin interfaceIWorkerContext- Parameters:
options- - controls the expansion process (overrides expansion parameters)url- - valueset uri.- Returns:
- the expansion, or information about how the expansion failed
-
expandVS
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean hierarchical, boolean incompleteOk, Parameters pIn) -
expandVS
Description copied from interface:IWorkerContextValueSet Expansion - see $expand Note that caching makes a real performance difference, so turn it off with care.- Specified by:
expandVSin interfaceIWorkerContext- Parameters:
options- - controls the expansion process (overrides expansion parameters)vs- - the valueset to expand- Returns:
- the expansion, or information about how the expansion failed
-
expandVS
public ValueSetExpansionOutcome expandVS(ExpansionOptions options, ValueSet vs, Parameters pIn, boolean noLimits) -
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String system, String version, String code, String display) Description copied from interface:IWorkerContextValidation of a code - consult the terminology infrstructure and/or service to see whether it is known. If known, return a description of it corresponds to 2 terminology service calls: $validate-code and $lookup- Specified by:
validateCodein interfaceIWorkerContext- Parameters:
options- - validation options (required)system- - equals Coding.system (required)code- - equals Coding.code (required)display- - equals Coding.display (optional)- Returns:
-
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String system, String version, String code, String display, ValueSet vs) Description copied from interface:IWorkerContextValidation of a code - consult the terminology infrstructure and/or service to see whether it is known. If known, return a description of it note: always return a result, with either an error or a code description- Specified by:
validateCodein interfaceIWorkerContext- Parameters:
options- - validation options (required)system- - equals Coding.system (required)code- - equals Coding.code (required)display- - equals Coding.display (optional)vs- the applicable valueset (optional)- Returns:
-
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String code, ValueSet vs) Description copied from interface:IWorkerContextValidation of a code - consult the terminology infrstructure and/or service to see whether it is known. If known, return a description of it note: always return a result, with either an error or a code description in this case, the system will be inferred from the value set. It's an error to call this one without the value set- Specified by:
validateCodein interfaceIWorkerContext- Parameters:
options- - validation options (required)code- The code to validate (required)vs- the applicable valueset (required)- Returns:
-
validateCodeBatch
public void validateCodeBatch(org.hl7.fhir.utilities.validation.ValidationOptions options, List<? extends CodingValidationRequest> codes, ValueSet vs, boolean passVS) Description copied from interface:IWorkerContextBatch validate code - reduce latency and do a bunch of codes in a single server call. Each is the same as a validateCode- Specified by:
validateCodeBatchin interfaceIWorkerContext- Parameters:
options-codes-vs-
-
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, Coding code, ValueSet vs) Description copied from interface:IWorkerContextValidation of a code - consult the terminology infrstructure and/or service to see whether it is known. If known, return a description of it note: always return a result, with either an error or a code description- Specified by:
validateCodein interfaceIWorkerContext- Parameters:
options- - validation options (required)code- - Coding to validatevs- the applicable valueset (optional)- Returns:
-
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, String path, Coding code, ValueSet vs) -
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions optionsArg, Coding code, ValueSet vs, ValidationContextCarrier ctxt) Description copied from interface:IWorkerContextSee comments in ValidationContextCarrier. This is called when there might be additional value sets etc available in the context, but we don't want to pre-process them.- Specified by:
validateCodein interfaceIWorkerContext- Parameters:
optionsArg-code-vs-ctxt-- Returns:
-
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions optionsArg, String path, Coding code, ValueSet vs, ValidationContextCarrier ctxt) -
subsumes
public Boolean subsumes(org.hl7.fhir.utilities.validation.ValidationOptions optionsArg, Coding parent, Coding child) ask the terminology system whether parent subsumes child.- Specified by:
subsumesin interfaceIWorkerContext- Returns:
- true if it does, false if it doesn't, and null if it's not know whether it does
-
processSubsumesResult
-
constructValueSetExpanderSimple
protected ValueSetExpander constructValueSetExpanderSimple(org.hl7.fhir.utilities.validation.ValidationOptions options) -
constructValueSetCheckerSimple
protected ValueSetValidator constructValueSetCheckerSimple(org.hl7.fhir.utilities.validation.ValidationOptions options, ValueSet vs, ValidationContextCarrier ctxt) -
constructValueSetCheckerSimple
protected ValueSetValidator constructValueSetCheckerSimple(org.hl7.fhir.utilities.validation.ValidationOptions options, ValueSet vs) -
constructParameters
protected Parameters constructParameters(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext tcd, ValueSet vs, boolean hierarchical) -
constructParameters
protected Parameters constructParameters(org.hl7.fhir.utilities.validation.ValidationOptions options, Coding coding) -
constructParameters
protected Parameters constructParameters(org.hl7.fhir.utilities.validation.ValidationOptions options, CodeableConcept codeableConcept) -
constructParameters
protected Parameters constructParameters(org.hl7.fhir.utilities.validation.ValidationOptions options, CodingValidationRequest codingValidationRequest) -
validateCode
public ValidationResult validateCode(org.hl7.fhir.utilities.validation.ValidationOptions options, CodeableConcept code, ValueSet vs) Description copied from interface:IWorkerContextValidation of a code - consult the terminology infrstructure and/or service to see whether it is known. If known, return a description of it note: always return a result, with either an error or a code description Note that this doesn't validate binding strength (e.g. is just text allowed?)- Specified by:
validateCodein interfaceIWorkerContext- Parameters:
options- - validation options (required)code- - CodeableConcept to validatevs- the applicable valueset (optional)- Returns:
-
validateOnServer
protected ValidationResult validateOnServer(TerminologyClientContext tc, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
validateOnServer2
protected ValidationResult validateOnServer2(TerminologyClientContext tc, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options, Set<String> systems) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
addServerValidationParameters
protected void addServerValidationParameters(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext terminologyClientContext, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options) -
addServerValidationParameters
protected void addServerValidationParameters(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext terminologyClientContext, ValueSet vs, Parameters pin, org.hl7.fhir.utilities.validation.ValidationOptions options, Set<String> systems) -
addDependentCodeSystem
public boolean addDependentCodeSystem(ValueSetProcessBase.TerminologyOperationDetails opCtxt, TerminologyClientContext tc, Parameters pin, String sys, Resource src) -
processValidationResult
-
initTxCache
public void initTxCache(String cachePath) throws FileNotFoundException, org.hl7.fhir.exceptions.FHIRException, IOException - Throws:
FileNotFoundExceptionorg.hl7.fhir.exceptions.FHIRExceptionIOException
-
initTxCache
-
clearTSCache
- Throws:
Exception
-
isCanRunWithoutTerminology
-
setCanRunWithoutTerminology
-
setLogger
-
getExpansionParameters
Returns a copy of the expansion parameters used by this context. Note that because the return value is a copy, any changes done to it will not be reflected in the context and any changes to the context will likewise not be reflected in the return value after it is returned. If you need to change the expansion parameters, usesetExpansionParameters(Parameters).- Specified by:
getExpansionParametersin interfaceIWorkerContext- Returns:
- a copy of the expansion parameters
-
setExpansionParameters
Description copied from interface:IWorkerContextManagerGet the expansion parameters passed through the terminology server when txServer calls are made Note that the Validation Options override these when they are specified on validateCode- Specified by:
setExpansionParametersin interfaceIWorkerContextManager
-
isNoTerminologyServer
- Specified by:
isNoTerminologyServerin interfaceIWorkerContext- Returns:
- true if there is a terminology server supporting the context
-
setNoTerminologyServer
-
getName
-
setName
-
getResourceNames
-
getResourceNamesAsSet
-
getResourceNamesAsSet
- Specified by:
getResourceNamesAsSetin interfaceIWorkerContext- Returns:
- a set of the resource names defined for this version
-
fetchResourceWithException
public <T extends Resource> T fetchResourceWithException(Class<T> class_, String uri) throws org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextFetch (load if necessary) an identified resource. The most common use of this is to access the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. The URI can have one of 3 formats: - a full URL e.g. http://acme.org/fhir/ValueSet/[id] - a relative URL e.g. ValueSet/[id] - a logical id e.g. [id] It's an error if the second form doesn't agree with class_. It's an error if class_ is null for the last form class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourceWithExceptionin interfaceIWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffix- Returns:
- the resource if known (or an exception will be thrown)
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
fetchResourceWithException
public <T extends Resource> T fetchResourceWithException(String cls, String uri) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
fetchResourceByVersionWithException
public <T extends Resource> T fetchResourceByVersionWithException(Class<T> class_, String uri, String version) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
fetchResourceWithException
public <T extends Resource> T fetchResourceWithException(Class<T> class_, String uri, String version, Resource sourceForReference) throws org.hl7.fhir.exceptions.FHIRException Description copied from interface:IWorkerContextFetch (load if necessary) an identified resource. The most common use of this is to access the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. The URI can have one of 3 formats: - a full URL e.g. http://acme.org/fhir/ValueSet/[id] - a relative URL e.g. ValueSet/[id] - a logical id e.g. [id] It's an error if the second form doesn't agree with class_. It's an error if class_ is null for the last form class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourceWithExceptionin interfaceIWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffixversion- the version. Don't provide both a version and a |version suffixsourceForReference- where the reference was found (if the reference is in a resource)- Returns:
- if the resource is known. Will throw an exception if the resource is not known
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
fetchResourceWithExceptionByVersion
public <T extends Resource> T fetchResourceWithExceptionByVersion(Class<T> class_, String uri, String version, Resource sourceForReference) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
getPackageForUrl
Description copied from interface:IWorkerContextNote: take care with this method - there are multiple packages with the same canonical (different sub-packages, different versions)- Specified by:
getPackageForUrlin interfaceIWorkerContext- Parameters:
uri- - canonical URL- Returns:
- - package information for the most recent package with the given canonical
-
fetchResourceWithExceptionByVersion
public <T extends Resource> T fetchResourceWithExceptionByVersion(String cls, String uri, String version, CanonicalResource source) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
fetchResourcesByType
public <T extends Resource> List<T> fetchResourcesByType(Class<T> class_, org.hl7.fhir.utilities.FhirPublication fhirVersion) -
fetchResourcesByType
Description copied from interface:IWorkerContextFetch all the resources of a particular type. if class == (null | Resource | DomainResource | CanonicalResource) return everything Note: this forces every resource to be loaded; this might take a very long time. Some implementations require some flag to be set elsewhere to allow this method to be called for some types to prevent the method from accidentally being called (ValueSets can take minutes to load, since there are so many in scope)- Specified by:
fetchResourcesByTypein interfaceIWorkerContext- Parameters:
class_- the type of resource to load- Returns:
- all the resources
-
fetchResourceVersionsByTypeAndUrl
-
fetchResourceById
public Resource fetchResourceById(String type, String uri, org.hl7.fhir.utilities.FhirPublication fhirVersion) -
fetchResourceById
Description copied from interface:IWorkerContextFetch (load if necessary) an identified resource. The most common use of this is to access the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. This is the non-generic version, but the functionality is otherwise the same The URI can have one of 3 formats: - a full URL e.g. http://acme.org/fhir/ValueSet/[id] - a relative URL e.g. ValueSet/[id] - a logical id e.g. [id] It's an error if the second form doesn't agree with class_. It's an error if class_ is null for the last form class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourceByIdin interfaceIWorkerContext- Parameters:
type- the type of resourceuri- the URL of the resource, optionally with a |version suffix- Returns:
- the resource if known (or null)
-
fetchResource
public <T extends Resource> T fetchResource(Class<T> class_, String uri, String version, Resource sourceForReference) Description copied from interface:IWorkerContextFetch (load if necessary) an identified resource. The most common use of this is to access the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. The URI can have one of 3 formats: - a full URL e.g. http://acme.org/fhir/ValueSet/[id] - a relative URL e.g. ValueSet/[id] - a logical id e.g. [id] It's an error if the second form doesn't agree with class_. It's an error if class_ is null for the last form class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourcein interfaceIWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffixversion- the version. Don't provide both a version and a |version suffixsourceForReference- where the reference was found (if the reference is in a resource)- Returns:
- if the resource is known
-
fetchResource
Description copied from interface:IWorkerContextFetch (load if necessary) an identified resource. The most common use of this is to access the standard conformance resources that are part of the standard - structure definitions, value sets, concept maps, etc. The URI can have one of 3 formats: - a full URL e.g. http://acme.org/fhir/ValueSet/[id] - a relative URL e.g. ValueSet/[id] - a logical id e.g. [id] It's an error if the second form doesn't agree with class_. It's an error if class_ is null for the last form class can be Resource, DomainResource or CanonicalResource, which means resource of all kinds- Specified by:
fetchResourcein interfaceIWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffix- Returns:
- the resource if known (or null)
-
fetchResource
-
hasResource
Description copied from interface:IWorkerContextfind whether a resource is available. the principal use of this method is to find whether a resource is known without actually loading it.- Specified by:
hasResourcein interfaceIWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffix- Returns:
- if the resource is known
-
hasResource
-
hasResourceVersion
-
hasResourceVersion
-
hasResource
public <T extends Resource> boolean hasResource(Class<T> class_, String uri, String version, Resource sourceForReference) Description copied from interface:IWorkerContextfind whether a resource is available. the principal use of this method is to find whether a resource is known without actually loading it.- Specified by:
hasResourcein interfaceIWorkerContext- Parameters:
class_- the type of resourceuri- the URL of the resource, optionally with a |version suffixversion- the version. Don't provide both a version and a |version suffixsourceForReference- where the reference was found (if the reference is in a resource)- Returns:
- if the resource is known
-
hasResourceVersion
public <T extends Resource> boolean hasResourceVersion(String cls, String uri, String version, org.hl7.fhir.utilities.FhirPublication fhirVersion) -
hasResource
public <T extends Resource> boolean hasResource(Class<T> class_, String uri, Resource sourceOfReference) -
reportStatus
-
dropResource
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
dropResource
-
listSupportedSystems
-
totalCount
-
listMaps
-
listStructures
-
listValueSets
-
listCodeSystems
-
getStructure
-
cacheVS
-
getSearchParameter
-
getLogger
- Specified by:
getLoggerin interfaceIWorkerContext- Returns:
- the logging service configured for the context
-
fetchTypeDefinition
public StructureDefinition fetchTypeDefinition(String typeName, org.hl7.fhir.utilities.FhirPublication fhirVersion) -
fetchTypeDefinition
Description copied from interface:IWorkerContextThis is a short cut for fetchResource(StructureDefinition.class, ...) but it accepts a typename - that is, it resolves based on StructureDefinition.type or StructureDefinition.url. This only resolves to http://hl7.org/fhir/StructureDefinition/{typename}- Specified by:
fetchTypeDefinitionin interfaceIWorkerContext- Parameters:
typeName-- Returns:
- type (or exception if there is multiple candidates
-
fetchTypeDefinitions
Description copied from interface:IWorkerContextThis finds all the structure definitions that have the given typeName- Specified by:
fetchTypeDefinitionsin interfaceIWorkerContext- Parameters:
typeName-- Returns:
-
isPrimitiveType
Description copied from interface:IWorkerContextreturn whether type is primitive type. This is called a lot, and needs a high performance implementation- Specified by:
isPrimitiveTypein interfaceIWorkerContext- Parameters:
type-- Returns:
-
isDataType
Description copied from interface:IWorkerContextreturn whether type is data type. This is called a lot, and needs a high performance implementation- Specified by:
isDataTypein interfaceIWorkerContext- Parameters:
type-- Returns:
-
isTlogging
-
setTlogging
-
getUcumService
- Specified by:
getUcumServicein interfaceIWorkerContext- Returns:
- Get the UCUM service that provides access to units of measure reasoning services (if available)
-
setUcumService
-
getLinkForUrl
-
allImplementationGuides
-
getBinaryKeysAsSet
Description copied from interface:IWorkerContextReturns a set of keys that can be used to get binaries from this context. In general, the binaries come from the loaded packages (mostly the pubpack)- Specified by:
getBinaryKeysAsSetin interfaceIWorkerContext- Returns:
- a set of binaries or null
-
hasBinaryKey
Description copied from interface:IWorkerContextReturns true if this worker context contains a binary for this key.- Specified by:
hasBinaryKeyin interfaceIWorkerContext- Parameters:
binaryKey-- Returns:
- true if binary is available for this key
-
getBinaryForKey
Description copied from interface:IWorkerContextReturns the binary for the key- Specified by:
getBinaryForKeyin interfaceIWorkerContext- Parameters:
binaryKey-- Returns:
-
finishLoading
-
tail
-
getClientRetryCount
- Specified by:
getClientRetryCountin interfaceIWorkerContext
-
setClientRetryCount
- Specified by:
setClientRetryCountin interfaceIWorkerContext
-
getTxClientManager
-
getCacheId
-
clock
- Specified by:
clockin interfaceIWorkerContext- Returns:
- time tracker for when the context is being loaded (0 = start of loading)
-
countAllCaches
-
getCodeSystemsUsed
- Specified by:
getCodeSystemsUsedin interfaceIWorkerContext- Returns:
- a list of all the code systems used by the functions above
-
getLocator
-
setLocator
-
getUserAgent
-
setUserAgent
-
getPackageTracker
- Specified by:
getPackageTrackerin interfaceIWorkerContext
-
setPackageTracker
public IWorkerContext setPackageTracker(IWorkerContextManager.IPackageLoadingTracker packageTracker) - Specified by:
setPackageTrackerin interfaceIWorkerContext
-
getProfiledElementBuilder
public PEBuilder getProfiledElementBuilder(PEBuilder.PEElementPropertiesPolicy elementProps, boolean fixedProps) - Specified by:
getProfiledElementBuilderin interfaceIWorkerContext
-
isForPublication
- Specified by:
isForPublicationin interfaceIWorkerContext
-
setForPublication
- Specified by:
setForPublicationin interfaceIWorkerContext
-
isCachingAllowed
-
setCachingAllowed
-
urlsForOid
- Specified by:
urlsForOidin interfaceIOIDServices
-
urlsForOid
-
unload
-
findTxResource
public <T extends Resource> T findTxResource(Class<T> class_, String canonical, String version, Resource sourceOfReference) Description copied from interface:IWorkerContextthis first does a fetch resource, and if nothing is found, looks in the terminology eco-system for a matching definition for the resource- Specified by:
findTxResourcein interfaceIWorkerContext
-
findTxResource
Description copied from interface:IWorkerContextthis first does a fetch resource, and if nothing is found, looks in the terminology eco-system for a matching definition for the resource- Specified by:
findTxResourcein interfaceIWorkerContext
-
findTxResource
-
fetchResourceVersions
Description copied from interface:IWorkerContextFetch all the versions of a resource.- Specified by:
fetchResourceVersionsin interfaceIWorkerContext- Parameters:
class_- the type of resource to load- Returns:
- all the resources
-
setLocale
Description copied from interface:IWorkerContextManagerSets the locale for this worker context.- Specified by:
setLocalein interfaceIWorkerContextManager- Overrides:
setLocalein classorg.hl7.fhir.utilities.i18n.I18nBase- Parameters:
locale- The locale to use.
-
validateTxResource
public OperationOutcome validateTxResource(org.hl7.fhir.utilities.validation.ValidationOptions options, Resource resource) Description copied from interface:IWorkerContextValidate the actual terminology resource itself on the appropriate terminology server (used for ECL validation)- Specified by:
validateTxResourcein interfaceIWorkerContext- Parameters:
options-resource-- Returns:
-
getSuppressedMappings
-
setSuppressedMappings
-
getCutils
-
txCacheReport
-
isAllowedToIterateTerminologyResources
-
setAllowedToIterateTerminologyResources
public static void setAllowedToIterateTerminologyResources(boolean allowedToIterateTerminologyResources) -
oidServices
- Specified by:
oidServicesin interfaceIWorkerContext- Returns:
- a handle to provide information about OIDs known to the context (if available)
-
getManager
Description copied from interface:IWorkerContextif this returns null, the context is frozen (usually for threading concerns on the server) If you're considering not providing this service, the context can't load stuff on the fly so you need to take care to load everything in advance. In particular, pay attention to cross-version packages Also, beware of the impact of lazy-loading on thread safety- Specified by:
getManagerin interfaceIWorkerContext- Returns:
- the manager that can be used to load / unload content from the context
-