Skip to content

Flag Profile

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

Nexus EMR profile for Flag, carrying a singleton administrative free-text field about a patient (booking alert or patient note). The patient-flag-type coding discriminates the field; the free text rides on Flag.code.text. Backs the Patient Profile Notes section.

TypedFhir API / Pydantic schema

The typed accessor surface Flag exposes for Flag — 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 FlagSchemamodel_json_schema() is a structured-output / tool definition; instantiating validates an extraction. Generated source.

class FlagSchema(BaseModel):
    """AI-facing shape of the Flag 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["active", "entered-in-error", "inactive"] | None = Field(
        None,
        description=(
            "active | inactive | entered-in-error. Supports basic workflow. Note: Flags are never "
            "edited in place or deleted. The frontend writes active flags; a text change retires "
            "the current Flag to inactive (text kept) and creates a replacement, and clearing a "
            "field retires it without one — a field's history is the chain of its retired flags, "
            "and what was removed or superseded (and by whom, via resource history) stays "
            "queryable. Readers filter to active flags — a retired flag no longer backs its "
            "field. entered-in-error is reserved for retracting a flag recorded in error. "
            "Flag.status — 1..1"
        ),
    )
    category: Concept | None = Field(
        None,
        description=(
            "What kind of flag this is: clinical, safety, behavioral, contact or admin. Allows a "
            "flag to be divided into different categories like clinical, administrative etc. "
            "Intended to be used as a means of filtering which flags are displayed to particular "
            "user or in a given context. Note: R4's own category set. `admin` identifies the "
            "singleton Patient Profile fields this guide has always modelled and holds them to "
            "the rule below; every other category is an ordinary alert. Extensible rather than "
            "required: the set is R4's and a deployment may meet a kind it does not name. "
            "Flag.category — 1..*. codes (extensible): admin | advance-directive | behavioral | "
            "clinical | contact | diet | drug | lab | …"
        ),
    )
    code: Concept | None = Field(
        None,
        description=(
            "What the flag says: a coding, its text, or both. The coded value or textual "
            "component of the flag to display to the user. Note: If non-coded, use "
            "CodeableConcept.text. This element should always be included in the narrative. "
            "Flag.code — 1..1"
        ),
    )
    subject: Reference | None = Field(
        None,
        description=(
            "The patient the flag is about. The patient, location, group, organization, or "
            "practitioner etc. this is about record this flag is associated with. Flag.subject — "
            "1..1"
        ),
    )