R6 Ballot (2nd Draft)

Publish-box (todo)

Encounter.shex

Patient Administration Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Encounter, Patient, Practitioner, RelatedPerson

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#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <code.shex>
IMPORT <Group.shex>
IMPORT <Period.shex>
IMPORT <Device.shex>
IMPORT <Patient.shex>
IMPORT <Account.shex>
IMPORT <dateTime.shex>
IMPORT <Duration.shex>
IMPORT <Location.shex>
IMPORT <CarePlan.shex>
IMPORT <CareTeam.shex>
IMPORT <Reference.shex>
IMPORT <Identifier.shex>
IMPORT <Appointment.shex>
IMPORT <Organization.shex>
IMPORT <Practitioner.shex>
IMPORT <RelatedPerson.shex>
IMPORT <EpisodeOfCare.shex>
IMPORT <DeviceRequest.shex>
IMPORT <DomainResource.shex>
IMPORT <NutritionOrder.shex>
IMPORT <ServiceRequest.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>
IMPORT <PractitionerRole.shex>
IMPORT <CodeableReference.shex>
IMPORT <HealthcareService.shex>
IMPORT <MedicationRequest.shex>
IMPORT <VisionPrescription.shex>
IMPORT <VirtualServiceDetail.shex>
IMPORT <RequestOrchestration.shex>
IMPORT <ImmunizationRecommendation.shex>


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

# An interaction during which services are provided to the patient
<Encounter> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:Encounter]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:identifier @<OneOrMore_Identifier>?;  # Identifier(s) by which this 
                                            # encounter is known 
    fhir:status @<code> AND
    	{fhir:v @fhirvs:encounter-status};  # planned | in-progress | on-hold | 
                                            # discharged | completed | cancelled 
                                            # | discontinued | entered-in-error 
                                            # | unknown 
    fhir:class @<OneOrMore_CodeableConcept>?;  # Classification of patient 
                                            # encounter context - e.g. 
                                            # Inpatient, outpatient 
    fhir:priority @<CodeableConcept>?;      # Indicates the urgency of the 
                                            # encounter 
    fhir:type @<OneOrMore_CodeableConcept>?;  # Specific type of encounter (e.g. 
                                            # e-mail consultation, surgical 
                                            # day-care, ...) 
    fhir:serviceType @<OneOrMore_CodeableReference>?;  # Specific type of service
    fhir:subject @<Reference> AND {fhir:link 
    			@<Group> OR 
    			@<Patient> ? }?;  # The patient or group related to 
                                            # this encounter 
    fhir:subjectStatus @<CodeableConcept>?;  # The current status of the subject 
                                            # in relation to the Encounter 
    fhir:episodeOfCare @<OneOrMore_Reference_EpisodeOfCare>?;  # Episode(s) of care that this 
                                            # encounter should be recorded 
                                            # against 
    fhir:basedOn @<OneOrMore_Reference_CarePlan_OR_DeviceRequest_OR_ImmunizationRecommendation_OR_MedicationRequest_OR_NutritionOrder_OR_RequestOrchestration_OR_ServiceRequest_OR_VisionPrescription>?;  # The request that initiated this 
                                            # encounter 
    fhir:careTeam @<OneOrMore_Reference_CareTeam>?;  # The group(s) that are allocated to 
                                            # participate in this encounter 
    fhir:partOf @<Reference> AND {fhir:link 
    			@<Encounter> ? }?;  # Another Encounter this encounter 
                                            # is part of 
    fhir:serviceProvider @<Reference> AND {fhir:link 
    			@<Organization> ? }?;  # The organization (facility) 
                                            # responsible for this encounter 
    fhir:participant @<OneOrMore_Encounter.participant>?;  # List of participants involved in 
                                            # the encounter 
    fhir:appointment @<OneOrMore_Reference_Appointment>?;  # The appointment that scheduled 
                                            # this encounter 
    fhir:virtualService @<OneOrMore_VirtualServiceDetail>?;  # Connection details of a virtual 
                                            # service (e.g. conference call) 
    fhir:actualPeriod @<Period>?;           # The actual start and end time of 
                                            # the encounter 
    fhir:plannedStartDate @<dateTime>?;     # The planned start date/time (or 
                                            # admission date) of the encounter 
    fhir:plannedEndDate @<dateTime>?;       # The planned end date/time (or 
                                            # discharge date) of the encounter 
    fhir:length @<Duration>?;               # Actual quantity of time the 
                                            # encounter lasted (less time 
                                            # absent) 
    fhir:reason @<OneOrMore_Encounter.reason>?;  # The list of medical reasons that 
                                            # are expected to be addressed 
                                            # during the episode of care 
    fhir:diagnosis @<OneOrMore_Encounter.diagnosis>?;  # The list of diagnosis relevant to 
                                            # this encounter 
    fhir:account @<OneOrMore_Reference_Account>?;  # The set of accounts that may be 
                                            # used for billing for this 
                                            # Encounter 
    fhir:dietPreference @<OneOrMore_CodeableConcept>?;  # Diet preferences reported by the 
                                            # patient 
    fhir:specialArrangement @<OneOrMore_CodeableConcept>?;  # Wheelchair, translator, stretcher, 
                                            # etc 
    fhir:specialCourtesy @<OneOrMore_CodeableConcept>?;  # Special courtesies (VIP, board 
                                            # member) 
    fhir:admission @<Encounter.admission>?;  # Details about the admission to a 
                                            # healthcare service 
    fhir:location @<OneOrMore_Encounter.location>?;  # List of locations where the 
                                            # patient has been 
}  

