Skip to content

Effective Date Extension

Canonical../StructureDefinition/effective-date
Statusdraft · 1.26.0
BaseExtension (constraint)
ContextStructureDefinition (element)
SourceFSH · JSON

Which element carries THE effective date for this profile, as a precedence-ordered list of raw-FHIR paths -- or an explicit declaration that the profile has none. One date concept per resource, declared in the IG rather than guessed by each consumer.

FSH

The authored source of truth: extensions/EffectiveDate.fsh (edit on GitHub). One FSH file may define several related artifacts.

// EffectiveDate.fsh
// Declares which element carries THE effective date for a profile, in precedence order -- or that
// the profile deliberately has none. Applied at the StructureDefinition level; authored terse via
// the `EffectiveDate` / `NoEffectiveDate` RuleSets, which are the only intended way to write it.
//
// WHY THIS EXISTS. A resource has exactly ONE date concept in this model, but which element that is
// differs per resource type: a Condition's onset, an Encounter's period start, a MedicationRequest's
// authoredOn. That is a per-profile clinical fact, so it is declared beside the profile it describes
// rather than kept in a hand-maintained table inside a code generator, where no profile author would
// think to look. Every consumer reads what is declared here: the facade's effective-date accessor,
// the PatientCache recency windows, and `effective_date_of` over raw JSON.
//
// THREE DISTINCT ANSWERS, and the difference is load-bearing:
//   - `paths` present  -- declared, as a ` | `-separated precedence list (first present wins).
//   - `none` = true    -- declared to have NO effective date. This is a real answer, not silence:
//                         birthDate / manufactureDate / a Location's period are not EFFECTIVE dates,
//                         so Patient, Practitioner, Organization, Location, PractitionerRole and
//                         Device pin themselves empty. Without it a consumer falls back to a guess
//                         and invents a date -- a Patient dating to its birthDate would enter
//                         recency windows and could re-anchor a whole chart's reference day.
//   - neither present  -- the profile has not declared. The consumer guesses, and warns.
//
// NOTE ON ITS HISTORY. This definition was missing for a long time while 38 profiles stamped the
// canonical anyway: SUSHI writes whatever caret rules it is given and never resolves extension URLs,
// so the omission was invisible to the FSH build and only the IG Publisher complained -- on every
// single use. Declaring it changes no stamped data; it just makes the URL resolve. (FHIR-27 open
// item, closed on the FHIR-28 branch alongside its sibling SmartExposed.)

Invariant:   effective-date-declares-exactly-one
Description: "An effective-date declaration must say either which paths carry the date, or that there is deliberately none -- never both, and never neither. An empty declaration is indistinguishable from not declaring, which is the ambiguity this extension exists to remove."
Severity:    #error
Expression:  "extension('paths').exists() xor extension('none').exists()"

Extension: EffectiveDate
Id: effective-date
Title: "Effective Date"
Description: "Which element carries THE effective date for this profile, as a precedence-ordered list of raw-FHIR paths -- or an explicit declaration that the profile has none. One date concept per resource, declared in the IG rather than guessed by each consumer."
* ^url = "../StructureDefinition/effective-date"
* ^status = #draft
* ^context[0].type = #element
* ^context[0].expression = "StructureDefinition"
* obeys effective-date-declares-exactly-one
* extension contains
    paths 0..1 MS and
    none 0..1 MS
* extension[paths].value[x] only string
* extension[paths] ^short = "The effective-date elements, most preferred first, separated by ` | `"
* extension[paths] ^definition = "A ` | `-separated list of raw-FHIR element paths, in precedence order: the first one present on an instance supplies the effective date."
* extension[none].value[x] only boolean
* extension[none] ^short = "True when the profile deliberately has no effective date"
* extension[none] ^definition = "Set to true to declare, positively, that this resource type has no effective date. Distinct from declaring nothing: it stops a consumer falling back to a guess and inventing one."
* url 1..1
* value[x] 0..0