Skip to content

Medication Dispense Profile

Canonical../StructureDefinition/nexus-emr-core-medicationdispense
Statusdraft · 1.26.0
BaseMedicationDispense (constraint)
SourceFSH · JSON

Nexus EMR profile for MedicationDispense resources, primarily for recording dispense events. Aligns with CII N1/N2 requirements and Nexus EMR standards.

TypedFhir API / Pydantic schema

The typed accessor surface MedicationDispense exposes for MedicationDispense — generated from this IG's compiled profile; each typed accessor has a validating raw-FHIR twin (xRaw) where marked. The three ports are parity-enforced.

The AI-facing shape: from typed_fhir.facade.generated.schemas import MedicationDispenseSchemamodel_json_schema() is a structured-output / tool definition; instantiating validates an extraction. Generated source.

class MedicationDispenseSchema(BaseModel):
    """AI-facing shape of the MedicationDispense profile: the facade's typed accessor
    surface (curated + salient fields) as a pydantic model. `model_json_schema()` is a
    structured-output / tool schema; instantiating validates an extraction."""

    model_config = ConfigDict(extra="forbid")

    status: Literal[
        "cancelled",
        "completed",
        "declined",
        "entered-in-error",
        "in-progress",
        "on-hold",
        "preparation",
        "stopped",
        "unknown",
    ] | None = Field(
        None,
        description=(
            "preparation | in-progress | cancelled | on-hold | completed | entered-in-error | "
            "stopped. A code specifying the state of the dispense event. Note: This is a modifier "
            "element. The status affects how the dispense should be interpreted. "
            "MedicationDispense.status — 1..1"
        ),
    )
    category: Concept | None = Field(
        None,
        description=(
            "Dispense category with raw code support. Indicates the type of medication dispense "
            "(e.g., inpatient, outpatient, community). RECOMMENDED: Standard terminology codes "
            "when available OPTIONAL: Raw EMR codes for source system preservation. Note: The "
            "category can be used to include where the medication is expected to be consumed or "
            "other types of dispenses. Invariants can be used to bind to different value sets "
            "when profiling to bind. MedicationDispense.category — 0..1. codes (preferred): "
            "community | discharge | inpatient | outpatient"
        ),
    )
    subject: Reference | None = Field(
        None,
        description=(
            "Who the dispense is for. The patient who received the dispensed medication. Must "
            "reference using Nexus EMR patient identifier. Note: References should use "
            "identifier-based references following Nexus EMR patterns. MedicationDispense.subject "
            "— 1..1"
        ),
    )
    performer: dict | None = Field(
        None,
        description=(
            "Who performed the dispense. Indicates who or what performed the dispensing event. "
            "Note: May be a pharmacist, pharmacy technician, or dispensing organization. "
            "MedicationDispense.performer — 0..*"
        ),
    )
    authorizing_prescription: Reference | None = Field(
        None,
        description=(
            "Prescription that authorized this dispense. Indicates the medication request that is "
            "being dispensed against. Note: Links the dispense to the original prescription "
            "order. MedicationDispense.authorizingPrescription — 0..*"
        ),
    )
    type: Concept | None = Field(
        None,
        description=(
            "Dispense type with raw code support. Indicates the type of dispensing event. "
            "RECOMMENDED: Standard terminology codes when available OPTIONAL: Raw EMR codes for "
            "source system preservation. MedicationDispense.type — 0..1"
        ),
    )
    quantity: Quantity | None = Field(
        None,
        description=(
            "Amount dispensed. The amount of medication that has been dispensed. Note: Includes "
            "both the numerical value and the unit of measure. MedicationDispense.quantity — 0..1"
        ),
    )
    days_supply: Quantity | None = Field(
        None,
        description=(
            "Amount of medication for period of time. The amount of medication expressed as a "
            "timing amount. Note: Typically represents the number of days the dispensed quantity "
            "will last. MedicationDispense.daysSupply — 0..1"
        ),
    )
    when_prepared: FuzzyDate | None = Field(
        None,
        description=(
            "When product was prepared. The time when the dispensed product was packaged and "
            "reviewed. Note: May be different from when handed over to patient. "
            "MedicationDispense.whenPrepared — 0..1"
        ),
    )
    when_handed_over: FuzzyDate | None = Field(
        None,
        description=(
            "When product was given - Maps to CII N2 Medication_Dispensed_Date. The time the "
            "dispensed product was provided to the patient or their representative. Note: This is "
            "the actual dispense date when medication was provided to patient. "
            "MedicationDispense.whenHandedOver — 1..1"
        ),
    )
    note: dict | None = Field(
        None,
        description=(
            "Additional information about dispense. Extra information about the dispense that "
            "could not be conveyed in other attributes. Note: May include pharmacist counseling "
            "notes or special instructions. MedicationDispense.note — 0..*"
        ),
    )
    dosage_instruction: dict | None = Field(
        None,
        description=(
            "How medication should be taken. Indicates how the medication is to be used by the "
            "patient. Note: May include dose, frequency, route, and other administration "
            "instructions. MedicationDispense.dosageInstruction — 0..*"
        ),
    )
    medication: str | None = Field(
        None,
        description=(
            "The medication as written, in human-readable form. Plain text representation of the "
            "dispensed medication, required for all entries. Note: Text first, then the first "
            "coding's display. `medication[x]` is constrained to CodeableConcept on this profile, "
            "so there is no reference arm to fall back to. Salient field — "
            "medicationCodeableConcept.text | medicationCodeableConcept.coding.first().display"
        ),
    )
    handed_over: FuzzyDate | None = Field(
        None,
        description=(
            "When product was given - Maps to CII N2 Medication_Dispensed_Date. The time the "
            "dispensed product was provided to the patient or their representative. Note: When "
            "the patient actually received the medication -- the profile's effective date, and "
            "1..1 here. `whenPrepared` is a separate, earlier event and does not surface as a "
            "salient field. Salient field — whenHandedOver"
        ),
    )
    dosage: str | None = Field(
        None,
        description=(
            "How medication should be taken. Indicates how the medication is to be used by the "
            "patient. Note: The FIRST dosage instruction's free text, matching "
            "MedicationRequest's `dosage`. `dosageInstruction` is 0..*; the rest stay reachable "
            "through the typed collection. Salient field — dosageInstruction.first().text"
        ),
    )