Skip to main content
Version: v0.0.3

Function: buildDocument()

buildDocument(root, ctx): Omit<CcdaDocumentInit, "warnings">

Build the CcdaDocumentInit parts (everything except warnings) from a ClinicalDocument root element. Recognizes the document type, parses the header, and frames the body, a structuredBody yields sections; a nonXMLBody yields the quarantined nonXmlBody content. Never throws; the orchestrator supplies warnings and constructs the CcdaDocument.

Parameters

root

Element

ctx

ParseCtx

Returns

Omit<CcdaDocumentInit, "warnings">

Example

import { buildDocument, CcdaDocument } from "@cosyte/ccda";
const parts = buildDocument(root, ctx);
const doc = new CcdaDocument({ ...parts, warnings: [] });