STU 3 Ballot

This page is part of the FHIR Specification (v1.6.0: STU 3 Ballot 4). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

Encounter.shex

Raw ShEx

ShEx statement for encounter

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
BASE <http://hl7.org/fhir/shape/>

start=<Encounter> AND {fhir:nodeRole [fhir:treeRoot]}


# An interaction during which services are provided to the patient
<Encounter> CLOSED {
    a [fhir:Encounter];
    fhir:nodeRole [fhir:treeRoot]?;
    fhir:Resource.id @<id>?;                # Logical id of this artifact
    fhir:Resource.meta @<Meta>?;            # Metadata about the resource
    fhir:Resource.implicitRules @<uri>?;    # A set of rules under which this 
                                            # content was created 
    fhir:Resource.language @<code>?;        # Language of the resource content
    fhir:DomainResource.text @<Narrative>?;  # Text summary of the resource, for 
                                            # human interpretation 
    fhir:DomainResource.contained @<Resource>*;  # Contained, inline Resources
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:modifierExtension @<Extension>*;   # Extensions that cannot be ignored
    fhir:Encounter.identifier @<Identifier>*;  # Identifier(s) by which this 
                                            # encounter is known 
    fhir:Encounter.status @<code> AND
    	{fhir:value @fhirvs:encounter-status};  # planned | arrived | in-progress | 
                                            # onleave | finished | cancelled | 
                                            # entered-in-error 
    fhir:Encounter.statusHistory @<Encounter.statusHistory>*;  # List of past encounter statuses
    fhir:Encounter.class @<Coding>?;        # inpatient | outpatient | 
                                            # ambulatory | emergency + 
    fhir:Encounter.type @<CodeableConcept>*;  # Specific type of encounter
    fhir:Encounter.priority @<CodeableConcept>?;  # Indicates the urgency of the 
                                            # encounter 
    fhir:Encounter.patient @<PatientReference>?;  # The patient present at the 
                                            # encounter 
    fhir:Encounter.episodeOfCare @<EpisodeOfCareReference>*;  # Episode(s) of care that this 
                                            # encounter should be recorded 
                                            # against 
    fhir:Encounter.incomingReferral @<ReferralRequestReference>*;  # The ReferralRequest that initiated 
                                            # this encounter 
    fhir:Encounter.participant @<Encounter.participant>*;  # List of participants involved in 
                                            # the encounter 
    fhir:Encounter.appointment @<AppointmentReference>?;  # The appointment that scheduled 
                                            # this encounter 
    fhir:Encounter.period @<Period>?;       # The start and end time of the 
                                            # encounter 
    fhir:Encounter.length @<Duration>?;     # Quantity of time the encounter 
                                            # lasted (less time absent) 
    fhir:Encounter.reason @<CodeableConcept>*;  # Reason the encounter takes place 
                                            # (code) 
    fhir:Encounter.indication               # Reason the encounter takes place 
                                            # (resource) 
    (   @<ConditionReference> OR
        @<ProcedureReference>
    )*;
    fhir:Encounter.account @<AccountReference>*;  # The set of accounts that may be 
                                            # used for billing for this 
                                            # Encounter 
    fhir:Encounter.hospitalization @<Encounter.hospitalization>?;  # Details about the admission to a 
                                            # healthcare service 
    fhir:Encounter.location @<Encounter.location>*;  # List of locations where the 
                                            # patient has been 
    fhir:Encounter.serviceProvider @<OrganizationReference>?;  # The custodian organization of this 
                                            # Encounter record 
    fhir:Encounter.partOf @<EncounterReference>?;  # Another Encounter this encounter 
                                            # is part of 
    fhir:index xsd:integer?                 # Relative position in a list
}

# List of past encounter statuses
<Encounter.statusHistory> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:modifierExtension @<Extension>*;   # Extensions that cannot be ignored
    fhir:Encounter.statusHistory.status @<code> AND
    	{fhir:value @fhirvs:encounter-status};  # planned | arrived | in-progress | 
                                            # onleave | finished | cancelled | 
                                            # entered-in-error 
    fhir:Encounter.statusHistory.period @<Period>;  # The time that the episode was in 
                                            # the specified status 
    fhir:index xsd:integer?                 # Relative position in a list
}

# List of participants involved in the encounter
<Encounter.participant> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:modifierExtension @<Extension>*;   # Extensions that cannot be ignored
    fhir:Encounter.participant.type @<CodeableConcept>*;  # Role of participant in encounter
    fhir:Encounter.participant.period @<Period>?;  # Period of time during the 
                                            # encounter participant was present 
    fhir:Encounter.participant.individual   # Persons involved in the encounter 
                                            # other than the patient 
    (   @<PractitionerReference> OR
        @<RelatedPersonReference>
    )?;
    fhir:index xsd:integer?                 # Relative position in a list
}

