Interface: BuildCcdaInit
Input to buildCcda. patient is required; each clinical collection
(problems, allergies, medications, results, vitalSigns) defaults to
empty, in which case its section is emitted as a spec-clean empty
nullFlavor="NI" section. immunizations is optional, its section is emitted
only when populated (Immunizations is not a CCD SHALL section). documentType
is "ccd" (the default) or "referralNote"; the other ten C-CDA R2.1
document types are not implemented.
Example
import type { BuildCcdaInit } from "@cosyte/ccda";
const init: BuildCcdaInit = {
patient: { mrn: "MRN001", given: ["Jane"], family: "Doe", gender: "F" },
problems: [{ problem: { code: "59621000", displayName: "Essential hypertension" } }],
allergies: [{ noKnownAllergy: true }],
};
Properties
allergies?
readonlyoptionalallergies?: readonlyBuildCcdaAllergy[]
Allergy Concerns for the Allergies section; empty section when omitted.
assessment?
readonlyoptionalassessment?:string
The Assessment Section narrative (documentType: "referralNote" only, a
Referral Note SHALL section). Narrative-only, so this is a free-text
clinician summary; when omitted the SHALL section is emitted as a spec-clean
empty nullFlavor="NI" section (never a fabricated assessment). Ignored for
a CCD.
confidentiality?
readonlyoptionalconfidentiality?:string
The confidentiality code; defaults to "N" (normal).
custodianName?
readonlyoptionalcustodianName?:string
The custodian organization name; defaults to a synthetic label.
documentId?
readonlyoptionaldocumentId?:string
The document id's extension; a synthetic id is generated when omitted.
documentType?
readonlyoptionaldocumentType?:"ccd"|"referralNote"
The document type, "ccd" (default) or "referralNote". Each specializes
the US Realm Header (its own document templateId + LOINC code) and its
SHALL section set; the other ten C-CDA R2.1 document types are not emitted.
effectiveTime?
readonlyoptionaleffectiveTime?:string|Date
The document effectiveTime (a Date is formatted to UTC); defaults to now.
encounters?
readonlyoptionalencounters?: readonlyBuildCcdaEncounter[]
Encounter Activities; the Encounters section is emitted only when non-empty (a CCD SHOULD section).
familyHistory?
readonlyoptionalfamilyHistory?: readonlyBuildCcdaFamilyHistory[]
Family history for the Family History section; the section is emitted only
when non-empty (a CCD SHOULD section). Each entry is one relative (a Family
History Organizer) carrying that relative's conditions, read back via
getFamilyHistory, grouped by relative.
functionalStatus?
readonlyoptionalfunctionalStatus?: readonlyBuildCcdaFunctionalStatus[]
Standalone Functional Status findings; the Functional Status section is emitted when this or functionalStatusOrganizers is non-empty (a CCD SHOULD section).
functionalStatusOrganizers?
readonlyoptionalfunctionalStatusOrganizers?: readonlyBuildCcdaFunctionalStatusOrganizer[]
Functional Status Organizers (each grouping ≥1 Functional Status Observation under one categorization); emitted into the Functional Status section alongside any standalone functionalStatus findings. The section is emitted when either is non-empty.
functionalStatusScales?
readonlyoptionalfunctionalStatusScales?: readonlyBuildCcdaAssessmentScale[]
Direct-entry Assessment Scale Observations (…22.4.69) for the Functional
Status section, scored instruments (e.g. a Barthel index, a Glasgow Coma
scale). Emitted as direct section entries (the conformant R2.1 placement),
read back tagged assessmentScale: true, domain: "functional". The
Functional Status section is emitted when this, functionalStatus, or
functionalStatusOrganizers is non-empty.
immunizations?
readonlyoptionalimmunizations?: readonlyBuildCcdaImmunization[]
Immunization Activities; the Immunizations section is emitted only when non-empty.
languageCode?
readonlyoptionallanguageCode?:string
The document language; defaults to "en-US".
medications?
readonlyoptionalmedications?: readonlyBuildCcdaMedication[]
Medication Activities for the Medications section; empty section when omitted.
mentalStatus?
readonlyoptionalmentalStatus?: readonlyBuildCcdaMentalStatus[]
Standalone Mental Status findings; the Mental Status section is emitted when this or mentalStatusOrganizers is non-empty (a CCD SHOULD section).
mentalStatusOrganizers?
readonlyoptionalmentalStatusOrganizers?: readonlyBuildCcdaMentalStatusOrganizer[]
Mental Status Organizers (each grouping ≥1 Mental Status Observation under one categorization); emitted into the Mental Status section alongside any standalone mentalStatus findings. The section is emitted when either is non-empty.
mentalStatusScales?
readonlyoptionalmentalStatusScales?: readonlyBuildCcdaAssessmentScale[]
Direct-entry Assessment Scale Observations (…22.4.69) for the Mental Status
section, scored instruments (e.g. a PHQ-9 depression screen, a MoCA). Emitted
as direct section entries (the conformant R2.1 placement), read back tagged
assessmentScale: true, domain: "mental". The Mental Status section is
emitted when this, mentalStatus, or mentalStatusOrganizers is
non-empty.
pastMedicalHistory?
readonlyoptionalpastMedicalHistory?: readonlyBuildCcdaProblem[]
Historical problems for the Past Medical History section; the section is
emitted only when non-empty (a CCD MAY section). Each is a bare Problem
Observation (not a concern act), read back via getPastMedicalHistory, never
conflated with the active Problems returned by getProblems.
patient
readonlypatient:BuildCcdaPatient
The single record-target patient (required).
planOfTreatment?
readonlyoptionalplanOfTreatment?: readonlyBuildCcdaPlannedItem[]
Planned items for the Plan of Treatment section; the section is emitted only
when non-empty (a CCD SHOULD section). Every item is future/ordered, read
back via getPlannedItems with disposition: "planned", never conflated
with the performed Procedures/Encounters.
problems?
readonlyoptionalproblems?: readonlyBuildCcdaProblem[]
Problem Concerns for the Problems section; empty section when omitted.
procedures?
readonlyoptionalprocedures?: readonlyBuildCcdaProcedure[]
Procedures; the Procedures section is emitted only when non-empty (a CCD SHOULD section).
reasonForReferral?
readonlyoptionalreasonForReferral?:string
The Reason for Referral Section narrative (documentType: "referralNote"
only, a Referral Note SHALL section). Narrative-only free text; when omitted
the SHALL section is emitted as an empty nullFlavor="NI" section (never a
fabricated reason). Ignored for a CCD.
results?
readonlyoptionalresults?: readonlyBuildCcdaResultPanel[]
Result panels for the Results section; empty section when omitted.
smokingStatus?
readonlyoptionalsmokingStatus?: readonlyBuildCcdaSmokingStatus[]
Smoking Status observations for the Social History section; emitted only when non-empty (a CCD SHOULD section).
title?
readonlyoptionaltitle?:string
The document title; defaults to the CCD document-code display name.
vitalSigns?
readonlyoptionalvitalSigns?: readonlyBuildCcdaVitalsPanel[]
Vital Signs panels for the Vital Signs section; empty section when omitted.