Skip to main content
Version: v0.0.3

Function: buildSection()

buildSection(el, ctx): CcdaSection

Frame a <section> element into a CcdaSection. Recognizes the section by templateId root (primary) or LOINC code (fallback, emitting SECTION_MATCHED_BY_LOINC_FALLBACK); an unrecognized coded section emits UNKNOWN_SECTION_CODE and is retained as narrative-only. Recurses into nested <component><section> subsections. Never throws.

Parameters

el

Element

ctx

ParseCtx

Returns

CcdaSection

Example

import { buildSection } from "@cosyte/ccda";
const section = buildSection(sectionEl, { emit: () => {} });
console.log(section.key, section.subsections.length);