# List of locations where the patient has been
<Encounter.location> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:modifierExtension @<Extension>*;   # Extensions that cannot be ignored
    fhir:Encounter.location.location @<LocationReference>;  # Location the encounter takes place
    fhir:Encounter.location.status @<code> AND
    	{fhir:value @fhirvs:encounter-location-status}?;  # planned | active | reserved | 
                                            # completed 
    fhir:Encounter.location.period @<Period>?;  # Time period during which the 
                                            # patient was present at the 
                                            # location 
    fhir:index xsd:integer?                 # Relative position in a list
}

# Details about the admission to a healthcare service
<Encounter.hospitalization> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:modifierExtension @<Extension>*;   # Extensions that cannot be ignored
    fhir:Encounter.hospitalization.preAdmissionIdentifier @<Identifier>?;  # Pre-admission identifier
    fhir:Encounter.hospitalization.origin @<LocationReference>?;  # The location from which the 
                                            # patient came before admission 
    fhir:Encounter.hospitalization.admitSource @<CodeableConcept>?;  # From where patient was admitted 
                                            # (physician referral, transfer) 
    fhir:Encounter.hospitalization.admittingDiagnosis @<ConditionReference>*;  # The admitting diagnosis as 
                                            # reported by admitting practitioner 
    fhir:Encounter.hospitalization.reAdmission @<CodeableConcept>?;  # The type of hospital re-admission 
                                            # that has occurred (if any). If the 
                                            # value is absent, then this is not 
                                            # identified as a readmission 
    fhir:Encounter.hospitalization.dietPreference @<CodeableConcept>*;  # Diet preferences reported by the 
                                            # patient 
    fhir:Encounter.hospitalization.specialCourtesy @<CodeableConcept>*;  # Special courtesies (VIP, board 
                                            # member) 
    fhir:Encounter.hospitalization.specialArrangement @<CodeableConcept>*;  # Wheelchair, translator, stretcher, 
                                            # etc. 
    fhir:Encounter.hospitalization.destination @<LocationReference>?;  # Location to which the patient is 
                                            # discharged 
    fhir:Encounter.hospitalization.dischargeDisposition @<CodeableConcept>?;  # Category or kind of location after 
                                            # discharge 
    fhir:Encounter.hospitalization.dischargeDiagnosis @<ConditionReference>*;  # The final diagnosis given a 
                                            # patient before release from the 
                                            # hospital after all testing, 
                                            # surgery, and workup are complete 
    fhir:index xsd:integer?                 # Relative position in a list
}

#---------------------- Data Types -------------------

# Metadata about a resource
<Meta> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:Meta.versionId @<id>?;             # Version specific identifier
    fhir:Meta.lastUpdated @<instant>?;      # When the resource version last 
                                            # changed 
    fhir:Meta.profile @<uri>*;              # Profiles this resource claims to 
                                            # conform to 
    fhir:Meta.security @<Coding>*;          # Security Labels applied to this 
                                            # resource 
    fhir:Meta.tag @<Coding>*;               # Tags applied to this resource
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type code
<code> CLOSED {
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:string?;                 # Primitive value for code
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type string
<string> CLOSED {
    fhir:id @<id>?;                         # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:string MAXLENGTH 1048576?;  # Primitive value for string
    fhir:index xsd:integer?                 # Relative position in a list
}

# Base Resource
<Resource> {a .+;
    fhir:Resource.id @<id>?;                # Logical id of this artifact
    fhir:Resource.meta @<Meta>?;            # Metadata about the resource
    fhir:Resource.implicitRules @<uri>?;    # A set of rules under which this 
                                            # content was created 
    fhir:Resource.language @<code>?;        # Language of the resource content
    fhir:index xsd:integer?
}

# Time range defined by start and end date/time
<Period> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:Period.start @<dateTime>?;         # Starting time with inclusive 
                                            # boundary 
    fhir:Period.end @<dateTime>?;           # End time with inclusive boundary, 
                                            # if not ongoing 
    fhir:index xsd:integer?                 # Relative position in a list
}

# A length of time
<Duration> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:Quantity.value @<decimal>?;        # Numerical value (with implicit 
                                            # precision) 
    fhir:Quantity.comparator @<code> AND
    	{fhir:value @fhirvs:quantity-comparator}?;  # < | <= | >= | > - how to 
                                            # understand the value 
    fhir:Quantity.unit @<string>?;          # Unit representation
    fhir:Quantity.system @<uri>?;           # System that defines coded unit form
    fhir:Quantity.code @<code>?;            # Coded form of the unit
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type uri
<uri> CLOSED {
    fhir:id @<id>?;                         # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:string?;                 # Primitive value for uri
    fhir:index xsd:integer?                 # Relative position in a list
}

<Extension> {fhir:extension @<Extension>*;
    fhir:index xsd:integer?
}

