Skip to main content
Version: v0.0.2

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

Concept

The concept under test.

filter

ConceptSetFilter

The filter predicate.

sub

Subsumption

The subsumption index for the concept's code system.

Returns

FilterMatch

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