Packet Cover Clinic Extension¶
| Canonical | https://fhir.apps.health/StructureDefinition/nexus-packet-cover-clinic |
|---|---|
| Status | draft · 1.33.0 |
| Base | Extension (constraint) |
| Context | List (element) |
| Source | FSH · JSON |
The clinic whose contact details head this attachment packet's generated cover page, as a logical reference to the Location that stands for that clinic.
FSH
The authored source of truth: extensions/PacketCoverClinicExtension.fsh (edit on GitHub). One FSH file may define several related artifacts.
// PacketCoverClinicExtension.fsh
// Which clinic's contact details head the generated cover page of an attachment packet. Rides the
// `List` itself, once, beside `nexus-packet-cover-page`.
//
// WHY IT IS RECORDED AT ALL. A packet is reopened and re-rendered from what the `List` says. The
// cover page prints one clinic's name, phone, fax and address, and a practice can have several
// clinics, so "leads with a cover page" does not say whose letterhead it carried. Without this a
// reopened packet would be rendered under whichever clinic the reader happened to resolve, which
// can differ from the one the assembler chose.
//
// WHY A LOGICAL REFERENCE, AND NOT A LITERAL ONE. A clinic is known to the assembling surface by its
// clinic id, and the Location that stands for a clinic carries that id as an identifier value
// (`NamingSystem/clinic-service-location-identifier`). Whether a Location exists for a given clinic
// in a given store is not something the assembler can know: a store provisioned here gets one on a
// provisioning pass, and other backends project their own. A literal `Location/<id>` would need a
// lookup on every assembly and would have nothing to point at for a clinic with no Location yet.
// The identifier is the fact; the Location, where there is one, is found by it.
//
// READ THE VALUE. The naming system's own page says it: match a clinic's Location on the identifier
// VALUE, not on the system. A reader of this extension takes `identifier.value` as the clinic id
// and resolves from there; it does not require the system to be the one a writer here stamps.
//
// ONLY WITH A COVER PAGE. A packet that does not lead with a cover page prints no clinic, so it
// records none: the packet profile's `nexus-packet-cover-clinic-needs-cover` invariant refuses a
// clinic unless the cover-page value is `true`. An absent cover-page value is not `false` -- it
// states nothing -- and a packet that states nothing about its cover states nothing about a clinic.
// A writer that turns the cover page off removes this extension in the same write.
//
// ABSENT ON A PACKET THAT DOES LEAD WITH A COVER PAGE means only that no clinic was recorded. That
// is every packet assembled before this extension existed, and a reader resolves the clinic for
// itself as it would have then. It is not a statement that the cover carried no clinic.
Invariant: nexus-packet-cover-clinic-by-identifier
Description: "The cover page's clinic SHALL be an identifier-only logical reference: `valueReference.identifier` under the clinic-service-location-identifier NamingSystem carrying the clinic id, and NO literal `reference`. The clinic is known by its id, and a Location may not exist for it in the store."
Severity: #error
Expression: "value.ofType(Reference).identifier.where(system = 'https://fhir.apps.health/NamingSystem/clinic-service-location-identifier').value.exists() and value.ofType(Reference).reference.empty()"
Extension: PacketCoverClinicExtension
Id: nexus-packet-cover-clinic
Title: "Packet Cover Clinic Extension"
Description: """
The clinic whose contact details head this attachment packet's generated cover page, as a logical
reference to the Location that stands for that clinic.
**The reference carries an identifier and no literal `reference`.** The identifier value is the
clinic id, under [`clinic-service-location-identifier`](NamingSystem-ClinicServiceLocationIdentifierNS.md).
A Location for the clinic may not exist in the store, so a reader takes the identifier value as the
clinic and matches a Location on that value where it needs one.
**Present only on a packet that says it leads with a cover page.** This extension SHALL NOT be
present unless [`nexus-packet-cover-page`](StructureDefinition-nexus-packet-cover-page.md) is `true`.
A packet whose cover-page value is `false` prints no clinic; one whose value is absent has stated
nothing about its cover, and so states nothing about a clinic either.
**Absent does not mean the cover carried no clinic.** It means none was recorded, which is true of
every packet assembled before this extension existed. A reader then resolves the clinic for itself.
Meaningful on an attachment packet (`nexus-attachment-packet`), and constrained to one: the
extension's `contextInvariant` requires the `List` it rides to carry an identifier under the
attachment-packet naming system.
"""
* ^url = "https://fhir.apps.health/StructureDefinition/nexus-packet-cover-clinic"
* ^status = #draft
* ^date = "2026-10-05"
* ^publisher = "WELLSTAR Technologies Corp."
* ^contact.name = "Nexus EMR FHIR Implementation Guide"
* ^contact.telecom.system = #url
* ^contact.telecom.value = "https://fhir.apps.health"
* ^jurisdiction = urn:iso:std:iso:3166#CA "Canada"
* ^context[0].type = #element
* ^context[0].expression = "List"
// The same test `nexus-packet-cover-page` uses to say it is on the right kind of List: an attachment
// packet is a List carrying an identifier under the attachment-packet naming system.
* insert AttachmentPacketContext
* obeys nexus-packet-cover-clinic-by-identifier
* . ^short = "Which clinic's details head the cover page (a Location, by identifier)"
* extension 0..0
* url 1..1
* value[x] 1..1 MS
* value[x] only Reference(NexusEmrCoreLocation)
* valueReference ^short = "The clinic's Location, named by the clinic id as an identifier; no literal reference"
* valueReference ^definition = "A logical reference to the Location that stands for the clinic whose name, phone, fax and address the generated cover page carries. `identifier.value` is the clinic id under the clinic-service-location-identifier naming system. No literal `reference` is carried: the clinic is known by its id, and the store may hold no Location for it."