Skip to main content
Version: v0.0.3

Interface: CodeTranslationResult

The outcome of TerminologyAdapter.translate, modeled on the FHIR $translate operation and @cosyte/terminology's translate. matches are the declared target codings, drawn verbatim from the consumer's map; an empty array means the source did not map. Per the never-fabricate invariant an adapter must return an empty matches for an unmapped source, never a guessed target.

Consumed on build. @cosyte/ccda defines this so a consumer can wire a ConceptMap-backed engine in behind TerminologyAdapter.translate. buildCcda consults it at each clinical coded slot (problem value, allergen, medication drug + route, vaccine + route) and emits any returned coding as a spec-clean CDA R2 <translation> alternate beside the primary code, never replacing it, and never fabricated (an empty matches emits nothing). The alternates round-trip through parseCcda into CD.translation. translate stays optional on the interface: a validation-only adapter need not implement it, and its absence yields byte-identical output.

Example

import type { CodeTranslationResult } from "@cosyte/ccda";
const mapped: CodeTranslationResult = {
matches: [{ system: "2.16.840.1.113883.6.90", code: "I10", display: "Essential hypertension" }],
};

Properties

matches

readonly matches: readonly TerminologyCoding[]

The declared target codings, verbatim from the map. Empty ⇒ unmapped (never a fabricated target).