Interface: PlannedItem
A single planned item from the Plan of Treatment. kind is the template
variant; disposition is the performed-vs-planned reading of moodCode
(normally "planned", never guessed); value carries the expected result for
the observation variant. negated and nullFlavor are kept distinct, never
collapsed.
code is the planned act's own <code> for five of the seven variants. For
the two substanceAdministration variants, medicationActivity and
immunizationActivity, it is the product (the drug, or the vaccine), read
from consumable/manufacturedProduct, and never the
substanceAdministration's own <code>: that element is an
ActSubstanceAdministrationCode (the kind of administration act), not the
substance. That [0..1] cardinality and that binding are base CDA R2's
SubstanceAdministration class, not a C-CDA constraint: R2.1 constrains
code on neither template, which is precisely why an act <code> is legal on
both. An act <code> present on either variant is not read into this field;
it round-trips through doc.toString().
Absence has three shapes there and only two of them are undefined, so do
not test this field for truthiness and stop. It is undefined when no arm
carries a <code> at all (beside MISSING_PRODUCT_CODE) and when the arms
name different drugs (beside MEDICATION_PRODUCT_ARM_CONFLICT). But an arm
whose <code> asserts neither a symbol nor a nullFlavor yields a truthy
but empty CD, and a nullFlavor-only one yields a CD carrying just that
marking. Neither is MISSING_PRODUCT_CODE, an arm did carry a <code>. Read
code?.code, not code.
On the two substanceAdministration variants that empty shape is no longer
silent: the field is slot-checked exactly as its performed twin's product
is, so it draws MISSING_CODE_VALUE. medicationActivity is checked at the
medication binding (RxNorm/NDC, as a performed Medication Activity's drug
is) and immunizationActivity at the vaccine binding (CVX only, as an
Immunization Activity's vaccine is), so a product code carrying no
@codeSystem or one outside its binding draws MISSING_CODE_SYSTEM or
UNEXPECTED_CODE_SYSTEM. The two bindings differ: NDC is expected on a drug
and unexpected on a vaccine, so an NDC-coded planned vaccine draws
UNEXPECTED_CODE_SYSTEM where an NDC-coded planned drug does not, matching
each variant's performed twin rather than each other. A nullFlavor-only CD
is a complete statement and stays silent, as it does everywhere else. The
other five variants are not slot-checked: their code is the planned act,
which is not one of the five bound CodeSlots.
Example
import type { PlannedItem } from "@cosyte/ccda";
function isPlanned(p: PlannedItem): boolean {
return p.disposition === "planned";
}
Properties
code?
readonlyoptionalcode?:CD
disposition?
readonlyoptionaldisposition?:EventDisposition
effectiveTime?
readonlyoptionaleffectiveTime?:IVL_TS
ids
readonlyids: readonlyII[]
kind
readonlykind:PlannedItemKind
moodCode?
readonlyoptionalmoodCode?:string
narrative?
readonlyoptionalnarrative?:string
negated?
readonlyoptionalnegated?:boolean
nullFlavor?
readonlyoptionalnullFlavor?:string
statusCode?
readonlyoptionalstatusCode?:string
value?
readonlyoptionalvalue?:ObservationValue