Skip to main content
Version: v0.0.4

Function: toFhirCodeableConcept()

toFhirCodeableConcept(cwe, ctx?): ConvertResult<FhirComplex>

Convert a parsed HL7 v2 CWE (or CE) to a FHIR CodeableConcept node, fail-safe on the coding system and on unmapped codes. Returns { value: undefined } when the element is empty.

Parameters

cwe

CodedElement

A parsed @cosyte/hl7 CWE (a CE is accepted as its subset).

ctx?

TransformContext = {}

The transform context; ctx.namingSystem resolves the coding-system mnemonic.

Returns

ConvertResult<FhirComplex>

Example

import { toFhirCodeableConcept, createNamingSystem } from "@cosyte/transform";
const { value } = toFhirCodeableConcept(
{ identifier: "789-8", text: "Hemoglobin", nameOfCodingSystem: "LN" },
{ namingSystem: createNamingSystem() },
);
// coding[0] === { system: "http://loinc.org", code: "789-8", display: "Hemoglobin" }
void value;