# List of locations where the patient has been
<Encounter.location> EXTENDS @<BackboneElement> CLOSED {   
    fhir:location @<Reference> AND {fhir:link 
    			@<Location> ? };  # Location the encounter takes place
    fhir:status @<code> AND
    	{fhir:v @fhirvs:encounter-location-status}?;  # planned | active | reserved | 
                                            # completed 
    fhir:form @<CodeableConcept>?;          # The physical type of the location 
                                            # (usually the level in the location 
                                            # hierarchy - bed, room, ward, 
                                            # virtual etc.) 
    fhir:period @<Period>?;                 # Time period during which the 
                                            # patient was present at the 
                                            # location 
}  

# The list of medical reasons that are expected to be addressed during the episode of care
<Encounter.reason> EXTENDS @<BackboneElement> CLOSED {   
    fhir:use @<OneOrMore_CodeableConcept>?;  # What the reason value should be 
                                            # used for/as 
    fhir:value @<OneOrMore_CodeableReference>?;  # Reason the encounter takes place 
                                            # (core or reference) 
}  

# The list of diagnosis relevant to this encounter
<Encounter.diagnosis> EXTENDS @<BackboneElement> CLOSED {   
    fhir:condition @<OneOrMore_CodeableReference>?;  # The diagnosis relevant to the 
                                            # encounter 
    fhir:use @<OneOrMore_CodeableConcept>?;  # Role that this diagnosis has 
                                            # within the encounter (e.g. 
                                            # admission, billing, discharge …) 
}  

# List of participants involved in the encounter
<Encounter.participant> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<OneOrMore_CodeableConcept>?;  # Role of participant in encounter
    fhir:period @<Period>?;                 # Period of time during the 
                                            # encounter that the participant 
                                            # participated 
    fhir:actor @<Reference> AND {fhir:link 
    			@<Device> OR 
    			@<Group> OR 
    			@<HealthcareService> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? }?;  # The individual, device, or service 
                                            # participating in the encounter 
}  

# Details about the admission to a healthcare service
<Encounter.admission> EXTENDS @<BackboneElement> CLOSED {   
    fhir:preAdmissionIdentifier @<Identifier>?;  # Pre-admission identifier
    fhir:origin @<Reference> AND {fhir:link 
    			@<Location> OR 
    			@<Organization> ? }?;  # The location/organization from 
                                            # which the patient came before 
                                            # admission 
    fhir:admitSource @<CodeableConcept>?;   # From where patient was admitted 
                                            # (physician referral, transfer) 
    fhir:reAdmission @<CodeableConcept>?;   # Indicates that the patient is 
                                            # being re-admitted 
    fhir:destination @<Reference> AND {fhir:link 
    			@<Location> OR 
    			@<Organization> ? }?;  # Location/organization to which the 
                                            # patient is discharged 
    fhir:dischargeDisposition @<CodeableConcept>?;  # Category or kind of location after 
                                            # discharge 
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

<OneOrMore_CodeableReference> CLOSED {
    rdf:first @<CodeableReference>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableReference> 
}

<OneOrMore_Reference_EpisodeOfCare> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<EpisodeOfCare> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_EpisodeOfCare> 
}

<OneOrMore_Reference_CarePlan_OR_DeviceRequest_OR_ImmunizationRecommendation_OR_MedicationRequest_OR_NutritionOrder_OR_RequestOrchestration_OR_ServiceRequest_OR_VisionPrescription> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<CarePlan> OR 
			@<DeviceRequest> OR 
			@<ImmunizationRecommendation> OR 
			@<MedicationRequest> OR 
			@<NutritionOrder> OR 
			@<RequestOrchestration> OR 
			@<ServiceRequest> OR 
			@<VisionPrescription> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_CarePlan_OR_DeviceRequest_OR_ImmunizationRecommendation_OR_MedicationRequest_OR_NutritionOrder_OR_RequestOrchestration_OR_ServiceRequest_OR_VisionPrescription> 
}

<OneOrMore_Reference_CareTeam> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<CareTeam> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_CareTeam> 
}

<OneOrMore_Encounter.participant> CLOSED {
    rdf:first @<Encounter.participant>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Encounter.participant> 
}

<OneOrMore_Reference_Appointment> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Appointment> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Appointment> 
}

<OneOrMore_VirtualServiceDetail> CLOSED {
    rdf:first @<VirtualServiceDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_VirtualServiceDetail> 
}

<OneOrMore_Encounter.reason> CLOSED {
    rdf:first @<Encounter.reason>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Encounter.reason> 
}

<OneOrMore_Encounter.diagnosis> CLOSED {
    rdf:first @<Encounter.diagnosis>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Encounter.diagnosis> 
}

<OneOrMore_Reference_Account> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Account> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Account> 
}

<OneOrMore_Encounter.location> CLOSED {
    rdf:first @<Encounter.location>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Encounter.location> 
}

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

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

# Current state of the encounter.
fhirvs:encounter-status ["planned" "in-progress" "on-hold" "discharged" "completed" "cancelled" "discontinued" "entered-in-error" "unknown"]


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.