Skip to main content
Version: v0.0.3

Function: defineCcdaProfile()

defineCcdaProfile(opts): CcdaProfile

Build a frozen CcdaProfile from a validated options object. Throws CcdaProfileDefinitionError on a bad name, an unknown option key, or an invalid tolerate entry, including the safety rule: a profile may never tolerate a safety-critical warning code.

extends composes profiles: lineage, tolerate, provenance, and description merge (parents left-to-right, then self; scalars are child-wins). The merged tolerate set is re-validated so a safety-critical code cannot sneak in via a hand-crafted parent.

Parameters

opts

DefineCcdaProfileOptions

The profile definition; see DefineCcdaProfileOptions.

Returns

CcdaProfile

A frozen, immutable profile with describe() attached.

Throws

CcdaProfileDefinitionError on any invalid definition.

Example

import { defineCcdaProfile } from "@cosyte/ccda";
const site = defineCcdaProfile({
name: "acme-hospital",
description: "Acme's inbound-CCD tolerances",
tolerate: [
{ code: "TEMPLATE_EXTENSION_ABSENT", rationale: "receives R1.1-origin CCDs" },
],
provenance: { source: "Acme integration corpus", reference: "internal-2026" },
});
console.log(site.lineage); // ["acme-hospital"]
console.log(site.describe?.());