Skip to main content
Version: v0.0.4

Function: toFhirIdentifier()

toFhirIdentifier(cx, ctx?): ConvertResult<FhirComplex>

Convert a parsed HL7 v2 CX to a FHIR Identifier node, fail-safe on the assigning authority. Returns { value: undefined } when the CX carries no identifier value at all.

Parameters

cx

CX

A parsed @cosyte/hl7 CX.

ctx?

TransformContext = {}

The transform context; ctx.namingSystem resolves the assigning authority (HD).

Returns

ConvertResult<FhirComplex>

Example

import { toFhirIdentifier, createNamingSystem } from "@cosyte/transform";
const { value, issues } = toFhirIdentifier(
{ idNumber: "12345", assigningAuthority: { namespaceId: "HOSPMRN" } },
{ namingSystem: createNamingSystem() },
);
// no registry entry for a bare "HOSPMRN" namespace → value emitted, system absent, one issue
void value;
void issues;