# An identifier intended for computation
<Identifier> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:Identifier.use @<code> AND
    	{fhir:value @fhirvs:identifier-use}?;  # usual | official | temp | 
                                            # secondary (If known) 
    fhir:Identifier.type @<CodeableConcept>?;  # Description of identifier
    fhir:Identifier.system @<uri>?;         # The namespace for the identifier
    fhir:Identifier.value @<string>?;       # The value that is unique
    fhir:Identifier.period @<Period>?;      # Time period when id is/was valid 
                                            # for use 
    fhir:Identifier.assigner @<OrganizationReference>?;  # Organization that issued id (may 
                                            # be just text) 
    fhir:index xsd:integer?                 # Relative position in a list
}

# A human-readable formatted text, including images
<Narrative> CLOSED {
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:Narrative.status @<code> AND
    	{fhir:value @fhirvs:narrative-status};  # generated | extensions | 
                                            # additional | empty 
    fhir:Narrative.div xsd:string;          # Limited xhtml content
    fhir:index xsd:integer?                 # Relative position in a list
}

# A reference to a code defined by a terminology system
<Coding> CLOSED {
    fhir:concept IRI?;
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:Coding.system @<uri>?;             # Identity of the terminology system
    fhir:Coding.version @<string>?;         # Version of the system - if relevant
    fhir:Coding.code @<code>?;              # Symbol in syntax defined by the 
                                            # system 
    fhir:Coding.display @<string>?;         # Representation defined by the 
                                            # system 
    fhir:Coding.userSelected @<boolean>?;   # If this coding was chosen directly 
                                            # by the user 
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type id
<id> CLOSED {
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:string?;                 # Primitive value for id
    fhir:index xsd:integer?                 # Relative position in a list
}

# Concept - reference to a terminology or just  text
<CodeableConcept> CLOSED {
    fhir:concept IRI*;
    fhir:Element.id @<string>?;             # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:CodeableConcept.coding @<Coding>*;  # Code defined by a terminology 
                                            # system 
    fhir:CodeableConcept.text @<string>?;   # Plain text representation of the 
                                            # concept 
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type dateTime
<dateTime> CLOSED {
    fhir:id @<id>?;                         # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:gYear OR xsd:gYearMonth OR xsd:date OR xsd:dateTime?;  # Primitive value for dateTime
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type instant
<instant> CLOSED {
    fhir:id @<id>?;                         # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:dateTime?;               # Primitive value for instant
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type boolean
<boolean> CLOSED {
    fhir:id @<id>?;                         # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:boolean?;                # Primitive value for boolean
    fhir:index xsd:integer?                 # Relative position in a list
}

# Primitive Type decimal
<decimal> CLOSED {
    fhir:id @<id>?;                         # xml:id (or equivalent in JSON)
    fhir:extension @<Extension>*;           # Additional Content defined by 
                                            # implementations 
    fhir:value xsd:decimal?;                # Primitive value for decimal
    fhir:index xsd:integer?                 # Relative position in a list
}

#---------------------- Reference Types -------------------

<AppointmentReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Appointment> OR CLOSED {a fhir:Appointment}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<ConditionReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Condition> OR CLOSED {a fhir:Condition}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<PractitionerReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Practitioner> OR CLOSED {a fhir:Practitioner}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<ReferralRequestReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<ReferralRequest> OR CLOSED {a fhir:ReferralRequest}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<AccountReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Account> OR CLOSED {a fhir:Account}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<OrganizationReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Organization> OR CLOSED {a fhir:Organization}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<EpisodeOfCareReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<EpisodeOfCare> OR CLOSED {a fhir:EpisodeOfCare}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<PatientReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Patient> OR CLOSED {a fhir:Patient}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<ProcedureReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Procedure> OR CLOSED {a fhir:Procedure}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<EncounterReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Encounter> OR CLOSED {a fhir:Encounter}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<RelatedPersonReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<RelatedPerson> OR CLOSED {a fhir:RelatedPerson}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

<LocationReference> CLOSED {
    fhir:Element.id @<id>?;
    fhir:extension @<Extension>*;
    fhir:link @<Location> OR CLOSED {a fhir:Location}?;
    fhir:Reference.reference @<string>?;
    fhir:Reference.display @<string>?;
    fhir:index xsd:integer?
}

#---------------------- Value Sets ------------------------

# Current state of the encounter
@fhirvs:encounter-status = ["planned" "arrived" "in-progress" "onleave" "finished" "cancelled" "entered-in-error"]

# How the Quantity should be understood and represented.
@fhirvs:quantity-comparator = ["<" "<=" ">=" ">"]

# The status of a resource narrative
@fhirvs:narrative-status = ["generated" "extensions" "additional" "empty"]

# The status of the location.
@fhirvs:encounter-location-status = ["planned" "active" "reserved" "completed"]

# Identifies the purpose for this identifier, if known .
@fhirvs:identifier-use = ["usual" "official" "temp" "secondary"]

Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.