Skip to main content
Version: v0.0.3

Function: applyProfile()

applyProfile(profile, warning): CcdaWarning

Apply a profile to a single warning. Returns a downgraded PROFILE_QUIRK_APPLIED warning when the profile expects this deviation; otherwise returns the original warning unchanged (referential identity preserved, so an un-tolerated warning is never reallocated). A warning that is already expected (e.g. re-processed) is passed through untouched.

Parameters

profile

CcdaProfile

warning

CcdaWarning

Returns

CcdaWarning

Example

import { applyProfile, ccdaProfiles, deprecatedLoinc } from "@cosyte/ccda";
const w = deprecatedLoinc({ path: "code" }, "41909-3");
const out = applyProfile(ccdaProfiles.smartScorecard, w);
console.log(out.code); // "PROFILE_QUIRK_APPLIED"
console.log(out.toleratedCode); // "DEPRECATED_LOINC"