Skip to main content
Version: v0.0.3

Interface: CcdaWarning

Data shape for every Tier-2 warning emitted by the parser. Warnings are plain data (distinct from CcdaParseError, which is a thrown Error subclass) so they can be safely accumulated into CcdaDocument.warnings and passed to onWarning callbacks.

Example

import type { CcdaWarning } from "@cosyte/ccda";
const w: CcdaWarning = {
code: "UNKNOWN_SECTION_CODE",
message: "Section LOINC code 99999-9 is not a recognized C-CDA section.",
position: { sectionCode: "99999-9" },
};

Properties

code

readonly code: WarningCode


expected?

readonly optional expected?: boolean

true when an active CcdaProfile expected this deviation and downgraded it, the warning is retained (never dropped) but flagged so a consumer can filter known, tolerated noise from novel deviations. In strict mode an expected warning does not escalate to a thrown error. Absent (not false) when no profile touched the warning.


message

readonly message: string


position

readonly position: CcdaPosition


profile?

readonly optional profile?: string

The name of the CcdaProfile that tolerated this warning, when expected.


toleratedCode?

readonly optional toleratedCode?: WarningCode

When code is WARNING_CODES.PROFILE_QUIRK_APPLIED, the original warning code the profile tolerated, so the specific deviation (DEPRECATED_LOINC, TEMPLATE_EXTENSION_ABSENT, …) is never lost, only re-badged as expected.