Package com.ibm.fhir.term.graph.provider
Class GraphTermServiceProvider
- java.lang.Object
-
- com.ibm.fhir.term.spi.AbstractTermServiceProvider
-
- com.ibm.fhir.term.graph.provider.GraphTermServiceProvider
-
- All Implemented Interfaces:
FHIRTermServiceProvider
public class GraphTermServiceProvider extends AbstractTermServiceProvider
Graph-based implementation of theFHIRTermServiceProviderinterface usingFHIRTermGraph
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_TIME_LIMIT
-
Constructor Summary
Constructors Constructor Description GraphTermServiceProvider(FHIRTermGraph graph)GraphTermServiceProvider(FHIRTermGraph graph, int timeLimit)GraphTermServiceProvider(org.apache.commons.configuration.Configuration configuration)GraphTermServiceProvider(org.apache.commons.configuration.Configuration configuration, int timeLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<CodeSystem.Concept>closure(CodeSystem codeSystem, Code code)Get a set containingCodeSystem.Conceptinstances where all structural hierarchies have been flattened.Map<Code,Set<CodeSystem.Concept>>closure(CodeSystem codeSystem, Set<Code> codes)Get a map of sets containingCodeSystem.Conceptinstances where all structural hierarchies have been flattenedCodeSystem.ConceptgetConcept(CodeSystem codeSystem, Code code)Get the concept in the provided code system with the specified code.Set<CodeSystem.Concept>getConcepts(CodeSystem codeSystem)Get a set containingCodeSystem.Conceptinstances where all structural hierarchies have been flattened.<R> Set<R>getConcepts(CodeSystem codeSystem, Function<CodeSystem.Concept,? extends R> function)Get a set containingFHIRTermServiceProviderinstances mapped from concepts where all structural hierarchies have been flattened.Set<CodeSystem.Concept>getConcepts(CodeSystem codeSystem, List<ValueSet.Compose.Include.Filter> filters)Get a set containingCodeSystem.Conceptinstances where all structural hierarchies have been flattened and filtered by the given set of value set include filters.<R> Set<R>getConcepts(CodeSystem codeSystem, List<ValueSet.Compose.Include.Filter> filters, Function<CodeSystem.Concept,? extends R> function)Get a set containingFHIRTermServiceProviderinstances mapped from concepts where all structural hierarchies have been flattened and filtered by the given set of value set include filters.FHIRTermGraphgetGraph()intgetTimeLimit()booleanhasConcept(CodeSystem codeSystem, Code code)Indicates whether the given code system contains a concept with the specified code.booleanhasConcepts(CodeSystem codeSystem, Set<Code> codes)Indicates whether the given code system contains a concept for each of the specified codes.booleanisSupported(CodeSystem codeSystem)Indicates whether the given code system is supported.booleansubsumes(CodeSystem codeSystem, Code codeA, Code codeB)Indicates whether the concept forCodeAsubsumes the concept forcodeBin the passed CodeSystem.-
Methods inherited from class com.ibm.fhir.term.spi.AbstractTermServiceProvider
checkArgument, checkArguments, checkArguments, checkArguments, checkArguments, checkArguments
-
-
-
-
Field Detail
-
DEFAULT_TIME_LIMIT
public static final int DEFAULT_TIME_LIMIT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GraphTermServiceProvider
public GraphTermServiceProvider(org.apache.commons.configuration.Configuration configuration)
-
GraphTermServiceProvider
public GraphTermServiceProvider(org.apache.commons.configuration.Configuration configuration, int timeLimit)
-
GraphTermServiceProvider
public GraphTermServiceProvider(FHIRTermGraph graph)
-
GraphTermServiceProvider
public GraphTermServiceProvider(FHIRTermGraph graph, int timeLimit)
-
-
Method Detail
-
closure
public Set<CodeSystem.Concept> closure(CodeSystem codeSystem, Code code)
Description copied from interface:FHIRTermServiceProviderGet a set containingCodeSystem.Conceptinstances where all structural hierarchies have been flattened.- Specified by:
closurein interfaceFHIRTermServiceProvider- Specified by:
closurein classAbstractTermServiceProvider- Parameters:
codeSystem- the code systemcode- the root of the hierarchy containing the Concept instances to be flattened- Returns:
- flattened set of Concept instances for the given tree
-
closure
public Map<Code,Set<CodeSystem.Concept>> closure(CodeSystem codeSystem, Set<Code> codes)
Description copied from interface:FHIRTermServiceProviderGet a map of sets containingCodeSystem.Conceptinstances where all structural hierarchies have been flattened- Parameters:
codeSystem- the code systemcodes- the set of roots of hierarchies containing the Concept instances to be flattened- Returns:
- a map containing flattened sets of Concept instances for the given trees
-
getConcept
public CodeSystem.Concept getConcept(CodeSystem codeSystem, Code code)
Description copied from interface:FHIRTermServiceProviderGet the concept in the provided code system with the specified code. Consumers should not expect the returned Concept to contain child concepts, even where such concepts exist in the underlying CodeSystem.- Specified by:
getConceptin interfaceFHIRTermServiceProvider- Specified by:
getConceptin classAbstractTermServiceProvider- Parameters:
codeSystem- the code systemcode- the code- Returns:
- the code system concept with the specified code, or null if no such concept exists
-
getConcepts
public Set<CodeSystem.Concept> getConcepts(CodeSystem codeSystem)
Description copied from interface:FHIRTermServiceProviderGet a set containingCodeSystem.Conceptinstances where all structural hierarchies have been flattened.- Specified by:
getConceptsin interfaceFHIRTermServiceProvider- Specified by:
getConceptsin classAbstractTermServiceProvider- Parameters:
codeSystem- the code system containing the set of Concept instances to be flattened- Returns:
- flattened set of Concept instances for the given code system
-
getConcepts
public <R> Set<R> getConcepts(CodeSystem codeSystem, Function<CodeSystem.Concept,? extends R> function)
Description copied from interface:FHIRTermServiceProviderGet a set containingFHIRTermServiceProviderinstances mapped from concepts where all structural hierarchies have been flattened.- Type Parameters:
R- the element type of the result set- Parameters:
codeSystem- the code system containing the set of Concept instances to be flattenedfunction- the function to apply to each element of the result set- Returns:
- flattened set of
FHIRTermServiceProviderinstances mapped from concepts for the given code system
-
getConcepts
public Set<CodeSystem.Concept> getConcepts(CodeSystem codeSystem, List<ValueSet.Compose.Include.Filter> filters)
Description copied from interface:FHIRTermServiceProviderGet a set containingCodeSystem.Conceptinstances where all structural hierarchies have been flattened and filtered by the given set of value set include filters.- Specified by:
getConceptsin interfaceFHIRTermServiceProvider- Specified by:
getConceptsin classAbstractTermServiceProvider- Parameters:
codeSystem- the code system containing the set of Concept instances to be flattened / filteredfilters- the value set include filters- Returns:
- flattened / filtered set of Concept instances for the given code system
-
getConcepts
public <R> Set<R> getConcepts(CodeSystem codeSystem, List<ValueSet.Compose.Include.Filter> filters, Function<CodeSystem.Concept,? extends R> function)
Description copied from interface:FHIRTermServiceProviderGet a set containingFHIRTermServiceProviderinstances mapped from concepts where all structural hierarchies have been flattened and filtered by the given set of value set include filters.- Type Parameters:
R- the element type of the result set- Parameters:
codeSystem- the code system containing the set of Concept instances to be flattened / filteredfilters- the value set include filtersfunction- the function to apply to each element of the result set- Returns:
- flattened / filtered set of
FHIRTermServiceProviderinstances mapped from concepts for the given code system
-
getGraph
public FHIRTermGraph getGraph()
-
getTimeLimit
public int getTimeLimit()
-
hasConcept
public boolean hasConcept(CodeSystem codeSystem, Code code)
Description copied from interface:FHIRTermServiceProviderIndicates whether the given code system contains a concept with the specified code.- Specified by:
hasConceptin interfaceFHIRTermServiceProvider- Specified by:
hasConceptin classAbstractTermServiceProvider- Parameters:
codeSystem- the code systemcode- the code- Returns:
- true if the given code system contains a concept with the specified code, false otherwise
-
hasConcepts
public boolean hasConcepts(CodeSystem codeSystem, Set<Code> codes)
Description copied from interface:FHIRTermServiceProviderIndicates whether the given code system contains a concept for each of the specified codes.- Parameters:
codeSystem- the code systemcodes- the codes- Returns:
- true if the given code system contains a concept for each of the specified codes, false otherwise
-
isSupported
public boolean isSupported(CodeSystem codeSystem)
Description copied from interface:FHIRTermServiceProviderIndicates whether the given code system is supported.- Specified by:
isSupportedin interfaceFHIRTermServiceProvider- Specified by:
isSupportedin classAbstractTermServiceProvider- Parameters:
codeSystem- the code system- Returns:
- true if the given code system is supported, false otherwise
-
subsumes
public boolean subsumes(CodeSystem codeSystem, Code codeA, Code codeB)
Description copied from interface:FHIRTermServiceProviderIndicates whether the concept forCodeAsubsumes the concept forcodeBin the passed CodeSystem.- Specified by:
subsumesin interfaceFHIRTermServiceProvider- Specified by:
subsumesin classAbstractTermServiceProvider- Parameters:
codeSystem- the code systemcodeA- the root of the hierarchy to searchcodeB- the code to match- Returns:
- true if the code system concept for
codeBexists in the tree rooted by the concept forCodeA, false otherwise
-
-