Skip to main content
Version: v0.0.3

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?

readonly optional allergies?: readonly BuildCcdaAllergy[]

Allergy Concerns for the Allergies section; empty section when omitted.


assessment?

readonly optional assessment?: 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?

readonly optional confidentiality?: string

The confidentiality code; defaults to "N" (normal).


custodianName?

readonly optional custodianName?: string

The custodian organization name; defaults to a synthetic label.


documentId?

readonly optional documentId?: string

The document id's extension; a synthetic id is generated when omitted.


documentType?

readonly optional documentType?: "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?

readonly optional effectiveTime?: string | Date

The document effectiveTime (a Date is formatted to UTC); defaults to now.


encounters?

readonly optional encounters?: readonly BuildCcdaEncounter[]

Encounter Activities; the Encounters section is emitted only when non-empty (a CCD SHOULD section).


familyHistory?

readonly optional familyHistory?: readonly BuildCcdaFamilyHistory[]

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?

readonly optional functionalStatus?: readonly BuildCcdaFunctionalStatus[]

Standalone Functional Status findings; the Functional Status section is emitted when this or functionalStatusOrganizers is non-empty (a CCD SHOULD section).


functionalStatusOrganizers?

readonly optional functionalStatusOrganizers?: readonly BuildCcdaFunctionalStatusOrganizer[]

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?

readonly optional functionalStatusScales?: readonly BuildCcdaAssessmentScale[]

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?

readonly optional immunizations?: readonly BuildCcdaImmunization[]

Immunization Activities; the Immunizations section is emitted only when non-empty.


languageCode?

readonly optional languageCode?: string

The document language; defaults to "en-US".


medications?

readonly optional medications?: readonly BuildCcdaMedication[]

Medication Activities for the Medications section; empty section when omitted.


mentalStatus?

readonly optional mentalStatus?: readonly BuildCcdaMentalStatus[]

Standalone Mental Status findings; the Mental Status section is emitted when this or mentalStatusOrganizers is non-empty (a CCD SHOULD section).


mentalStatusOrganizers?

readonly optional mentalStatusOrganizers?: readonly BuildCcdaMentalStatusOrganizer[]

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?

readonly optional mentalStatusScales?: readonly BuildCcdaAssessmentScale[]

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?

readonly optional pastMedicalHistory?: readonly BuildCcdaProblem[]

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

readonly patient: BuildCcdaPatient

The single record-target patient (required).


planOfTreatment?

readonly optional planOfTreatment?: readonly BuildCcdaPlannedItem[]

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?

readonly optional problems?: readonly BuildCcdaProblem[]

Problem Concerns for the Problems section; empty section when omitted.


procedures?

readonly optional procedures?: readonly BuildCcdaProcedure[]

Procedures; the Procedures section is emitted only when non-empty (a CCD SHOULD section).


reasonForReferral?

readonly optional reasonForReferral?: 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?

readonly optional results?: readonly BuildCcdaResultPanel[]

Result panels for the Results section; empty section when omitted.


smokingStatus?

readonly optional smokingStatus?: readonly BuildCcdaSmokingStatus[]

Smoking Status observations for the Social History section; emitted only when non-empty (a CCD SHOULD section).


title?

readonly optional title?: string

The document title; defaults to the CCD document-code display name.


vitalSigns?

readonly optional vitalSigns?: readonly BuildCcdaVitalsPanel[]

Vital Signs panels for the Vital Signs section; empty section when omitted.