Function: matchesFilter()
matchesFilter(
concept,filter,sub):FilterMatch
Evaluate one ConceptSetFilter against one Concept, using the release's hierarchy.
The concept filter property (and the hierarchy operators regardless of property) reads the code
itself / its subsumption; other properties read the concept's property values. An unimplemented
operator returns { supported: false } - never a coerced matched.
Parameters
concept
The concept under test.
filter
The filter predicate.
sub
The subsumption index for the concept's code system.
Returns
A FilterMatch.
Example
import { loadCodeSystem, buildSubsumption, matchesFilter } from "@cosyte/terminology";
const cs = loadCodeSystem({
format: "fhir",
resource: { resourceType: "CodeSystem", concept: [{ code: "p", concept: [{ code: "c" }] }] },
});
const dog = cs.concepts.get("c");
dog && matchesFilter(dog, { property: "concept", op: "is-a", value: "p" }, buildSubsumption(cs)).matched; // => true